]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
3095472384d836174ff197575401b14668e1c497
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.h
1 /*=========================================================================
2   Program:   bbtk
3   Module:    $RCSfile$
4   Language:  C++
5   Date:      $Date$
6   Version:   $Revision$
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
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.
20 *
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
25 *  liability.
26 *
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 * ------------------------------------------------------------------------ */
30
31
32
33 /**
34  *  \file
35  *  \brief Class bbtk::BlackBox : abstract black-box interface.
36  */
37
38 /****
39 * Design and Developpement of BBTK GEditor
40 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
41 * RaC - 2010
42 ****/
43
44 #ifndef __WxGUIEditorGraphicBBS_h__
45 #define __WxGUIEditorGraphicBBS_h__
46
47 //Includes same project
48 #include "wxTabPanelsManager.h"
49 #include "wxBlackBoxEditionDialog.h"
50 #include "wxDiagramPropertiesEditionDialog.h"
51 #include "wxVtkSceneManager.h"
52 #include "GlobalConstants.h"
53
54
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"
69
70 //Includes creaMaracasVisu
71
72 //Includes bbtk
73 #include <bbtkWxGUIPackageBrowser2.h>
74 #include <bbtkWxGUIHtmlBrowser.h>
75 #include <bbtkBlackBoxDescriptor.h>
76 #include <bbtkUtilities.h>
77 #include <bbtkConfigurationFile.h>
78 #include <bbtkSystemTools.h>
79
80 //Includes vtk
81
82 //Includes wxWidgets
83 #include <wx/frame.h>
84 #include <wx/aui/aui.h>
85 #include <wx/aui/auibook.h>
86 #include <wx/panel.h>
87 #include <wx/toolbar.h>
88 #include <wx/bitmap.h>
89 #include <wx/menu.h>
90 #include <wx/dnd.h>
91 #include <wx/grid.h>
92
93 //Includes std
94 #include <iostream>
95 #include <fstream>
96
97 namespace bbtk
98 {
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;
103
104         class  wxGUIEditorGraphicBBS : public wxFrame
105         {
106                 public:
107                         wxGUIEditorGraphicBBS(wxFrame *parent);
108                         ~wxGUIEditorGraphicBBS();
109
110                         void initToolbar();
111                         void initMenu();
112                         void initTabPanelsManager();
113                         void initPackageBrowser();
114                         void initHelpHTMLBrowser();
115                         wxAuiNotebook* getAuiNotebook();
116
117                         // Display the info of the black box highlighted in the PackageBrowser
118                         void displayBlackBoxInfo(std::string packageName, std::string boxName);
119
120                         // Shows the textStatus in the wxFrame status bar
121                         void updateStatusBar(std::string textStatus);
122
123                         // Executes the BBS script in parameter
124                         void executeScript(std::string script);
125
126                         // Shows the dialog to change the parameters and values of the black box
127                         void editBlackBox(GBlackBoxModel *bbmodel);
128
129                         bool boxNameExists(std::string boxname);
130
131                         // Checks and adds if necessary the .bbg/.bbs extensions
132                         std::string CheckExtension (std::string filename, std::string extension);                       
133                         // Method that can be used to refresh the help and package browser
134                         // RaC TOFIX!!!
135                         void RegenerateAll();
136                         void DoRegeneratePackageDoc(const std::string& pack);
137                         void DoRegenerateBoxesLists();
138
139                         // Refresh the state of buttons and menus when changing for example the mode to edit complex box
140                         void refreshGUIControls();
141                         
142             void SaveActualBBS(std::string filename);
143             void AskComplexBoxConfiguration();
144             void SaveActualComplexBox(std::string filename);
145             void SaveActualDiagram(std::string filename);
146                         void SaveCurrentDiagramAs( ); //DFCH
147                         void SaveTempActualDiagram(const std::string &);//FCY
148
149
150                         // File menu and toolbar events
151                         void OnCreateNewTab(wxCommandEvent& event);
152                         void OnOpenDiagram(wxCommandEvent& event);
153                         void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
154                         void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
155                         void OnOpenBBS(wxCommandEvent& event);
156                         void OnSaveActualBBS(wxCommandEvent& event);
157                         void OnSaveActualComplexBox(wxCommandEvent& event);
158                         void OnExecuteActualDiagram(wxCommandEvent& event);
159                         void OnClickBtnExecutableBox(wxCommandEvent& event);
160                         void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
161                         void OnCenterViewActualDiagram(wxCommandEvent& event);
162                         void OnClickBtnBox(wxCommandEvent& event);
163                         void OnClickBtnComplexBox(wxCommandEvent& event);
164                         void OnAddComplexBoxInput(wxCommandEvent& event);
165                         void OnAddComplexBoxOutput(wxCommandEvent& event);
166                         void OnExit(wxCommandEvent& event);
167                         void OnHelpBBeditor(wxCommandEvent& event);
168                         void OnUndo(wxCommandEvent& event);
169                         void OnRedo(wxCommandEvent& event);
170                         void OnChangeName(wxCommandEvent& event);
171                         void OnEditDiagramProperties(wxCommandEvent& event);
172
173                         // Edit menu events
174                         void OnCopySelectedToComplexDiagram(wxCommandEvent& event);                   
175                        
176
177                         // Tool menu events
178                         void OnCreatePackage(wxCommandEvent& event);
179                         void OnCreateBlackBox(wxCommandEvent& event);
180                         void OnPlugPackage(wxCommandEvent& event);
181                         void OnEditConfig(wxCommandEvent& event);
182                         void OnShowHTMLDoc(wxCommandEvent& event);
183                         void OnCreateIndex(wxCommandEvent& event);
184                 
185                         // Getters and Setters of current diagram properties
186                         // RaC-2012
187                         void setCurrentDiagramDescription(std::string description);
188                         void setCurrentDiagramAuthor(std::string author);
189                         void setCurrentDiagramCategory(std::string category);
190
191                         std::string getCurrentDiagramDescription();
192                         std::string getCurrentDiagramAuthor();
193                         std::string getCurrentDiagramCategory();
194                 
195                 
196                 private:
197
198                         //AuiManager for the wxWindow
199                         wxAuiManager                                            *_frameAUIMgr;
200
201                         //Class that manages all the tabs in the window
202                         wxTabPanelsManager                                      *_tabsMgr;
203
204                         //Notebook managed by the wxTabPanelsManager
205                         wxAuiNotebook                                           *_notebook;
206
207                         //Instance to the BBTK Package Browser
208                         WxGUIPackageBrowser2                            *_pkgBrowser;
209
210                         //Instance to the BBTK Help Browser
211                         WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
212
213                         //Name of the box and its package that is shown in the browser
214                         std::string                         _actualPkgBrowserBoxName;
215                         std::string                         _actualPkgBrowserPkgName;
216
217                 protected:
218
219
220  };
221
222
223 }
224 // namespace bbtk
225 #endif
226