]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
#3132 bbGEditor Feature New Normal - branch changeWx28to30 compilation with wxWidgets3
[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  *  \file
37  *  \brief Class bbtk::BlackBox : abstract black-box interface.
38  */
39
40 /****
41 * Design and Developpement of BBTK GEditor
42 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
43 * RaC - 2010
44 ****/
45
46 #ifndef __WxGUIEditorGraphicBBS_h__
47 #define __WxGUIEditorGraphicBBS_h__
48
49 //Includes same project
50 #include "wxTabPanelsManager.h"
51 #include "wxBlackBoxEditionDialog.h"
52 #include "wxDiagramPropertiesEditionDialog.h"
53 #include "wxVtkSceneManager.h"
54 #include "GlobalConstants.h"
55
56
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"
72
73 //Includes creaMaracasVisu
74
75 //Includes bbtk
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>
83
84 //Includes vtk
85
86 //Includes wxWidgets
87 #include <wx/frame.h>
88 #include <wx/aui/aui.h>
89 #include <wx/aui/auibook.h>
90 #include <wx/panel.h>
91 #include <wx/toolbar.h>
92 #include <wx/bitmap.h>
93 #include <wx/menu.h>
94 #include <wx/dnd.h>
95 #include <wx/grid.h>
96
97 //Includes std
98 #include <iostream>
99 #include <fstream>
100 #include <vector>
101
102 namespace bbtk
103 {
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;
108
109         class  wxGUIEditorGraphicBBS : public wxFrame
110         {
111                 public:
112                         wxGUIEditorGraphicBBS(wxFrame *parent);
113                         ~wxGUIEditorGraphicBBS();
114
115                         void initToolbar();
116                         void initMenu();
117                         void initTabPanelsManager();
118                         void initPackageBrowser();
119                         void initHelpHTMLBrowser();
120                         wxAuiNotebook* getAuiNotebook();
121
122                         // Display the info of the black box highlighted in the PackageBrowser
123                         void displayBlackBoxInfo(std::string packageName, std::string boxName);
124
125                         // Shows the textStatus in the wxFrame status bar
126                         void updateStatusBar(std::string textStatus);
127
128                         // Executes the BBS script in parameter
129                         void executeScript(std::string script);
130
131                         // Shows the dialog to change the parameters and values of the black box
132                         void editBlackBox(GBlackBoxModel *bbmodel);
133
134                         bool boxNameExists(std::string boxname);
135                         bool isCurrentDiagramComplexBox();
136
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
140                         // RaC TOFIX!!!
141                         void RegenerateAll();
142                         void DoRegeneratePackageDoc(const std::string& pack);
143                         void DoRegenerateBoxesLists();
144
145                         // Refresh the state of buttons and menus when changing for example the mode to edit complex box
146                         void refreshGUIControls();
147                         
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
154
155
156
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 OnClickBtnComplexBox(wxCommandEvent& event);
174                         void OnAddComplexBoxInput(wxCommandEvent& event);
175                         void OnAddComplexBoxOutput(wxCommandEvent& event);
176                         void OnExit(wxCommandEvent& event);
177                         void OnHelpBBeditor(wxCommandEvent& event);
178                         void OnUndo(wxCommandEvent& event);
179                         void OnRedo(wxCommandEvent& event);
180                         void OnChangeName(wxCommandEvent& event);
181                         void OnEditDiagramProperties(wxCommandEvent& event);
182                         void OnShowTree(wxCommandEvent& event); //CFT
183                         void OnEditComplexBoxScript(wxCommandEvent& event);
184
185                 
186                         // Edit menu events
187                         void OnCopySelectedToComplexDiagram(wxCommandEvent& event);                   
188                        
189
190                         // Tool menu events
191                         void OnCreatePackage(wxCommandEvent& event);
192                         void OnCreateBlackBox(wxCommandEvent& event);
193                         void OnPlugPackage(wxCommandEvent& event);
194                         void OnEditConfig(wxCommandEvent& event);
195                         void OnShowHTMLDoc(wxCommandEvent& event);
196                         void OnCreateIndex(wxCommandEvent& event);
197                         void OpenScript(std::string filePathNameBBS ,std::string boxType);
198
199                         bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
200                         bool TryToOpenScriptComplexBox(std::string packageName ,std::string boxType);
201                         bool TryToOpenScript(std::string packageName ,std::string boxType,bool scriptApplication, bool scriptComplexBox);
202                 
203                         Factory::Pointer GetBBTKFactory();
204                 
205                         // RaC-2012
206                         void enableComplexBox();
207                         void disableComplexBox();
208
209                         // Getters and Setters of current diagram properties
210
211                         void setCurrentDiagramDescription(std::string description);
212                         void setCurrentDiagramAuthor(std::string author);
213                         void setCurrentDiagramCategory(std::string category);
214                         void setCurrentDiagramMessageKind(std::string kind);
215                         void setCurrentDiagramMessageLevel(std::string level);
216
217                         std::string getCurrentDiagramDescription();
218                         std::string getCurrentDiagramAuthor();
219                         std::string getCurrentDiagramCategory();
220                         std::string getCurrentDiagramMessageKind();
221                         std::string getCurrentDiagramMessageLevel();
222                 
223                 private:
224
225                         //AuiManager for the wxWindow
226                         wxAuiManager                                            *_frameAUIMgr;
227
228                         //Class that manages all the tabs in the window
229                         wxTabPanelsManager                                      *_tabsMgr;
230
231                         //Notebook managed by the wxTabPanelsManager
232                         wxAuiNotebook                                           *_notebook;
233
234                         //Instance to the BBTK Package Browser
235                         WxGUIPackageBrowser2                            *_pkgBrowser;
236
237                         //Instance to the BBTK Help Browser
238                         WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
239
240                         //Name of the box and its package that is shown in the browser
241                         std::string                         _actualPkgBrowserBoxName;
242                         std::string                         _actualPkgBrowserPkgName;
243
244                         // VERY IMPORTANT FOR SAVE&LOAD PROCESSES
245                         // RaC 2012 2nd HackFest
246                         std::string                                             _currentBBGversion;
247                         
248                         NodeTreeC tree;
249                         wxVtkSceneManager *_sceneM;
250                 protected:
251
252
253  };
254
255
256 }
257 // namespace bbtk
258 #endif
259