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