#include <bbtkWxGUIScriptingInterface.h>
Public Member Functions | |
WxGUIScriptingInterface (wxWindow *parent) | |
~WxGUIScriptingInterface () | |
Interpreter::Pointer | GetInterpreter () const |
void | SetInputs (const std::map< std::string, std::string > &m) |
void | SetNoExecMode (bool b) |
void | SetDialogMode (Interpreter::DialogModeType t) |
bool | InterpretFile (const std::string &filename) |
Runs the interpretation of a file. | |
void | Open (const std::string &filename) |
void | OnMenuQuit (wxCommandEvent &event) |
void | OnMenuAbout (wxCommandEvent &event) |
void | OnMenuEditConfig (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuCreatePackage (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuCreateBlackBox (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuShowImageGraph (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuRegeneratePackageDoc (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuRegenerateBoxesLists (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuRegenerateAll (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuPlugPackage (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuWindowsFiles (wxCommandEvent &event) |
void | OnMenuWindowsHelp (wxCommandEvent &event) |
void | OnMenuWindowsPackageBrowser (wxCommandEvent &event) |
void | OnMenuWindowsMessages (wxCommandEvent &event) |
void | OnMenuWindowsCommand (wxCommandEvent &event) |
void | OnMenuWindowsSave (wxCommandEvent &WXUNUSED(event)) |
void | OnMenuWindowsCheck (wxCommandEvent &event, wxWindow *w) |
void | OnPaneClose (wxAuiManagerEvent &evt) |
void | SavePerspective () |
void | LoadPerspective () |
bool | InterpreterUserHasOwnHtmlPageViewer () |
void | InterpreterUserViewHtmlPage (const std::string &) |
void | WxGUICommandEnter (const std::string &) |
Callback invoked when a command is entered in the WxGUICommand. | |
void | WxGUITextEditorRun () |
Callback invoked when the 'run' button is pressed. | |
void | WxGUITextEditorRunBBI () |
void | WxGUITextEditorGraphSimple () |
void | WxGUITextEditorGraphDetail () |
bool | WxGUIHtmlBrowserUserOnLinkClicked (const std::string &target) |
void | DoRegeneratePackageDoc (const std::string &pack) |
void | DoRegenerateBoxesLists () |
void | OnClose (wxCloseEvent &event) |
Private Attributes | |
wxAuiManager | m_mgr |
Interpreter::Pointer | mInterpreter |
wxAuiNotebook * | mwxNotebook |
WxGUICommand * | mWxGUICommand |
WxGUIOutputMessages * | mWxGUIOutputMessages |
WxGUIHtmlBrowser * | mWxGUIHtmlBrowser |
WxGUITextEditor * | mWxGUITextEditor |
WxGUIPackageBrowser2 * | mWxGUIPackageBrowser2 |
wxMenuItem * | mwxMenuItemReset |
bool | mBreaked |
Definition at line 72 of file bbtkWxGUIScriptingInterface.h.
bbtk::WxGUIScriptingInterface::WxGUIScriptingInterface | ( | wxWindow * | parent | ) |
Definition at line 89 of file bbtkWxGUIScriptingInterface.cxx.
References _T, DoRegenerateBoxesLists(), DoRegeneratePackageDoc(), bbtk::ConfigurationFile::DotBbtkIsNew(), bbtk::ConfigurationFile::Get_data_path(), bbtk::ConfigurationFile::GetInstance(), bbtk::WxGUIHtmlBrowser::GoHome(), bbtk::ID_Menu_About, bbtk::ID_Menu_CreateBlackBox, bbtk::ID_Menu_CreatePackage, bbtk::ID_Menu_EditConfig, bbtk::ID_Menu_PlugPackage, bbtk::ID_Menu_Quit, bbtk::ID_Menu_RegenerateAll, bbtk::ID_Menu_RegenerateBoxesLists, bbtk::ID_Menu_RegeneratePackageDoc, bbtk::ID_Menu_ShowImageGraph, bbtk::ID_Menu_Windows_Command, bbtk::ID_Menu_Windows_Files, bbtk::ID_Menu_Windows_Help, bbtk::ID_Menu_Windows_Messages, bbtk::ID_Menu_Windows_PackageBrowser, LoadPerspective(), m_mgr, mBreaked, mInterpreter, mWxGUICommand, mWxGUIHtmlBrowser, mWxGUIOutputMessages, mWxGUITextEditor, mwxMenuItemReset, mwxNotebook, bbtk::InterpreterVirtual::New(), bbtk::WxGUITextEditor::SetFileNameFilter(), bbtk::Wx::SetTopWindow(), and bbtk::std2wx().
00090 : wxFrame((wxFrame *)parent, -1, _T("bbStudio"), 00091 wxDefaultPosition, wxSize(1200,800) ) 00092 { 00093 m_mgr.SetManagedWindow(this); 00094 00095 mInterpreter = bbtk::Interpreter::New(); 00096 mInterpreter->SetUser(this); 00097 mInterpreter->SetCommandLine(true); 00098 mInterpreter->SetThrow(true); 00099 // mInterpreter->AddBreakObserver 00100 //boost::bind( &WxGUIScriptingInterface::InterpreterUserOnBreak, this )); 00101 //============== 00102 // Menu 00103 wxInitAllImageHandlers(); 00104 00105 wxMenu *menuFile = new wxMenu; 00106 menuFile->Append( ID_Menu_EditConfig, _T("Open bbtk &Config file") ); 00107 menuFile->Append( ID_Menu_Quit, _T("&Quit") ); 00108 00109 wxMenu *menuAbout = new wxMenu; 00110 menuAbout->Append( ID_Menu_About, _T("&About...") ); 00111 00112 wxMenu *menuTools = new wxMenu; 00113 menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") ); 00114 menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &black box") ); 00115 menuTools->Append( ID_Menu_PlugPackage, _T("&Plug package") ); 00116 menuTools->AppendSeparator(); 00117 menuTools->Append( ID_Menu_RegeneratePackageDoc,_T("Regenerate package &doc") ); 00118 menuTools->Append( ID_Menu_RegenerateBoxesLists,_T("Regenerate boxes &lists") ); 00119 menuTools->Append( ID_Menu_RegenerateAll, _T("Regenerate &all") ); 00120 menuTools->AppendSeparator(); 00121 menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last graph") ); 00122 00123 wxMenu *menuWindows = new wxMenu; 00124 menuWindows->AppendCheckItem(ID_Menu_Windows_Files, 00125 _T("Show 'files' panel") )->Check(); 00126 menuWindows->AppendCheckItem(ID_Menu_Windows_Help, 00127 _T("Show 'help' panel") )->Check(); 00128 menuWindows->AppendCheckItem(ID_Menu_Windows_Messages, 00129 _T("Show 'messages' panel") )->Check(); 00130 menuWindows->AppendCheckItem(ID_Menu_Windows_Command, 00131 _T("Show 'command' panel") )->Check(); 00132 menuWindows->AppendSeparator(); 00133 menuWindows->Append( ID_Menu_Windows_PackageBrowser, _T("Start Package &Browser") ); 00134 00135 // menuWindows->AppendSeparator(); 00136 // menuWindows->Append ( ID_Menu_Windows_Save, _T("Save interface configuration")); 00137 00138 wxMenu *menuOptions = new wxMenu; 00139 mwxMenuItemReset = menuOptions->AppendCheckItem(-1, 00140 _T("Reset before running") ); 00141 mwxMenuItemReset->Check(); 00142 00143 wxMenuBar *menuBar = new wxMenuBar; 00144 menuBar->Append( menuFile, _T("&File") ); 00145 menuBar->Append( menuTools, _T("&Tools") ); 00146 menuBar->Append( menuOptions, _T("&Options") ); 00147 menuBar->Append( menuWindows, _T("&Windows") ); 00148 menuBar->Append( menuAbout, _T("About") ); 00149 00150 SetMenuBar( menuBar ); 00151 00152 //=== 00153 // Status bar 00154 CreateStatusBar(); 00155 SetStatusText( _T("Welcome to bbStudio !") ); 00156 00157 //=== 00158 // Panes (Files, Messages, Help, Command) 00159 mWxGUITextEditor = new WxGUITextEditor(this,this); 00160 mWxGUITextEditor->SetFileNameFilter("*.bbs"); 00161 00162 mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0),this); 00163 00164 mWxGUIOutputMessages = new WxGUIOutputMessages(this); 00165 00166 mWxGUICommand = new WxGUICommand(this,this); 00167 00168 mWxGUICommand->SetFocus(); 00169 00170 00171 #if NOTEBOOK 00172 00173 mwxNotebook = new wxAuiNotebook(this, 00174 -1, 00175 wxPoint(0, 0), 00176 wxSize(500,500), 00177 wxAUI_NB_TAB_SPLIT 00178 | wxAUI_NB_TAB_MOVE 00179 | wxAUI_NB_TAB_EXTERNAL_MOVE 00180 //| wxAUI_NB_WINDOWLIST_BUTTON 00181 //|wxAUI_NB_SCROLL_BUTTONS 00182 // | wxAUI_NB_CLOSE_BUTTON 00183 //| wxAUI_NB_CLOSE_ON_ACTIVE_TAB 00184 //| wxAUI_NB_CLOSE_ON_ALL_TABS 00185 | wxNO_BORDER); 00186 00187 00188 mwxNotebook->AddPage(mWxGUITextEditor,_T("Files"),true); 00189 mwxNotebook->AddPage(mWxGUIHtmlBrowser,_T("Help"),true); 00190 00191 mwxNotebook->AddPage(mWxGUIOutputMessages,_T("Messages"),true); 00192 00193 mwxNotebook->AddPage(mWxGUICommand,_T("Command"),true); 00194 00195 00196 m_mgr.AddPane(mwxNotebook, 00197 wxAuiPaneInfo().Name(wxT("nb")) 00198 .CaptionVisible(false) 00199 .MinimizeButton(false) 00200 .MaximizeButton(false) 00201 .Center() 00202 // .MinSize(wxSize(100,100)) 00203 ); 00204 #else 00205 00206 // 00207 m_mgr.AddPane(mWxGUITextEditor, 00208 wxAuiPaneInfo().Name(wxT("editor_content")) 00209 .Caption(wxT("Files")) 00210 .MinimizeButton(true) 00211 .MaximizeButton(true) 00212 .Center() 00213 .MinSize(wxSize(100,100)) 00214 ); 00215 00216 m_mgr.AddPane(mWxGUIHtmlBrowser, 00217 wxAuiPaneInfo().Name(wxT("browser_content")) 00218 .Caption(wxT("Help")) 00219 .MinimizeButton(true) 00220 .MaximizeButton(true) 00221 .Right() 00222 .Layer(2) 00223 .MinSize(wxSize(400,100)) 00224 ); 00225 00226 m_mgr.AddPane(mWxGUIOutputMessages, 00227 wxAuiPaneInfo().Name(wxT("messages_content")) 00228 .Caption(wxT("Messages")) 00229 .MinimizeButton(true) 00230 .MaximizeButton(true) 00231 .Bottom() 00232 .MinSize(wxSize(100,100)) 00233 ); 00234 00235 m_mgr.AddPane(mWxGUICommand, 00236 wxAuiPaneInfo().Name(wxT("command_content")) 00237 .Caption(wxT("Command")) 00238 .MinimizeButton(true) 00239 .MaximizeButton(true) 00240 .Bottom() 00241 .Layer(1) 00242 .MinSize(wxSize(100,100)) 00243 ); 00244 #endif 00245 00246 // parent window of all bbtk windows will be a child of this 00247 // Wx::SetTopWindowParent(this); 00248 Wx::SetTopWindow(this); 00249 // Wx::SetAutoDestroyTopWindow(false); 00250 // Add the method OnWxSignal as a Wx::Signal observer 00251 //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal); 00252 00253 //.PaneBorder(false)); 00254 // Load the interface appearance saved on last closing 00255 LoadPerspective(); 00256 00257 // Done in LoadPerspective 00258 // m_mgr.Update(); 00259 00260 SetAutoLayout(true); 00261 Layout(); 00262 // mwxNotebook->SetSelection(1); 00263 mWxGUIHtmlBrowser->GoHome(); 00264 // Refresh(); 00265 m_mgr.Update(); 00266 // LoadPerspective(); 00267 00268 mBreaked = false; 00269 00270 wxBitmap bitmap; 00271 wxSplashScreen* splash; 00272 long style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT; 00273 if (ConfigurationFile::GetInstance().DotBbtkIsNew()) 00274 style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT; 00275 std::string splash_file = ConfigurationFile::GetInstance().Get_data_path(); 00276 splash_file += "/kernel/icons/bbStudioSplashScreen.png"; 00277 00278 if (bitmap.LoadFile(std2wx(splash_file),wxBITMAP_TYPE_PNG)) 00279 splash = 00280 new wxSplashScreen(bitmap, 00281 style, 00282 1000, 0, -1, wxDefaultPosition, wxDefaultSize, 00283 wxSIMPLE_BORDER|wxSTAY_ON_TOP); 00284 00285 if (ConfigurationFile::GetInstance().DotBbtkIsNew()) 00286 { 00287 00288 DoRegeneratePackageDoc("-a"); 00289 DoRegenerateBoxesLists(); 00290 00291 /* 00292 wxTipWindow* tip = new wxTipWindow(this, 00293 _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); 00294 tip->CenterOnParent(); 00295 tip->Show(); 00296 */ 00297 if (splash) splash->Destroy(); 00298 } 00299 00300 }
bbtk::WxGUIScriptingInterface::~WxGUIScriptingInterface | ( | ) |
Definition at line 304 of file bbtkWxGUIScriptingInterface.cxx.
References bbtkDebugMessage, m_mgr, and SavePerspective().
00305 { 00306 bbtkDebugMessage("widget",9,"bbStudio::~bbStudio()"<<std::endl); 00307 SavePerspective(); 00308 m_mgr.UnInit(); 00309 }
void bbtk::WxGUIScriptingInterface::DoRegenerateBoxesLists | ( | ) |
Definition at line 686 of file bbtkWxGUIScriptingInterface.cxx.
References _T, BBTK_BUSY_CURSOR, bbtkMessage, bbtk::ConfigurationFile::Get_bin_path(), bbtk::ConfigurationFile::Get_file_separator(), bbtk::ConfigurationFile::GetInstance(), and bbtk::std2wx().
Referenced by OnMenuPlugPackage(), OnMenuRegenerateAll(), OnMenuRegenerateBoxesLists(), and WxGUIScriptingInterface().
00687 { 00688 SetStatusText( _T("Regenerating boxes lists ... please wait") ); 00689 BBTK_BUSY_CURSOR ; 00690 00691 std::string command; 00692 #if defined(WIN32) 00693 command = "\""; 00694 #endif 00695 command += ConfigurationFile::GetInstance().Get_bin_path(); 00696 command += ConfigurationFile::GetInstance().Get_file_separator(); 00697 command += "bbRegenerateBoxesLists"; 00698 #if defined(WIN32) 00699 command += "\""; 00700 #endif 00701 command += " -q"; 00702 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl); 00703 00704 std::cout << "==========================================================================================================" << command.c_str() << std::endl; 00705 if ( ! system ( command.c_str() ) ) 00706 { 00707 SetStatusText( _T("Done !")); 00708 /* 00709 wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"), 00710 wxOK | wxICON_INFORMATION); 00711 */ 00712 } 00713 else 00714 { 00715 SetStatusText( _T("Done !")); 00716 wxString err(_T("An error occured while running '")); 00717 err += bbtk::std2wx(command) + _T("'"); 00718 wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR); 00719 } 00720 }
void bbtk::WxGUIScriptingInterface::DoRegeneratePackageDoc | ( | const std::string & | pack | ) |
Definition at line 625 of file bbtkWxGUIScriptingInterface.cxx.
References _T, BBTK_BUSY_CURSOR, bbtkMessage, bbtk::ConfigurationFile::Get_bin_path(), bbtk::ConfigurationFile::Get_file_separator(), bbtk::ConfigurationFile::GetInstance(), and bbtk::std2wx().
Referenced by OnMenuPlugPackage(), OnMenuRegenerateAll(), OnMenuRegeneratePackageDoc(), and WxGUIScriptingInterface().
00626 { 00627 std::string mess("Regenerating doc for package '"); 00628 if (pack!="-a") 00629 mess += pack + "'"; 00630 else 00631 mess = "Regenerating doc for all packages"; 00632 mess += " ... please wait"; 00633 00634 SetStatusText( std2wx(mess) ); 00635 00636 BBTK_BUSY_CURSOR; 00637 00638 std::string command; 00639 #if defined(WIN32) 00640 command = "\""; 00641 #endif 00642 command += ConfigurationFile::GetInstance().Get_bin_path(); 00643 command += ConfigurationFile::GetInstance().Get_file_separator(); 00644 command += "bbRegeneratePackageDoc"; 00645 #if defined(WIN32) 00646 command += "\""; 00647 #endif 00648 command += " " + pack + " -q"; 00649 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl); 00650 00651 00652 if ( ! system ( command.c_str() ) ) 00653 { 00654 SetStatusText( _T("Done !")); 00655 /* 00656 wxMessageBox(_T("Done !"),_T("Regenerate package '") 00657 +std2wx(pack)+_T("' doc"), 00658 wxOK | wxICON_INFORMATION); 00659 */ 00660 } 00661 else 00662 { 00663 SetStatusText( _T("Done !")); 00664 wxString err(_T("An error occured while running '")); 00665 err += bbtk::std2wx(command) + _T("'"); 00666 wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR); 00667 } 00668 }
Interpreter::Pointer bbtk::WxGUIScriptingInterface::GetInterpreter | ( | ) | const [inline] |
Returns the Interpreter used ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT (DIFFERENT WORKSPACES)
Definition at line 85 of file bbtkWxGUIScriptingInterface.h.
00085 { return mInterpreter; }
bool bbtk::WxGUIScriptingInterface::InterpreterUserHasOwnHtmlPageViewer | ( | ) | [inline, virtual] |
Reimplemented from bbtk::InterpreterUser.
Definition at line 131 of file bbtkWxGUIScriptingInterface.h.
void bbtk::WxGUIScriptingInterface::InterpreterUserViewHtmlPage | ( | const std::string & | page | ) | [virtual] |
Reimplemented from bbtk::InterpreterUser.
Definition at line 777 of file bbtkWxGUIScriptingInterface.cxx.
References bbtk::WxGUIHtmlBrowser::GoTo(), and mWxGUIHtmlBrowser.
00778 { 00779 std::string s(page); 00780 // std::cout << "WxGUIScriptingInterface::ShowHtmlPage('"<<page<<"')"<<std::endl; 00781 if (mWxGUIHtmlBrowser->GoTo(s)) 00782 { 00783 //EED mwxNotebook->ChangeSelection(1); 00784 // mwxNotebook->SetSelection(1); 00785 } 00786 else 00787 { 00788 // std::cout << "ERROR html"<<std::endl; 00789 } 00790 }
bool bbtk::WxGUIScriptingInterface::InterpretFile | ( | const std::string & | filename | ) |
Runs the interpretation of a file.
Runs the interpretation of a file Returns false on error
Definition at line 402 of file bbtkWxGUIScriptingInterface.cxx.
References CATCH_MACRO, and mInterpreter.
00403 { 00404 try 00405 { 00406 mInterpreter->InterpretFile(filename); 00407 } 00408 CATCH_MACRO; 00409 return true; 00410 }
void bbtk::WxGUIScriptingInterface::LoadPerspective | ( | ) |
Definition at line 928 of file bbtkWxGUIScriptingInterface.cxx.
References bbtk::Utilities::FileExists(), m_mgr, bbtk::Utilities::MakeUserSettingsFullFileName(), and bbtk::std2wx().
Referenced by WxGUIScriptingInterface().
00929 { 00930 std::string fname = 00931 Utilities::MakeUserSettingsFullFileName("bbStudio.aui"); 00932 if ( Utilities::FileExists( fname )) 00933 { 00934 // std::cout << "Loading configuration..."<<std::endl; 00935 00936 std::ifstream f; 00937 f.open(fname.c_str()); 00938 std::string conf; 00939 f >> conf; 00940 00941 // int x,y; 00942 // f >> x >> y ; 00943 00944 int w,h; 00945 f >> w >> h ; 00946 00947 f.close(); 00948 00949 // std::cout << conf << std::endl; 00950 00951 // Move(x,y); 00952 SetSize(w,h); 00953 m_mgr.LoadPerspective(std2wx(conf)); 00954 } 00955 else 00956 { 00957 m_mgr.Update(); 00958 } 00959 }
void bbtk::WxGUIScriptingInterface::OnClose | ( | wxCloseEvent & | event | ) |
Definition at line 313 of file bbtkWxGUIScriptingInterface.cxx.
References bbtkDebugMessage.
00314 { 00315 bbtkDebugMessage("widget",9,"bbStudio::OnClose()"<<std::endl); 00316 //Wx::SetWindowsHaveBeenDestroyedByParent(); 00317 //mInterpreter.reset(); 00318 wxWindowList& list = GetChildren(); 00319 wxWindowList::iterator iter; 00320 for (iter = list.begin(); iter != list.end(); ++iter) 00321 { 00322 (*iter)->Close(); 00323 } 00324 this->Destroy(); 00325 }
void bbtk::WxGUIScriptingInterface::OnMenuAbout | ( | wxCommandEvent & | event | ) |
void bbtk::WxGUIScriptingInterface::OnMenuCreateBlackBox | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 580 of file bbtkWxGUIScriptingInterface.cxx.
References bbtkMessage, mWxGUICommand, and bbtk::WxGUICommand::SendCommand().
00581 { 00582 /* 00583 std::string command("toolsbbtk/appli/GUICreateBlackBox"); 00584 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl); 00585 00586 Interpreter::Pointer I = Interpreter::New(); 00587 I->InterpretFile(command); 00588 */ 00589 std::string command("reset"); 00590 mWxGUICommand->SendCommand(command); 00591 command = "include toolsbbtk/appli/GUICreateBlackBox"; 00592 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl); 00593 mWxGUICommand->SendCommand(command); 00594 }
void bbtk::WxGUIScriptingInterface::OnMenuCreatePackage | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 561 of file bbtkWxGUIScriptingInterface.cxx.
References bbtkMessage, mWxGUICommand, and bbtk::WxGUICommand::SendCommand().
00562 { 00563 /* 00564 std::string command("toolsbbtk/appli/GUICreatePackage"); 00565 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl); 00566 00567 Interpreter::Pointer I = Interpreter::New(); 00568 I->InterpretFile(command); 00569 */ 00570 std::string command("reset"); 00571 mWxGUICommand->SendCommand(command); 00572 command = "include toolsbbtk/appli/GUICreatePackage"; 00573 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl); 00574 mWxGUICommand->SendCommand(command); 00575 }
void bbtk::WxGUIScriptingInterface::OnMenuEditConfig | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 516 of file bbtkWxGUIScriptingInterface.cxx.
References _T, bbtk::ConfigurationFile::Get_config_xml_full_path(), bbtk::ConfigurationFile::GetInstance(), and Open().
00517 { 00518 00519 std::string configFile = 00520 ConfigurationFile::GetInstance().Get_config_xml_full_path(); 00521 Open(configFile); 00522 wxMessageDialog ww(NULL,_T("If you change the bbtk_config.xml, you have to restart this appliaction..."), _T("Alert !"), wxOK); 00523 ww.ShowModal(); 00524 }
void bbtk::WxGUIScriptingInterface::OnMenuPlugPackage | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 742 of file bbtkWxGUIScriptingInterface.cxx.
References _T, bbtk::ConfigurationFile::AddPackagePathsAndWrite(), DoRegenerateBoxesLists(), DoRegeneratePackageDoc(), bbtk::Utilities::FileExists(), bbtk::ConfigurationFile::GetInstance(), and bbtk::wx2std().
00743 { 00744 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST; 00745 wxDirDialog* FD = 00746 new wxDirDialog( 0, 00747 _T("Select package directory"), 00748 _T(""), 00749 style); 00750 00751 if (FD->ShowModal()==wxID_OK) 00752 { 00753 std::string path = wx2std (FD->GetPath()) ; 00754 std::string fname = path + "/bbtkPackage"; 00755 if ( ! Utilities::FileExists( fname ) ) 00756 { 00757 wxString err(_T("The directory does not contain a 'bbtkPackage' file")); 00758 wxMessageBox(err,_T("Plug package"),wxOK | wxICON_ERROR); 00759 return; 00760 } 00761 00762 std::ifstream f; 00763 f.open(fname.c_str()); 00764 std::string pname; 00765 f >> pname; 00766 f.close(); 00767 00768 bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path ); 00769 00770 DoRegeneratePackageDoc(pname); 00771 DoRegenerateBoxesLists(); 00772 } 00773 }
void bbtk::WxGUIScriptingInterface::OnMenuQuit | ( | wxCommandEvent & | event | ) |
void bbtk::WxGUIScriptingInterface::OnMenuRegenerateAll | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 732 of file bbtkWxGUIScriptingInterface.cxx.
References DoRegenerateBoxesLists(), and DoRegeneratePackageDoc().
00733 { 00734 00735 DoRegeneratePackageDoc("-a"); 00736 DoRegenerateBoxesLists(); 00737 }
void bbtk::WxGUIScriptingInterface::OnMenuRegenerateBoxesLists | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 725 of file bbtkWxGUIScriptingInterface.cxx.
References DoRegenerateBoxesLists().
00726 { 00727 DoRegenerateBoxesLists(); 00728 }
void bbtk::WxGUIScriptingInterface::OnMenuRegeneratePackageDoc | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 672 of file bbtkWxGUIScriptingInterface.cxx.
References _T, DoRegeneratePackageDoc(), and bbtk::wx2std().
00673 { 00674 wxString name = wxGetTextFromUser(_T("Enter package name (-a for all)"), 00675 _T("Regenerate package doc"), 00676 _T("")); 00677 if (name.IsEmpty()) return; 00678 std::string pack = bbtk::wx2std(name); 00679 00680 DoRegeneratePackageDoc(pack); 00681 }
void bbtk::WxGUIScriptingInterface::OnMenuShowImageGraph | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 598 of file bbtkWxGUIScriptingInterface.cxx.
References bbtk::ConfigurationFile::Get_doc_path(), bbtk::ConfigurationFile::Get_file_separator(), and bbtk::ConfigurationFile::GetInstance().
00599 { 00600 00601 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path(); 00602 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator(); 00603 doc_path += "bbdoc"; 00604 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator(); 00605 00606 std::string pack_name("User"); 00607 std::string pack_path = doc_path + pack_name; 00608 00609 #if defined(WIN32) 00610 std::string strappli="start "; 00611 #else 00612 #if defined(MACOSX) 00613 std::string strappli="open "; 00614 #else 00615 std::string strappli="gnome-open "; 00616 #endif 00617 #endif 00618 std::string strcommand = strappli +pack_path+"/workspace_workspacePrototype.png"; 00619 // std::cout << "system: " << strcommand << std::endl; 00620 system ( strcommand.c_str() ); 00621 00622 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsCheck | ( | wxCommandEvent & | event, | |
wxWindow * | w | |||
) |
Definition at line 855 of file bbtkWxGUIScriptingInterface.cxx.
References m_mgr.
Referenced by OnMenuWindowsCommand(), OnMenuWindowsFiles(), OnMenuWindowsHelp(), and OnMenuWindowsMessages().
00857 { 00858 bool checked = event.IsChecked(); 00859 bool shown = m_mgr.GetPane(w).IsShown(); 00860 // std::cout << "checked = "<<checked<<" - shown = "<<shown<<std::endl; 00861 if (checked ^ shown) 00862 { 00863 m_mgr.GetPane(w).Show(checked); 00864 m_mgr.Update(); 00865 } 00866 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsCommand | ( | wxCommandEvent & | event | ) |
Definition at line 890 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUICommand, and OnMenuWindowsCheck().
00891 { 00892 OnMenuWindowsCheck(event,mWxGUICommand); 00893 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsFiles | ( | wxCommandEvent & | event | ) |
Definition at line 869 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUITextEditor, and OnMenuWindowsCheck().
00870 { 00871 OnMenuWindowsCheck(event,mWxGUITextEditor); 00872 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsHelp | ( | wxCommandEvent & | event | ) |
Definition at line 876 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUIHtmlBrowser, and OnMenuWindowsCheck().
00877 { 00878 OnMenuWindowsCheck(event,mWxGUIHtmlBrowser); 00879 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsMessages | ( | wxCommandEvent & | event | ) |
Definition at line 883 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUIOutputMessages, and OnMenuWindowsCheck().
00884 { 00885 OnMenuWindowsCheck(event,mWxGUIOutputMessages); 00886 }
void bbtk::WxGUIScriptingInterface::OnMenuWindowsPackageBrowser | ( | wxCommandEvent & | event | ) |
void bbtk::WxGUIScriptingInterface::OnMenuWindowsSave | ( | wxCommandEvent & | WXUNUSEDevent | ) |
Definition at line 897 of file bbtkWxGUIScriptingInterface.cxx.
References SavePerspective().
00898 { 00899 SavePerspective(); 00900 }
void bbtk::WxGUIScriptingInterface::OnPaneClose | ( | wxAuiManagerEvent & | evt | ) |
Definition at line 963 of file bbtkWxGUIScriptingInterface.cxx.
00964 { 00965 std::cout << "Closing panel '"<<evt.pane->name<<"'"<<std::endl; 00966 // TO DO : Uncheck 00967 // OnMenuWindowsCheck( wxCommandEvent& event, wxWindow* w); 00968 }
void bbtk::WxGUIScriptingInterface::Open | ( | const std::string & | filename | ) |
Definition at line 330 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUITextEditor, and bbtk::WxGUITextEditor::Open().
Referenced by OnMenuEditConfig().
00331 { 00332 mWxGUITextEditor->Open(filename); 00333 }
void bbtk::WxGUIScriptingInterface::SavePerspective | ( | ) |
Definition at line 904 of file bbtkWxGUIScriptingInterface.cxx.
References m_mgr, bbtk::Utilities::MakeUserSettingsFullFileName(), and bbtk::wx2std().
Referenced by OnMenuWindowsSave(), and ~WxGUIScriptingInterface().
00905 { 00906 // std::cout << "Saving configuration..."<<std::endl; 00907 std::string conf = wx2std(m_mgr.SavePerspective()); 00908 std::string fname = Utilities::MakeUserSettingsFullFileName("bbStudio.aui"); 00909 std::ofstream f; 00910 f.open(fname.c_str(), std::ios::out ); 00911 f << conf << std::endl; 00912 00913 // int x,y; 00914 // GetPosition(&x,&y); 00915 // f << x << " " << y << std::endl; 00916 00917 00918 int w,h; 00919 GetSize(&w,&h); 00920 00921 f << w << " " << h << std::endl; 00922 00923 f.close(); 00924 }
void bbtk::WxGUIScriptingInterface::SetDialogMode | ( | Interpreter::DialogModeType | t | ) | [inline] |
Definition at line 96 of file bbtkWxGUIScriptingInterface.h.
00097 { mInterpreter->SetDialogMode(t); }
void bbtk::WxGUIScriptingInterface::SetInputs | ( | const std::map< std::string, std::string > & | m | ) | [inline] |
Sets the inputs of the workspace : the map is passed as is to the Executer
Definition at line 89 of file bbtkWxGUIScriptingInterface.h.
00090 { mInterpreter->SetInputs(m); }
void bbtk::WxGUIScriptingInterface::SetNoExecMode | ( | bool | b | ) | [inline] |
Puts the executer in "no exec" mode, which creates but does not execute pipelines.
Definition at line 94 of file bbtkWxGUIScriptingInterface.h.
00094 { mInterpreter->SetNoExecMode(b); }
void bbtk::WxGUIScriptingInterface::WxGUICommandEnter | ( | const std::string & | command | ) | [virtual] |
Callback invoked when a command is entered in the WxGUICommand.
Reimplemented from bbtk::WxGUICommandUser.
Definition at line 386 of file bbtkWxGUIScriptingInterface.cxx.
References CATCH_MACRO, mInterpreter, mWxGUIOutputMessages, and bbtk::WxGUIOutputMessages::Print().
Referenced by WxGUITextEditorGraphDetail(), WxGUITextEditorGraphSimple(), and WxGUITextEditorRun().
00387 { 00388 std::string s("> "); 00389 s += command + "\n"; 00390 mWxGUIOutputMessages->Print(s,wxRED); 00391 00392 try 00393 { 00394 mInterpreter->InterpretLine( command ); 00395 } 00396 CATCH_MACRO; 00397 }
bool bbtk::WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked | ( | const std::string & | target | ) | [virtual] |
Reimplemented from bbtk::WxGUIHtmlBrowserUser.
Definition at line 804 of file bbtkWxGUIScriptingInterface.cxx.
References mWxGUITextEditor, mwxNotebook, and bbtk::WxGUITextEditor::Open().
00805 { 00806 size_t s = target.length(); 00807 if ((s>3) && (target[s-1]=='s') 00808 && (target[s-2]=='b') 00809 && (target[s-3]=='b') 00810 && (target[s-4]=='.')) 00811 { 00812 mWxGUITextEditor->Open(target); 00813 #if NOTEBOOK 00814 mwxNotebook->SetSelection(0); 00815 #endif 00816 mWxGUITextEditor->SetFocus(); 00817 return false; 00818 } 00819 00820 if ((s>3) && (target[s-1]=='f') 00821 && (target[s-2]=='d') 00822 && (target[s-3]=='p') 00823 && (target[s-4]=='.')) 00824 { 00825 00826 // Open pdf in linux 00827 // gnome-open target 00828 00829 // Open pdf in macOS 00830 00831 // Open pdf in windows 00832 int size=target.size(); 00833 int pos=target.rfind("\\"); 00834 std::string commandStart("start "); 00835 std::string commandPath("/D \""+target.substr(0,pos) +"\""); 00836 std::string commandPDF( target.substr(pos+1,size-pos+1) ); 00837 00838 printf("EED WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked cc %s \n",commandPath.c_str() ); 00839 // cleanning path 00840 while (commandPath.rfind("\\\\")!=-1 ) 00841 { 00842 commandPath.erase( commandPath.rfind("\\\\") , 1 ); 00843 printf("EED WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked cc %s \n",commandPath.c_str() ); 00844 } 00845 00846 std::string command = commandStart+commandPath+" "+commandPDF; 00847 printf("EED WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked BB %s \n",command.c_str() ); 00848 system( command.c_str() ); 00849 return false; 00850 } 00851 return true; 00852 }
void bbtk::WxGUIScriptingInterface::WxGUITextEditorGraphDetail | ( | ) | [virtual] |
Reimplemented from bbtk::WxGUITextEditorUser.
Definition at line 425 of file bbtkWxGUIScriptingInterface.cxx.
References WxGUICommandEnter(), and WxGUITextEditorRun().
00426 { 00427 WxGUICommandEnter("exec freeze_no_error"); 00428 WxGUITextEditorRun(); 00429 WxGUICommandEnter("exec unfreeze"); 00430 WxGUICommandEnter("graph . 1"); 00431 }
void bbtk::WxGUIScriptingInterface::WxGUITextEditorGraphSimple | ( | ) | [virtual] |
Reimplemented from bbtk::WxGUITextEditorUser.
Definition at line 415 of file bbtkWxGUIScriptingInterface.cxx.
References WxGUICommandEnter(), and WxGUITextEditorRun().
00416 { 00417 WxGUICommandEnter("exec freeze_no_error"); 00418 WxGUITextEditorRun(); 00419 WxGUICommandEnter("exec unfreeze"); 00420 WxGUICommandEnter("graph"); 00421 }
void bbtk::WxGUIScriptingInterface::WxGUITextEditorRun | ( | ) | [virtual] |
Callback invoked when the 'run' button is pressed.
Reimplemented from bbtk::WxGUITextEditorUser.
Definition at line 470 of file bbtkWxGUIScriptingInterface.cxx.
References CATCH_MACRO, bbtk::WxGUITextEditor::GetCurrentPage(), bbtk::WxGUITextEditorPage::GetText(), mBreaked, mInterpreter, mWxGUITextEditor, mwxMenuItemReset, and WxGUICommandEnter().
Referenced by WxGUITextEditorGraphDetail(), and WxGUITextEditorGraphSimple().
00471 { 00472 // wxString temp = mWxGUIHtmlBrowser->GetCurrentPage(); 00473 std::stringstream* buf = new std::stringstream; 00474 (*buf) << mWxGUITextEditor->GetCurrentPage()->GetText(); 00475 try 00476 { 00477 if (!mBreaked) 00478 { 00479 if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset"); 00480 mInterpreter->InterpretBuffer(buf); 00481 } 00482 else 00483 { 00484 mBreaked = false; 00485 mInterpreter->InterpretCurrentStreams(); 00486 } 00487 // std::cout << "EO RUN"<<std::endl; 00488 } 00489 CATCH_MACRO; 00490 // std::cout << "EO RUN 3"<<std::endl; 00491 }
void bbtk::WxGUIScriptingInterface::WxGUITextEditorRunBBI | ( | ) | [virtual] |
Reimplemented from bbtk::WxGUITextEditorUser.
Definition at line 436 of file bbtkWxGUIScriptingInterface.cxx.
References bbtk::ConfigurationFile::Get_bin_path(), bbtk::ConfigurationFile::Get_default_temp_dir(), bbtk::ConfigurationFile::Get_file_separator(), bbtk::WxGUITextEditor::GetCurrentPage(), bbtk::ConfigurationFile::GetInstance(), mWxGUITextEditor, and bbtk::WxGUITextEditorPage::SaveFile().
00437 { 00438 std::string separator = ConfigurationFile::GetInstance().Get_file_separator (); 00439 std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); 00440 std::string filename = dir + separator + "tmp_bbtk.bbs"; 00441 mWxGUITextEditor->GetCurrentPage()->SaveFile(filename); 00442 00443 std::string command = "\""; 00444 00445 #ifdef WIN32 00446 command += "\""; 00447 #endif 00448 00449 command += ConfigurationFile::GetInstance().Get_bin_path(); 00450 #ifdef MACOSX 00451 command += separator + "bbi.app/Contents/MacOS/bbi\" "; 00452 #else 00453 command += separator + "bbi\" "; 00454 #endif 00455 command += "\""+filename + "\""; 00456 00457 #ifdef WIN32 00458 command += "\""; 00459 #endif 00460 00461 command += " & "; 00462 00463 printf ("EED WxGUIScriptingInterface::WxGUITextEditorRunBBI %s \n" , command.c_str() ); 00464 system( command.c_str() ); 00465 }
wxAuiManager bbtk::WxGUIScriptingInterface::m_mgr [private] |
Definition at line 153 of file bbtkWxGUIScriptingInterface.h.
Referenced by LoadPerspective(), OnMenuWindowsCheck(), SavePerspective(), WxGUIScriptingInterface(), and ~WxGUIScriptingInterface().
bool bbtk::WxGUIScriptingInterface::mBreaked [private] |
Definition at line 172 of file bbtkWxGUIScriptingInterface.h.
Referenced by WxGUIScriptingInterface(), and WxGUITextEditorRun().
Definition at line 154 of file bbtkWxGUIScriptingInterface.h.
Referenced by InterpretFile(), WxGUICommandEnter(), WxGUIScriptingInterface(), and WxGUITextEditorRun().
Definition at line 163 of file bbtkWxGUIScriptingInterface.h.
Referenced by OnMenuCreateBlackBox(), OnMenuCreatePackage(), OnMenuWindowsCommand(), and WxGUIScriptingInterface().
Definition at line 165 of file bbtkWxGUIScriptingInterface.h.
Referenced by InterpreterUserViewHtmlPage(), OnMenuWindowsHelp(), and WxGUIScriptingInterface().
Definition at line 164 of file bbtkWxGUIScriptingInterface.h.
Referenced by OnMenuWindowsMessages(), WxGUICommandEnter(), and WxGUIScriptingInterface().
Definition at line 167 of file bbtkWxGUIScriptingInterface.h.
Definition at line 166 of file bbtkWxGUIScriptingInterface.h.
Referenced by OnMenuWindowsFiles(), Open(), WxGUIHtmlBrowserUserOnLinkClicked(), WxGUIScriptingInterface(), WxGUITextEditorRun(), and WxGUITextEditorRunBBI().
wxMenuItem* bbtk::WxGUIScriptingInterface::mwxMenuItemReset [private] |
Definition at line 169 of file bbtkWxGUIScriptingInterface.h.
Referenced by WxGUIScriptingInterface(), and WxGUITextEditorRun().
wxAuiNotebook* bbtk::WxGUIScriptingInterface::mwxNotebook [private] |
Definition at line 156 of file bbtkWxGUIScriptingInterface.h.
Referenced by WxGUIHtmlBrowserUserOnLinkClicked(), and WxGUIScriptingInterface().