]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
#1356, #1358
[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 "wxVtkSceneManager.h"
51 #include "GlobalConstants.h"
52
53 #include "wxart_new.xpm" // JPR
54 #include "wxart_open.xpm"
55 #include "wxart_save.xpm"
56 #include "wxart_run.xpm"
57 #include "wxart_delete.xpm"
58 #include "wxart_centerview.xpm"
59 #include "wxart_box.xpm"
60 #include "wxart_executablebox.xpm"
61 #include "wxart_complexbox.xpm"
62 #include "wxart_complexinputport.xpm"
63 #include "wxart_complexoutputport.xpm"
64 #include "wxart_undo.xpm"
65 #include "wxart_redo.xpm"
66
67 //Includes creaMaracasVisu
68
69 //Includes bbtk
70 #include <bbtkWxGUIPackageBrowser2.h>
71 #include <bbtkWxGUIHtmlBrowser.h>
72 #include <bbtkBlackBoxDescriptor.h>
73 #include <bbtkConfigurationFile.h>
74 #include <bbtkSystemTools.h>
75
76 //Includes vtk
77
78 //Includes wxWidgets
79 #include <wx/frame.h>
80 #include <wx/aui/aui.h>
81 #include <wx/aui/auibook.h>
82 #include <wx/panel.h>
83 #include <wx/toolbar.h>
84 #include <wx/bitmap.h>
85 #include <wx/menu.h>
86 #include <wx/dnd.h>
87 #include <wx/grid.h>
88
89 //Includes std
90 #include <iostream>
91 #include <fstream>
92
93 namespace bbtk
94 {
95         //RaC: It is important if it exists a double relation
96         //e.g. wxTabPanelsManager includes wxGUIEditorGraphicBBS, and wxGUIEditorGraphicBBS includes wxTabPanelsManager
97         class wxTabPanelsManager;
98         class wxVtkSceneManager;
99
100         class  wxGUIEditorGraphicBBS : public wxFrame
101         {
102                 public:
103                         wxGUIEditorGraphicBBS(wxFrame *parent);
104                         ~wxGUIEditorGraphicBBS();
105
106                         void initToolbar();
107                         void initMenu();
108                         void initTabPanelsManager();
109                         void initPackageBrowser();
110                         void initHelpHTMLBrowser();
111                         wxAuiNotebook* getAuiNotebook();
112
113                         // Display the info of the black box highlighted in the PackageBrowser
114                         void displayBlackBoxInfo(std::string packageName, std::string boxName);
115
116                         // Shows the textStatus in the wxFrame status bar
117                         void updateStatusBar(std::string textStatus);
118
119                         // Executes the BBS script in parameter
120                         void executeScript(std::string script);
121
122                         // Shows the dialog to change the parameters and values of the black box
123                         void editBlackBox(GBlackBoxModel *bbmodel);
124
125                         // Checks and adds if necessary the .bbg/.bbs extensions
126                         std::string CheckExtension (std::string filename, std::string extension);                       
127                         // Method that can be used to refresh the help and package browser
128                         // RaC TOFIX!!!
129                         void RegenerateAll();
130                         void DoRegeneratePackageDoc(const std::string& pack);
131                         void DoRegenerateBoxesLists();
132
133                         // Refresh the state of buttons and menus when changing for example the mode to edit complex box
134                         void refreshGUIControls();
135                         
136             void SaveActualBBS(std::string filename);
137             void AskComplexBoxConfiguration();
138             void SaveActualComplexBox(std::string filename);
139             void SaveActualDiagram(std::string filename);
140                         void SaveCurrentDiagramAs( ); //DFCH
141                         void SaveTempActualDiagram();//FCY
142
143
144                         // File menu and toolbar events
145                         void OnCreateNewTab(wxCommandEvent& event);
146                         void OnOpenDiagram(wxCommandEvent& event);
147                         void OnSaveActualDiagram(wxCommandEvent& event); //DFCH
148                         void OnSaveAsActualDiagram(wxCommandEvent& event); //DFCH
149                         void OnOpenBBS(wxCommandEvent& event);
150                         void OnSaveActualBBS(wxCommandEvent& event);
151                         void OnSaveActualComplexBox(wxCommandEvent& event);
152                         void OnExecuteActualDiagram(wxCommandEvent& event);
153                         void OnClickBtnExecutableBox(wxCommandEvent& event);
154                         void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
155                         void OnCenterViewActualDiagram(wxCommandEvent& event);
156                         void OnClickBtnBox(wxCommandEvent& event);
157                         void OnClickBtnComplexBox(wxCommandEvent& event);
158                         void OnAddComplexBoxInput(wxCommandEvent& event);
159                         void OnAddComplexBoxOutput(wxCommandEvent& event);
160                         void OnExit(wxCommandEvent& event);
161                         void OnHelpBBeditor(wxCommandEvent& event);
162                         void OnUndo(wxCommandEvent& event);
163                         void OnRedo(wxCommandEvent& event);
164
165                         // Edit menu events
166                         void OnCopySelectedToComplexDiagram(wxCommandEvent& event);
167
168                         // Tool menu events
169                         void OnCreatePackage(wxCommandEvent& event);
170                         void OnCreateBlackBox(wxCommandEvent& event);
171                         void OnPlugPackage(wxCommandEvent& event);
172                         void OnEditConfig(wxCommandEvent& event);
173                         void OnShowHTMLDoc(wxCommandEvent& event);
174                         void OnCreateIndex(wxCommandEvent& event);
175                 
176                 
177                 
178                 
179                 private:
180
181                         //AuiManager for the wxWindow
182                         wxAuiManager                                            *_frameAUIMgr;
183
184                         //Class that manages all the tabs in the window
185                         wxTabPanelsManager                                      *_tabsMgr;
186
187                         //Notebook managed by the wxTabPanelsManager
188                         wxAuiNotebook                                           *_notebook;
189
190                         //Instance to the BBTK Package Browser
191                         WxGUIPackageBrowser2                            *_pkgBrowser;
192
193                         //Instance to the BBTK Help Browser
194                         WxGUIHtmlBrowser                                        *_helpHtmlBrowser;
195
196                         //Name of the box and its package that is shown in the browser
197                         std::string                         _actualPkgBrowserBoxName;
198                         std::string                         _actualPkgBrowserPkgName;
199
200                 protected:
201
202
203  };
204
205
206 }
207 // namespace bbtk
208 #endif
209