]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
Feature #1665 . RaC - New dialog to set diagrams properties and decide diagram type.
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
1 /*=========================================================================
2  Program:   bbtk
3  Module:    $RCSfile$
4  Language:  C++
5  Date:      $Date$
6  Version:   $Revision$
7  =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11  * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12  * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13  *
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.
20  *
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
25  *  liability.
26  *
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  * ------------------------------------------------------------------------ */
30
31 /**
32  *  \file
33  *  \brief Class bbtk::WxInterfaceEditorGraphicBBS .
34  */
35
36 #include "bbtkwxGUIEditorGraphicBBS.h"
37 #include "creaWx.h"
38 #include "creaSystem.h"
39 //must go #include "bbtkUtilities.h"
40 //must go #include "bbtkConfigurationFile.h"
41 #include <wx/defs.h>
42
43 #include <InterpreterBBS.h>
44
45 namespace bbtk {
46
47 //=========================================================================
48 wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) :
49                         wxFrame(parent, -1, _T("bbtkGEditor"), wxDefaultPosition, wxSize(
50                                         1200, 800)) {
51
52         _frameAUIMgr = new wxAuiManager(this);
53
54         /*std::string datadir( crea::System::GetExecutablePath() );
55          std::string datadir (".");
56          cout<<"RaC //------------------"<<endl;
57          cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with  crea::System::GetExecutablePath() ."<<endl;
58          cout<<"RaC //------------------"<<endl;
59
60          #ifdef LINUX // assume this is OSX
61          datadir=datadir+"/../share/creaContours";
62          #endif // MACOSX
63
64          #ifdef MACOSX // assume this is OSX
65          datadir=datadir+"/../../../../share/creaContours";
66          #endif // MACOSX
67
68          _dataDir = datadir;*/
69
70         initMenu();
71         initToolbar();
72         initTabPanelsManager();
73         initPackageBrowser();
74         // JGGR & CM  initHelpHTMLBrowser();
75         _helpHtmlBrowser = NULL;
76         CreateStatusBar();
77         _frameAUIMgr->Update();
78         _actualPkgBrowserBoxName = "";
79         _actualPkgBrowserPkgName = "";
80         refreshGUIControls();
81 }
82
83 //=========================================================================
84 wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() {
85
86         printf("EED %p ~wxGUIEditorGraphicBBS()\n", this);
87
88         //EED02JUIN2010         delete _tabsMgr;
89
90         _frameAUIMgr->UnInit();
91         // FCY memory leaks
92         delete _frameAUIMgr;
93         delete _notebook;
94         delete _tabsMgr;
95
96 }
97
98 //=========================================================================
99 void wxGUIEditorGraphicBBS::initToolbar() {
100         wxBitmap bmp_new(new_xpm);
101         wxBitmap bmp_open(open_xpm);
102         wxBitmap bmp_save(save_xpm);
103         wxBitmap bmp_run(run_xpm);
104         wxBitmap bmp_delete(delete_xpm);
105         wxBitmap bmp_centerview(centerview_xpm);
106         wxBitmap bmp_box(box_xpm);
107         wxBitmap bmp_executablebox(executablebox_xpm);
108         wxBitmap bmp_complexbox(complexbox_xpm);
109         wxBitmap bmp_complexinputport(complexinputport_xpm);
110         wxBitmap bmp_complexoutputport(complexoutputport_xpm);
111         wxBitmap bmp_undo(undo_xpm);
112         wxBitmap bmp_redo(redo_xpm);
113         wxBitmap bmp_editProperties(editProperties_xpm);
114         wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
115
116         //Adds a tool btn to the toolbar
117         toolbar->AddTool(ID_NEW, _T("New"), bmp_new, wxNullBitmap, wxITEM_NORMAL,
118                         _T("New tab"), _T("Create a new panel tab"));
119         toolbar->AddTool(ID_OPEN, _T("Open diagram"), bmp_open, wxNullBitmap,
120                         wxITEM_NORMAL, _T("Open a diagram"), _T("Open a diagram"));
121         toolbar->AddTool(ID_SAVE_DIAGRAM, _T("Save Diagram"), bmp_save,
122                         wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"),
123                         _T("Saves the current diagram")); //DFCH
124         //toolbar->AddTool(ID_SAVE_AS_DIAGRAM,_T("Save Diagram As"),bmp_save, wxNullBitmap, wxITEM_NORMAL,_T("Saves the current diagram"), _T("Saves the current diagram")); //DFCH
125         toolbar->AddTool(ID_RUN, _T("Run"), bmp_run, wxNullBitmap, wxITEM_NORMAL,
126                         _T("Execute actual diagram"), _T("Execute actual diagram"));
127         toolbar->AddTool(ID_DELETEALL, _T("Delete all"), bmp_delete, wxNullBitmap,
128                         wxITEM_NORMAL, _T("Delete all boxes"), _T("Delete all boxes"));
129         toolbar->AddTool(ID_CENTERVIEW, _T("Center view"), bmp_centerview,
130                         wxNullBitmap, wxITEM_NORMAL, _T("Center view"), _T("Center view"));
131         toolbar->AddSeparator();
132         toolbar->AddTool(ID_BTNBOX, _T("New Box"), bmp_box, wxNullBitmap,
133                         wxITEM_NORMAL, _T("New Box"), _T("Nex Box"));
134         toolbar->AddSeparator();
135         toolbar->AddTool(ID_BTEXECUTABLEBOX, _T("Select as executable Box"),
136                         bmp_executablebox, wxNullBitmap, wxITEM_NORMAL,
137                         _T("Select as executable Box"), _T("Select as executable Box"));
138         toolbar->AddSeparator();
139         toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm,
140                         wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box"));
141         toolbar->SetToggle(ID_BTNCOMPLEXBOX, true);
142
143         //toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"),
144         //              bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
145         //              _T("Add input to Complex box"), _T("Add input to Complex box"));
146         toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add external input (Complex box or console app)"),
147                         bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
148                         _T("Add external input (Complex box or console app)"), _T("Add external input (Complex box or console app)"));
149
150         toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT, _T("Add output to Complex box"),
151                         bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,
152                         _T("Add output Complex box"), _T("Add output Complex box"));
153         toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false);
154         toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
155         toolbar->AddSeparator();
156         toolbar->AddTool(ID_UNDO, _T("Undo"),bmp_undo, wxNullBitmap, wxITEM_NORMAL,     _T("Undo"), _T("Undo"));
157         toolbar->AddTool(ID_REDO, _T("Redo"),bmp_redo, wxNullBitmap, wxITEM_NORMAL,     _T("Redo"), _T("Redo"));
158         toolbar->AddSeparator();
159         toolbar->AddTool(ID_EDITPROPERTIES, _T("Edit diagram properties"),bmp_editProperties, wxNullBitmap, wxITEM_NORMAL,      _T("Edit diagram properties"), _T("Edit diagram properties"));
160         toolbar->EnableTool(ID_EDITPROPERTIES, false);
161         
162         toolbar->EnableTool(ID_UNDO, false);
163         toolbar->EnableTool(ID_REDO, false);
164         toolbar->SetMargins(2, 2);
165         toolbar->Realize();
166         SetToolBar(toolbar);
167
168         
169         // connect command event handlers
170
171         Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
172                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
173         Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
174                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
175         Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
176                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
177         Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
178                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram)); //DFCH
179         Connect(
180                         ID_RUN,
181                         wxEVT_COMMAND_TOOL_CLICKED,
182                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
183         Connect(
184                         ID_DELETEALL,
185                         wxEVT_COMMAND_TOOL_CLICKED,
186                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
187         Connect(
188                         ID_CENTERVIEW,
189                         wxEVT_COMMAND_TOOL_CLICKED,
190                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
191         Connect(ID_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,
192                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
193         Connect(
194                         ID_BTEXECUTABLEBOX,
195                         wxEVT_COMMAND_TOOL_CLICKED,
196                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnExecutableBox));
197         Connect(ID_BTNCOMPLEXBOX, wxEVT_COMMAND_TOOL_CLICKED,
198                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
199         Connect(ID_ADDCOMPLEXBOXINPUT, wxEVT_COMMAND_TOOL_CLICKED,
200                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
201         Connect(ID_ADDCOMPLEXBOXOUTPUT, wxEVT_COMMAND_TOOL_CLICKED,
202                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
203         Connect(ID_UNDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnUndo));
204         Connect(ID_REDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnRedo));
205         Connect(ID_CHANGENAME, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnChangeName));
206         Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
207
208 }
209 //=========================================================================
210 void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() {
211         // JGRR & CM 
212         _helpHtmlBrowser = new WxGUIHtmlBrowser(this, wxSize(200, 0));
213    
214         // EO JGRR & CM 
215         
216 }
217
218 //=========================================================================
219 void wxGUIEditorGraphicBBS::initMenu() {
220         // Create File menu and its items
221         wxMenu *fileMenu = new wxMenu();
222         fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
223         fileMenu->Append(ID_SAVE_DIAGRAM, _T("Save Diagram"), _T("Save Diagram")); //DFCH
224         fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save Diagram As"),
225                         _T("Save Diagram As")); //DFCH
226         fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
227         // CM
228         fileMenu->Append(ID_OPEN, _T("Open a diagram"), _T("Open a diagram"));
229         fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
230         fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"),
231                         _T("Save complex box"));
232         fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
233
234         Connect(ID_NEW, wxEVT_COMMAND_MENU_SELECTED,
235                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
236         Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
237                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
238         Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
239                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram));
240         Connect(ID_OPEN_BBS, wxEVT_COMMAND_MENU_SELECTED,
241                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
242         Connect(ID_SAVE_AS_BBS, wxEVT_COMMAND_MENU_SELECTED,
243                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
244         Connect(
245                         ID_SAVE_AS_COMPLEXBOX,
246                         wxEVT_COMMAND_MENU_SELECTED,
247                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
248         Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
249                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
250
251         // Create Help menu and its items
252         wxMenu *editMenu = new wxMenu;
253         editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM,
254                         _T("Copy selected to complex box"),
255                         _T("Creates a new complex box diagram with selected boxes"));
256
257         Connect(
258                         ID_COPY_TO_COMPLEXDIAGRAM,
259                         wxEVT_COMMAND_MENU_SELECTED,
260                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
261
262         // Create Help menu and its items
263         wxMenu *helpMenu = new wxMenu;
264         helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
265         helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
266         Connect(ID_HELP_BBEDITOR, wxEVT_COMMAND_MENU_SELECTED,
267                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
268
269         // Create Tool menu
270         wxMenu *menuTools = new wxMenu;
271         menuTools->Append(ID_bbEditor_Tool_Menu_CreatePackage,
272                         _T("Create &package") );
273         menuTools->Append(ID_bbEditor_Tool_Menu_CreateBlackBox,
274                         _T("Create &blackbox") );
275         menuTools->Append(ID_bbEditor_Tool_Menu_PlugPackage, _T("Plug package") );
276         menuTools->Append(ID_bbEditor_Tool_Menu_EditConfig, _T("&Edit bbtk config") );
277         menuTools->Append(ID_bbEditor_Tool_Menu_ShowHTMLDoc,
278                         _T("Show &HTML documentation") );
279         menuTools->Append(ID_bbEditor_Tool_Menu_CreateIndex, _T("&Generate index") );
280
281         Connect(ID_bbEditor_Tool_Menu_CreatePackage, wxEVT_COMMAND_MENU_SELECTED,
282                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreatePackage));
283         Connect(ID_bbEditor_Tool_Menu_CreateBlackBox, wxEVT_COMMAND_MENU_SELECTED,
284                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateBlackBox));
285         Connect(ID_bbEditor_Tool_Menu_PlugPackage, wxEVT_COMMAND_MENU_SELECTED,
286                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnPlugPackage));
287         Connect(ID_bbEditor_Tool_Menu_EditConfig, wxEVT_COMMAND_MENU_SELECTED,
288                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditConfig));
289         Connect(ID_bbEditor_Tool_Menu_ShowHTMLDoc, wxEVT_COMMAND_MENU_SELECTED,
290                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowHTMLDoc));
291         Connect(ID_bbEditor_Tool_Menu_CreateIndex, wxEVT_COMMAND_MENU_SELECTED,
292                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateIndex));
293
294         // Append the created menu to the menu bar
295         wxMenuBar *menuBar = new wxMenuBar();
296         menuBar->Append(fileMenu, _T("&File") );
297         menuBar->Append(editMenu, _T("&Edit") );
298         menuBar->Append(menuTools, _T("&Tool") );
299         menuBar->Append(helpMenu, _T("&Help") );
300
301         // Attach this menu bar to the frame
302         SetMenuBar(menuBar);
303 }
304
305 //=========================================================================
306 void wxGUIEditorGraphicBBS::initTabPanelsManager() 
307 {
308         _notebook = new wxAuiNotebook(this, wxID_NOTEBOOK, wxDefaultPosition,
309                         wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE
310                                         | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_FIXED_WIDTH
311                                         | wxAUI_NB_WINDOWLIST_BUTTON);
312         _tabsMgr = new wxTabPanelsManager(this);
313         _frameAUIMgr->AddPane(_notebook, wxAuiPaneInfo().CenterPane());
314 }
315
316 //=========================================================================
317 void wxGUIEditorGraphicBBS::initPackageBrowser() 
318 {
319         _pkgBrowser = new WxGUIPackageBrowser2(this);
320         _pkgBrowser->IncludeAll();
321         _frameAUIMgr->AddPane(_pkgBrowser, wxAuiPaneInfo().Left().MinSize(30, 500).BestSize(750,500).CloseButton(false));
322 }
323
324 //================================================================
325
326 void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc(const std::string& pack) 
327 {
328         std::string mess("Regenerating doc for package '");
329         if (pack != "-a") {
330                 mess += pack + "'";
331         } else {
332                 mess = "Regenerating doc for all packages";
333         }
334
335         mess += " ... please wait";
336
337         SetStatusText(std2wx(mess));
338
339         //BBTK_BUSY_CURSOR;
340
341         std::string command;
342 #if defined(WIN32)
343         command = "\"";
344 #endif
345         command += ConfigurationFile::GetInstance().Get_bin_path();
346         command += ConfigurationFile::GetInstance().Get_file_separator();
347         command += "bbRegeneratePackageDoc";
348 #if defined(WIN32)
349         command += "\"";
350 #endif
351
352         command += " " + pack + " -q";
353         bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
354
355         if (!system(command.c_str())) {
356                 SetStatusText(_T("Done !"));
357                 /*
358                  wxMessageBox(_T("Done !"),_T("Regenerate package '")
359                  +std2wx(pack)+_T("' doc"),
360                  wxOK | wxICON_INFORMATION);
361                  */
362         } else {
363                 SetStatusText(_T("Done !"));
364                 wxString err(_T("An error occured while running '"));
365                 err += bbtk::std2wx(command) + _T("'");
366                 wxMessageBox(err, _T("Regenerate package doc"), wxOK | wxICON_ERROR);
367         }
368 }
369
370 //================================================================
371 void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists() {
372         SetStatusText(_T("Regenerating boxes lists ... please wait"));
373         //BBTK_BUSY_CURSOR ;
374
375         std::string command;
376 #if defined(WIN32)
377         command = "\"";
378 #endif
379         command += ConfigurationFile::GetInstance().Get_bin_path();
380         command += ConfigurationFile::GetInstance().Get_file_separator();
381         command += "bbRegenerateBoxesLists";
382
383 #if defined(WIN32)
384         command += "\"";
385 #endif
386         command += " -q";
387
388         bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
389
390         if (!system(command.c_str())) {
391                 SetStatusText(_T("Done !"));
392                 /*
393                  wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
394                  wxOK | wxICON_INFORMATION);
395                  */
396         } else {
397                 SetStatusText(_T("Done !"));
398                 wxString err(_T("An error occured while running '"));
399                 err += bbtk::std2wx(command) + _T("'");
400                 wxMessageBox(err, _T("Regenerate boxes lists"), wxOK | wxICON_ERROR);
401         }
402 }
403
404 //================================================================
405 void wxGUIEditorGraphicBBS::RegenerateAll() {
406         DoRegeneratePackageDoc("-a");
407         DoRegenerateBoxesLists();
408 }
409
410 //================================================================
411
412 wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook() {
413         return _notebook;
414 }
415
416 //================================================================
417
418 void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName,
419                 std::string boxName) {
420         if (_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName
421                         != boxName) {
422                 _actualPkgBrowserPkgName = packageName;
423                 _actualPkgBrowserBoxName = boxName;
424
425                 BlackBoxDescriptor::Pointer descriptor =
426                                 GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
427                                                 packageName, boxName);
428                 _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
429         }
430 }
431
432 //=========================================================================
433
434 void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel) {
435         wxBlackBoxEditionDialog* dialog =
436                         new wxBlackBoxEditionDialog(this, bbmodel);
437         dialog->Show();
438 }
439
440 //=========================================================================
441
442 bool wxGUIEditorGraphicBBS::boxNameExists(std::string boxname) {
443  
444         return this->_tabsMgr->getActualTabPanel()->getSceneManager()->boxExist(boxname);
445 }
446
447 //=========================================================================
448
449 void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus) {
450         SetStatusText(crea::std2wx(textStatus));
451 }
452
453 //=========================================================================
454
455 void wxGUIEditorGraphicBBS::executeScript(std::string script) {
456         std::string separator =
457                         ConfigurationFile::GetInstance().Get_file_separator();
458         std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
459         std::string filename = dir + separator + "tmp_bbtk.bbs";
460
461         ofstream tempFile;
462         tempFile.open(filename.c_str());
463         tempFile << script;
464         tempFile.close();
465
466         std::string command = "";
467
468 #ifdef WIN32
469         command += "start /b ";
470 #endif
471
472         //              command += "\""+ crea::System::GetExecutablePath();
473         //#ifdef MACOSX
474         //              command += separator + "../../../bbi.app/Contents/MacOS";
475         //#endif
476
477         command += "bbi ";
478         command += "\"" + filename + "\"";
479
480 #ifndef WIN32
481         command += " & ";
482 #endif
483
484         printf("RaC wxGUIEditorGraphicBBS::executeScript %s \n", command.c_str());
485         system(command.c_str());
486 }
487
488 //=========================================================================
489 std::string wxGUIEditorGraphicBBS::CheckExtension(std::string filename, std::string extension) {
490         if(filename.size() > extension.size() ){
491                 if( (filename.compare(filename.size()-extension.size(), extension.size(),extension)) !=0 ){
492                         filename.append(extension);
493                 }
494         }else{
495                 filename.append(extension);
496         }
497         return filename;
498 }
499 //=========================================================================
500 // EVENT HANDLERS
501 //=========================================================================
502
503 void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) {
504         _tabsMgr->addNewTab();
505         refreshGUIControls();
506 }
507
508 void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) {
509         unsigned short disable;
510         std::string stundo;
511         std::string stredo;
512
513         _tabsMgr->loadTempDiagram(0);
514         disable = _tabsMgr->getUndoState(stundo);
515         if(disable == 0)
516         {
517                 std::string name = _tabsMgr->GetNameTabPanel();
518                 if(name[name.length() - 1] == '*')
519                 {
520                         name =name.substr(0,name.length()-1);
521                 }
522                 _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
523         }
524
525         GetToolBar()->EnableTool(ID_UNDO,disable);
526         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
527         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
528         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
529         refreshGUIControls();
530 }
531
532 //=========================================================================
533
534 void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) {
535         unsigned short disable;
536         std::string stundo;
537         std::string stredo;
538
539         _tabsMgr->loadTempDiagram(1);
540         std::string name = _tabsMgr->GetNameTabPanel();
541         if(name[name.length() - 1] != '*')
542                 name +="*";
543         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
544         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
545         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
546         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
547         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
548         refreshGUIControls();
549 }
550
551 void wxGUIEditorGraphicBBS::OnChangeName(wxCommandEvent& event){
552 }
553
554 //=========================================================================
555
556 void wxGUIEditorGraphicBBS::OnEditDiagramProperties(wxCommandEvent& event)
557 {
558         wxDiagramPropertiesEditionDialog* dialog =
559                                 new wxDiagramPropertiesEditionDialog(this);
560         dialog->Show();
561 }
562
563 //=========================================================================
564
565 void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) {
566         std::string script1 = _tabsMgr->getActualDiagramBBS(true);
567         cout << endl << "RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"
568                         << endl << endl;
569         cout << script1 << endl;
570
571         std::string script2 = _tabsMgr->getActualDiagramBBS(false);
572         executeScript(script2);
573 }
574
575 //=========================================================================
576 // HANDLERS
577 //=========================================================================
578 void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event) {
579         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"),
580                         wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxOPEN);
581         if (openFileDialog->ShowModal() == wxID_OK) {
582                 wxString fileName = openFileDialog->GetPath();
583
584                 _tabsMgr->addNewTab(openFileDialog->GetFilename());
585
586                 bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New(
587                                 this->_tabsMgr->getActualTabPanel()->getSceneManager(),
588                                 _pkgBrowser->GetFactory());
589
590                 // We tell the interpreter to throw exceptions on error
591                 I->SetThrow(true);
592                 // Interpret the file supposed to define a box called 'Processing'
593                 I->InterpretFile((const char*) (fileName.mb_str()));
594         }
595         refreshGUIControls();
596 }
597
598 void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename) {
599         ofstream file;
600
601         //EED           file.open(fileName.c_str());
602         file.open(filename.c_str());
603         std::string content = "";
604         // writing file header
605         content += "# ----------------------------------\n";
606         content += "# - BBTKGEditor v 1.3 BBS BlackBox Script\n";
607         content += "# - ";
608         content += filename;
609         content += "\n";
610         content += "# ----------------------------------\n";
611         content += "\n";
612         content += _tabsMgr->getActualDiagramBBS();
613         file << content;
614         file.close();
615 }
616
617 void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) {
618         wxFileDialog * saveFileDialog = new wxFileDialog(this,
619                         wxT("Save  actual BBS"), wxEmptyString, wxT("NewBBS"),
620                         wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
621         if (saveFileDialog->ShowModal() == wxID_OK) {
622                 wxString fileName = saveFileDialog->GetPath();
623                 std::string filename = (const char*) (fileName.mb_str());
624                 filename=CheckExtension (filename, ".bbs");
625                 SaveActualBBS(filename);
626         }
627
628 }
629
630 void wxGUIEditorGraphicBBS::AskComplexBoxConfiguration() {
631         std::string cbName = _tabsMgr->GetCbName();
632         std::string paName = _tabsMgr->GetCbPackageName();
633
634         wxTextEntryDialog *cbNameDialog = new wxTextEntryDialog(this,
635                         wxT("Complex Box name"));
636         wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,
637                         wxT("Package name"));
638
639         cbNameDialog->SetValue(wxString(cbName.c_str(), wxConvUTF8));
640         paNameDialog->SetValue(wxString(paName.c_str(), wxConvUTF8));
641
642         if (cbNameDialog->ShowModal() == wxID_OK) {
643                 wxString complexboxname = cbNameDialog->GetValue();
644                 cbName = (const char*) (complexboxname.mb_str());
645         }
646
647         if (paNameDialog->ShowModal() == wxID_OK) {
648                 wxString packagename = paNameDialog->GetValue();
649                 paName = (const char*) (packagename.mb_str());
650         }
651
652         _tabsMgr->SetCbName(cbName);
653         _tabsMgr->SetCbPackageName(paName);
654 }
655
656 //=========================================================================
657
658 void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) {
659         ofstream file;
660         file.open(filename.c_str());
661
662         std::string content = "";
663
664         // writing file header
665         content += "# ----------------------------------\n";
666         content += "# - BBTKGEditor v 1.3 BBS BlackBox Script (Complex Box)\n";
667         content += "# - ";
668         content += filename;
669         content += "\n";
670         content += "# ----------------------------------\n";
671         content += "\n";
672         content += _tabsMgr->getActualComplexBoxBBS();
673         file << content;
674         file.close();
675 }
676
677 //=========================================================================
678
679 void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event) {
680         wxFileDialog * saveFileDialog = new wxFileDialog(this,
681                         wxT("Save Complex Box BBS"), wxEmptyString,
682                         _T("ComplexBoxName"), wxT("*.bbs"), wxSAVE
683                                         | wxOVERWRITE_PROMPT);
684         if (saveFileDialog->ShowModal() == wxID_OK) {
685                 wxString fileName = saveFileDialog->GetPath();
686                 std::string filename = (const char*) (fileName.mb_str());
687                 filename=CheckExtension (filename, ".bbs");
688                 SaveActualComplexBox(filename);
689         }
690 }
691
692 //=========================================================================
693 void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) {
694         ofstream file;
695         file.open(filename.c_str());
696
697         std::string content = "";
698
699         // writing file header
700         content += "# ----------------------------------\n";
701         content += "# - BBTKGEditor v 1.3 BBG BlackBox Diagram file\n";
702         content += "# - ";
703
704         content += filename;
705
706         content += "\n";
707         content += "# ----------------------------------\n";
708         content += "\n";
709         content += "APP_START\n";
710         _tabsMgr->saveActualDiagram(content, filename); //DFCH
711         content += "APP_END\n";
712         file << content;
713         file.close();
714 }
715
716 //=========================================================================
717 void wxGUIEditorGraphicBBS::SaveTempActualDiagram(const std::string &action) 
718 {
719         std::string stundo;
720         std::string stredo;
721         std::string name = _tabsMgr->GetNameTabPanel();
722         if(name[name.length() - 1] != '*')
723                 name +="*";
724         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
725         _tabsMgr->saveTempActualDiagram(action);
726         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
727         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
728         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
729         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
730 }
731
732 //=========================================================================
733
734 //The following method allows to save the current diagram asking the filename
735 //DFCH
736 void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs() {
737         wxFileDialog * saveFileDialog = new wxFileDialog(this,
738                         wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"),
739                         wxT("*.bbg"), wxSAVE | wxOVERWRITE_PROMPT);
740         if (saveFileDialog->ShowModal() == wxID_OK) {
741                 //_tabsMgr->SetNameTabPanel(saveFileDialog->GetFilename());
742                 wxString pathfileName = saveFileDialog->GetPath();
743                 std::string pathfilename = (const char*) (pathfileName.mb_str());
744                 pathfilename=CheckExtension (pathfilename, ".bbg");
745
746                 //modify the tab name accordingly
747                 wxString fileName = saveFileDialog->GetFilename();
748                 std::string filename = (const char*) (fileName.mb_str());
749                 filename=CheckExtension (filename, ".bbg");
750                 _tabsMgr->SetNameTabPanel( wxString (filename.c_str(), wxConvUTF8) );
751
752                 std::string pathfilenamebbs = pathfilename;
753                 pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
754                 if (_tabsMgr->isActualDiagramComplexBox() == false) {
755                         SaveActualDiagram(pathfilename);
756                         SaveActualBBS(pathfilenamebbs);
757                 } else {
758                         AskComplexBoxConfiguration();
759                         SaveActualDiagram(pathfilename);
760                         SaveActualComplexBox(pathfilenamebbs);
761                 } //if isActualDiagramComplexBox
762         } // if saveFileDialog
763 }
764 //=========================================================================
765 //DFCH
766 void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) {
767         std::string pathfilename = _tabsMgr->GetCurrentTabPanelPath();
768         if (pathfilename.empty()) {
769                 SaveCurrentDiagramAs();
770         } else {
771                 std::string pathfilenamebbs = pathfilename;
772                 pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
773                 
774                 if (_tabsMgr->isActualDiagramComplexBox() == false) {
775                         std::string name = _tabsMgr->GetNameTabPanel();
776                         if(name[name.length() - 1] == '*')
777                         {
778                                 name =name.substr(0,name.length()-1);
779                         }
780                         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
781                         SaveActualDiagram(pathfilename);
782                         SaveActualBBS(pathfilenamebbs);
783                 } else {
784                         AskComplexBoxConfiguration();
785                         SaveActualDiagram(pathfilename);
786                         SaveActualComplexBox(pathfilenamebbs);
787                 } //if isActualDiagramComplexBox
788         }
789 }
790 //=========================================================================
791 //DFCH
792 void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) {
793         SaveCurrentDiagramAs();
794 }
795 //=========================================================================
796
797 void wxGUIEditorGraphicBBS::refreshGUIControls() {
798         std::string stundo;
799         std::string stredo;
800         //RaC2012 2ndHackFest Next line seems weird ... To keep in mind for other devels
801         wxToolBar* toolbar = GetToolBar();
802         if (_tabsMgr->isActualDiagramComplexBox()) {
803                 toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
804                 toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, true);
805                 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, true);
806
807                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, true);
808                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, false);
809         } else {
810                 toolbar->ToggleTool(ID_BTNCOMPLEXBOX, false);
811                 toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false);
812                 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
813
814                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, false);
815                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true);
816         }
817
818         //RaC2012 2ndHackFest
819         GetToolBar()->EnableTool(ID_EDITPROPERTIES,true);
820
821         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
822         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
823         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
824         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
825
826         if (_tabsMgr->getNumActualSelectedObjects() > 0) {
827                 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
828         } else {
829                 ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
830                 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
831         }
832
833 }
834
835 //=========================================================================
836
837 void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event) {
838         wxMessageDialog *dial = new wxMessageDialog(NULL,
839                         wxT("Are you sure to delete all boxes of the diagram?"),
840                         wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT
841                                         | wxICON_QUESTION);
842         if (dial->ShowModal() == wxID_YES) {
843                 _tabsMgr->deleteAllBoxesActualDiagram();
844         }
845 }
846
847 //=========================================================================
848
849 void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event) {
850         _tabsMgr->centerViewActualDiagram();
851 }
852
853 //=========================================================================
854
855 void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) {
856         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"),
857                         wxEmptyString, wxT(""), wxT("*.bbg"), wxOPEN | wxFILE_MUST_EXIST);
858         printf("SCP: wxGUIEditorGraphicBBS::OnOpenDiagram  \n");
859         if (openFileDialog->ShowModal() == wxID_OK) {
860                 wxString fileName = openFileDialog->GetPath();
861                 ifstream inputStream;
862                 std::string fName = (const char*) (fileName.mb_str());
863
864                 inputStream.open(fName.c_str());
865                 assert(inputStream.good()); // fails
866                 _tabsMgr->addNewTab(openFileDialog->GetFilename());
867                 _tabsMgr->loadDiagram(inputStream, fName);
868                 _tabsMgr->saveTempActualDiagram("load diagram");
869                 GetToolBar()->EnableTool(ID_UNDO, false);
870                 GetToolBar()->EnableTool(ID_UNDO, false);
871                 inputStream.close();
872         }
873         refreshGUIControls();
874 }
875
876 //=========================================================================
877
878
879 void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) {
880         BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
881         if (bbDes != NULL) {
882                 std::string typeName = bbDes->GetTypeName();
883                 std::string packageName = bbDes->GetPackage()->GetName();
884
885                 wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
886                 
887
888                 if (pnl != NULL) {
889                         wxVtkSceneManager *scn = pnl->getSceneManager();
890                         scn->createGBlackBox(50, 50, packageName, typeName);
891                         scn->refresh();
892                 }
893
894                 SaveTempActualDiagram("New Box");
895                 // if pnl
896         }// if bbDes
897 }
898
899 //=========================================================================
900
901 void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event) {
902         //DFCH
903         wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
904
905         if (pnl != NULL) {
906                 wxVtkSceneManager *scn = pnl->getSceneManager();
907                 if( scn->MakeBoxExecutable() )
908                         std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...successful"<<std::endl;
909                 else
910                         std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...Error!!"<<std::endl;
911         }
912         //DFCH
913
914 }
915
916 //=========================================================================
917
918 void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) {
919         wxToolBar* toolbar = GetToolBar();
920         bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
921         if (temp) {
922                 enableComplexBox();
923         } else {
924                 disableComplexBox();
925         }
926 }
927
928 //=========================================================================
929
930 void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event) {
931         wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
932                         wxT("Name of input port"));
933         if (nameDialog->ShowModal() == wxID_OK) {
934                 wxString fileName = nameDialog->GetValue();
935                 if (!fileName.IsEmpty()) {
936                         std::string portName = (const char*) (fileName.mb_str());
937                         _tabsMgr->addActualDiagramComplexInputPort(portName);
938                 }
939         }
940 }
941
942 //=========================================================================
943
944 void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event) {
945         wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
946                         wxT("Name of output port"));
947         if (nameDialog->ShowModal() == wxID_OK) {
948                 wxString fileName = nameDialog->GetValue();
949                 if (!fileName.IsEmpty()) {
950                         std::string portName = (const char*) (fileName.mb_str());
951                         _tabsMgr->addActualDiagramComplexOutputPort(portName);
952                 }
953         }
954 }
955
956 //=========================================================================
957
958 void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(
959                 wxCommandEvent& event) {
960         _tabsMgr->copySelectedBBoxesToComplexDiagram();
961 }
962
963 void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event) {
964         printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ....not implemented..\n");
965 }
966
967 //=========================================================================
968 void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event) {
969
970         bbtkSystemTools::CreatePackage();
971 }
972
973 //=========================================================================
974 void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event) {
975         bbtkSystemTools::CreateBlackBox();
976 }
977 //=========================================================================
978 void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) {
979         //DFGO2012 Plug Package functionnalities
980         long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
981         wxDirDialog* FD =
982           new wxDirDialog( 0,
983                            _T("Select package directory"),
984                            _T(""),
985                            style);
986         long userResponse;
987         do
988         {
989                 userResponse = FD->ShowModal();
990                 if(userResponse==wxID_OK)
991                 {
992                         std::string path = wx2std (FD->GetPath()) ;
993                         std::string fname = path + "/bbtkPackage";
994                         std::cout << "Path chosen = \"" << FD->GetPath() << "\"" << std::endl;
995                         if ( Utilities::FileExists( fname ) )
996                         {
997                                 std::ifstream f;
998                                 f.open(fname.c_str());
999                                 std::string pname;
1000                                 f >> pname;
1001                                 f.close();
1002
1003                                 bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );
1004
1005                                 DoRegeneratePackageDoc(pname);
1006                                 DoRegenerateBoxesLists();
1007
1008                                 _pkgBrowser->RebuildList();
1009
1010                                 wxMessageBox(_T("Package successfully plugged. Please restart bbEditor to see the new package in the package browser."),_T("Plug package"),wxOK | wxICON_INFORMATION);
1011                                 userResponse = wxID_CANCEL;
1012                         }
1013                         else
1014                         {
1015                                 std::string err = "The directory \"" + path + "\" does not contain a 'bbtkPackage' file.";
1016                                 #ifndef WIN32
1017                                         #ifndef MACOSX
1018                                                 err += "\nNote: If you are on Linux please select the folder and click \"Open\", don't enter in it.";
1019                                         #endif
1020                                 #endif
1021
1022                                 wxMessageBox(crea::std2wx(err), _T("Plug package"),wxOK | wxICON_ERROR);
1023                                 // THE FOLLOWING LINE GIVES ERRORS BECAUSE IT IS NECESSARY TO USE std2wx
1024                                 //wxMessageBox( _T( err) , _T("Plug package"),wxOK | wxICON_ERROR);
1025                         }
1026                 }
1027         }while(userResponse != wxID_CANCEL);
1028
1029 }
1030 //=========================================================================
1031 void wxGUIEditorGraphicBBS::OnEditConfig(wxCommandEvent& event) {
1032         printf("EED wxGUIEditorGraphicBBS::OnEditConfig ... not implemented ..\n");
1033     }
1034     //=========================================================================
1035
1036     void wxGUIEditorGraphicBBS::OnShowHTMLDoc(wxCommandEvent& event) {
1037         // JGRR & CM WH
1038         if (_helpHtmlBrowser != NULL){
1039              _frameAUIMgr->DetachPane(_helpHtmlBrowser);
1040             _helpHtmlBrowser->Destroy();   
1041         }
1042         initHelpHTMLBrowser();
1043         _frameAUIMgr->AddPane(_helpHtmlBrowser, wxAuiPaneInfo().Right().MinSize(200, 200));
1044         _frameAUIMgr->Update();
1045         refreshGUIControls();
1046         
1047         // EO JGRR    & CM WH       
1048 }
1049 //=========================================================================
1050 void wxGUIEditorGraphicBBS::OnCreateIndex(wxCommandEvent& event) {
1051         printf("EED wxGUIEditorGraphicBBS::OnCreateIndex ... not implemented ..\n");
1052 }
1053
1054 //=========================================================================
1055
1056 void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) {
1057         Close(true);
1058 }
1059
1060 //=========================================================================
1061
1062 void wxGUIEditorGraphicBBS::enableComplexBox() {
1063         _tabsMgr->setActualDiagramComplexBox(true);
1064         refreshGUIControls();
1065 }
1066
1067 //=========================================================================
1068
1069 void wxGUIEditorGraphicBBS::disableComplexBox() {
1070         _tabsMgr->setActualDiagramComplexBox(false);
1071         refreshGUIControls();
1072 }
1073
1074 //=========================================================================
1075
1076 void wxGUIEditorGraphicBBS::setCurrentDiagramDescription(std::string description)
1077 {
1078         _tabsMgr->SetDescription(description);
1079 }
1080
1081 //=========================================================================
1082
1083 void wxGUIEditorGraphicBBS::setCurrentDiagramAuthor(std::string author)
1084 {
1085         _tabsMgr->SetAuthor(author);
1086 }
1087
1088 //=========================================================================
1089
1090 void wxGUIEditorGraphicBBS::setCurrentDiagramCategory(std::string category)
1091 {
1092         _tabsMgr->SetCategory(category);
1093 }
1094
1095 //=========================================================================
1096
1097 std::string wxGUIEditorGraphicBBS::getCurrentDiagramDescription()
1098 {
1099         return _tabsMgr->GetDescription();
1100 }
1101
1102 //=========================================================================
1103
1104 std::string wxGUIEditorGraphicBBS::getCurrentDiagramAuthor()
1105 {
1106         return _tabsMgr->GetAuthor();
1107 }
1108
1109 //=========================================================================
1110
1111
1112 std::string wxGUIEditorGraphicBBS::getCurrentDiagramCategory()
1113 {
1114         return _tabsMgr->GetCategory();
1115 }
1116
1117 //=========================================================================
1118
1119 bool wxGUIEditorGraphicBBS::isCurrentDiagramComplexBox()
1120 {
1121         return _tabsMgr->isActualDiagramComplexBox();
1122 }
1123
1124
1125 } // EO namespace bbtk
1126
1127 // EOF
1128