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