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 =========================================================================*/
34 /* ---------------------------------------------------------------------
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
60 * \brief Class bbtk::BlackBox : abstract black-box interface.
64 * Design and Developpement of BBTK GEditor
65 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
69 #ifndef __WxGUIEditorGraphicBBS_h__
70 #define __WxGUIEditorGraphicBBS_h__
72 //Includes same project
73 #include "wxTabPanelsManager.h"
74 #include "wxBlackBoxEditionDialog.h"
75 #include "wxDiagramPropertiesEditionDialog.h"
76 #include "wxVtkSceneManager.h"
77 #include "GlobalConstants.h"
80 #include "wxart_new.xpm" // JPR
81 #include "wxart_open.xpm"
82 #include "wxart_save.xpm"
83 #include "wxart_run.xpm"
84 #include "wxart_delete.xpm"
85 #include "wxart_centerview.xpm"
86 #include "wxart_box.xpm"
87 #include "wxart_executablebox.xpm"
88 #include "wxart_complexbox.xpm"
89 #include "wxart_complexinputport.xpm"
90 #include "wxart_complexoutputport.xpm"
91 #include "wxart_undo.xpm"
92 #include "wxart_redo.xpm"
93 #include "wxart_editProperties.xpm"
94 #include "wxart_showTree.xpm"
96 //Includes creaMaracasVisu
99 #include <bbtkWxGUIPackageBrowser2.h>
100 #include <bbtkWxGUIHtmlBrowser.h>
101 #include <bbtkBlackBoxDescriptor.h>
102 #include <bbtkComplexBlackBoxDescriptor.h>
103 #include <bbtkUtilities.h>
104 #include <bbtkConfigurationFile.h>
105 #include <bbtkSystemTools.h>
110 #include <wx/frame.h>
111 #include <wx/aui/aui.h>
112 #include <wx/aui/auibook.h>
113 #include <wx/panel.h>
114 #include <wx/toolbar.h>
115 #include <wx/bitmap.h>
127 //RaC: It is important if it exists a double relation
128 //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
129 class wxTabPanelsManager;
130 class wxVtkSceneManager;
132 class wxGUIEditorGraphicBBS : public wxFrame
135 wxGUIEditorGraphicBBS(wxFrame *parent);
136 ~wxGUIEditorGraphicBBS();
140 void initTabPanelsManager();
141 void initPackageBrowser();
142 void initHelpHTMLBrowser();
143 wxAuiNotebook* getAuiNotebook();
145 // Display the info of the black box highlighted in the PackageBrowser
146 void displayBlackBoxInfo(std::string packageName, std::string boxName);
148 // Shows the textStatus in the wxFrame status bar
149 void updateStatusBar(std::string textStatus);
151 // Executes the BBS script in parameter
152 void executeScript(std::string script);
154 // Shows the dialog to change the parameters and values of the black box
155 void editBlackBox(GBlackBoxModel *bbmodel);
157 bool boxNameExists(std::string boxname);
158 bool isCurrentDiagramComplexBox();
160 // Checks and adds if necessary the .bbg/.bbs extensions
161 std::string CheckExtension (std::string filename, std::string extension);
162 // Method that can be used to refresh the help and package browser
164 void RegenerateAll();
165 void DoRegeneratePackageDoc(const std::string& pack);
166 void DoRegenerateBoxesLists();
168 // Refresh the state of buttons and menus when changing for example the mode to edit complex box
169 void refreshGUIControls();
171 void SaveActualBBS(std::string filename);
172 void AskComplexBoxConfiguration();
173 void SaveActualComplexBox(std::string filename);
174 void SaveActualDiagram(std::string filename);
175 void SaveCurrentDiagramAs( ); //DFCH
176 void SaveTempActualDiagram(const std::string &);//FCY
180 // File menu and toolbar events
181 void OnCreateNewTab(wxCommandEvent& event);
182 void OnOpenDiagram(wxCommandEvent& event);
183 void OpenDiagram(std::string filePathName, std::string fileName);
184 void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
185 void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
186 void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
187 void OnOpenBBS(wxCommandEvent& event);
188 void OpenBBS(std::string filePathName, std::string fileName);
189 void OnSaveActualBBS(wxCommandEvent& event);
190 void OnSaveActualComplexBox(wxCommandEvent& event);
191 void OnExecuteActualDiagram(wxCommandEvent& event);
192 void OnClickBtnExecutableBox(wxCommandEvent& event);
193 void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
194 void OnCenterViewActualDiagram(wxCommandEvent& event);
195 void OnClickBtnBox(wxCommandEvent& event);
196 void OnClickBtnComplexBox(wxCommandEvent& event);
197 void OnAddComplexBoxInput(wxCommandEvent& event);
198 void OnAddComplexBoxOutput(wxCommandEvent& event);
199 void OnExit(wxCommandEvent& event);
200 void OnHelpBBeditor(wxCommandEvent& event);
201 void OnUndo(wxCommandEvent& event);
202 void OnRedo(wxCommandEvent& event);
203 void OnChangeName(wxCommandEvent& event);
204 void OnEditDiagramProperties(wxCommandEvent& event);
205 void OnShowTree(wxCommandEvent& event); //CFT
206 void OnEditComplexBoxScript(wxCommandEvent& event);
210 void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
214 void OnCreatePackage(wxCommandEvent& event);
215 void OnCreateBlackBox(wxCommandEvent& event);
216 void OnPlugPackage(wxCommandEvent& event);
217 void OnEditConfig(wxCommandEvent& event);
218 void OnShowHTMLDoc(wxCommandEvent& event);
219 void OnCreateIndex(wxCommandEvent& event);
220 void OpenScript(std::string filePathNameBBS ,std::string boxType);
222 bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
223 bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
224 bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
226 Factory::Pointer GetBBTKFactory();
229 void enableComplexBox();
230 void disableComplexBox();
232 // Getters and Setters of current diagram properties
234 void setCurrentDiagramDescription(std::string description);
235 void setCurrentDiagramAuthor(std::string author);
236 void setCurrentDiagramCategory(std::string category);
237 void setCurrentDiagramMessageKind(std::string kind);
238 void setCurrentDiagramMessageLevel(std::string level);
240 std::string getCurrentDiagramDescription();
241 std::string getCurrentDiagramAuthor();
242 std::string getCurrentDiagramCategory();
243 std::string getCurrentDiagramMessageKind();
244 std::string getCurrentDiagramMessageLevel();
248 //AuiManager for the wxWindow
249 wxAuiManager *_frameAUIMgr;
251 //Class that manages all the tabs in the window
252 wxTabPanelsManager *_tabsMgr;
254 //Notebook managed by the wxTabPanelsManager
255 wxAuiNotebook *_notebook;
257 //Instance to the BBTK Package Browser
258 WxGUIPackageBrowser2 *_pkgBrowser;
260 //Instance to the BBTK Help Browser
261 WxGUIHtmlBrowser *_helpHtmlBrowser;
263 //Name of the box and its package that is shown in the browser
264 std::string _actualPkgBrowserBoxName;
265 std::string _actualPkgBrowserPkgName;
267 // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
268 // RaC 2012 2nd HackFest
269 std::string _currentBBGversion;
272 wxVtkSceneManager *_sceneM;