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_executablebox.xpm"
65 #include "wxart_complexbox.xpm"
66 #include "wxart_complexinputport.xpm"
67 #include "wxart_complexoutputport.xpm"
68 #include "wxart_undo.xpm"
69 #include "wxart_redo.xpm"
70 #include "wxart_editProperties.xpm"
71 #include "wxart_showTree.xpm"
73 //Includes creaMaracasVisu
76 #include <bbtkWxGUIPackageBrowser2.h>
77 #include <bbtkWxGUIHtmlBrowser.h>
78 #include <bbtkBlackBoxDescriptor.h>
79 #include <bbtkComplexBlackBoxDescriptor.h>
80 #include <bbtkUtilities.h>
81 #include <bbtkConfigurationFile.h>
82 #include <bbtkSystemTools.h>
88 #include <wx/aui/aui.h>
89 #include <wx/aui/auibook.h>
91 #include <wx/toolbar.h>
92 #include <wx/bitmap.h>
104 //RaC: It is important if it exists a double relation
105 //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
106 class wxTabPanelsManager;
107 class wxVtkSceneManager;
109 class wxGUIEditorGraphicBBS : public wxFrame
112 wxGUIEditorGraphicBBS(wxFrame *parent);
113 ~wxGUIEditorGraphicBBS();
117 void initTabPanelsManager();
118 void initPackageBrowser();
119 void initHelpHTMLBrowser();
120 wxAuiNotebook* getAuiNotebook();
122 // Display the info of the black box highlighted in the PackageBrowser
123 void displayBlackBoxInfo(std::string packageName, std::string boxName);
125 // Shows the textStatus in the wxFrame status bar
126 void updateStatusBar(std::string textStatus);
128 // Executes the BBS script in parameter
129 void executeScript(std::string script);
131 // Shows the dialog to change the parameters and values of the black box
132 void editBlackBox(GBlackBoxModel *bbmodel);
134 bool boxNameExists(std::string boxname);
135 bool isCurrentDiagramComplexBox();
137 // Checks and adds if necessary the .bbg/.bbs extensions
138 std::string CheckExtension (std::string filename, std::string extension);
139 // Method that can be used to refresh the help and package browser
141 void RegenerateAll();
142 void DoRegeneratePackageDoc(const std::string& pack);
143 void DoRegenerateBoxesLists();
145 // Refresh the state of buttons and menus when changing for example the mode to edit complex box
146 void refreshGUIControls();
148 void SaveActualBBS(std::string filename);
149 void AskComplexBoxConfiguration();
150 void SaveActualComplexBox(std::string filename);
151 void SaveActualDiagram(std::string filename);
152 void SaveCurrentDiagramAs( ); //DFCH
153 void SaveTempActualDiagram(const std::string &);//FCY
157 // File menu and toolbar events
158 void OnCreateNewTab(wxCommandEvent& event);
159 void OnOpenDiagram(wxCommandEvent& event);
160 void OpenDiagram(std::string filePathName, std::string fileName);
161 void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
162 void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
163 void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
164 void OnOpenBBS(wxCommandEvent& event);
165 void OpenBBS(std::string filePathName, std::string fileName);
166 void OnSaveActualBBS(wxCommandEvent& event);
167 void OnSaveActualComplexBox(wxCommandEvent& event);
168 void OnExecuteActualDiagram(wxCommandEvent& event);
169 void OnClickBtnExecutableBox(wxCommandEvent& event);
170 void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
171 void OnCenterViewActualDiagram(wxCommandEvent& event);
172 void OnClickBtnBox(wxCommandEvent& event);
173 void OnClickBtnSelectBoxes(wxCommandEvent& event);
174 void OnClickBtnComplexBox(wxCommandEvent& event);
175 void OnAddComplexBoxInput(wxCommandEvent& event);
176 void OnAddComplexBoxOutput(wxCommandEvent& event);
177 void OnExit(wxCommandEvent& event);
178 void OnHelpBBeditor(wxCommandEvent& event);
179 void OnUndo(wxCommandEvent& event);
180 void OnRedo(wxCommandEvent& event);
181 void OnChangeName(wxCommandEvent& event);
182 void OnEditDiagramProperties(wxCommandEvent& event);
183 void OnShowTree(wxCommandEvent& event); //CFT
184 void OnEditComplexBoxScript(wxCommandEvent& event);
188 void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
192 void OnCreatePackage(wxCommandEvent& event);
193 void OnCreateBlackBox(wxCommandEvent& event);
194 void OnPlugPackage(wxCommandEvent& event);
195 void OnEditConfig(wxCommandEvent& event);
196 void OnShowHTMLDoc(wxCommandEvent& event);
197 void OnCreateIndex(wxCommandEvent& event);
198 void OpenScript(std::string filePathNameBBS ,std::string boxType);
200 bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
201 bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
202 bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
204 Factory::Pointer GetBBTKFactory();
207 void enableComplexBox();
208 void disableComplexBox();
210 // Getters and Setters of current diagram properties
212 void setCurrentDiagramDescription(std::string description);
213 void setCurrentDiagramAuthor(std::string author);
214 void setCurrentDiagramCategory(std::string category);
215 void setCurrentDiagramMessageKind(std::string kind);
216 void setCurrentDiagramMessageLevel(std::string level);
218 std::string getCurrentDiagramDescription();
219 std::string getCurrentDiagramAuthor();
220 std::string getCurrentDiagramCategory();
221 std::string getCurrentDiagramMessageKind();
222 std::string getCurrentDiagramMessageLevel();
226 //AuiManager for the wxWindow
227 wxAuiManager *_frameAUIMgr;
229 //Class that manages all the tabs in the window
230 wxTabPanelsManager *_tabsMgr;
232 //Notebook managed by the wxTabPanelsManager
233 wxAuiNotebook *_notebook;
235 //Instance to the BBTK Package Browser
236 WxGUIPackageBrowser2 *_pkgBrowser;
238 //Instance to the BBTK Help Browser
239 WxGUIHtmlBrowser *_helpHtmlBrowser;
241 //Name of the box and its package that is shown in the browser
242 std::string _actualPkgBrowserBoxName;
243 std::string _actualPkgBrowserPkgName;
245 // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
246 // RaC 2012 2nd HackFest
247 std::string _currentBBGversion;
250 wxVtkSceneManager *_sceneM;