]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
#3132 bbGEditor Feature New Normal - branch changeWx28to30 compilation with wxWidgets3
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 #
8 #  This software is governed by the CeCILL-B license under French law and 
9 #  abiding by the rules of distribution of free software. You can  use, 
10 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
11 #  license as circulated by CEA, CNRS and INRIA at the following URL 
12 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
13 #  or in the file LICENSE.txt.
14 #
15 #  As a counterpart to the access to the source code and  rights to copy,
16 #  modify and redistribute granted by the license, users are provided only
17 #  with a limited warranty  and the software's author,  the holder of the
18 #  economic rights,  and the successive licensors  have only  limited
19 #  liability. 
20 #
21 #  The fact that you are presently reading this means that you have had
22 #  knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------  
24 */
25
26 /*=========================================================================
27  Program:   bbtk
28  Module:    $RCSfile$
29  Language:  C++
30  Date:      $Date$
31  Version:   $Revision$
32  =========================================================================*/
33
34 /* ---------------------------------------------------------------------
35
36  * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37  * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
38  *
39  *  This software is governed by the CeCILL-B license under French law and
40  *  abiding by the rules of distribution of free software. You can  use,
41  *  modify and/ or redistribute the software under the terms of the CeCILL-B
42  *  license as circulated by CEA, CNRS and INRIA at the following URL
43  *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
44  *  or in the file LICENSE.txt.
45  *
46  *  As a counterpart to the access to the source code and  rights to copy,
47  *  modify and redistribute granted by the license, users are provided only
48  *  with a limited warranty  and the software's author,  the holder of the
49  *  economic rights,  and the successive licensors  have only  limited
50  *  liability.
51  *
52  *  The fact that you are presently reading this means that you have had
53  *  knowledge of the CeCILL-B license and that you accept its terms.
54  * ------------------------------------------------------------------------ */
55
56 /**
57  *  \file
58  *  \brief Class bbtk::WxInterfaceEditorGraphicBBS .
59  */
60
61 #include "bbtkwxGUIEditorGraphicBBS.h"
62 #include "creaWx.h"
63 #include "creaSystem.h"
64 //must go #include "bbtkUtilities.h"
65 //must go #include "bbtkConfigurationFile.h"
66 #include <wx/defs.h>
67
68 #include <InterpreterBBS.h>
69
70 namespace bbtk {
71
72 //=========================================================================
73 wxGUIEditorGraphicBBS::wxGUIEditorGraphicBBS(wxFrame *parent) 
74         : wxFrame( parent, -1, _T("bbtkGEditor"), wxDefaultPosition, wxSize(1200,800) ) 
75 {
76         _pkgBrowser = NULL;
77         _frameAUIMgr = new wxAuiManager(this);
78
79         /*std::string datadir( crea::System::GetExecutablePath() );
80          std::string datadir (".");
81          cout<<"RaC //------------------"<<endl;
82          cout<<"RaC //TODO wxGUIEditorGraphicBBS constructor.Initialize datadir with  crea::System::GetExecutablePath() ."<<endl;
83          cout<<"RaC //------------------"<<endl;
84
85          #ifdef LINUX // assume this is OSX
86          datadir=datadir+"/../share/creaContours";
87          #endif // MACOSX
88
89          #ifdef MACOSX // assume this is OSX
90          datadir=datadir+"/../../../../share/creaContours";
91          #endif // MACOSX
92
93          _dataDir = datadir;*/
94
95         initMenu();
96         initToolbar();
97         initPackageBrowser();
98         initTabPanelsManager();
99         // JGGR & CM  initHelpHTMLBrowser();
100         _helpHtmlBrowser = NULL;
101         CreateStatusBar();
102         _frameAUIMgr->Update();
103         _actualPkgBrowserBoxName = "";
104         _actualPkgBrowserPkgName = "";
105         refreshGUIControls();
106
107         /////////////////////////////////
108         /// IMPORTANT!! FOR SAVE&LOAD PROCESSES THE VERSION IS VERY IMPORTANT.
109         /// RaC 2012 2nd Hackfest
110         _currentBBGversion="1.4";
111 }
112
113 //=========================================================================
114 wxGUIEditorGraphicBBS::~wxGUIEditorGraphicBBS() 
115 {
116         //EED02JUIN2010         delete _tabsMgr;
117         _frameAUIMgr->UnInit();
118         // FCY memory leaks
119         delete _frameAUIMgr;
120         delete _notebook;
121         delete _tabsMgr;
122 }
123
124 //=========================================================================
125 void wxGUIEditorGraphicBBS::initToolbar() 
126 {
127         wxBitmap bmp_new(new_xpm);
128         wxBitmap bmp_open(open_xpm);
129         wxBitmap bmp_save(save_xpm);
130         wxBitmap bmp_run(run_xpm);
131         wxBitmap bmp_delete(delete_xpm);
132         wxBitmap bmp_centerview(centerview_xpm);
133         wxBitmap bmp_box(box_xpm);
134         wxBitmap bmp_executablebox(executablebox_xpm);
135         wxBitmap bmp_complexbox(complexbox_xpm);
136         wxBitmap bmp_complexinputport(complexinputport_xpm);
137         wxBitmap bmp_complexoutputport(complexoutputport_xpm);
138         wxBitmap bmp_undo(undo_xpm);
139         wxBitmap bmp_redo(redo_xpm);
140         wxBitmap bmp_editProperties(editProperties_xpm);
141         wxBitmap bmp_showTree(showTree_xpm);
142         wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
143
144         //Adds a tool btn to the toolbar
145         toolbar->AddTool(ID_NEW, _T("New"), bmp_new, wxNullBitmap, wxITEM_NORMAL,
146                         _T("New tab"), _T("Create a new panel tab"));
147
148         toolbar->AddTool(ID_OPEN, _T("Open diagram"), bmp_open, wxNullBitmap,
149                         wxITEM_NORMAL, _T("Open a diagram"), _T("Open a diagram"));
150
151         toolbar->AddTool(ID_SAVE_DIAGRAM, _T("Save Diagram"), bmp_save,
152                         wxNullBitmap, wxITEM_NORMAL, _T("Saves the current diagram"),
153                         _T("Saves the current diagram")); //DFCH
154         //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
155         toolbar->AddTool(ID_RUN, _T("Run"), bmp_run, wxNullBitmap, wxITEM_NORMAL,
156                         _T("Execute actual diagram"), _T("Execute actual diagram"));
157         toolbar->AddTool(ID_DELETEALL, _T("Delete all"), bmp_delete, wxNullBitmap,
158                         wxITEM_NORMAL, _T("Delete all boxes"), _T("Delete all boxes"));
159         toolbar->AddTool(ID_CENTERVIEW, _T("Center view"), bmp_centerview,
160                         wxNullBitmap, wxITEM_NORMAL, _T("Center view"), _T("Center view"));
161         toolbar->AddSeparator();
162         toolbar->AddTool(ID_BTNBOX, _T("New Box"), bmp_box, wxNullBitmap,
163                         wxITEM_NORMAL, _T("New Box"), _T("Nex Box"));
164         toolbar->AddSeparator();
165         toolbar->AddTool(ID_BTEXECUTABLEBOX, _T("Select as executable Box"),
166                         bmp_executablebox, wxNullBitmap, wxITEM_NORMAL,
167                         _T("Select as executable Box"), _T("Select as executable Box"));
168         toolbar->AddSeparator();
169         toolbar->AddTool(ID_BTNCOMPLEXBOX, _T("Complex box"), complexbox_xpm,
170                         wxNullBitmap, wxITEM_NORMAL, _T("Complex box"), _T("Complex box"));
171
172 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
173 #if wxMAJOR_VERSION <= 2
174         toolbar->SetToggle(ID_BTNCOMPLEXBOX, true);
175 #else
176         printf ("EED Warnning. wxGUIEditorGraphicBBS::initToolbar       >>>   toolbar->SetToggle  \n ");
177         // ..
178 #endif
179
180         // RaC 2012 2nd HackFest - Now Complex inputs are any external input
181         //              toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add input to Complex box"),
182         //              bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
183         //              _T("Add input to Complex box"), _T("Add input to Complex box"));
184         toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT, _T("Add external input (Complex box or console app)"),
185                         bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,
186                         _T("Add external input (Complex box or console app)"), _T("Add external input (Complex box or console app)"));
187
188         toolbar->AddTool(ID_ADDCOMPLEXBOXOUTPUT, _T("Add output to Complex box"),
189                         bmp_complexoutputport, wxNullBitmap, wxITEM_NORMAL,
190                         _T("Add output Complex box"), _T("Add output Complex box"));
191
192         // toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false); RaC2012 2nd HackFest
193         toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, true);
194
195         toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
196         toolbar->AddSeparator();
197         toolbar->AddTool(ID_UNDO, _T("Undo"),bmp_undo, wxNullBitmap, wxITEM_NORMAL,     _T("Undo"), _T("Undo"));
198         toolbar->AddTool(ID_REDO, _T("Redo"),bmp_redo, wxNullBitmap, wxITEM_NORMAL,     _T("Redo"), _T("Redo"));
199         toolbar->AddSeparator();
200         toolbar->AddTool(ID_EDITPROPERTIES, _T("Edit diagram properties"),bmp_editProperties, wxNullBitmap, wxITEM_NORMAL,      _T("Edit diagram properties"), _T("Edit diagram properties"));
201         toolbar->EnableTool(ID_EDITPROPERTIES, false);
202
203         toolbar->AddTool(ID_SHOWTREE, _T("Show tree"),bmp_showTree, wxNullBitmap, wxITEM_NORMAL,        _T("Show tree"), _T("Show tree"));
204
205         
206         toolbar->EnableTool(ID_UNDO, false);
207         toolbar->EnableTool(ID_REDO, false);
208         toolbar->SetMargins(2, 2);
209         toolbar->Realize();
210         SetToolBar(toolbar);
211
212
213         
214         // connect command event handlers
215
216         Connect(ID_NEW, wxEVT_COMMAND_TOOL_CLICKED,
217                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
218         Connect(ID_OPEN, wxEVT_COMMAND_TOOL_CLICKED,
219                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenDiagram));
220         Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
221                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
222         Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_TOOL_CLICKED,
223                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram)); //DFCH
224         Connect(
225                         ID_RUN,
226                         wxEVT_COMMAND_TOOL_CLICKED,
227                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
228         Connect(
229                         ID_DELETEALL,
230                         wxEVT_COMMAND_TOOL_CLICKED,
231                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
232         Connect(
233                         ID_CENTERVIEW,
234                         wxEVT_COMMAND_TOOL_CLICKED,
235                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
236         Connect(ID_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,
237                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
238         Connect(
239                         ID_BTEXECUTABLEBOX,
240                         wxEVT_COMMAND_TOOL_CLICKED,
241                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnExecutableBox));
242         Connect(ID_BTNCOMPLEXBOX, wxEVT_COMMAND_TOOL_CLICKED,
243                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
244         Connect(ID_ADDCOMPLEXBOXINPUT, wxEVT_COMMAND_TOOL_CLICKED,
245                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
246         Connect(ID_ADDCOMPLEXBOXOUTPUT, wxEVT_COMMAND_TOOL_CLICKED,
247                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
248         Connect(ID_UNDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnUndo));
249         Connect(ID_REDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnRedo));
250         Connect(ID_CHANGENAME, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnChangeName));
251         Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
252         Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree));
253
254
255 }
256 //=========================================================================
257 void wxGUIEditorGraphicBBS::initHelpHTMLBrowser() {
258         // JGRR & CM 
259         _helpHtmlBrowser = new WxGUIHtmlBrowser(this, wxSize(200, 0));
260    
261         // EO JGRR & CM 
262         
263 }
264
265 //=========================================================================
266 void wxGUIEditorGraphicBBS::initMenu() {
267         // Create File menu and its items
268         wxMenu *fileMenu = new wxMenu();
269         fileMenu->Append(ID_NEW, _T("New diagram"), _T("New"));
270         fileMenu->Append(ID_SAVE_DIAGRAM, _T("Save Diagram"), _T("Save Diagram")); //DFCH
271         fileMenu->Append(ID_SAVE_AS_DIAGRAM, _T("Save Diagram As"),
272                         _T("Save Diagram As")); //DFCH
273         fileMenu->Append(ID_OPEN_BBS, _T("Open BBS"), _T("Open BBS"));
274         // CM
275         fileMenu->Append(ID_OPEN, _T("Open a diagram"), _T("Open a diagram"));
276         fileMenu->Append(ID_SAVE_AS_BBS, _T("Save BBS"), _T("Save BBS"));
277         fileMenu->Append(ID_SAVE_AS_COMPLEXBOX, _T("Save complex box"),
278                         _T("Save complex box"));
279         fileMenu->Append(ID_EXPORT_CONSOLEAPP, _T("Export console commands"),
280                                 _T("Export console execution commands"));
281         fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Exit"));
282
283         Connect(ID_NEW, wxEVT_COMMAND_MENU_SELECTED,
284                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateNewTab));
285         Connect(ID_SAVE_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
286                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualDiagram)); //DFCH
287         Connect(ID_SAVE_AS_DIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
288                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveAsActualDiagram));
289         Connect(ID_OPEN_BBS, wxEVT_COMMAND_MENU_SELECTED,
290                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnOpenBBS));
291         Connect(ID_SAVE_AS_BBS, wxEVT_COMMAND_MENU_SELECTED,
292                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualBBS));
293         Connect( ID_SAVE_AS_COMPLEXBOX, wxEVT_COMMAND_MENU_SELECTED,
294                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnSaveActualComplexBox));
295         Connect( ID_EXPORT_CONSOLEAPP, wxEVT_COMMAND_MENU_SELECTED,
296                                 wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExportConsoleExecCommand));
297         Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
298                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExit));
299
300         // Create Edit menu and its items
301         wxMenu *editMenu = new wxMenu;
302         editMenu->Append(ID_COPY_TO_COMPLEXDIAGRAM, _T("Copy selected to complex box"), _T("Creates a new complex box diagram with selected boxes"));
303         editMenu->Append(ID_EDIT_COMPLEXBOX_SCRIPT, _T("Edit Complex Box"), _T("Edit Complex Box"));
304         Connect( ID_COPY_TO_COMPLEXDIAGRAM, wxEVT_COMMAND_MENU_SELECTED,
305                          wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram));
306         Connect( ID_EDIT_COMPLEXBOX_SCRIPT, wxEVT_COMMAND_MENU_SELECTED,
307                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditComplexBoxScript));
308
309         // Create Help menu and its items
310         wxMenu *helpMenu = new wxMenu;
311         helpMenu->Append(wxID_ABOUT, _T("&About..."), _T("About"));
312         helpMenu->Append(ID_HELP_BBEDITOR, _T("&Help..."), _T("Help"));
313         Connect(ID_HELP_BBEDITOR, wxEVT_COMMAND_MENU_SELECTED,
314                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnHelpBBeditor));
315
316         // Create Tool menu
317         wxMenu *menuTools = new wxMenu;
318         menuTools->Append(ID_bbEditor_Tool_Menu_CreatePackage,
319                         _T("Create &package") );
320         menuTools->Append(ID_bbEditor_Tool_Menu_CreateBlackBox,
321                         _T("Create &blackbox") );
322         menuTools->Append(ID_bbEditor_Tool_Menu_PlugPackage, _T("Plug package") );
323         menuTools->Append(ID_bbEditor_Tool_Menu_EditConfig, _T("&Edit bbtk config") );
324         menuTools->Append(ID_bbEditor_Tool_Menu_ShowHTMLDoc,
325                         _T("Show &HTML documentation") );
326         menuTools->Append(ID_bbEditor_Tool_Menu_CreateIndex, _T("&Generate index") );
327
328         Connect(ID_bbEditor_Tool_Menu_CreatePackage, wxEVT_COMMAND_MENU_SELECTED,
329                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreatePackage));
330         Connect(ID_bbEditor_Tool_Menu_CreateBlackBox, wxEVT_COMMAND_MENU_SELECTED,
331                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateBlackBox));
332         Connect(ID_bbEditor_Tool_Menu_PlugPackage, wxEVT_COMMAND_MENU_SELECTED,
333                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnPlugPackage));
334         Connect(ID_bbEditor_Tool_Menu_EditConfig, wxEVT_COMMAND_MENU_SELECTED,
335                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditConfig));
336         Connect(ID_bbEditor_Tool_Menu_ShowHTMLDoc, wxEVT_COMMAND_MENU_SELECTED,
337                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowHTMLDoc));
338         Connect(ID_bbEditor_Tool_Menu_CreateIndex, wxEVT_COMMAND_MENU_SELECTED,
339                         wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCreateIndex));
340
341         // Append the created menu to the menu bar
342         wxMenuBar *menuBar = new wxMenuBar();
343         menuBar->Append(fileMenu, _T("&File") );
344         menuBar->Append(editMenu, _T("&Edit") );
345         menuBar->Append(menuTools, _T("&Tool") );
346         menuBar->Append(helpMenu, _T("&Help") );
347
348         // Attach this menu bar to the frame
349         SetMenuBar(menuBar);
350 }
351
352 //=========================================================================
353 void wxGUIEditorGraphicBBS::initTabPanelsManager() 
354 {
355         _notebook = new wxAuiNotebook(this, wxID_NOTEBOOK, wxDefaultPosition,
356                         wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE
357                                         | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_FIXED_WIDTH
358                                         | wxAUI_NB_WINDOWLIST_BUTTON);
359         _tabsMgr = new wxTabPanelsManager(this);
360         _frameAUIMgr->AddPane(_notebook, wxAuiPaneInfo().CenterPane());
361 }
362
363 //=========================================================================
364 void wxGUIEditorGraphicBBS::initPackageBrowser() 
365 {
366         _pkgBrowser = new WxGUIPackageBrowser2(this);
367         _pkgBrowser->IncludeAll();
368         _frameAUIMgr->AddPane(_pkgBrowser, wxAuiPaneInfo().Left().MinSize(30, 500).BestSize(750,500).CloseButton(false));
369 }
370
371 //================================================================
372
373 void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc(const std::string& pack) 
374 {
375         std::string mess("Regenerating doc for package '");
376         if (pack != "-a") {
377                 mess += pack + "'";
378         } else {
379                 mess = "Regenerating doc for all packages";
380         }
381
382         mess += " ... please wait";
383
384         SetStatusText(std2wx(mess));
385
386         //BBTK_BUSY_CURSOR;
387
388         std::string command;
389 #if defined(WIN32)
390         command = "\"";
391 #endif
392         command += ConfigurationFile::GetInstance().Get_bin_path();
393         command += ConfigurationFile::GetInstance().Get_file_separator();
394         command += "bbRegeneratePackageDoc";
395 #if defined(WIN32)
396         command += "\"";
397 #endif
398
399         command += " " + pack + " -q";
400         bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
401
402         if (!system(command.c_str())) {
403                 SetStatusText(_T("Done !"));
404                 /*
405                  wxMessageBox(_T("Done !"),_T("Regenerate package '")
406                  +std2wx(pack)+_T("' doc"),
407                  wxOK | wxICON_INFORMATION);
408                  */
409         } else {
410                 SetStatusText(_T("Done !"));
411                 wxString err(_T("An error occured while running '"));
412                 err += bbtk::std2wx(command) + _T("'");
413                 wxMessageBox(err, _T("Regenerate package doc"), wxOK | wxICON_ERROR);
414         }
415 }
416
417 //================================================================
418 void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists() {
419         SetStatusText(_T("Regenerating boxes lists ... please wait"));
420         //BBTK_BUSY_CURSOR ;
421
422         std::string command;
423 #if defined(WIN32)
424         command = "\"";
425 #endif
426         command += ConfigurationFile::GetInstance().Get_bin_path();
427         command += ConfigurationFile::GetInstance().Get_file_separator();
428         command += "bbRegenerateBoxesLists";
429
430 #if defined(WIN32)
431         command += "\"";
432 #endif
433         command += " -q";
434
435         bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
436
437         if (!system(command.c_str())) {
438                 SetStatusText(_T("Done !"));
439                 /*
440                  wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
441                  wxOK | wxICON_INFORMATION);
442                  */
443         } else {
444                 SetStatusText(_T("Done !"));
445                 wxString err(_T("An error occured while running '"));
446                 err += bbtk::std2wx(command) + _T("'");
447                 wxMessageBox(err, _T("Regenerate boxes lists"), wxOK | wxICON_ERROR);
448         }
449 }
450
451 //================================================================
452 void wxGUIEditorGraphicBBS::RegenerateAll() {
453         DoRegeneratePackageDoc("-a");
454         DoRegenerateBoxesLists();
455 }
456
457 //================================================================
458
459 wxAuiNotebook* wxGUIEditorGraphicBBS::getAuiNotebook() {
460         return _notebook;
461 }
462
463 //================================================================
464
465 void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::string boxName) 
466 {
467         if (_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName != boxName) 
468         {
469
470                 _actualPkgBrowserPkgName = packageName;
471                 _actualPkgBrowserBoxName = boxName;
472
473 //EED 15 oct 2012               BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
474                 
475                 Package::Pointer k;
476 //EED           ComplexBlackBoxDescriptor::Pointer descriptor;
477                 BlackBoxDescriptor::Pointer descriptor;
478
479                 std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
480                 k                       = _pkgBrowser->GetFactory()->GetPackage(_actualPkgBrowserPkgName);
481                 mapDesc         = k->GetDescriptorMap();                
482                 descriptor      = mapDesc[_actualPkgBrowserBoxName];
483 /*
484                 tree.treeTour(0);               
485
486                 tree.deleteTree();
487
488                 descriptor->GetBoxesInside(tree, 0);
489
490                 //tree.treeTour(0);
491                 //std::vector<std::string> boxesDiagram = _sceneM->boxesDiagram;
492                 //for(int i=0;i<boxesDiagram.size();i++){
493                 //      std::cout<<"caja: "<<boxesDiagram[i]<<std::endl;
494                 //}             
495                 
496                 _actualPkgBrowserPkgName = "";
497                 _actualPkgBrowserBoxName = "";
498 */
499                 /*
500                 Package::Pointer k;
501                 BlackBoxDescriptor::Pointer descriptor;
502                 std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
503                 k                       = _pkgBrowser->GetFactory()->GetPackage(packageName);
504                 std::vector<std::string> temp;
505                 _pkgBrowser->GetFactory()->GetPackagesList(temp);
506                 for(int ii = 0 ; ii < temp.size() ; ii++)
507                 {
508                                 std::cout << " packs "<< temp[ii]<< std::endl;
509                 }
510                 mapDesc         = k->GetDescriptorMap();                
511                 descriptor      = mapDesc[boxName];
512                 */
513                 _pkgBrowser->WxGUIBlackBoxListUserOnSelected(descriptor.get());
514         }
515 }
516
517 //=========================================================================
518
519 void wxGUIEditorGraphicBBS::editBlackBox(GBlackBoxModel *bbmodel) {
520         wxBlackBoxEditionDialog* dialog =
521                         new wxBlackBoxEditionDialog(this, bbmodel);
522         dialog->Show();
523 }
524
525 //=========================================================================
526
527 bool wxGUIEditorGraphicBBS::boxNameExists(std::string boxname) {
528  
529         return this->_tabsMgr->getActualTabPanel()->getSceneManager()->boxExist(boxname);
530 }
531
532 //=========================================================================
533
534 void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus) {
535         SetStatusText(crea::std2wx(textStatus));
536 }
537
538 //=========================================================================
539
540 void wxGUIEditorGraphicBBS::executeScript(std::string script) {
541         std::string separator =
542                         ConfigurationFile::GetInstance().Get_file_separator();
543         std::string dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
544         std::string filename = dir + separator + "tmp_bbtk.bbs";
545
546         ofstream tempFile;
547         tempFile.open(filename.c_str());
548         tempFile << script;
549         tempFile.close();
550
551         std::string command = "";
552
553 #ifdef WIN32
554         command += "start /b ";
555 #endif
556
557         //              command += "\""+ crea::System::GetExecutablePath();
558         //#ifdef MACOSX
559         //              command += separator + "../../../bbi.app/Contents/MacOS";
560         //#endif
561
562         command += "bbi ";
563         command += "\"" + filename + "\"";
564
565 #ifndef WIN32
566         command += " & ";
567 #endif
568
569         printf("RaC wxGUIEditorGraphicBBS::executeScript %s \n", command.c_str());
570         system(command.c_str());
571 }
572
573 //=========================================================================
574 std::string wxGUIEditorGraphicBBS::CheckExtension(std::string filename, std::string extension) {
575         if(filename.size() > extension.size() ){
576                 if( (filename.compare(filename.size()-extension.size(), extension.size(),extension)) !=0 ){
577                         filename.append(extension);
578                 }
579         }else{
580                 filename.append(extension);
581         }
582         return filename;
583 }
584 //=========================================================================
585 // EVENT HANDLERS
586 //=========================================================================
587
588 void wxGUIEditorGraphicBBS::OnCreateNewTab(wxCommandEvent& event) {
589         _tabsMgr->addNewTab();
590         refreshGUIControls();
591 }
592
593 void wxGUIEditorGraphicBBS::OnUndo(wxCommandEvent& event) {
594         unsigned short disable;
595         std::string stundo;
596         std::string stredo;
597
598         _tabsMgr->loadTempDiagram(0);
599         disable = _tabsMgr->getUndoState(stundo);
600         if(disable == 0)
601         {
602                 std::string name = _tabsMgr->GetNameTabPanel();
603                 if(name[name.length() - 1] == '*')
604                 {
605                         name =name.substr(0,name.length()-1);
606                 }
607                 _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
608         }
609
610         GetToolBar()->EnableTool(ID_UNDO,disable);
611         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
612         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
613         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
614         refreshGUIControls();
615 }
616
617 //=========================================================================
618
619 void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) {
620         unsigned short disable;
621         std::string stundo;
622         std::string stredo;
623
624         _tabsMgr->loadTempDiagram(1);
625         std::string name = _tabsMgr->GetNameTabPanel();
626         if(name[name.length() - 1] != '*')
627                 name +="*";
628         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
629         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
630         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
631         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
632         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
633         refreshGUIControls();
634 }
635
636 void wxGUIEditorGraphicBBS::OnChangeName(wxCommandEvent& event){
637 }
638 //=========================================================================
639
640 void wxGUIEditorGraphicBBS::OnShowTree(wxCommandEvent& event){
641                 std::cout <<  "wxGUIEditorGraphicBBS::OnShowTree"<<std::endl;
642 if (_actualPkgBrowserPkgName !="" || _actualPkgBrowserBoxName != "") 
643         {
644                 Package::Pointer k;
645 //EED           ComplexBlackBoxDescriptor::Pointer descriptor;
646                 BlackBoxDescriptor::Pointer descriptor;
647
648                 std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
649                 k                       = _pkgBrowser->GetFactory()->GetPackage(_actualPkgBrowserPkgName);
650                 mapDesc         = k->GetDescriptorMap();                
651                 descriptor      = mapDesc[_actualPkgBrowserBoxName];
652
653                 tree.treeTour(0);               
654
655                 tree.deleteTree();
656
657                 descriptor->GetBoxesInside(tree, 0);
658                 
659                 _actualPkgBrowserPkgName = "";
660                 _actualPkgBrowserBoxName = "";
661         }
662 else
663         {
664                 std::cout<<"Select a Box"<<std::endl;
665         }
666 }
667
668 //=========================================================================
669
670 void wxGUIEditorGraphicBBS::OnEditDiagramProperties(wxCommandEvent& event)
671 {
672         wxDiagramPropertiesEditionDialog* dialog =
673                                 new wxDiagramPropertiesEditionDialog(this, tree);
674         dialog->Show();
675 }
676
677 //=========================================================================
678
679 void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) {
680         std::string script1 = _tabsMgr->getActualDiagramBBS(true);
681         cout << endl << "RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"
682                         << endl << endl;
683         cout << script1 << endl;
684
685         std::string script2 = _tabsMgr->getActualDiagramBBS(false);
686         executeScript(script2);
687 }
688
689         
690 //=========================================================================
691 void wxGUIEditorGraphicBBS::OpenBBS(std::string filePathName, std::string fileName) 
692 {
693         _tabsMgr->addNewTab( crea::std2wx(fileName) );
694         bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager(), _pkgBrowser->GetFactory());
695         // We tell the interpreter to throw exceptions on error
696         I->SetThrow(true);
697         // Interpret the file supposed to define a box called 'Processing'
698         I->InterpretFile( filePathName );
699         refreshGUIControls();
700 }
701         
702 //=========================================================================
703 // HANDLERS
704 //=========================================================================
705 void wxGUIEditorGraphicBBS::OnOpenBBS(wxCommandEvent& event) 
706 {
707 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
708 #if wxMAJOR_VERSION <= 2
709         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"), wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxOPEN);
710 #else
711         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open BBS"), wxEmptyString, wxT("NewBBS"), wxT("*.bbs"), wxFD_OPEN);
712 #endif
713
714         if (openFileDialog->ShowModal() == wxID_OK) 
715         {
716                 OpenBBS( crea::wx2std(openFileDialog->GetPath()) , crea::wx2std(openFileDialog->GetFilename())  );
717         }
718         
719 /*EED Borrame   
720         if (openFileDialog->ShowModal() == wxID_OK) 
721         {
722                 wxString fileName = openFileDialog->GetPath();
723                 _tabsMgr->addNewTab(openFileDialog->GetFilename());
724                 bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager(), _pkgBrowser->GetFactory());
725                 // We tell the interpreter to throw exceptions on error
726                 I->SetThrow(true);
727                 // Interpret the file supposed to define a box called 'Processing'
728                 I->InterpretFile((const char*) (fileName.mb_str()));
729         }
730         refreshGUIControls();
731 */ 
732 }
733
734 //=========================================================================
735 void wxGUIEditorGraphicBBS::SaveActualBBS(std::string filename) {
736         ofstream file;
737
738         //EED           file.open(fileName.c_str());
739         file.open(filename.c_str());
740         std::string content = "";
741         // writing file header
742         content += "# ----------------------------------\n";
743         content += "# - BBTKGEditor v ";
744         content += _currentBBGversion; //VERSION
745         content += " BBS BlackBox Script\n";
746         content += "# - ";
747         content += filename;
748         content += "\n";
749         content += "# ----------------------------------\n";
750         content += "\n";
751         content += _tabsMgr->getActualDiagramBBS();
752         file << content;
753         file.close();
754 }
755
756 void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) {
757
758 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
759 #if wxMAJOR_VERSION <= 2
760         wxFileDialog * saveFileDialog = new wxFileDialog(this,
761                         wxT("Save  actual BBS"), wxEmptyString, wxT("NewBBS"),
762                         wxT("*.bbs"), wxSAVE | wxOVERWRITE_PROMPT);
763 #else
764         wxFileDialog * saveFileDialog = new wxFileDialog(this,
765                         wxT("Save  actual BBS"), wxEmptyString, wxT("NewBBS"),
766                         wxT("*.bbs"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
767 #endif
768
769         if (saveFileDialog->ShowModal() == wxID_OK) {
770                 wxString fileName = saveFileDialog->GetPath();
771                 std::string filename = (const char*) (fileName.mb_str());
772                 filename=CheckExtension (filename, ".bbs");
773                 SaveActualBBS(filename);
774         }
775
776 }
777
778 void wxGUIEditorGraphicBBS::AskComplexBoxConfiguration() {
779         std::string cbName = _tabsMgr->GetCbName();
780         std::string paName = _tabsMgr->GetCbPackageName();
781
782         wxTextEntryDialog *cbNameDialog = new wxTextEntryDialog(this,
783                         wxT("Complex Box name"));
784         wxTextEntryDialog *paNameDialog = new wxTextEntryDialog(this,
785                         wxT("Package name"));
786
787         cbNameDialog->SetValue(wxString(cbName.c_str(), wxConvUTF8));
788         paNameDialog->SetValue(wxString(paName.c_str(), wxConvUTF8));
789
790         if (cbNameDialog->ShowModal() == wxID_OK) {
791                 wxString complexboxname = cbNameDialog->GetValue();
792                 cbName = (const char*) (complexboxname.mb_str());
793         }
794
795         if (paNameDialog->ShowModal() == wxID_OK) {
796                 wxString packagename = paNameDialog->GetValue();
797                 paName = (const char*) (packagename.mb_str());
798         }
799
800         _tabsMgr->SetCbName(cbName);
801         _tabsMgr->SetCbPackageName(paName);
802 }
803
804 //=========================================================================
805
806 void wxGUIEditorGraphicBBS::SaveActualComplexBox(std::string filename) {
807         ofstream file;
808         file.open(filename.c_str());
809
810         std::string content = "";
811
812         // writing file header
813         content += "# ----------------------------------\n";
814         content += "# - BBTKGEditor v ";
815         content += _currentBBGversion;//VERSION
816         content += " BBS BlackBox Script (Complex Box)\n";
817         content += "# - ";
818         content += filename;
819         content += "\n";
820         content += "# ----------------------------------\n";
821         content += "\n";
822         content += _tabsMgr->getActualComplexBoxBBS();
823         file << content;
824         file.close();
825 }
826
827 //=========================================================================
828
829 void wxGUIEditorGraphicBBS::OnSaveActualComplexBox(wxCommandEvent& event) 
830 {
831 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
832 #if wxMAJOR_VERSION <= 2
833         wxFileDialog * saveFileDialog = new wxFileDialog(this,
834                         wxT("Save Complex Box BBS"), wxEmptyString,
835                         _T("ComplexBoxName"), wxT("*.bbs"), wxSAVE
836                                         | wxOVERWRITE_PROMPT);
837 #else
838         wxFileDialog * saveFileDialog = new wxFileDialog(this,
839                         wxT("Save Complex Box BBS"), wxEmptyString,
840                         _T("ComplexBoxName"), wxT("*.bbs"), wxFD_SAVE
841                                         | wxFD_OVERWRITE_PROMPT);
842 #endif
843
844         if (saveFileDialog->ShowModal() == wxID_OK) {
845                 wxString fileName = saveFileDialog->GetPath();
846                 std::string filename = (const char*) (fileName.mb_str());
847                 filename=CheckExtension (filename, ".bbs");
848                 SaveActualComplexBox(filename);
849         }
850 }
851
852 //=========================================================================
853 void wxGUIEditorGraphicBBS::SaveActualDiagram(std::string filename) {
854         ofstream file;
855         file.open(filename.c_str());
856
857         std::string content = "";
858
859         // writing file header
860         content += "# ----------------------------------\n";
861         content += "# - BBTKGEditor v ";
862         content += _currentBBGversion; //VERSION
863         content += " BBG BlackBox Diagram file\n";
864         content += "# - ";
865
866         content += filename;
867
868         content += "\n";
869         content += "# ----------------------------------\n";
870         content += "\n";
871         content += "APP_START\n";
872         _tabsMgr->saveActualDiagram(content, filename); //DFCH
873         content += "APP_END\n";
874         file << content;
875         file.close();
876 }
877
878 //=========================================================================
879 void wxGUIEditorGraphicBBS::SaveTempActualDiagram(const std::string &action) 
880 {
881         std::string stundo;
882         std::string stredo;
883         std::string name = _tabsMgr->GetNameTabPanel();
884         if(name[name.length() - 1] != '*')
885                 name +="*";
886         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
887         _tabsMgr->saveTempActualDiagram(action);
888         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
889         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
890         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
891         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
892 }
893
894 //=========================================================================
895
896 //The following method allows to save the current diagram asking the filename
897 //DFCH
898 void wxGUIEditorGraphicBBS::SaveCurrentDiagramAs() 
899 {
900
901 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
902 #if wxMAJOR_VERSION <= 2
903         wxFileDialog * saveFileDialog = new wxFileDialog(this,
904                         wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"),
905                         wxT("*.bbg"), wxSAVE | wxOVERWRITE_PROMPT);
906 #else
907         wxFileDialog * saveFileDialog = new wxFileDialog(this,
908                         wxT("Save current diagram"), wxEmptyString, wxT("NewDiagram"),
909                         wxT("*.bbg"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
910 #endif
911
912         if (saveFileDialog->ShowModal() == wxID_OK) {
913                 //_tabsMgr->SetNameTabPanel(saveFileDialog->GetFilename());
914                 wxString pathfileName = saveFileDialog->GetPath();
915                 std::string pathfilename = (const char*) (pathfileName.mb_str());
916                 pathfilename=CheckExtension (pathfilename, ".bbg");
917
918                 //modify the tab name accordingly
919                 wxString fileName = saveFileDialog->GetFilename();
920                 std::string filename = (const char*) (fileName.mb_str());
921                 filename=CheckExtension (filename, ".bbg");
922                 _tabsMgr->SetNameTabPanel( wxString (filename.c_str(), wxConvUTF8) );
923
924                 std::string pathfilenamebbs = pathfilename;
925                 pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
926                 if (_tabsMgr->isActualDiagramComplexBox() == false) {
927                         SaveActualDiagram(pathfilename);
928                         SaveActualBBS(pathfilenamebbs);
929                 } else {
930                         AskComplexBoxConfiguration();
931                         SaveActualDiagram(pathfilename);
932                         SaveActualComplexBox(pathfilenamebbs);
933                 } //if isActualDiagramComplexBox
934         } // if saveFileDialog
935 }
936 //=========================================================================
937 //DFCH
938 void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) {
939         std::string pathfilename = _tabsMgr->GetCurrentTabPanelPath();
940         if (pathfilename.empty()) {
941                 SaveCurrentDiagramAs();
942         } else {
943                 std::string pathfilenamebbs = pathfilename;
944                 pathfilenamebbs[pathfilenamebbs.length() - 1] = 's';
945                 
946                 if (_tabsMgr->isActualDiagramComplexBox() == false) {
947                         std::string name = _tabsMgr->GetNameTabPanel();
948                         if(name[name.length() - 1] == '*')
949                         {
950                                 name =name.substr(0,name.length()-1);
951                         }
952                         _tabsMgr->SetNameTabPanel(wxString (name.c_str(), wxConvUTF8));
953                         SaveActualDiagram(pathfilename);
954                         SaveActualBBS(pathfilenamebbs);
955                 } else {
956                         AskComplexBoxConfiguration();
957                         SaveActualDiagram(pathfilename);
958                         SaveActualComplexBox(pathfilenamebbs);
959                 } //if isActualDiagramComplexBox
960         }
961 }
962 //=========================================================================
963 //DFCH
964 void wxGUIEditorGraphicBBS::OnSaveAsActualDiagram(wxCommandEvent& event) {
965         SaveCurrentDiagramAs();
966 }
967
968 //=========================================================================
969 void wxGUIEditorGraphicBBS::OnExportConsoleExecCommand(wxCommandEvent& event)
970 {
971 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
972 #if wxMAJOR_VERSION <= 2
973         wxFileDialog * saveFileDialog = new wxFileDialog(this,
974                         wxT("Export console command"), wxEmptyString, wxT("ConsoleApp.txt"),
975                         wxT("*.txt;*.bbs;*.bbg;*.sh;*.bat"), wxSAVE | wxOVERWRITE_PROMPT);
976 #else
977         wxFileDialog * saveFileDialog = new wxFileDialog(this,
978                         wxT("Export console command"), wxEmptyString, wxT("ConsoleApp.txt"),
979                         wxT("*.txt;*.bbs;*.bbg;*.sh;*.bat"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
980 #endif
981
982
983         if (saveFileDialog->ShowModal() == wxID_OK)
984         {
985                 wxString fileName = saveFileDialog->GetPath();
986                 std::string filename = (const char*) (fileName.mb_str());
987                 filename=CheckExtension (filename, ".txt");
988
989                 ofstream file;
990                 file.open(filename.c_str());
991
992                 std::vector<std::string> extInputs = _tabsMgr->getActualTabPanel()->getSceneManager()->GetExternalInputsNames();
993
994                 //TODO PUT IN A METHOD OF A FILES AND TEXT MANAGER CLASS !!!
995                 //std::string inputsInCommentsWin="";
996                 //std::string inputsInCommentsUnix="";
997                 //std::string inputsInOneLineWin="";
998                 std::string inputsInOneLineUnix="";
999                 for (unsigned int i = 0; i < extInputs.size(); ++i)
1000                 {
1001                         /* No gusto la idea al jefe pero por si acaso ...
1002                         * RaC 2012 2nd HackFest
1003                         *
1004                         inputsInCommentsWin+="REM ";
1005                         inputsInCommentsWin+=extInputs[i];
1006                         inputsInCommentsWin+="=\"value\"\n";
1007                         inputsInCommentsUnix+="# ";
1008                         inputsInCommentsUnix+=extInputs[i];
1009                         inputsInCommentsUnix+="=\"value\"\n";
1010
1011                         char buffer [50];
1012                         sprintf (buffer, "%d", (i+1));
1013                         inputsInOneLineWin+=extInputs[i];
1014                         inputsInOneLineWin+="=\"%";
1015                         inputsInOneLineWin+=buffer;
1016                         inputsInOneLineWin+="\" ";
1017                         */
1018                         inputsInOneLineUnix+=extInputs[i];
1019                         inputsInOneLineUnix+="=\"<value>\" ";
1020
1021                 }
1022
1023
1024                 std::string content = "";
1025                 // writing file header
1026                 content += "# ----------------------------------\n";
1027                 content += "# - BBTKGEditor v ";
1028                 content += _currentBBGversion; //VERSION
1029                 content += " Console Commands to execute BBS application\n";
1030                 content += "# - ";
1031                 content += filename;
1032                 content += "\n";
1033                 content += "# ----------------------------------\n";
1034                 content += "\n";
1035                 content += "\n";
1036                 content += "# Command to execute bbi\n";
1037                 content += "bbi <bbs_path> ";
1038                 content += inputsInOneLineUnix;
1039
1040                 /* No gusto la idea al jefe pero por si acaso ...
1041                  * RaC 2012 2nd HackFest
1042                  content += "# For Windows (copy the following lines to a .bat file)\n";
1043                  content += "REM BBS application\n";
1044                  content += "REM Inputs:\n";
1045                  content += inputsInCommentsWin;
1046                  content += "REM To use previous inputs, put %$inputName% in the corresponding input of the execution bbi line\n";
1047                  content += "bbi applicationBBS.bbs ";
1048                  content += inputsInOneLineWin;
1049                  content += "\n";
1050                  content += "\n";
1051                  content += "# For Linux or Mac (copy the following lines to a .sh file)\n";
1052                  content += "#!/bin/bash\n";
1053                  content += "# BBS application\n";
1054                  content += "# Inputs:\n";
1055                  content += inputsInCommentsUnix;
1056                  content += "# To use previous inputs, put $inputName in the corresponding input of the execution bbi line\n";
1057                  content += "bbi applicationBBS.bbs ";
1058                  content += inputsInOneLineUnix;
1059                  content += "\n";
1060                 */
1061
1062                 file << content;
1063                 file.close();
1064         }
1065
1066
1067 }
1068
1069 //=========================================================================
1070
1071 void wxGUIEditorGraphicBBS::refreshGUIControls() 
1072 {
1073         std::string stundo;
1074         std::string stredo;
1075         //RaC2012 2ndHackFest Next line seems weird ... To keep in mind for other devels
1076         wxToolBar* toolbar = GetToolBar();
1077         if (_tabsMgr->isActualDiagramComplexBox()) 
1078         {
1079                 toolbar->ToggleTool(ID_BTNCOMPLEXBOX, true);
1080                 //toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, true); RaC2012 2nd HackFest
1081                 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, true);
1082
1083                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, true);
1084                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, false);
1085                 GetMenuBar()->GetMenu(0)->Enable(ID_EXPORT_CONSOLEAPP, false);
1086         } else {
1087                 toolbar->ToggleTool(ID_BTNCOMPLEXBOX, false);
1088                 //toolbar->EnableTool(ID_ADDCOMPLEXBOXINPUT, false); RaC2012 2nd HackFest
1089                 toolbar->EnableTool(ID_ADDCOMPLEXBOXOUTPUT, false);
1090
1091                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_COMPLEXBOX, false);
1092                 GetMenuBar()->GetMenu(0)->Enable(ID_SAVE_AS_BBS, true);
1093                 GetMenuBar()->GetMenu(0)->Enable(ID_EXPORT_CONSOLEAPP, true);
1094         }
1095
1096         //RaC2012 2ndHackFest
1097         GetToolBar()->EnableTool(ID_EDITPROPERTIES,true);
1098
1099         GetToolBar()->EnableTool(ID_UNDO,_tabsMgr->getUndoState(stundo));
1100         GetToolBar()->SetToolShortHelp(ID_UNDO,crea::std2wx(stundo));
1101         GetToolBar()->EnableTool(ID_REDO,_tabsMgr->getRedoState(stredo));
1102         GetToolBar()->SetToolShortHelp(ID_REDO,crea::std2wx(stredo));
1103
1104         if (_tabsMgr->getNumActualSelectedObjects() > 0) {
1105                 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
1106         } else {
1107                 ///TODO Fix the possibility to say from the SceneManager to the GUI to refresh the options
1108                 GetMenuBar()->GetMenu(1)->Enable(ID_COPY_TO_COMPLEXDIAGRAM, true);
1109         }
1110
1111 }
1112
1113 //=========================================================================
1114
1115 void wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram(wxCommandEvent& event) 
1116 {
1117         wxMessageDialog *dial = new wxMessageDialog(NULL,wxT("Are you sure to delete all boxes of the diagram?"),wxT("Delete all boxes"), wxYES_NO | wxNO_DEFAULT| wxICON_QUESTION);
1118         if (dial->ShowModal() == wxID_YES)
1119         {
1120                 _tabsMgr->deleteAllBoxesActualDiagram();
1121         }
1122 }
1123
1124 //=========================================================================
1125
1126 void wxGUIEditorGraphicBBS::OnCenterViewActualDiagram(wxCommandEvent& event) 
1127 {
1128         _tabsMgr->centerViewActualDiagram();
1129 }
1130
1131 //=========================================================================
1132 void wxGUIEditorGraphicBBS::OpenDiagram(std::string filePathName, std::string fileName) 
1133 {
1134         ifstream inputStream;   
1135         inputStream.open(filePathName.c_str());
1136         assert(inputStream.good()); // fails
1137         
1138         if(_tabsMgr->FindTab(filePathName)!=-1) //RaC2012 avoid opening same diagram twice
1139         {
1140                 inputStream.close();
1141                 printf("RaC: Diagram already opened\n");
1142                 return;
1143         }
1144         _tabsMgr->addNewTab( crea::std2wx(fileName) );
1145         _tabsMgr->loadDiagram(inputStream, filePathName);
1146
1147         _tabsMgr->saveTempActualDiagram("load diagram");
1148         GetToolBar()->EnableTool(ID_UNDO, false);
1149         GetToolBar()->EnableTool(ID_UNDO, false);
1150         inputStream.close();
1151         refreshGUIControls();
1152 }
1153         
1154 //=========================================================================
1155
1156 void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event) 
1157 {
1158
1159 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1160 #if wxMAJOR_VERSION <= 2
1161         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"), wxEmptyString, wxT(""), wxT("*.bbg"), wxOPEN | wxFILE_MUST_EXIST);
1162 #else
1163         wxFileDialog * openFileDialog = new wxFileDialog(this, wxT("Open diagram"), wxEmptyString, wxT(""), wxT("*.bbg"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1164 #endif
1165
1166         if (openFileDialog->ShowModal() == wxID_OK) 
1167         {
1168                 wxString filePath = openFileDialog->GetPath();
1169                 wxString fileName = openFileDialog->GetFilename();
1170                 OpenDiagram( crea::wx2std(filePath) , crea::wx2std(fileName) );                                 
1171         }
1172 }
1173
1174 //=========================================================================
1175 void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) 
1176 {
1177         std::cout<<"wxGUIEditorGraphicBBS::OnClickBtnBox"<<std::endl;
1178         BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
1179         if (bbDes != NULL) {
1180                 std::string typeName = bbDes->GetTypeName();
1181                 std::string packageName = bbDes->GetPackage()->GetName();
1182                 wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
1183                 if (pnl != NULL) {
1184                         wxVtkSceneManager *scn = pnl->getSceneManager();
1185                         scn->createGBlackBox(50, 50, packageName, typeName);
1186                         scn->refresh();
1187                 }
1188                 SaveTempActualDiagram("New Box");
1189                 // if pnl
1190         }// if bbDes
1191 }
1192
1193 //=========================================================================
1194
1195 void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event) 
1196 {
1197         //DFCH
1198         wxGEditorTabPanel *pnl = this->_tabsMgr->getActualTabPanel();
1199
1200         if (pnl != NULL) {
1201                 wxVtkSceneManager *scn = pnl->getSceneManager();
1202                 if( scn->MakeBoxExecutable() )
1203                         std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...successful"<<std::endl;
1204                 else
1205                         std::cout<<"DFCH: wxGUIEditorGraphicBBS::OnClickBtnExecutableBox...Error!!"<<std::endl;
1206         }
1207         //DFCH
1208
1209 }
1210
1211 //=========================================================================
1212 void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) 
1213 {
1214         std::cout<<"wxGUIEditorGraphicBBS::OnClickBtnComplexBox"<<std::endl;
1215         wxToolBar* toolbar = GetToolBar();
1216         bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
1217         if (temp) {
1218                 enableComplexBox();
1219         } else {
1220                 disableComplexBox();
1221         }
1222 }
1223
1224 //=========================================================================
1225 //EED01
1226 void wxGUIEditorGraphicBBS::OnAddComplexBoxInput(wxCommandEvent& event) 
1227 {
1228         wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
1229                         wxT("Name of input port"));
1230         if (nameDialog->ShowModal() == wxID_OK) 
1231         {
1232                 wxString fileName = nameDialog->GetValue();
1233                 if (!fileName.IsEmpty()) 
1234                 {
1235                         std::string portName = (const char*) (fileName.mb_str());
1236                         if ( !boxNameExists(portName) )
1237                         {
1238                            _tabsMgr->addActualDiagramComplexInputPort(portName);
1239                         } else {
1240                            wxMessageDialog *dial = new wxMessageDialog(NULL,
1241                                        wxT("Impossible to create Box. The name already exists. Please provide another name"),
1242                                        wxT("Change name: name already exists"), wxOK | wxICON_EXCLAMATION | wxSTAY_ON_TOP);
1243                            dial->ShowModal();
1244                         }
1245                 } // if !fileName
1246         } // if namaDialog
1247 }
1248
1249 //=========================================================================
1250 void wxGUIEditorGraphicBBS::OnAddComplexBoxOutput(wxCommandEvent& event) 
1251 {
1252         wxTextEntryDialog *nameDialog = new wxTextEntryDialog(this,
1253                         wxT("Name of output port"));
1254         if (nameDialog->ShowModal() == wxID_OK) 
1255         {
1256                 wxString fileName = nameDialog->GetValue();
1257                 if (!fileName.IsEmpty()) 
1258                 {
1259                         std::string portName = (const char*) (fileName.mb_str());
1260                         if ( !boxNameExists(portName) )
1261                         {
1262                         _tabsMgr->addActualDiagramComplexOutputPort(portName);
1263                         } else {
1264                            wxMessageDialog *dial = new wxMessageDialog(NULL,
1265                                        wxT("Impossible to create Box. The name already exists. Please provide another name"),
1266                                        wxT("Change name: name already exists"), wxOK | wxICON_EXCLAMATION | wxSTAY_ON_TOP);
1267                            dial->ShowModal();
1268                         }
1269
1270                 } // if !filename
1271         } // namaDialog
1272 }
1273
1274 //=========================================================================
1275 void wxGUIEditorGraphicBBS::OnCopySelectedToComplexDiagram(
1276                 wxCommandEvent& event) 
1277 {
1278         _tabsMgr->copySelectedBBoxesToComplexDiagram();
1279 }
1280
1281 //=========================================================================
1282 void wxGUIEditorGraphicBBS::OnHelpBBeditor(wxCommandEvent& event) 
1283 {
1284         printf("wxGUIEditorGraphicBBS::OnHelpBBeditor ....not implemented..\n");
1285 }
1286
1287 //=========================================================================
1288 void wxGUIEditorGraphicBBS::OnCreatePackage(wxCommandEvent& event) 
1289 {
1290         bbtkSystemTools::CreatePackage();
1291 }
1292
1293 //=========================================================================
1294 void wxGUIEditorGraphicBBS::OnCreateBlackBox(wxCommandEvent& event) 
1295 {
1296         bbtkSystemTools::CreateBlackBox();
1297 }
1298         
1299 //=========================================================================
1300 void wxGUIEditorGraphicBBS::OnPlugPackage(wxCommandEvent& event) 
1301 {
1302         //DFGO2012 Plug Package functionnalities
1303         long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
1304         wxDirDialog* FD =
1305           new wxDirDialog( 0,
1306                            _T("Select package directory"),
1307                            _T(""),
1308                            style);
1309         long userResponse;
1310         do
1311         {
1312                 userResponse = FD->ShowModal();
1313                 if(userResponse==wxID_OK)
1314                 {
1315                         std::string path = wx2std (FD->GetPath()) ;
1316                         #ifdef WIN32
1317                         std::string fname = path + "\\bbtkPackage";
1318                         #else
1319                         std::string fname = path + "/bbtkPackage";
1320                         #endif
1321                         
1322                         std::cout << "Path chosen = \"" << FD->GetPath() << "\"" << std::endl;
1323                         if ( Utilities::FileExists( fname ) )
1324                         {
1325                                 std::ifstream f;
1326                                 f.open(fname.c_str());
1327                                 std::string pname;
1328                                 f >> pname;
1329                                 while(pname[0] == '#')
1330                                 {
1331                                         getline(f, pname, '\n');
1332                                         f >> pname;
1333                                 }
1334                                 f.close();
1335
1336                                 bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );
1337
1338                                 DoRegeneratePackageDoc(pname);
1339                                 DoRegenerateBoxesLists();
1340
1341                                 _pkgBrowser->RebuildList();
1342
1343                                 wxMessageBox(_T("Package successfully plugged. Please restart bbEditor to see the new package in the package browser."),_T("Plug package"),wxOK | wxICON_INFORMATION);
1344                                 userResponse = wxID_CANCEL;
1345                         }
1346                         else
1347                         {
1348                                 std::string err = "The directory \"" + path + "\" does not contain a 'bbtkPackage' file.";
1349                                 #ifndef WIN32
1350                                         #ifndef MACOSX
1351                                                 err += "\nNote: If you are on Linux please select the folder and click \"Open\", don't enter in it.";
1352                                         #endif
1353                                 #endif
1354
1355                                 wxMessageBox(crea::std2wx(err), _T("Plug package"),wxOK | wxICON_ERROR);
1356                                 // THE FOLLOWING LINE GIVES ERRORS BECAUSE IT IS NECESSARY TO USE std2wx
1357                                 //wxMessageBox( _T( err) , _T("Plug package"),wxOK | wxICON_ERROR);
1358                         }
1359                 }
1360         }while(userResponse != wxID_CANCEL);
1361
1362 }
1363         
1364 //=========================================================================
1365 void wxGUIEditorGraphicBBS::OnEditConfig(wxCommandEvent& event) 
1366 {
1367         std::string commandStr;
1368             std::string configFile = ConfigurationFile::GetInstance().Get_config_xml_full_path();
1369         #ifdef WIN32
1370                 commandStr = "notepad.exe ";
1371         #else
1372                 commandStr = "gedit ";
1373         #endif
1374                 commandStr = commandStr + configFile;
1375                 std::cout << "system: " << commandStr << std::endl;
1376                 system ( commandStr.c_str() );
1377 }
1378         
1379 //=========================================================================
1380 void wxGUIEditorGraphicBBS::OnShowHTMLDoc(wxCommandEvent& event) 
1381 {
1382         // JGRR & CM WH
1383         if (_helpHtmlBrowser != NULL){
1384              _frameAUIMgr->DetachPane(_helpHtmlBrowser);
1385             _helpHtmlBrowser->Destroy();   
1386         }
1387         initHelpHTMLBrowser();
1388         _frameAUIMgr->AddPane(_helpHtmlBrowser, wxAuiPaneInfo().Right().MinSize(200, 200));
1389         _frameAUIMgr->Update();
1390         refreshGUIControls();
1391         
1392         // EO JGRR    & CM WH       
1393 }
1394         
1395 //=========================================================================
1396 void wxGUIEditorGraphicBBS::OnCreateIndex(wxCommandEvent& event) 
1397 {
1398         printf("EED wxGUIEditorGraphicBBS::OnCreateIndex ... not implemented ..\n");
1399 }
1400
1401         
1402 //=========================================================================
1403 void wxGUIEditorGraphicBBS::OnEditComplexBoxScript(wxCommandEvent& event)
1404 {
1405         BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
1406         if (bbDes != NULL) 
1407         {
1408                 std::string packageName = bbDes->GetPackage()->GetName();
1409                 std::string typeName = bbDes->GetTypeName();
1410                 if (!TryToOpenScriptComplexBox(packageName ,typeName))
1411                 {
1412                         wxMessageDialog windowMessage1(NULL,_T("This is not a ComplexBox script."), _T("Alert !"), wxOK);
1413                         windowMessage1.ShowModal();
1414                 }
1415         }// if bbDes
1416 }
1417
1418 //=========================================================================
1419 void wxGUIEditorGraphicBBS::OnExit(wxCommandEvent& event) 
1420 {
1421         Close(true);
1422 }
1423
1424 Factory::Pointer wxGUIEditorGraphicBBS::GetBBTKFactory()
1425 {
1426         if (_pkgBrowser==NULL) 
1427         {
1428                 printf ("EED ERROR! wxGUIEditorGraphicBBS::GetBBTKFactory _pkgBrowser = NULL\n");
1429         }
1430         return _pkgBrowser->GetFactory();
1431 }
1432
1433 //=========================================================================
1434 void wxGUIEditorGraphicBBS::enableComplexBox() 
1435 {
1436         _tabsMgr->setActualDiagramComplexBox(true);
1437         refreshGUIControls();
1438 }
1439
1440 //=========================================================================
1441
1442 void wxGUIEditorGraphicBBS::disableComplexBox() 
1443 {
1444         _tabsMgr->setActualDiagramComplexBox(false);
1445         refreshGUIControls();
1446 }
1447
1448 //=========================================================================
1449 void wxGUIEditorGraphicBBS::setCurrentDiagramDescription(std::string description)
1450 {
1451         _tabsMgr->SetDescription(description);
1452 }
1453
1454 //=========================================================================
1455 void wxGUIEditorGraphicBBS::setCurrentDiagramAuthor(std::string author)
1456 {
1457         _tabsMgr->SetAuthor(author);
1458 }
1459
1460 //=========================================================================
1461 void wxGUIEditorGraphicBBS::setCurrentDiagramCategory(std::string category)
1462 {
1463         _tabsMgr->SetCategory(category);
1464 }
1465
1466 //=========================================================================
1467 void wxGUIEditorGraphicBBS::setCurrentDiagramMessageKind(std::string kind){
1468         _tabsMgr->SetMessageKind(kind); 
1469 }
1470
1471 //=========================================================================
1472 void wxGUIEditorGraphicBBS::setCurrentDiagramMessageLevel(std::string level){
1473         _tabsMgr->SetMessageLevel(level);       
1474 }
1475
1476 //=========================================================================
1477 std::string wxGUIEditorGraphicBBS::getCurrentDiagramDescription()
1478 {
1479         return _tabsMgr->GetDescription();
1480 }
1481
1482 //=========================================================================
1483 std::string wxGUIEditorGraphicBBS::getCurrentDiagramAuthor()
1484 {
1485         return _tabsMgr->GetAuthor();
1486 }
1487
1488 //=========================================================================
1489 std::string wxGUIEditorGraphicBBS::getCurrentDiagramCategory()
1490 {
1491         return _tabsMgr->GetCategory();
1492 }
1493
1494 //=========================================================================
1495 std::string wxGUIEditorGraphicBBS::getCurrentDiagramMessageKind(){
1496         return _tabsMgr->GetMessageKind();
1497 }
1498
1499 //=========================================================================
1500 std::string wxGUIEditorGraphicBBS::getCurrentDiagramMessageLevel(){
1501         return _tabsMgr->GetMessageLevel();
1502 }
1503
1504 //=========================================================================
1505 bool wxGUIEditorGraphicBBS::isCurrentDiagramComplexBox()
1506 {
1507         return _tabsMgr->isActualDiagramComplexBox();
1508 }
1509
1510
1511 //=========================================================================
1512 void wxGUIEditorGraphicBBS::OpenScript(std::string filePathNameBBS ,std::string boxType)
1513 {       
1514         std::string fileName                                                    = boxType+".bbg";
1515         std::string filePathNameBBG                                             = filePathNameBBS;
1516         filePathNameBBG[ filePathNameBBG.length()-1 ]   = 'g';
1517         
1518         wxMessageDialog windowMessage1(NULL,_T("The system is going to open a bbg or bbs for you. Be careful if you save this file."), _T("Alert !"), wxOK);
1519         windowMessage1.ShowModal();
1520         
1521         if ( Utilities::FileExists( filePathNameBBG ) )
1522         {
1523                 OpenDiagram( filePathNameBBG , fileName );     
1524         } else {
1525                 if ( Utilities::FileExists( filePathNameBBS ) )
1526                 {
1527                         OpenBBS( filePathNameBBS , fileName );     
1528                 } else {
1529                         wxMessageDialog windowMessage1(NULL,_T("..ERROR.. loading script bbg/bbs."), _T("Alert !"), wxOK);
1530                         windowMessage1.ShowModal();
1531                 } // FileExists BBS
1532         } // FieExists BBG
1533 } //OpenScript
1534         
1535         
1536         
1537 //=========================================================================
1538 bool wxGUIEditorGraphicBBS::TryToOpenScriptApplication(std::string packageName ,std::string boxType)
1539 {       
1540         return TryToOpenScript(packageName ,boxType, true, false);
1541 }               
1542
1543 //=========================================================================
1544 bool wxGUIEditorGraphicBBS::TryToOpenScriptComplexBox(std::string packageName ,std::string boxType)
1545 {       
1546         return TryToOpenScript(packageName ,boxType, false, true);
1547 }               
1548         
1549         
1550 //=========================================================================
1551 bool wxGUIEditorGraphicBBS::TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox)
1552 {       
1553         Package::Pointer k;
1554         std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
1555         BlackBoxDescriptor::Pointer descriptor;
1556         k                       = GetBBTKFactory()->GetPackage(packageName);
1557         mapDesc         = k->GetDescriptorMap();
1558         descriptor      = mapDesc[boxType];
1559
1560         bool result=false;
1561         
1562         if (
1563                 ((descriptor->IsTypeOfScript_Application()==true) && (scriptApplication==true))
1564                 ||
1565                 ((descriptor->IsTypeOfScript_ComplexBox()==true) && (scriptComplexBox==true))           
1566                 )
1567         {
1568                 result=true;
1569                 OpenScript(descriptor->GetScriptFileName(),boxType);
1570         }
1571         
1572         return result;
1573 }       
1574         
1575 } // EO namespace bbtk
1576
1577 // EOF
1578