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