]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
c0255da5686e4dbc98eb685a8c84bf31bd895f07
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxGEditorTabPanel.cxx
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 *  \file
33 *  \brief Class bbtk::wxGEditorTabPanel .
34 */
35
36
37 #include "wxGEditorTabPanel.h"
38 #include "creaWx.h"
39
40 namespace bbtk
41 {
42
43         //=========================================================================
44         wxGEditorTabPanel::wxGEditorTabPanel()
45         {
46                 printf ("EED %p wxGEditorTabPanel 1 ()\n" , this );
47         }
48
49         //=========================================================================
50         wxGEditorTabPanel::wxGEditorTabPanel(wxWindow *parent,int id):wxPanel(parent),wxTextDropTarget()
51         {
52 printf("EED wxGEditorTabPanel::wxGEditorTabPanel 0\n");
53                 printf ("EED %p wxGEditorTabPanel 2 ()\n" , this );
54                 _id=id;
55                 _panelAUIMgr = new wxAuiManager(this);
56                 _sceneManager = NULL;
57                 initWxVtkCanvas();
58 printf("EED wxGEditorTabPanel::wxGEditorTabPanel 1\n");
59         }
60
61         //=========================================================================
62         wxGEditorTabPanel::~wxGEditorTabPanel()
63         {
64 printf ("EED %p ~wxGEditorTabPanel()\n" , this );
65 //ED02JUIN2010          _sceneManager->disconnectDrop();
66
67         _panelsManager->VerifyLastTabPanel();
68
69         }
70
71         //=========================================================================
72         void wxGEditorTabPanel::initWxVtkCanvas()
73         {
74 printf("EED wxGEditorTabPanel::initWxVtkCanvas 0\n");
75                 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
76                 baseview->Configure();
77                 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
78
79
80 //EED02JUIN2010
81                 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
82                 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
83
84                 _panelAUIMgr->Update();
85 printf("EED wxGEditorTabPanel::initWxVtkCanvas 1\n");
86         }
87
88         //=========================================================================
89
90         bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
91         {
92                 std::string packageName="";
93                 std::string boxType="";
94
95                 wxString foo( (data) );
96                 char str[150];
97                 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
98
99                 char delims[] = ":";
100                  char *result = NULL;
101                  result = strtok( str, delims );
102                  packageName += result;
103
104                  result = strtok( NULL, delims );
105                  boxType += result;
106
107                 _sceneManager->createGBlackBox(x,y,packageName, boxType);
108
109           return true;
110         }
111
112         //=========================================================================
113
114         void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
115         {
116                 _panelsManager = panelsManager;
117         }
118
119         //=========================================================================
120
121         void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
122         {
123                 _panelsManager->displayBlackBoxInfo(packageName,boxName);
124         }
125
126         //=========================================================================
127
128         void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
129         {
130                 _panelsManager->updateStatusBar(textStatus);
131         }
132
133         //=========================================================================
134
135         std::string wxGEditorTabPanel::getDiagramBBS(bool wln)
136         {
137                 return _sceneManager->getDiagramBBS(wln);
138         }
139
140         //=========================================================================
141
142         std::string wxGEditorTabPanel::saveComplexBoxBBS()
143         {
144                 return _sceneManager->saveComplexBoxBBS();
145         }
146
147         //=========================================================================
148
149         void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
150         {
151                 _panelsManager->editBlackBox(bbmodel);
152         }
153
154         //=========================================================================
155
156         void wxGEditorTabPanel::deleteAllBoxes()
157         {
158                 _sceneManager->deleteAllBoxes();
159         }
160
161         //=========================================================================
162
163         void wxGEditorTabPanel::centerView()
164         {
165                 _sceneManager->centerView();
166         }
167
168         //=========================================================================
169
170         void wxGEditorTabPanel::saveDiagram(std::string &content)
171         {
172                 _sceneManager->saveDiagram(content);
173         }
174
175         //=========================================================================
176
177         void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
178         {
179                 _sceneManager->loadDiagram(inputStream);
180         }
181
182         //=========================================================================
183
184         int wxGEditorTabPanel::getPanelId()
185         {
186                 return _id;
187         }
188
189         //=========================================================================
190
191         bool wxGEditorTabPanel::isComplexBox()
192         {
193                 return _sceneManager->isComplexBox();
194         }
195
196         //=========================================================================
197
198         void wxGEditorTabPanel::setComplexBox(bool val)
199         {
200                 _sceneManager->setComplexBox(val);
201         }
202
203         //=========================================================================
204
205         void wxGEditorTabPanel::addComplexInputPort(std::string portName)
206         {
207                 _sceneManager->createGComplexBoxInputPort(portName);
208         }
209
210         //=========================================================================
211
212         void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
213         {
214                 _sceneManager->createGComplexBoxOutputPort(portName);
215         }
216
217         //=========================================================================
218
219         std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
220         {
221                 return _sceneManager->getSelectedObjects();
222         }
223
224         //=========================================================================
225
226         void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
227         {
228                 _sceneManager->addObjects(objectsMap);
229         }
230
231         //=========================================================================
232
233         int wxGEditorTabPanel::getNumSelectedObjects()
234         {
235                 return _sceneManager->getNumSelectedObjects();
236         }
237
238         //=========================================================================
239
240
241         wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
242         {
243                 return _sceneManager;
244         }
245
246         //=========================================================================
247     std::string wxGEditorTabPanel::GetCbName()
248         {
249             return _sceneManager->GetCbName();
250         }
251
252
253         //=========================================================================
254     std::string wxGEditorTabPanel::GetCbPackageName()
255         {
256             return _sceneManager->GetCbPackageName();
257         }
258
259         //=========================================================================
260     std::string wxGEditorTabPanel::GetAuthor()
261         {
262             return _sceneManager->GetAuthor();
263         }
264
265         //=========================================================================
266     std::string wxGEditorTabPanel::GetDescription()
267         {
268             return _sceneManager->GetDescription();
269         }
270
271         //=========================================================================
272     std::string wxGEditorTabPanel::GetCategory()
273         {
274             return _sceneManager->GetCategory();
275         }
276
277         //=========================================================================
278     void wxGEditorTabPanel::SetCbName(std::string cbName)
279     {
280         _sceneManager->SetCbName( cbName );
281     }
282
283         //=========================================================================
284     void wxGEditorTabPanel::SetCbPackageName(std::string packagename)
285     {
286         _sceneManager->SetCbPackageName( packagename );
287     }
288
289
290         //=========================================================================
291     void wxGEditorTabPanel::SetAuthor(std::string author)
292     {
293         _sceneManager->SetAuthor( author );
294     }
295
296
297         //=========================================================================
298     void wxGEditorTabPanel::SetCategory(std::string category)
299     {
300         _sceneManager->SetCategory( category );
301     }
302
303
304         //=========================================================================
305     void wxGEditorTabPanel::SetDescription(std::string description)
306     {
307         _sceneManager->SetDescription( description );
308     }
309
310
311
312
313
314
315
316
317 }  // EO namespace bbtk
318
319 // EOF