1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
35 * \brief Class bbtk::BlackBox : abstract black-box interface.
39 * Design and Developpement of BBTK GEditor
40 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
44 #ifndef __WxGUIEditorGraphicBBS_h__
45 #define __WxGUIEditorGraphicBBS_h__
47 //Includes same project
48 #include "wxTabPanelsManager.h"
49 #include "wxBlackBoxEditionDialog.h"
50 #include "wxDiagramPropertiesEditionDialog.h"
51 #include "wxVtkSceneManager.h"
52 #include "GlobalConstants.h"
55 #include "wxart_new.xpm" // JPR
56 #include "wxart_open.xpm"
57 #include "wxart_save.xpm"
58 #include "wxart_run.xpm"
59 #include "wxart_delete.xpm"
60 #include "wxart_centerview.xpm"
61 #include "wxart_box.xpm"
62 #include "wxart_executablebox.xpm"
63 #include "wxart_complexbox.xpm"
64 #include "wxart_complexinputport.xpm"
65 #include "wxart_complexoutputport.xpm"
66 #include "wxart_undo.xpm"
67 #include "wxart_redo.xpm"
68 #include "wxart_editProperties.xpm"
70 //Includes creaMaracasVisu
73 #include <bbtkWxGUIPackageBrowser2.h>
74 #include <bbtkWxGUIHtmlBrowser.h>
75 #include <bbtkBlackBoxDescriptor.h>
76 #include <bbtkUtilities.h>
77 #include <bbtkConfigurationFile.h>
78 #include <bbtkSystemTools.h>
84 #include <wx/aui/aui.h>
85 #include <wx/aui/auibook.h>
87 #include <wx/toolbar.h>
88 #include <wx/bitmap.h>
99 //RaC: It is important if it exists a double relation
100 //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
101 class wxTabPanelsManager;
102 class wxVtkSceneManager;
104 class wxGUIEditorGraphicBBS : public wxFrame
107 wxGUIEditorGraphicBBS(wxFrame *parent);
108 ~wxGUIEditorGraphicBBS();
112 void initTabPanelsManager();
113 void initPackageBrowser();
114 void initHelpHTMLBrowser();
115 wxAuiNotebook* getAuiNotebook();
117 // Display the info of the black box highlighted in the PackageBrowser
118 void displayBlackBoxInfo(std::string packageName, std::string boxName);
120 // Shows the textStatus in the wxFrame status bar
121 void updateStatusBar(std::string textStatus);
123 // Executes the BBS script in parameter
124 void executeScript(std::string script);
126 // Shows the dialog to change the parameters and values of the black box
127 void editBlackBox(GBlackBoxModel *bbmodel);
129 bool boxNameExists(std::string boxname);
130 bool isCurrentDiagramComplexBox();
132 // Checks and adds if necessary the .bbg/.bbs extensions
133 std::string CheckExtension (std::string filename, std::string extension);
134 // Method that can be used to refresh the help and package browser
136 void RegenerateAll();
137 void DoRegeneratePackageDoc(const std::string& pack);
138 void DoRegenerateBoxesLists();
140 // Refresh the state of buttons and menus when changing for example the mode to edit complex box
141 void refreshGUIControls();
143 void SaveActualBBS(std::string filename);
144 void AskComplexBoxConfiguration();
145 void SaveActualComplexBox(std::string filename);
146 void SaveActualDiagram(std::string filename);
147 void SaveCurrentDiagramAs( ); //DFCH
148 void SaveTempActualDiagram(const std::string &);//FCY
152 // File menu and toolbar events
153 void OnCreateNewTab(wxCommandEvent& event);
154 void OnOpenDiagram(wxCommandEvent& event);
155 void OpenDiagram(std::string filePathName, std::string fileName);
156 void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
157 void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
158 void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
159 void OnOpenBBS(wxCommandEvent& event);
160 void OpenBBS(std::string filePathName, std::string fileName);
161 void OnSaveActualBBS(wxCommandEvent& event);
162 void OnSaveActualComplexBox(wxCommandEvent& event);
163 void OnExecuteActualDiagram(wxCommandEvent& event);
164 void OnClickBtnExecutableBox(wxCommandEvent& event);
165 void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
166 void OnCenterViewActualDiagram(wxCommandEvent& event);
167 void OnClickBtnBox(wxCommandEvent& event);
168 void OnClickBtnComplexBox(wxCommandEvent& event);
169 void OnAddComplexBoxInput(wxCommandEvent& event);
170 void OnAddComplexBoxOutput(wxCommandEvent& event);
171 void OnExit(wxCommandEvent& event);
172 void OnHelpBBeditor(wxCommandEvent& event);
173 void OnUndo(wxCommandEvent& event);
174 void OnRedo(wxCommandEvent& event);
175 void OnChangeName(wxCommandEvent& event);
176 void OnEditDiagramProperties(wxCommandEvent& event);
177 void OnEditComplexBoxScript(wxCommandEvent& event);
181 void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
185 void OnCreatePackage(wxCommandEvent& event);
186 void OnCreateBlackBox(wxCommandEvent& event);
187 void OnPlugPackage(wxCommandEvent& event);
188 void OnEditConfig(wxCommandEvent& event);
189 void OnShowHTMLDoc(wxCommandEvent& event);
190 void OnCreateIndex(wxCommandEvent& event);
191 void OpenScript(std::string filePathNameBBS ,std::string boxType);
193 bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
194 bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
195 bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
197 Factory::Pointer GetBBTKFactory();
200 void enableComplexBox();
201 void disableComplexBox();
203 // Getters and Setters of current diagram properties
205 void setCurrentDiagramDescription(std::string description);
206 void setCurrentDiagramAuthor(std::string author);
207 void setCurrentDiagramCategory(std::string category);
209 std::string getCurrentDiagramDescription();
210 std::string getCurrentDiagramAuthor();
211 std::string getCurrentDiagramCategory();
216 //AuiManager for the wxWindow
217 wxAuiManager *_frameAUIMgr;
219 //Class that manages all the tabs in the window
220 wxTabPanelsManager *_tabsMgr;
222 //Notebook managed by the wxTabPanelsManager
223 wxAuiNotebook *_notebook;
225 //Instance to the BBTK Package Browser
226 WxGUIPackageBrowser2 *_pkgBrowser;
228 //Instance to the BBTK Help Browser
229 WxGUIHtmlBrowser *_helpHtmlBrowser;
231 //Name of the box and its package that is shown in the browser
232 std::string _actualPkgBrowserBoxName;
233 std::string _actualPkgBrowserPkgName;
235 // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
236 // RaC 2012 2nd HackFest
237 std::string _currentBBGversion;