]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
Feature #1771 Add licence terms for all files.
[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 <bbtkUtilities.h>
102 #include <bbtkConfigurationFile.h>
103 #include <bbtkSystemTools.h>
104
105 //Includes vtk
106
107 //Includes wxWidgets
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>
114 #include <wx/menu.h>
115 #include <wx/dnd.h>
116 #include <wx/grid.h>
117
118 //Includes std
119 #include <iostream>
120 #include <fstream>
121
122 namespace bbtk
123 {
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;
128
129         class  wxGUIEditorGraphicBBS : public wxFrame
130         {
131                 public:
132                         wxGUIEditorGraphicBBS(wxFrame *parent);
133                         ~wxGUIEditorGraphicBBS();
134
135                         void initToolbar();
136                         void initMenu();
137                         void initTabPanelsManager();
138                         void initPackageBrowser();
139                         void initHelpHTMLBrowser();
140                         wxAuiNotebook* getAuiNotebook();
141
142                         // Display the info of the black box highlighted in the PackageBrowser
143                         void displayBlackBoxInfo(std::string packageName, std::string boxName);
144
145                         // Shows the textStatus in the wxFrame status bar
146                         void updateStatusBar(std::string textStatus);
147
148                         // Executes the BBS script in parameter
149                         void executeScript(std::string script);
150
151                         // Shows the dialog to change the parameters and values of the black box
152                         void editBlackBox(GBlackBoxModel *bbmodel);
153
154                         bool boxNameExists(std::string boxname);
155                         bool isCurrentDiagramComplexBox();
156
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
160                         // RaC TOFIX!!!
161                         void RegenerateAll();
162                         void DoRegeneratePackageDoc(const std::string& pack);
163                         void DoRegenerateBoxesLists();
164
165                         // Refresh the state of buttons and menus when changing for example the mode to edit complex box
166                         void refreshGUIControls();
167                         
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
174
175
176
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);
203
204                 
205                         // Edit menu events
206                         void OnCopySelectedToComplexDiagram(wxCommandEvent& event);                   
207                        
208
209                         // Tool menu events
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);
217
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);
221                 
222                         Factory::Pointer GetBBTKFactory();
223                 
224                         // RaC-2012
225                         void enableComplexBox();
226                         void disableComplexBox();
227
228                         // Getters and Setters of current diagram properties
229
230                         void setCurrentDiagramDescription(std::string description);
231                         void setCurrentDiagramAuthor(std::string author);
232                         void setCurrentDiagramCategory(std::string category);
233
234                         std::string getCurrentDiagramDescription();
235                         std::string getCurrentDiagramAuthor();
236                         std::string getCurrentDiagramCategory();
237                 
238                 
239                 private:
240
241                         //AuiManager for the wxWindow
242                         wxAuiManager                                            *_frameAUIMgr;
243
244                         //Class that manages all the tabs in the window
245                         wxTabPanelsManager                                      *_tabsMgr;
246
247                         //Notebook managed by the wxTabPanelsManager
248                         wxAuiNotebook                                           *_notebook;
249
250                         //Instance to the BBTK Package Browser
251                         WxGUIPackageBrowser2                            *_pkgBrowser;
252
253                         //Instance to the BBTK Help Browser
254                         WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
255
256                         //Name of the box and its package that is shown in the browser
257                         std::string                         _actualPkgBrowserBoxName;
258                         std::string                         _actualPkgBrowserPkgName;
259
260                         // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
261                         // RaC 2012 2nd HackFest
262                         std::string                                             _currentBBGversion;
263
264                 protected:
265
266
267  };
268
269
270 }
271 // namespace bbtk
272 #endif
273