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