]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
#3084 bbGEditor Bug New Normal - Color refresh for inputs and outputs
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxGEditorTabPanel.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 __wxGEditorTabPanel_h__
70 #define __wxGEditorTabPanel_h__
71
72 //Includes same project
73 #include "wxVtkSceneManager.h"
74 #include "wxTabPanelsManager.h"
75
76 //Includes wxWidgets
77 #include <wx/panel.h>
78 #include <wx/aui/aui.h>
79 #include <wx/dnd.h>
80
81 //Includes creaMaracasVisu
82 #include <wxVtk3DBaseView.h>
83
84 //Includes std
85 #include <fstream>
86
87 namespace bbtk
88 {
89
90         class tmpClasswxTextDropTarget :   public wxTextDropTarget
91         {
92                 public:
93                   virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data) { return false;}
94         };
95
96
97         //RaC: It is important if it exists a double relation
98         //e.g. wxGEditorTabPanel includes wxVtkSceneManager, and wxVtkSceneManager includes wxGEditorTabPanel
99         class wxVtkSceneManager;
100         class wxTabPanelsManager;
101
102         // RaC Be careful with the double heritance
103         class wxGEditorTabPanel :  public wxPanel, public wxTextDropTarget
104         {
105         public:
106                 wxGEditorTabPanel();
107                 wxGEditorTabPanel(wxWindow *parent, int id, Factory::Pointer bbtkfactory);
108                 ~wxGEditorTabPanel();
109
110                 void initWxVtkCanvas();
111
112                 // Sets the parent manager
113                 void setPanelsManager(wxTabPanelsManager* panelsManager);
114
115                 // Get the BBS script of the pipeline diagram included in the panel
116                 std::string getDiagramBBS(bool wln=false);
117
118                 // Saves the actual BBS as complex box
119                 // RaC TOFIX It must be included the package of the complex box
120                 std::string saveComplexBoxBBS();
121
122                 // Shows the dialog to edit black box parameters
123                 void editBlackBox(GBlackBoxModel *bbmodel);
124
125                 // Save diagram as BBG
126                 void saveDiagram(std::string &content, const std::string &path); //DFCH
127
128                 // Save temporary diagram as BBG
129                 void saveTempDiagram(const std::string &);
130
131                 // Save temporary diagram as BBG and update buttons
132                 void saveTempandUpdate(const std::string &);
133
134                 // Load BBG diagram
135                 void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
136
137                 void saveStringAction(const std::string &action);
138
139                 // Load temporary diagram as BBG
140                 void  loadTempDiagram(unsigned short un);
141
142                 // evaluate the position in the undo actions list
143                 unsigned short getUndoState(std::string &);
144
145                 // evaluate the position in the redo actions list
146                 unsigned short getRedoState(std::string &);
147
148                 // Add a new complex input object to the scene
149                 void addComplexInputPort(std::string portName);
150
151                 // Add a new complex output object to the scene
152                 void addComplexOutputPort(std::string portName);
153
154                 // Delete all boxes in the diagram
155                 void deleteAllBoxes();
156
157                 // Center the camera in the initial position
158                 void centerView();
159
160                 // Display feedback info in the GUI
161                 void displayBlackBoxInfo(std::string packageName, std::string boxName);
162                 void updateStatusBar(std::string textStatus);
163
164                 int getPanelId();
165                 bool isComplexBox();
166                 void setComplexBox(bool val);
167
168                 // Returns a map with the id,controller of all the objects selected
169                 std::map<int,GObjectController*> getSelectedObjects();
170
171                 void addObjects(std::map<int,GObjectController*> objectsMap);
172                 int getNumSelectedObjects();
173
174                 // Receives the string from a drag and drop source as for example the BBTK Package Browser
175                 virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
176
177                 wxVtkSceneManager* getSceneManager();
178
179                 void SetFullPath( const std::string& );
180                 void SetFileName( const std::string& );
181                 void SetCbName(std::string cbName);
182         void SetCbPackageName(std::string packagename);
183         void SetAuthor(std::string author);
184         void SetCategory(std::string category);
185         void SetDescription(std::string description);
186                 void SetMessageKind(std::string kind);
187         void SetMessageLevel(std::string level);
188         //Getters
189         std::string GetFullPath( );
190         std::string GetFileName( );
191         std::string GetCbName();
192         std::string GetCbPackageName();
193         std::string GetAuthor();
194         std::string GetDescription();
195         std::string GetCategory();
196                 std::string GetMessageKind();
197         std::string GetMessageLevel();
198
199         //=========================================================================
200
201         private:
202                 std::vector<std::string> states;                                // represents each modification of the tab. Maxixum size 100!!
203                 std::vector<std::string>::iterator _actualdo;   // actual position on modifications vector
204                 std::vector<std::string> sstates;                               // represents string of each modification of the tab. Maxixum size 100!!
205                 std::vector<std::string>::iterator _sactualdo;  // actual position onstring  modifications vector
206                 int                                             _id;
207                 wxAuiManager                    *_panelAUIMgr;
208                 wxVtkSceneManager               *_sceneManager;
209                 wxTabPanelsManager              *_panelsManager;
210                 std::string                             _fullPath;
211                 std::string                             _fileName;
212         protected:
213                 Factory::Pointer                _bbtkfactory;
214
215         };
216
217
218 }
219 // namespace bbtk
220 #endif
221