1 /*=========================================================================
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 Class bbtk::WxInterfaceEditorGraphicBBS .
36 #include "bbtkwxGUIEditorGraphicBBS.h"
38 #include "creaSystem.h"
40 #include <InterpreterBBS.h>
48 //=========================================================================
49 wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent)
50 : wxFrame(parent, -1, _T("bbtkGEditor"),wxDefaultPosition, wxSize(1200,800))
53 _frameAUIMgr = new wxAuiManager(this);
56 /*std::string datadir( crea::System::GetExecutablePath() );
57 std::string datadir (".");
58 cout<<"RaC //------------------"<<endl;
59 cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with crea::System::GetExecutablePath() ."<<endl;
60 cout<<"RaC //------------------"<<endl;
62 #ifdef LINUX // assume this is OSX
63 datadir=datadir+"/../share/creaContours";
66 #ifdef MACOSX // assume this is OSX
67 datadir=datadir+"/../../../../share/creaContours";
74 initTabPanelsManager();
76 initHelpHTMLBrowser();
79 _frameAUIMgr->Update();
80 _actualPkgBrowserBoxName="";
81 _actualPkgBrowserPkgName="";
86 //=========================================================================
87 wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS()
89 printf ("EED %p ~wxGUIEditorGraphicBBS()\n" , this );
91 //EED02JUIN2010 delete _tabsMgr;
93 _frameAUIMgr->UnInit();
98 //=========================================================================
99 void wxGUIEditorGraphicBBS::initToolbar()
101 wxBitmap bmp_new(new_xpm);
102 wxBitmap bmp_open(open_xpm);
103 wxBitmap bmp_save(save_xpm);
104 wxBitmap bmp_run(run_xpm);
105 wxBitmap bmp_delete(delete_xpm);
106 wxBitmap bmp_centerview(centerview_xpm);
107 wxBitmap bmp_box(box_xpm);
108 wxBitmap bmp_complexbox(complexbox_xpm);
109 wxBitmap bmp_complexinputport(complexinputport_xpm);
110 wxBitmap bmp_complexoutputport(complexoutputport_xpm);
112 wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
114 //Adds a tool btn to the toolbar
115 toolbar->AddTool(ID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
116 toolbar->AddTool(ID_OPEN,_T("Open diagram"),bmp_open, wxNullBitmap, wxITEM_NORMAL,_T("Open a diagram"), _T("Open a diagram"));
117 toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save diagram"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves actual diagram"), _T("Saves actual diagram"));
118 toolbar->AddTool(ID_RUN,_T("Run"),bmp_run, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram"));
119 toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
120 toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
121 toolbar->AddSeparator();
122 toolbar->AddTool(ID_BTNBOX,_T("New Box"),bmp_box, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Nex Box"));
123 toolbar->AddSeparator();
124 toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
125 toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
126 toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
127 toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT,_T("Add output to Complex box"),bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,_T("Add output Complex box"), _T("Add output Complex box"));
128 toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
129 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
131 toolbar->SetMargins( 2, 2 );
135 // connect command event handlers
136 Connect(ID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
137 Connect(ID_OPEN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
138 Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
139 Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
140 Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
141 Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
142 Connect(ID_BTNBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
143 Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
144 Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
145 Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
148 //=========================================================================
149 void wxGUIEditorGraphicBBS::initHelpHTMLBrowser()
151 //TO FIX THE PATH OF BBTK BIN IN ORDER TO USE REGENERATE EXECUTABLES
153 _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0));
154 _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200));
157 //=========================================================================
158 void wxGUIEditorGraphicBBS::initMenu()
160 // Create File menu and its items
161 wxMenu *fileMenu = new wxMenu();
162 fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
163 fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save diagram"), _T("Save diagram"));
164 fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
165 fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
166 fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"), _T("Save complex box"));
167 fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
169 Connect(ID_NEW,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
170 Connect(ID_SAVE_AS_DIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram));
171 Connect(ID_OPEN_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
172 Connect(ID_SAVE_AS_BBS,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
173 Connect(ID_SAVE_AS_COMPLEXBOX,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
174 Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
176 // Create Help menu and its items
177 wxMenu *editMenu = new wxMenu;
178 editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes"));
180 Connect(ID_COPY_TO_COMPLEXDIAGRAM,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
182 // Create Help menu and its items
183 wxMenu *helpMenu = new wxMenu;
184 helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
186 // Append the created menu to the menu bar
187 wxMenuBar *menuBar = new wxMenuBar();
188 menuBar->Append(fileMenu, _T("&File"));
189 menuBar->Append(editMenu, _T("&Edit"));
190 menuBar->Append(helpMenu, _T("&Help"));
192 // Attach this menu bar to the frame
196 //=========================================================================
197 void wxGUIEditorGraphicBBS::initTabPanelsManager()
199 _notebook = new wxAuiNotebook(this,wxID_NOTEBOOK,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
200 _tabsMgr = new wxTabPanelsManager(this);
201 _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane());
205 //=========================================================================
206 void wxGUIEditorGraphicBBS::initPackageBrowser()
208 _pkgBrowser = new WxGUIPackageBrowser2(this);
209 _pkgBrowser->IncludeAll();
210 _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false));
213 //================================================================
215 void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc( const std::string& pack )
217 std::string mess("Regenerating doc for package '");
223 mess = "Regenerating doc for all packages";
226 mess += " ... please wait";
228 SetStatusText( std2wx(mess) );
236 command += ConfigurationFile::GetInstance().Get_bin_path();
237 command += ConfigurationFile::GetInstance().Get_file_separator();
238 command += "bbRegeneratePackageDoc";
243 command += " " + pack + " -q";
244 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
246 if ( ! system ( command.c_str() ) )
248 SetStatusText( _T("Done !"));
250 wxMessageBox(_T("Done !"),_T("Regenerate package '")
251 +std2wx(pack)+_T("' doc"),
252 wxOK | wxICON_INFORMATION);
257 SetStatusText( _T("Done !"));
258 wxString err(_T("An error occured while running '"));
259 err += bbtk::std2wx(command) + _T("'");
260 wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);
264 //================================================================
265 void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists()
267 SetStatusText( _T("Regenerating boxes lists ... please wait") );
274 command += ConfigurationFile::GetInstance().Get_bin_path();
275 command += ConfigurationFile::GetInstance().Get_file_separator();
276 command += "bbRegenerateBoxesLists";
283 bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
285 if ( ! system ( command.c_str() ) )
287 SetStatusText( _T("Done !"));
289 wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
290 wxOK | wxICON_INFORMATION);
295 SetStatusText( _T("Done !"));
296 wxString err(_T("An error occured while running '"));
297 err += bbtk::std2wx(command) + _T("'");
298 wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);
302 //================================================================
303 void wxGUIEditorGraphicBBS::RegenerateAll()
305 DoRegeneratePackageDoc("-a");
306 DoRegenerateBoxesLists();
309 //================================================================
311 wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook()
316 //================================================================
318 void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::string boxName)
320 if(_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName != boxName )
322 _actualPkgBrowserPkgName = packageName;
323 _actualPkgBrowserBoxName = boxName;
325 BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
326 _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
330 //=========================================================================
332 void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel)
334 wxBlackBoxEditionDialog* dialog = new wxBlackBoxEditionDialog(this,bbmodel);
338 //=========================================================================
340 void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
342 SetStatusText(crea::std2wx(textStatus));
345 //=========================================================================
347 void wxGUIEditorGraphicBBS::executeScript(std::string script)
349 std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
350 std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
351 std::string filename = dir + separator + "tmp_bbtk.bbs";
354 tempFile.open(filename.c_str());
358 std::string command = "\""+ crea::System::GetExecutablePath();
362 command += separator + "../../../bbi.app/Contents/MacOS";
371 //command += ConfigurationFile::GetInstance().Get_bin_path();
372 //EED command +="C:/temp/bbtkBIN/RelWithDebInfo//";
373 //EED command +="C:/Program Files/CreaTools/bbtk-0.9.5/bin";
377 command += separator + "usr/local/bin/bbi.app/Contents/MacOS/bbi\" ";
380 command += separator + "bbi\" ";
383 command += separator + "bbi\" ";
384 command += "\""+filename + "\"";
391 printf ("RaC wxGUIEditorGraphicBBS::executeScript %s \n" , command.c_str() );
392 system( command.c_str() );
395 //=========================================================================
397 //=========================================================================
399 void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event)
401 _tabsMgr->addNewTab();
402 refreshGUIControls();
405 //=========================================================================
407 void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event)
409 std::string script1 = _tabsMgr->getActualDiagramBBS(true);
410 cout<<endl<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<<endl<<endl;
413 std::string script2 = _tabsMgr->getActualDiagramBBS(false);
414 executeScript(script2);
418 //=========================================================================
420 //=========================================================================
421 void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event)
423 wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxOPEN);
424 if (openFileDialog->ShowModal() == wxID_OK)
426 wxString fileName = openFileDialog->GetPath( );
429 _tabsMgr->addNewTab();
431 bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());
433 // We tell the interpreter to throw exceptions on error
435 // Interpret the file supposed to define a box called 'Processing'
436 I->InterpretFile( (const char*) (fileName.mb_str()) );
438 refreshGUIControls();
441 void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event)
443 wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual BBS"),wxEmptyString,wxT("NewBBS"),wxT("*.bbs"),wxSAVE|wxOVERWRITE_PROMPT);
444 if (saveFileDialog->ShowModal() == wxID_OK)
446 wxString fileName = saveFileDialog->GetPath( );
450 //EED file.open(fileName.c_str());
451 file.open( (const char*) (fileName.mb_str()) );
453 std::string content="";
455 // writing file header
456 content += "# ----------------------------------\n";
457 content += "# - BBTKGEditor v 1.0 BBS BlackBox Script\n";
458 content += "# ----------------------------------\n";
460 content += _tabsMgr->getActualDiagramBBS();
467 //=========================================================================
469 void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event)
471 wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of complex box"));
472 std::string cbName="";
473 if (nameDialog->ShowModal() == wxID_OK)
475 wxString fileName = nameDialog->GetValue();
476 cbName=(const char*) (fileName.mb_str());
481 wxFileDialog * saveFileDialog = new wxFileDialog(this ,wxT("Save Complex Box BBS") ,wxEmptyString, wxString( cbName.c_str(), wxConvUTF8),wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
482 if (saveFileDialog->ShowModal() == wxID_OK)
484 wxString fileName = saveFileDialog->GetPath();
487 file.open( (const char*) (fileName.mb_str()) );
489 std::string content="";
491 // writing file header
492 content += "# ----------------------------------\n";
493 content += "# - BBTKGEditor v 1.1 BBS BlackBox Script (Complex Box)\n";
494 content += "# ----------------------------------\n";
496 content += _tabsMgr->getActualComplexBoxBBS(cbName);
504 //=========================================================================
506 void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event)
508 wxFileDialog * saveFileDialog = new wxFileDialog(this,wxT("Save actual diagram"),wxEmptyString,wxT("NewDiagram"),wxT("*.bbg"),wxSAVE|wxOVERWRITE_PROMPT);
509 if (saveFileDialog->ShowModal() == wxID_OK)
511 wxString fileName = saveFileDialog->GetPath();
514 file.open( (const char*) (fileName.mb_str()) );
516 std::string content="";
518 // writing file header
519 content += "# ----------------------------------\n";
520 content += "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file\n";
523 content += (const char*) (fileName.mb_str());
526 content += "# ----------------------------------\n";
528 content += "APP_START\n";
529 _tabsMgr->saveActualDiagram(content);
530 content += "APP_END\n";
537 //=========================================================================
539 void wxGUIEditorGraphicBBS::refreshGUIControls()
541 wxToolBar* toolbar = GetToolBar();
542 if(_tabsMgr->isActualDiagramComplexBox())
544 toolbar->ToggleTool(ID_BTNCOMPLEXBOX,true);
545 toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,true);
546 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,true);
548 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,true);
549 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,false);
553 toolbar->ToggleTool(ID_BTNCOMPLEXBOX,false);
554 toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT,false);
555 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT,false);
557 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX,false);
558 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS,true);
561 if(_tabsMgr->getNumActualSelectedObjects()>0)
563 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
567 ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
568 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM,true);
573 //=========================================================================
575 void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event)
577 wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Are you sure to delete all boxes of the diagram?"), wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
578 if(dial->ShowModal() == wxID_YES)
580 _tabsMgr->deleteAllBoxesActualDiagram();
584 //=========================================================================
586 void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event)
588 _tabsMgr->centerViewActualDiagram();
591 //=========================================================================
594 void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
596 wxFileDialog * openFileDialog = new wxFileDialog(this,wxT("Open diagram"),wxEmptyString,wxT(""),wxT("*.bbg"),wxOPEN|wxFILE_MUST_EXIST);
597 if (openFileDialog->ShowModal() == wxID_OK)
599 wxString fileName = openFileDialog->GetPath();
601 ifstream inputStream;
603 //EED inputStream.open(fileName.c_str());
604 inputStream.open( (const char*) (fileName.mb_str()) );
608 _tabsMgr->addNewTab();
609 _tabsMgr->loadDiagram(inputStream);
613 refreshGUIControls();
616 //=========================================================================
619 void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
622 BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
625 std::string typeName = bbDes->GetTypeName();
626 std::string packageName = bbDes->GetPackage()->GetName();
629 wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
633 wxVtkSceneManager *scn = pnl->getSceneManager();
634 scn->createGBlackBox(50,50,packageName, typeName);
640 //=========================================================================
643 void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
645 wxToolBar* toolbar = GetToolBar();
646 bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
649 _tabsMgr->setActualDiagramComplexBox(true);
653 _tabsMgr->setActualDiagramComplexBox(false);
655 refreshGUIControls();
658 //=========================================================================
660 void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event)
662 wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of input port"));
663 if (nameDialog->ShowModal() == wxID_OK)
665 wxString fileName = nameDialog->GetValue();
666 if(!fileName.IsEmpty())
668 std::string portName=(const char*) (fileName.mb_str());
669 _tabsMgr->addActualDiagramComplexInputPort(portName);
674 //=========================================================================
676 void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event)
678 wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,wxT("Name of output port"));
679 if (nameDialog->ShowModal() == wxID_OK)
681 wxString fileName = nameDialog->GetValue();
682 if(!fileName.IsEmpty())
684 std::string portName=(const char*) (fileName.mb_str());
685 _tabsMgr->addActualDiagramComplexOutputPort(portName);
690 //=========================================================================
692 void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(wxCommandEvent& event)
694 _tabsMgr->copySelectedBBoxesToComplexDiagram();
697 //=========================================================================
699 void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event)
704 //=========================================================================
706 } // EO namespace bbtk