X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkWxGUIScriptingInterface.cxx;h=6e20b0333eb13df2d84c9076dcff3801297b8109;hb=f596ffe4b01d1aa7605c403979c5b61ad54b0cf4;hp=966c1f70486f924d6c5f3eb88e6b00215d0f4322;hpb=f3d05516965aece323133928f72d85e38c2b0b71;p=bbtk.git diff --git a/kernel/src/bbtkWxGUIScriptingInterface.cxx b/kernel/src/bbtkWxGUIScriptingInterface.cxx index 966c1f7..6e20b03 100644 --- a/kernel/src/bbtkWxGUIScriptingInterface.cxx +++ b/kernel/src/bbtkWxGUIScriptingInterface.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $ Language: C++ - Date: $Date: 2008/12/15 09:04:47 $ - Version: $Revision: 1.32 $ + Date: $Date: 2009/11/05 16:47:42 $ + Version: $Revision: 1.39 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -55,6 +55,7 @@ #include "bbtkUtilities.h" #include +#include //#include "icons/cc_run.xpm" @@ -88,12 +89,11 @@ namespace bbtk : wxFrame((wxFrame *)parent, -1, _T("bbStudio"), wxDefaultPosition, wxSize(1200,800) ) { - // m_mgr = new wxAuiManager(this); m_mgr.SetManagedWindow(this); mInterpreter = bbtk::Interpreter::New(); mInterpreter->SetUser(this); - mInterpreter->SetCommandLine(true); + mInterpreter->SetCommandLine(true); mInterpreter->SetThrow(true); // mInterpreter->AddBreakObserver //boost::bind( &WxGUIScriptingInterface::InterpreterUserOnBreak, this )); @@ -230,6 +230,7 @@ namespace bbtk .Bottom() .MinSize(wxSize(100,100)) ); + m_mgr.AddPane(mWxGUICommand, wxAuiPaneInfo().Name(wxT("command_content")) .Caption(wxT("Command")) @@ -242,8 +243,10 @@ namespace bbtk #endif // parent window of all bbtk windows will be a child of this - Wx::SetTopWindowParent(this); - // Add the method OnWxSignal as a Wx::Signal observer + // Wx::SetTopWindowParent(this); + Wx::SetTopWindow(this); + // Wx::SetAutoDestroyTopWindow(false); + // Add the method OnWxSignal as a Wx::Signal observer //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal); //.PaneBorder(false)); @@ -262,22 +265,67 @@ namespace bbtk // LoadPerspective(); mBreaked = false; + + wxBitmap bitmap; + wxSplashScreen* splash; + long style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT; + if (ConfigurationFile::GetInstance().DotBbtkIsNew()) + style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT; + std::string splash_file = ConfigurationFile::GetInstance().Get_data_path(); + splash_file += "/kernel/icons/bbStudioSplashScreen.png"; + + if (bitmap.LoadFile(std2wx(splash_file),wxBITMAP_TYPE_PNG)) + splash = + new wxSplashScreen(bitmap, + style, + 1000, 0, -1, wxDefaultPosition, wxDefaultSize, + wxSIMPLE_BORDER|wxSTAY_ON_TOP); + - wxTipWindow* tip = new wxTipWindow(this, - _T("\n Welcome to bbStudio !\n\n To run a demo or example:\n 1. click on the 'Demos' or 'Examples' link\n 2. select a demo or example\n 3. click on the '[source]' link : the source file is loaded in bbStudio\n 4. click on the 'Run' button (the arrow at the bottom right of the source file) \n"),1000); - tip->CenterOnParent(); - tip->Show(); + if (ConfigurationFile::GetInstance().DotBbtkIsNew()) + { + + DoRegeneratePackageDoc("-a"); + DoRegenerateBoxesLists(); + + /* + wxTipWindow* tip = new wxTipWindow(this, + _T("\n Welcome to bbStudio !\n\n To run a demo or example:\n 1. click on the 'Demos' or 'Examples' link\n 2. select a demo or example\n 3. click on the '[source]' link : the source file is loaded in bbStudio\n 4. click on the 'Run' button (the arrow at the bottom right of the source file) \n"),1000); + tip->CenterOnParent(); + tip->Show(); + */ + if (splash) splash->Destroy(); + } + } //================================================================ //================================================================ WxGUIScriptingInterface::~WxGUIScriptingInterface() { + bbtkDebugMessage("widget",9,"bbStudio::~bbStudio()"<Close(); + } + this->Destroy(); + } + //================================================================ + + //================================================================ void WxGUIScriptingInterface::Open(const std::string& filename) { @@ -362,6 +410,52 @@ namespace bbtk } //================================================================ + + //================================================================ + void WxGUIScriptingInterface::WxGUITextEditorGraphSimple() + { + WxGUICommandEnter("exec freeze_no_error"); + WxGUITextEditorRun(); + WxGUICommandEnter("exec unfreeze"); + WxGUICommandEnter("graph"); + } + //================================================================ + + //================================================================ + void WxGUIScriptingInterface::WxGUITextEditorGraphDetail() + { + WxGUICommandEnter("exec freeze_no_error"); + WxGUITextEditorRun(); + WxGUICommandEnter("exec unfreeze"); + WxGUICommandEnter("graph . 1"); + } + //================================================================ + + + //================================================================ + void WxGUIScriptingInterface::WxGUITextEditorRunBBI() + { + std::string separator = ConfigurationFile::GetInstance().Get_file_separator (); + std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); + std::string filename = dir + separator + "tmp_bbtk.bbs"; + mWxGUITextEditor->GetCurrentPage()->SaveFile(filename); + + std::string command = "\""; + command += ConfigurationFile::GetInstance().Get_bin_path(); +#ifdef MACOSX + command += separator + "bbi.app/Contents/MacOS/bbi\" "; +#else + command += separator + "bbi\" "; +#endif + command += "\""+filename + "\""; + command += " & "; + + printf ("EED WxGUIScriptingInterface::WxGUITextEditorRunBBI %s \n" , command.c_str() ); + system( command.c_str() ); + } + //================================================================ + + //================================================================ void WxGUIScriptingInterface::WxGUITextEditorRun() { @@ -411,9 +505,12 @@ namespace bbtk //================================================================ void WxGUIScriptingInterface::OnMenuEditConfig(wxCommandEvent& WXUNUSED(event)) { + std::string configFile = ConfigurationFile::GetInstance().Get_config_xml_full_path(); Open(configFile); + wxMessageDialog ww(NULL,_T("If you change the bbtk_config.xml, you have to reinicialice this appliaction..."), _T("Alert !"), wxOK); + ww.ShowModal(); } //================================================================ @@ -491,14 +588,27 @@ namespace bbtk //================================================================ void WxGUIScriptingInterface::OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event)) { - std::string default_temp_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); + std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path(); + doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator(); + doc_path += "bbdoc"; + doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator(); + + std::string pack_name("User"); + std::string pack_path = doc_path + pack_name; + + #if defined(WIN32) std::string strappli="start "; #else - std::string strappli="gnome-open "; + #if defined(MACOSX) + std::string strappli="open "; + #else + std::string strappli="gnome-open "; + #endif #endif - std::string strcommand = strappli +default_temp_dir+"/temp_dir/workspace_workspacePrototype.png"; + + std::string strcommand = strappli +pack_path+"/workspace_workspacePrototype.png"; // std::cout << "system: " << strcommand << std::endl; system ( strcommand.c_str() ); @@ -507,11 +617,22 @@ namespace bbtk void WxGUIScriptingInterface::DoRegeneratePackageDoc( const std::string& pack ) { - std::string command; + std::string mess("Regenerating doc for package '"); + if (pack!="-a") + mess += pack + "'"; + else + mess = "Regenerating doc for all packages"; + mess += " ... please wait"; + + SetStatusText( std2wx(mess) ); + + BBTK_BUSY_CURSOR; + + std::string command; #if defined(WIN32) - command = "\""; + command = "\""; #endif - command += ConfigurationFile::GetInstance().Get_bin_path(); + command += ConfigurationFile::GetInstance().Get_bin_path(); command += ConfigurationFile::GetInstance().Get_file_separator(); command += "bbRegeneratePackageDoc"; #if defined(WIN32) @@ -519,19 +640,27 @@ namespace bbtk #endif command += " " + pack + " -q"; bbtkMessage("debug",1,"Executing system command '"<