2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
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.
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
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 # ------------------------------------------------------------------------
26 /*=========================================================================
32 =========================================================================*/
37 * \brief Class bbtk::BlackBox : abstract black-box interface.
41 * Design and Developpement of BBTK GEditor
42 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
46 #ifndef __WxGUIEditorGraphicBBS_h__
47 #define __WxGUIEditorGraphicBBS_h__
49 //Includes same project
50 #include "wxTabPanelsManager.h"
51 #include "wxBlackBoxEditionDialog.h"
52 #include "wxDiagramPropertiesEditionDialog.h"
53 #include "wxVtkSceneManager.h"
54 #include "GlobalConstants.h"
57 #include "wxart_new.xpm" // JPR
58 #include "wxart_open.xpm"
59 #include "wxart_save.xpm"
60 #include "wxart_run.xpm"
61 #include "wxart_delete.xpm"
62 #include "wxart_centerview.xpm"
63 #include "wxart_box.xpm"
64 #include "wxart_find.xpm"
65 #include "wxart_executablebox.xpm"
66 #include "wxart_complexbox.xpm"
67 #include "wxart_complexinputport.xpm"
68 #include "wxart_complexoutputport.xpm"
69 #include "wxart_undo.xpm"
70 #include "wxart_redo.xpm"
71 #include "wxart_editProperties.xpm"
72 #include "wxart_showTree.xpm"
74 //Includes creaMaracasVisu
77 #include <bbtkWxGUIPackageBrowser2.h>
78 #include <bbtkWxGUIHtmlBrowser.h>
79 #include <bbtkBlackBoxDescriptor.h>
80 #include <bbtkComplexBlackBoxDescriptor.h>
81 #include <bbtkUtilities.h>
82 #include <bbtkConfigurationFile.h>
83 #include <bbtkSystemTools.h>
89 #include <wx/aui/aui.h>
90 #include <wx/aui/auibook.h>
92 #include <wx/toolbar.h>
93 #include <wx/bitmap.h>
105 //RaC: It is important if it exists a double relation
106 //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
107 class wxTabPanelsManager;
108 class wxVtkSceneManager;
110 class wxGUIEditorGraphicBBS : public wxFrame
113 wxGUIEditorGraphicBBS(wxFrame *parent);
114 ~wxGUIEditorGraphicBBS();
118 void initTabPanelsManager();
119 void initPackageBrowser();
120 void initHelpHTMLBrowser();
121 wxAuiNotebook* getAuiNotebook();
123 // Display the info of the black box highlighted in the PackageBrowser
124 void displayBlackBoxInfo(std::string packageName, std::string boxName);
126 // Shows the textStatus in the wxFrame status bar
127 void updateStatusBar(std::string textStatus);
129 // Executes the BBS script in parameter
130 void executeScript(std::string script);
132 // Shows the dialog to change the parameters and values of the black box
133 void editBlackBox(GBlackBoxModel *bbmodel);
135 bool boxNameExists(std::string boxname);
136 bool isCurrentDiagramComplexBox();
138 // Checks and adds if necessary the .bbg/.bbs extensions
139 std::string CheckExtension (std::string filename, std::string extension);
140 // Method that can be used to refresh the help and package browser
142 void RegenerateAll();
143 void DoRegeneratePackageDoc(const std::string& pack);
144 void DoRegenerateBoxesLists();
146 // Refresh the state of buttons and menus when changing for example the mode to edit complex box
147 void refreshGUIControls();
149 void SaveActualBBS(std::string filename);
150 void AskComplexBoxConfiguration();
151 void SaveActualComplexBox(std::string filename);
152 void SaveActualDiagram(std::string filename);
153 void SaveCurrentDiagramAs( ); //DFCH
154 void SaveTempActualDiagram(const std::string &);//FCY
158 // File menu and toolbar events
159 void OnCreateNewTab(wxCommandEvent& event);
160 void OnOpenDiagram(wxCommandEvent& event);
161 void OpenDiagram(std::string filePathName, std::string fileName);
162 void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
163 void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
164 void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
165 void OnOpenBBS(wxCommandEvent& event);
166 void OpenBBS(std::string filePathName, std::string fileName);
167 void OnSaveActualBBS(wxCommandEvent& event);
168 void OnSaveActualComplexBox(wxCommandEvent& event);
169 void OnExecuteActualDiagram(wxCommandEvent& event);
170 void OnClickBtnExecutableBox(wxCommandEvent& event);
171 void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
172 void OnCenterViewActualDiagram(wxCommandEvent& event);
173 void OnClickBtnBox(wxCommandEvent& event);
174 void OnClickBtnSelectBoxes(wxCommandEvent& event);
175 void OnClickBtnComplexBox(wxCommandEvent& event);
176 void OnAddComplexBoxInput(wxCommandEvent& event);
177 void OnAddComplexBoxOutput(wxCommandEvent& event);
178 void OnExit(wxCommandEvent& event);
179 void OnHelpBBeditor(wxCommandEvent& event);
180 void OnUndo(wxCommandEvent& event);
181 void OnRedo(wxCommandEvent& event);
182 void OnChangeName(wxCommandEvent& event);
183 void OnEditDiagramProperties(wxCommandEvent& event);
184 void OnShowTree(wxCommandEvent& event); //CFT
185 void OnEditComplexBoxScript(wxCommandEvent& event);
189 void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
193 void OnCreatePackage(wxCommandEvent& event);
194 void OnCreateBlackBox(wxCommandEvent& event);
195 void OnPlugPackage(wxCommandEvent& event);
196 void OnEditConfig(wxCommandEvent& event);
197 void OnShowHTMLDoc(wxCommandEvent& event);
198 void OnCreateIndex(wxCommandEvent& event);
199 void OpenScript(std::string filePathNameBBS ,std::string boxType);
201 bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
202 bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
203 bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
205 Factory::Pointer GetBBTKFactory();
208 void enableComplexBox();
209 void disableComplexBox();
211 // Getters and Setters of current diagram properties
213 void setCurrentDiagramDescription(std::string description);
214 void setCurrentDiagramAuthor(std::string author);
215 void setCurrentDiagramCategory(std::string category);
216 void setCurrentDiagramMessageKind(std::string kind);
217 void setCurrentDiagramMessageLevel(std::string level);
219 std::string getCurrentDiagramDescription();
220 std::string getCurrentDiagramAuthor();
221 std::string getCurrentDiagramCategory();
222 std::string getCurrentDiagramMessageKind();
223 std::string getCurrentDiagramMessageLevel();
227 //AuiManager for the wxWindow
228 wxAuiManager *_frameAUIMgr;
230 //Class that manages all the tabs in the window
231 wxTabPanelsManager *_tabsMgr;
233 //Notebook managed by the wxTabPanelsManager
234 wxAuiNotebook *_notebook;
236 //Instance to the BBTK Package Browser
237 WxGUIPackageBrowser2 *_pkgBrowser;
239 //Instance to the BBTK Help Browser
240 WxGUIHtmlBrowser *_helpHtmlBrowser;
242 //Name of the box and its package that is shown in the browser
243 std::string _actualPkgBrowserBoxName;
244 std::string _actualPkgBrowserPkgName;
246 // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
247 // RaC 2012 2nd HackFest
248 std::string _currentBBGversion;
251 wxVtkSceneManager *_sceneM;