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"
95 //Includes creaMaracasVisu
98 #include <bbtkWxGUIPackageBrowser2.h>
99 #include <bbtkWxGUIHtmlBrowser.h>
100 #include <bbtkBlackBoxDescriptor.h>
101 #include <bbtkUtilities.h>
102 #include <bbtkConfigurationFile.h>
103 #include <bbtkSystemTools.h>
108 #include <wx/frame.h>
109 #include <wx/aui/aui.h>
110 #include <wx/aui/auibook.h>
111 #include <wx/panel.h>
112 #include <wx/toolbar.h>
113 #include <wx/bitmap.h>
124 //RaC: It is important if it exists a double relation
125 //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
126 class wxTabPanelsManager;
127 class wxVtkSceneManager;
129 class wxGUIEditorGraphicBBS : public wxFrame
132 wxGUIEditorGraphicBBS(wxFrame *parent);
133 ~wxGUIEditorGraphicBBS();
137 void initTabPanelsManager();
138 void initPackageBrowser();
139 void initHelpHTMLBrowser();
140 wxAuiNotebook* getAuiNotebook();
142 // Display the info of the black box highlighted in the PackageBrowser
143 void displayBlackBoxInfo(std::string packageName, std::string boxName);
145 // Shows the textStatus in the wxFrame status bar
146 void updateStatusBar(std::string textStatus);
148 // Executes the BBS script in parameter
149 void executeScript(std::string script);
151 // Shows the dialog to change the parameters and values of the black box
152 void editBlackBox(GBlackBoxModel *bbmodel);
154 bool boxNameExists(std::string boxname);
155 bool isCurrentDiagramComplexBox();
157 // Checks and adds if necessary the .bbg/.bbs extensions
158 std::string CheckExtension (std::string filename, std::string extension);
159 // Method that can be used to refresh the help and package browser
161 void RegenerateAll();
162 void DoRegeneratePackageDoc(const std::string& pack);
163 void DoRegenerateBoxesLists();
165 // Refresh the state of buttons and menus when changing for example the mode to edit complex box
166 void refreshGUIControls();
168 void SaveActualBBS(std::string filename);
169 void AskComplexBoxConfiguration();
170 void SaveActualComplexBox(std::string filename);
171 void SaveActualDiagram(std::string filename);
172 void SaveCurrentDiagramAs( ); //DFCH
173 void SaveTempActualDiagram(const std::string &);//FCY
177 // File menu and toolbar events
178 void OnCreateNewTab(wxCommandEvent& event);
179 void OnOpenDiagram(wxCommandEvent& event);
180 void OpenDiagram(std::string filePathName, std::string fileName);
181 void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
182 void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
183 void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
184 void OnOpenBBS(wxCommandEvent& event);
185 void OpenBBS(std::string filePathName, std::string fileName);
186 void OnSaveActualBBS(wxCommandEvent& event);
187 void OnSaveActualComplexBox(wxCommandEvent& event);
188 void OnExecuteActualDiagram(wxCommandEvent& event);
189 void OnClickBtnExecutableBox(wxCommandEvent& event);
190 void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
191 void OnCenterViewActualDiagram(wxCommandEvent& event);
192 void OnClickBtnBox(wxCommandEvent& event);
193 void OnClickBtnComplexBox(wxCommandEvent& event);
194 void OnAddComplexBoxInput(wxCommandEvent& event);
195 void OnAddComplexBoxOutput(wxCommandEvent& event);
196 void OnExit(wxCommandEvent& event);
197 void OnHelpBBeditor(wxCommandEvent& event);
198 void OnUndo(wxCommandEvent& event);
199 void OnRedo(wxCommandEvent& event);
200 void OnChangeName(wxCommandEvent& event);
201 void OnEditDiagramProperties(wxCommandEvent& event);
202 void OnEditComplexBoxScript(wxCommandEvent& event);
206 void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
210 void OnCreatePackage(wxCommandEvent& event);
211 void OnCreateBlackBox(wxCommandEvent& event);
212 void OnPlugPackage(wxCommandEvent& event);
213 void OnEditConfig(wxCommandEvent& event);
214 void OnShowHTMLDoc(wxCommandEvent& event);
215 void OnCreateIndex(wxCommandEvent& event);
216 void OpenScript(std::string filePathNameBBS ,std::string boxType);
218 bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
219 bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
220 bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
222 Factory::Pointer GetBBTKFactory();
225 void enableComplexBox();
226 void disableComplexBox();
228 // Getters and Setters of current diagram properties
230 void setCurrentDiagramDescription(std::string description);
231 void setCurrentDiagramAuthor(std::string author);
232 void setCurrentDiagramCategory(std::string category);
234 std::string getCurrentDiagramDescription();
235 std::string getCurrentDiagramAuthor();
236 std::string getCurrentDiagramCategory();
241 //AuiManager for the wxWindow
242 wxAuiManager *_frameAUIMgr;
244 //Class that manages all the tabs in the window
245 wxTabPanelsManager *_tabsMgr;
247 //Notebook managed by the wxTabPanelsManager
248 wxAuiNotebook *_notebook;
250 //Instance to the BBTK Package Browser
251 WxGUIPackageBrowser2 *_pkgBrowser;
253 //Instance to the BBTK Help Browser
254 WxGUIHtmlBrowser *_helpHtmlBrowser;
256 //Name of the box and its package that is shown in the browser
257 std::string _actualPkgBrowserBoxName;
258 std::string _actualPkgBrowserPkgName;
260 // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
261 // RaC 2012 2nd HackFest
262 std::string _currentBBGversion;