1 /*=========================================================================
3 Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
5 Date: $Date: 2009/05/28 08:12:07 $
6 Version: $Revision: 1.38 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Short description in one line
35 * Long description which
36 * can span multiple lines
48 #ifdef _USE_WXWIDGETS_
51 #include "bbtkWxGUIScriptingInterface.h"
52 #include "bbtkWxBlackBox.h"
53 #include "bbtkConfigurationFile.h"
54 #include "bbtkWxStreamRedirector.h"
55 #include "bbtkUtilities.h"
57 #include <wx/tipwin.h>
58 #include <wx/splash.h>
60 //#include "icons/cc_run.xpm"
70 ID_Menu_CreatePackage,
71 ID_Menu_CreateBlackBox,
72 ID_Menu_ShowImageGraph,
73 ID_Menu_RegeneratePackageDoc,
74 ID_Menu_RegenerateBoxesLists,
75 ID_Menu_RegenerateAll,
77 ID_Menu_Windows_Files,
79 ID_Menu_Windows_Messages,
80 ID_Menu_Windows_Command,
82 ID_Menu_Windows_PackageBrowser
87 //================================================================
88 WxGUIScriptingInterface::WxGUIScriptingInterface( wxWindow *parent )
89 : wxFrame((wxFrame *)parent, -1, _T("bbStudio"),
90 wxDefaultPosition, wxSize(1200,800) )
92 m_mgr.SetManagedWindow(this);
94 mInterpreter = bbtk::Interpreter::New();
95 mInterpreter->SetUser(this);
96 mInterpreter->SetCommandLine(true);
97 mInterpreter->SetThrow(true);
98 // mInterpreter->AddBreakObserver
99 //boost::bind( &WxGUIScriptingInterface::InterpreterUserOnBreak, this ));
102 wxInitAllImageHandlers();
104 wxMenu *menuFile = new wxMenu;
105 menuFile->Append( ID_Menu_EditConfig, _T("Open bbtk &Config file") );
106 menuFile->Append( ID_Menu_Quit, _T("&Quit") );
108 wxMenu *menuAbout = new wxMenu;
109 menuAbout->Append( ID_Menu_About, _T("&About...") );
111 wxMenu *menuTools = new wxMenu;
112 menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") );
113 menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &black box") );
114 menuTools->Append( ID_Menu_PlugPackage, _T("&Plug package") );
115 menuTools->AppendSeparator();
116 menuTools->Append( ID_Menu_RegeneratePackageDoc,_T("Regenerate package &doc") );
117 menuTools->Append( ID_Menu_RegenerateBoxesLists,_T("Regenerate boxes &lists") );
118 menuTools->Append( ID_Menu_RegenerateAll,_T("Regenerate &all") );
119 menuTools->AppendSeparator();
120 menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last graph") );
122 wxMenu *menuWindows = new wxMenu;
123 menuWindows->AppendCheckItem(ID_Menu_Windows_Files,
124 _T("Show 'files' panel") )->Check();
125 menuWindows->AppendCheckItem(ID_Menu_Windows_Help,
126 _T("Show 'help' panel") )->Check();
127 menuWindows->AppendCheckItem(ID_Menu_Windows_Messages,
128 _T("Show 'messages' panel") )->Check();
129 menuWindows->AppendCheckItem(ID_Menu_Windows_Command,
130 _T("Show 'command' panel") )->Check();
131 menuWindows->AppendSeparator();
132 menuWindows->Append( ID_Menu_Windows_PackageBrowser, _T("Start Package &Browser") );
134 // menuWindows->AppendSeparator();
135 // menuWindows->Append ( ID_Menu_Windows_Save, _T("Save interface configuration"));
137 wxMenu *menuOptions = new wxMenu;
138 mwxMenuItemReset = menuOptions->AppendCheckItem(-1,
139 _T("Reset before running") );
140 mwxMenuItemReset->Check();
142 wxMenuBar *menuBar = new wxMenuBar;
143 menuBar->Append( menuFile, _T("&File") );
144 menuBar->Append( menuTools, _T("&Tools") );
145 menuBar->Append( menuOptions, _T("&Options") );
146 menuBar->Append( menuWindows, _T("&Windows") );
147 menuBar->Append( menuAbout, _T("About") );
149 SetMenuBar( menuBar );
154 SetStatusText( _T("Welcome to bbStudio !") );
157 // Panes (Files, Messages, Help, Command)
158 mWxGUITextEditor = new WxGUITextEditor(this,this);
159 mWxGUITextEditor->SetFileNameFilter("*.bbs");
161 mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0),this);
163 mWxGUIOutputMessages = new WxGUIOutputMessages(this);
165 mWxGUICommand = new WxGUICommand(this,this);
167 mWxGUICommand->SetFocus();
172 mwxNotebook = new wxAuiNotebook(this,
178 | wxAUI_NB_TAB_EXTERNAL_MOVE
179 //| wxAUI_NB_WINDOWLIST_BUTTON
180 //|wxAUI_NB_SCROLL_BUTTONS
181 // | wxAUI_NB_CLOSE_BUTTON
182 //| wxAUI_NB_CLOSE_ON_ACTIVE_TAB
183 //| wxAUI_NB_CLOSE_ON_ALL_TABS
187 mwxNotebook->AddPage(mWxGUITextEditor,_T("Files"),true);
188 mwxNotebook->AddPage(mWxGUIHtmlBrowser,_T("Help"),true);
190 mwxNotebook->AddPage(mWxGUIOutputMessages,_T("Messages"),true);
192 mwxNotebook->AddPage(mWxGUICommand,_T("Command"),true);
195 m_mgr.AddPane(mwxNotebook,
196 wxAuiPaneInfo().Name(wxT("nb"))
197 .CaptionVisible(false)
198 .MinimizeButton(false)
199 .MaximizeButton(false)
201 // .MinSize(wxSize(100,100))
206 m_mgr.AddPane(mWxGUITextEditor,
207 wxAuiPaneInfo().Name(wxT("editor_content"))
208 .Caption(wxT("Files"))
209 .MinimizeButton(true)
210 .MaximizeButton(true)
212 .MinSize(wxSize(100,100))
215 m_mgr.AddPane(mWxGUIHtmlBrowser,
216 wxAuiPaneInfo().Name(wxT("browser_content"))
217 .Caption(wxT("Help"))
218 .MinimizeButton(true)
219 .MaximizeButton(true)
222 .MinSize(wxSize(400,100))
225 m_mgr.AddPane(mWxGUIOutputMessages,
226 wxAuiPaneInfo().Name(wxT("messages_content"))
227 .Caption(wxT("Messages"))
228 .MinimizeButton(true)
229 .MaximizeButton(true)
231 .MinSize(wxSize(100,100))
234 m_mgr.AddPane(mWxGUICommand,
235 wxAuiPaneInfo().Name(wxT("command_content"))
236 .Caption(wxT("Command"))
237 .MinimizeButton(true)
238 .MaximizeButton(true)
241 .MinSize(wxSize(100,100))
245 // parent window of all bbtk windows will be a child of this
246 // Wx::SetTopWindowParent(this);
247 Wx::SetTopWindow(this);
248 // Wx::SetAutoDestroyTopWindow(false);
249 // Add the method OnWxSignal as a Wx::Signal observer
250 //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
252 //.PaneBorder(false));
253 // Load the interface appearance saved on last closing
256 // Done in LoadPerspective
261 // mwxNotebook->SetSelection(1);
262 mWxGUIHtmlBrowser->GoHome();
265 // LoadPerspective();
270 wxSplashScreen* splash;
271 long style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT;
272 if (ConfigurationFile::GetInstance().DotBbtkIsNew())
273 style = wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT;
274 std::string splash_file = ConfigurationFile::GetInstance().Get_data_path();
275 splash_file += "/kernel/icons/bbStudioSplashScreen.png";
277 if (bitmap.LoadFile(std2wx(splash_file),wxBITMAP_TYPE_PNG))
279 new wxSplashScreen(bitmap,
281 1000, 0, -1, wxDefaultPosition, wxDefaultSize,
282 wxSIMPLE_BORDER|wxSTAY_ON_TOP);
285 if (ConfigurationFile::GetInstance().DotBbtkIsNew())
288 DoRegeneratePackageDoc("-a");
289 DoRegenerateBoxesLists();
292 wxTipWindow* tip = new wxTipWindow(this,
293 _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);
294 tip->CenterOnParent();
297 if (splash) splash->Destroy();
301 //================================================================
303 //================================================================
304 WxGUIScriptingInterface::~WxGUIScriptingInterface()
306 bbtkDebugMessage("widget",9,"bbStudio::~bbStudio()"<<std::endl);
310 //================================================================
312 //================================================================
313 void WxGUIScriptingInterface::OnClose(wxCloseEvent& event)
315 bbtkDebugMessage("widget",9,"bbStudio::OnClose()"<<std::endl);
316 //Wx::SetWindowsHaveBeenDestroyedByParent();
317 //mInterpreter.reset();
318 wxWindowList& list = GetChildren();
319 wxWindowList::iterator iter;
320 for (iter = list.begin(); iter != list.end(); ++iter)
326 //================================================================
329 //================================================================
330 void WxGUIScriptingInterface::Open(const std::string& filename)
332 mWxGUITextEditor->Open(filename);
334 //================================================================
336 catch (BreakException e) \
338 std::cout << "* BREAK"<<std::endl; \
339 if (e.IsInScriptFile()) \
340 std::cout << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
341 std::cout << "* LINE : "<<e.GetScriptLine()<<std::endl; \
343 catch (QuitException e) \
345 std::cout << "* QUIT"<<std::endl; \
346 if (e.IsInScriptFile()) \
347 std::cout << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
348 std::cout << "* LINE : "<<e.GetScriptLine()<<std::endl; \
352 #define CATCH_MACRO \
353 catch (InterpreterException e) \
355 if (e.GetErrorMessage()=="quit") \
357 std::cerr << "* QUIT ENCOUNTERED"<<std::endl; \
358 if (e.IsInScriptFile()) \
359 std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
360 std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
362 else if (e.GetErrorMessage()=="break") \
365 std::cerr << "* BREAK"<<std::endl; \
366 if (e.IsInScriptFile()) \
367 std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
368 std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
372 std::cerr << "* ERROR : "<<e.GetErrorMessage()<<std::endl; \
373 if (e.IsInScriptFile()) \
374 std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
375 std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
376 int lev = bbtk::MessageManager::GetMessageLevel("Error"); \
378 std::cerr << "* Exception thrown : "<<std::endl; \
379 std::cerr << "* OBJECT : " <<e.GetObject()<<std::endl; \
380 std::cerr << "* FILE : " <<e.GetSourceFile()<<std::endl; \
385 //================================================================
386 void WxGUIScriptingInterface::WxGUICommandEnter(const std::string& command)
390 mWxGUIOutputMessages->Print(s,wxRED);
394 mInterpreter->InterpretLine( command );
398 //================================================================
400 //================================================================
401 /// Runs the interpretation of a file
402 bool WxGUIScriptingInterface::InterpretFile( const std::string& filename)
406 mInterpreter->InterpretFile(filename);
411 //================================================================
414 //================================================================
415 void WxGUIScriptingInterface::WxGUITextEditorGraphSimple()
417 WxGUICommandEnter("exec freeze_no_error");
418 WxGUITextEditorRun();
419 WxGUICommandEnter("exec unfreeze");
420 WxGUICommandEnter("graph");
422 //================================================================
424 //================================================================
425 void WxGUIScriptingInterface::WxGUITextEditorGraphDetail()
427 WxGUICommandEnter("exec freeze_no_error");
428 WxGUITextEditorRun();
429 WxGUICommandEnter("exec unfreeze");
430 WxGUICommandEnter("graph . 1");
432 //================================================================
435 //================================================================
436 void WxGUIScriptingInterface::WxGUITextEditorRunBBI()
438 std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
439 std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
440 std::string filename = dir + separator + "tmp_bbtk.bbs";
441 mWxGUITextEditor->GetCurrentPage()->SaveFile(filename);
443 std::string command = "\"";
444 command += ConfigurationFile::GetInstance().Get_bin_path();
446 command += separator + "bbi.app/Contents/MacOS/bbi\" ";
448 command += separator + "bbi\" ";
450 command += "\""+filename + "\"";
453 printf ("EED WxGUIScriptingInterface::WxGUITextEditorRunBBI %s \n" , command.c_str() );
454 system( command.c_str() );
456 //================================================================
459 //================================================================
460 void WxGUIScriptingInterface::WxGUITextEditorRun()
462 // wxString temp = mWxGUIHtmlBrowser->GetCurrentPage();
463 std::stringstream* buf = new std::stringstream;
464 (*buf) << mWxGUITextEditor->GetCurrentPage()->GetText();
469 if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
470 mInterpreter->InterpretBuffer(buf);
475 mInterpreter->InterpretCurrentStreams();
477 // std::cout << "EO RUN"<<std::endl;
480 // std::cout << "EO RUN 3"<<std::endl;
482 //================================================================
484 //================================================================
485 void WxGUIScriptingInterface::OnMenuQuit(wxCommandEvent& WXUNUSED(event))
487 if (!mWxGUITextEditor->CloseAllPages()) return;
490 //================================================================
493 //================================================================
494 void WxGUIScriptingInterface::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
498 wxMessageBox(_T(" bbStudio\nThe Black Box Toolkit Development Studio\n(c) CREATIS-LRMN 2008"),
499 _T("About ..."), wxOK | wxICON_INFORMATION,
502 //================================================================
505 //================================================================
506 void WxGUIScriptingInterface::OnMenuEditConfig(wxCommandEvent& WXUNUSED(event))
508 std::string configFile =
509 ConfigurationFile::GetInstance().Get_config_xml_full_path();
512 //================================================================
514 //================================================================
515 void WxGUIScriptingInterface::OnMenuWindowsPackageBrowser(wxCommandEvent& WXUNUSED(event))
518 WxGUIPackageBrowser2Window *helpbrowser = new
519 WxGUIPackageBrowser2Window(this,_T("Package Browser"), wxSize(600,600) );
524 WxGUIPackageBrowser2 *browser = new WxGUIPackageBrowser2(this);
525 browser->IncludeAll();
528 // mwxNotebook->AddPage(browser,_T("Package Browser"),true);
531 m_mgr.AddPane(browser,
532 wxAuiPaneInfo().Name(wxT("package_brower"))
533 .Caption(wxT("Package browser"))
534 .MinimizeButton(true)
535 .MaximizeButton(true)
538 .MinSize(wxSize(100,100))
543 //================================================================
547 //================================================================
548 void WxGUIScriptingInterface::OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event))
551 std::string command("toolsbbtk/appli/GUICreatePackage");
552 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
554 Interpreter::Pointer I = Interpreter::New();
555 I->InterpretFile(command);
557 std::string command("reset");
558 mWxGUICommand->SendCommand(command);
559 command = "include toolsbbtk/appli/GUICreatePackage";
560 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
561 mWxGUICommand->SendCommand(command);
564 //================================================================
567 //================================================================
568 void WxGUIScriptingInterface::OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event))
571 std::string command("toolsbbtk/appli/GUICreateBlackBox");
572 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
574 Interpreter::Pointer I = Interpreter::New();
575 I->InterpretFile(command);
577 std::string command("reset");
578 mWxGUICommand->SendCommand(command);
579 command = "include toolsbbtk/appli/GUICreateBlackBox";
580 bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
581 mWxGUICommand->SendCommand(command);
583 //================================================================
585 //================================================================
586 void WxGUIScriptingInterface::OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event))
589 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
590 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
592 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
594 std::string pack_name("User");
595 std::string pack_path = doc_path + pack_name;
599 std::string strappli="start ";
602 std::string strappli="open ";
604 std::string strappli="gnome-open ";
608 std::string strcommand = strappli +pack_path+"/workspace_workspacePrototype.png";
609 // std::cout << "system: " << strcommand << std::endl;
610 system ( strcommand.c_str() );
613 //================================================================
615 void WxGUIScriptingInterface::DoRegeneratePackageDoc( const std::string& pack )
617 std::string mess("Regenerating doc for package '");
621 mess = "Regenerating doc for all packages";
622 mess += " ... please wait";
624 SetStatusText( std2wx(mess) );
632 command += ConfigurationFile::GetInstance().Get_bin_path();
633 command += ConfigurationFile::GetInstance().Get_file_separator();
634 command += "bbRegeneratePackageDoc";
638 command += " " + pack + " -q";
639 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
642 if ( ! system ( command.c_str() ) )
644 SetStatusText( _T("Done !"));
646 wxMessageBox(_T("Done !"),_T("Regenerate package '")
647 +std2wx(pack)+_T("' doc"),
648 wxOK | wxICON_INFORMATION);
653 SetStatusText( _T("Done !"));
654 wxString err(_T("An error occured while running '"));
655 err += bbtk::std2wx(command) + _T("'");
656 wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);
664 //================================================================
665 void WxGUIScriptingInterface::OnMenuRegeneratePackageDoc(wxCommandEvent& WXUNUSED(event))
667 wxString name = wxGetTextFromUser(_T("Enter package name (-a for all)"),
668 _T("Regenerate package doc"),
670 if (name.IsEmpty()) return;
671 std::string pack = bbtk::wx2std(name);
673 DoRegeneratePackageDoc(pack);
675 //================================================================
678 //================================================================
679 void WxGUIScriptingInterface::DoRegenerateBoxesLists()
681 SetStatusText( _T("Regenerating boxes lists ... please wait") );
688 command += ConfigurationFile::GetInstance().Get_bin_path();
689 command += ConfigurationFile::GetInstance().Get_file_separator();
690 command += "bbRegenerateBoxesLists";
695 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
699 if ( ! system ( command.c_str() ) )
701 SetStatusText( _T("Done !"));
703 wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
704 wxOK | wxICON_INFORMATION);
709 SetStatusText( _T("Done !"));
710 wxString err(_T("An error occured while running '"));
711 err += bbtk::std2wx(command) + _T("'");
712 wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);
715 //================================================================
718 //================================================================
719 void WxGUIScriptingInterface::OnMenuRegenerateBoxesLists(wxCommandEvent& WXUNUSED(event))
721 DoRegenerateBoxesLists();
723 //================================================================
725 //================================================================
726 void WxGUIScriptingInterface::OnMenuRegenerateAll(wxCommandEvent& WXUNUSED(event))
729 DoRegeneratePackageDoc("-a");
730 DoRegenerateBoxesLists();
732 //================================================================
735 //================================================================
736 void WxGUIScriptingInterface::OnMenuPlugPackage(wxCommandEvent& WXUNUSED(event))
738 long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
741 _T("Select package directory"),
745 if (FD->ShowModal()==wxID_OK)
747 std::string path = wx2std (FD->GetPath()) ;
748 std::string fname = path + "/bbtkPackage";
749 if ( ! Utilities::FileExists( fname ) )
751 wxString err(_T("The directory does not contain a 'bbtkPackage' file"));
752 wxMessageBox(err,_T("Plug package"),wxOK | wxICON_ERROR);
757 f.open(fname.c_str());
763 bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );
765 DoRegeneratePackageDoc(pname);
766 DoRegenerateBoxesLists();
770 //================================================================
772 //================================================================
773 void WxGUIScriptingInterface::InterpreterUserViewHtmlPage(const std::string& page)
776 // std::cout << "WxGUIScriptingInterface::ShowHtmlPage('"<<page<<"')"<<std::endl;
777 if (mWxGUIHtmlBrowser->GoTo(s))
779 //EED mwxNotebook->ChangeSelection(1);
780 // mwxNotebook->SetSelection(1);
784 // std::cout << "ERROR html"<<std::endl;
787 //================================================================
790 //================================================================
791 void WxGUIScriptingInterface::InterpreterUserOnBreak()
793 // std::cout << "Break" << std::endl;
796 //================================================================
799 //================================================================
800 bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target)
802 size_t s = target.length();
803 if ((s>3) && (target[s-1]=='s')
804 && (target[s-2]=='b')
805 && (target[s-3]=='b')
806 && (target[s-4]=='.'))
808 mWxGUITextEditor->Open(target);
810 mwxNotebook->SetSelection(0);
812 mWxGUITextEditor->SetFocus();
817 //================================================================
819 void WxGUIScriptingInterface::OnMenuWindowsCheck( wxCommandEvent& event,
822 bool checked = event.IsChecked();
823 bool shown = m_mgr.GetPane(w).IsShown();
824 // std::cout << "checked = "<<checked<<" - shown = "<<shown<<std::endl;
827 m_mgr.GetPane(w).Show(checked);
833 //================================================================
834 void WxGUIScriptingInterface::OnMenuWindowsFiles(wxCommandEvent& event)
836 OnMenuWindowsCheck(event,mWxGUITextEditor);
838 //================================================================
840 //================================================================
841 void WxGUIScriptingInterface::OnMenuWindowsHelp(wxCommandEvent& event)
843 OnMenuWindowsCheck(event,mWxGUIHtmlBrowser);
845 //================================================================
847 //================================================================
848 void WxGUIScriptingInterface::OnMenuWindowsMessages(wxCommandEvent& event)
850 OnMenuWindowsCheck(event,mWxGUIOutputMessages);
852 //================================================================
854 //================================================================
855 void WxGUIScriptingInterface::OnMenuWindowsCommand(wxCommandEvent& event)
857 OnMenuWindowsCheck(event,mWxGUICommand);
859 //================================================================
861 //================================================================
862 void WxGUIScriptingInterface::OnMenuWindowsSave( wxCommandEvent& WXUNUSED(event))
866 //================================================================
868 //================================================================
869 void WxGUIScriptingInterface::SavePerspective()
871 // std::cout << "Saving configuration..."<<std::endl;
872 std::string conf = wx2std(m_mgr.SavePerspective());
873 std::string fname = Utilities::MakeUserSettingsFullFileName("bbStudio.aui");
875 f.open(fname.c_str(), std::ios::out );
876 f << conf << std::endl;
879 // GetPosition(&x,&y);
880 // f << x << " " << y << std::endl;
886 f << w << " " << h << std::endl;
890 //================================================================
892 //================================================================
893 void WxGUIScriptingInterface::LoadPerspective()
896 Utilities::MakeUserSettingsFullFileName("bbStudio.aui");
897 if ( Utilities::FileExists( fname ))
899 // std::cout << "Loading configuration..."<<std::endl;
902 f.open(fname.c_str());
914 // std::cout << conf << std::endl;
918 m_mgr.LoadPerspective(std2wx(conf));
925 //================================================================
927 //================================================================
928 void WxGUIScriptingInterface::OnPaneClose(wxAuiManagerEvent& evt)
930 std::cout << "Closing panel '"<<evt.pane->name<<"'"<<std::endl;
932 // OnMenuWindowsCheck( wxCommandEvent& event, wxWindow* w);
934 //================================================================
937 //================================================================
938 BEGIN_EVENT_TABLE(WxGUIScriptingInterface, wxFrame)
939 EVT_CLOSE( WxGUIScriptingInterface::OnClose)
940 EVT_MENU(ID_Menu_Quit, WxGUIScriptingInterface::OnMenuQuit)
941 EVT_MENU(ID_Menu_About, WxGUIScriptingInterface::OnMenuAbout)
942 EVT_MENU(ID_Menu_EditConfig, WxGUIScriptingInterface::OnMenuEditConfig)
943 EVT_MENU(ID_Menu_CreatePackage, WxGUIScriptingInterface::OnMenuCreatePackage)
944 EVT_MENU(ID_Menu_CreateBlackBox, WxGUIScriptingInterface::OnMenuCreateBlackBox)
945 EVT_MENU(ID_Menu_ShowImageGraph, WxGUIScriptingInterface::OnMenuShowImageGraph)
946 EVT_MENU(ID_Menu_RegeneratePackageDoc, WxGUIScriptingInterface::OnMenuRegeneratePackageDoc)
947 EVT_MENU(ID_Menu_RegenerateBoxesLists, WxGUIScriptingInterface::OnMenuRegenerateBoxesLists)
948 EVT_MENU(ID_Menu_RegenerateAll, WxGUIScriptingInterface::OnMenuRegenerateAll)
949 EVT_MENU(ID_Menu_PlugPackage, WxGUIScriptingInterface::OnMenuPlugPackage)
950 EVT_MENU(ID_Menu_Windows_Files, WxGUIScriptingInterface::OnMenuWindowsFiles)
951 EVT_MENU(ID_Menu_Windows_Help, WxGUIScriptingInterface::OnMenuWindowsHelp)
952 EVT_MENU(ID_Menu_Windows_Messages, WxGUIScriptingInterface::OnMenuWindowsMessages)
953 EVT_MENU(ID_Menu_Windows_Command, WxGUIScriptingInterface::OnMenuWindowsCommand)
954 EVT_MENU(ID_Menu_Windows_Save, WxGUIScriptingInterface::OnMenuWindowsSave)
955 EVT_MENU(ID_Menu_Windows_PackageBrowser, WxGUIScriptingInterface::OnMenuWindowsPackageBrowser)
956 EVT_AUI_PANE_CLOSE(WxGUIScriptingInterface::OnPaneClose)
957 // EVT_BUTTON(ID_Button_Run, WxGUIScriptingInterface::OnButtonRun )
959 //================================================================
964 #endif //_USE_WXWIDGETS_