]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
Display of the tree obtained in the information dialog window in BBEditor. 12/05...
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 #
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.
14 #
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
19 #  liability. 
20 #
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 # ------------------------------------------------------------------------  
24 */
25
26 /*=========================================================================
27   Program:   bbtk
28   Module:    $RCSfile$
29   Language:  C++
30   Date:      $Date$
31   Version:   $Revision$
32 =========================================================================*/
33
34 /* ---------------------------------------------------------------------
35
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
38 *
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.
45 *
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
50 *  liability.
51 *
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 * ------------------------------------------------------------------------ */
55
56
57
58 /**
59  *  \file
60  *  \brief Class bbtk::BlackBox : abstract black-box interface.
61  */
62
63 /****
64 * Design and Developpement of BBTK GEditor
65 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
66 * RaC - 2010
67 ****/
68
69 #ifndef __WxGUIEditorGraphicBBS_h__
70 #define __WxGUIEditorGraphicBBS_h__
71
72 //Includes same project
73 #include "wxTabPanelsManager.h"
74 #include "wxBlackBoxEditionDialog.h"
75 #include "wxDiagramPropertiesEditionDialog.h"
76 #include "wxVtkSceneManager.h"
77 #include "GlobalConstants.h"
78
79
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
95 //Includes creaMaracasVisu
96
97 //Includes bbtk
98 #include <bbtkWxGUIPackageBrowser2.h>
99 #include <bbtkWxGUIHtmlBrowser.h>
100 #include <bbtkBlackBoxDescriptor.h>
101 #include <bbtkComplexBlackBoxDescriptor.h>
102 #include <bbtkUtilities.h>
103 #include <bbtkConfigurationFile.h>
104 #include <bbtkSystemTools.h>
105
106 //Includes vtk
107
108 //Includes wxWidgets
109 #include <wx/frame.h>
110 #include <wx/aui/aui.h>
111 #include <wx/aui/auibook.h>
112 #include <wx/panel.h>
113 #include <wx/toolbar.h>
114 #include <wx/bitmap.h>
115 #include <wx/menu.h>
116 #include <wx/dnd.h>
117 #include <wx/grid.h>
118
119 //Includes std
120 #include <iostream>
121 #include <fstream>
122 #include <vector>
123
124 namespace bbtk
125 {
126         //RaC: It is important if it exists a double relation
127         //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
128         class wxTabPanelsManager;
129         class wxVtkSceneManager;
130
131         class  wxGUIEditorGraphicBBS : public wxFrame
132         {
133                 public:
134                         wxGUIEditorGraphicBBS(wxFrame *parent);
135                         ~wxGUIEditorGraphicBBS();
136
137                         void initToolbar();
138                         void initMenu();
139                         void initTabPanelsManager();
140                         void initPackageBrowser();
141                         void initHelpHTMLBrowser();
142                         wxAuiNotebook* getAuiNotebook();
143
144                         // Display the info of the black box highlighted in the PackageBrowser
145                         void displayBlackBoxInfo(std::string packageName, std::string boxName);
146
147                         // Shows the textStatus in the wxFrame status bar
148                         void updateStatusBar(std::string textStatus);
149
150                         // Executes the BBS script in parameter
151                         void executeScript(std::string script);
152
153                         // Shows the dialog to change the parameters and values of the black box
154                         void editBlackBox(GBlackBoxModel *bbmodel);
155
156                         bool boxNameExists(std::string boxname);
157                         bool isCurrentDiagramComplexBox();
158
159                         // Checks and adds if necessary the .bbg/.bbs extensions
160                         std::string CheckExtension (std::string filename, std::string extension);                       
161                         // Method that can be used to refresh the help and package browser
162                         // RaC TOFIX!!!
163                         void RegenerateAll();
164                         void DoRegeneratePackageDoc(const std::string& pack);
165                         void DoRegenerateBoxesLists();
166
167                         // Refresh the state of buttons and menus when changing for example the mode to edit complex box
168                         void refreshGUIControls();
169                         
170             void SaveActualBBS(std::string filename);
171             void AskComplexBoxConfiguration();
172             void SaveActualComplexBox(std::string filename);
173             void SaveActualDiagram(std::string filename);
174                         void SaveCurrentDiagramAs( ); //DFCH
175                         void SaveTempActualDiagram(const std::string &);//FCY
176
177
178
179                         // File menu and toolbar events
180                         void OnCreateNewTab(wxCommandEvent& event);
181                         void OnOpenDiagram(wxCommandEvent& event);
182                         void OpenDiagram(std::string filePathName, std::string fileName); 
183                         void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
184                         void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
185                         void OnExportConsoleExecCommand(wxCommandEvent& event); //RaC
186                         void OnOpenBBS(wxCommandEvent& event);
187                         void OpenBBS(std::string filePathName, std::string fileName);
188                         void OnSaveActualBBS(wxCommandEvent& event);
189                         void OnSaveActualComplexBox(wxCommandEvent& event);
190                         void OnExecuteActualDiagram(wxCommandEvent& event);
191                         void OnClickBtnExecutableBox(wxCommandEvent& event);
192                         void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
193                         void OnCenterViewActualDiagram(wxCommandEvent& event);
194                         void OnClickBtnBox(wxCommandEvent& event);
195                         void OnClickBtnComplexBox(wxCommandEvent& event);
196                         void OnAddComplexBoxInput(wxCommandEvent& event);
197                         void OnAddComplexBoxOutput(wxCommandEvent& event);
198                         void OnExit(wxCommandEvent& event);
199                         void OnHelpBBeditor(wxCommandEvent& event);
200                         void OnUndo(wxCommandEvent& event);
201                         void OnRedo(wxCommandEvent& event);
202                         void OnChangeName(wxCommandEvent& event);
203                         void OnEditDiagramProperties(wxCommandEvent& event);
204                         void OnEditComplexBoxScript(wxCommandEvent& event);
205
206                 
207                         // Edit menu events
208                         void OnCopySelectedToComplexDiagram(wxCommandEvent& event);                   
209                        
210
211                         // Tool menu events
212                         void OnCreatePackage(wxCommandEvent& event);
213                         void OnCreateBlackBox(wxCommandEvent& event);
214                         void OnPlugPackage(wxCommandEvent& event);
215                         void OnEditConfig(wxCommandEvent& event);
216                         void OnShowHTMLDoc(wxCommandEvent& event);
217                         void OnCreateIndex(wxCommandEvent& event);
218                         void OpenScript(std::string filePathNameBBS ,std::string boxType);
219
220                         bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
221                         bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
222                         bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
223                 
224                         Factory::Pointer GetBBTKFactory();
225                 
226                         // RaC-2012
227                         void enableComplexBox();
228                         void disableComplexBox();
229
230                         // Getters and Setters of current diagram properties
231
232                         void setCurrentDiagramDescription(std::string description);
233                         void setCurrentDiagramAuthor(std::string author);
234                         void setCurrentDiagramCategory(std::string category);
235
236                         std::string getCurrentDiagramDescription();
237                         std::string getCurrentDiagramAuthor();
238                         std::string getCurrentDiagramCategory();
239                 
240                 
241                 private:
242
243                         //AuiManager for the wxWindow
244                         wxAuiManager                                            *_frameAUIMgr;
245
246                         //Class that manages all the tabs in the window
247                         wxTabPanelsManager                                      *_tabsMgr;
248
249                         //Notebook managed by the wxTabPanelsManager
250                         wxAuiNotebook                                           *_notebook;
251
252                         //Instance to the BBTK Package Browser
253                         WxGUIPackageBrowser2                            *_pkgBrowser;
254
255                         //Instance to the BBTK Help Browser
256                         WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
257
258                         //Name of the box and its package that is shown in the browser
259                         std::string                         _actualPkgBrowserBoxName;
260                         std::string                         _actualPkgBrowserPkgName;
261
262                         // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
263                         // RaC 2012 2nd HackFest
264                         std::string                                             _currentBBGversion;
265                         
266                         NodeTreeC tree;
267                 protected:
268
269
270  };
271
272
273 }
274 // namespace bbtk
275 #endif
276