]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
no message
[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 %p wxGEditorTabPanel 2 ()\n" , this );
53                 _id=id;
54                 _panelAUIMgr = new wxAuiManager(this);
55                 _sceneManager = NULL;
56                 initWxVtkCanvas();
57         }
58
59         //=========================================================================
60         wxGEditorTabPanel::~wxGEditorTabPanel()
61         {
62 printf ("EED %p ~wxGEditorTabPanel()\n" , this );
63 //ED02JUIN2010          _sceneManager->disconnectDrop();
64         }
65         
66         //=========================================================================
67         void wxGEditorTabPanel::initWxVtkCanvas()
68         {
69                 wxVtk3DBaseView *baseview = new wxVtk3DBaseView(this);
70                 baseview->Configure();
71                 _sceneManager=new wxVtkSceneManager(this,baseview,_id);
72
73                 printf("RaC-EED 21-06-2010 wxGEditorTabPanel::initWxVtkCanvas Remove the panelAUIMgr, and change to a normal sizer inside the wxGEditorTabPanel\n");
74                 _panelAUIMgr->AddPane((wxWindow*)baseview->GetWxVTKRenderWindowInteractor(),wxAuiPaneInfo().Fixed().CenterPane());
75 //EED02JUIN2010
76
77                 _panelAUIMgr->Update();
78         }
79
80         //=========================================================================
81
82         bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data)
83         {
84                 std::string packageName="";
85                 std::string boxType="";
86
87                 wxString foo( (data) );
88                 char str[150];
89                 strcpy( str, (const char*)foo.mb_str(wxConvUTF8) );
90
91                 char delims[] = ":";
92                  char *result = NULL;
93                  result = strtok( str, delims );
94                  packageName += result;
95                  
96                  result = strtok( NULL, delims );
97                  boxType += result;
98                  
99                 _sceneManager->createGBlackBox(x,y,packageName, boxType);
100
101           return true;
102         }
103
104         //=========================================================================
105
106         void wxGEditorTabPanel::setPanelsManager(wxTabPanelsManager* panelsManager)
107         {
108                 _panelsManager = panelsManager;
109         }
110
111         //=========================================================================
112
113         void wxGEditorTabPanel::displayBlackBoxInfo(std::string packageName, std::string boxName)
114         {
115                 _panelsManager->displayBlackBoxInfo(packageName,boxName);
116         }
117
118         //=========================================================================
119
120         void wxGEditorTabPanel::updateStatusBar(std::string textStatus)
121         {
122                 _panelsManager->updateStatusBar(textStatus);
123         }
124
125         //=========================================================================
126
127         std::string wxGEditorTabPanel::getDiagramBBS()
128         {
129                 return _sceneManager->getDiagramBBS();
130         }
131
132         //=========================================================================
133
134         std::string wxGEditorTabPanel::saveComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
135         {
136                 return _sceneManager->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
137         }
138
139         //=========================================================================
140
141         void wxGEditorTabPanel::editBlackBox(GBlackBoxModel *bbmodel)
142         {
143                 _panelsManager->editBlackBox(bbmodel);
144         }
145
146         //=========================================================================
147
148         void wxGEditorTabPanel::deleteAllBoxes()
149         {
150                 _sceneManager->deleteAllBoxes();
151         }
152
153         //=========================================================================
154
155         void wxGEditorTabPanel::centerView()
156         {
157                 _sceneManager->centerView();
158         }
159
160         //=========================================================================
161         
162         void wxGEditorTabPanel::saveDiagram(std::string &content)
163         {
164                 _sceneManager->saveDiagram(content);
165         }
166
167         //=========================================================================
168
169         void wxGEditorTabPanel::loadDiagram(ifstream &inputStream)
170         {
171                 _sceneManager->loadDiagram(inputStream);
172         }
173
174         //=========================================================================
175
176         int wxGEditorTabPanel::getPanelId()
177         {
178                 return _id;
179         }
180
181         //=========================================================================
182
183         bool wxGEditorTabPanel::isComplexBox()
184         {
185                 return _sceneManager->isComplexBox();
186         }
187
188         //=========================================================================
189
190         void wxGEditorTabPanel::setComplexBox(bool val)
191         {
192                 _sceneManager->setComplexBox(val);
193         }
194
195         //=========================================================================
196
197         void wxGEditorTabPanel::addComplexInputPort(std::string portName)
198         {
199                 _sceneManager->createGComplexBoxInputPort(portName);
200         }
201
202         //=========================================================================
203
204         void wxGEditorTabPanel::addComplexOutputPort(std::string portName)
205         {
206                 _sceneManager->createGComplexBoxOutputPort(portName);
207         }
208
209         //=========================================================================
210         
211         std::map<int,GObjectController*> wxGEditorTabPanel::getSelectedObjects()
212         {
213                 return _sceneManager->getSelectedObjects();
214         }
215
216         //=========================================================================
217
218         void wxGEditorTabPanel::addObjects(std::map<int,GObjectController*> objectsMap)
219         {
220                 _sceneManager->addObjects(objectsMap);
221         }
222
223         //=========================================================================     
224         
225         int wxGEditorTabPanel::getNumSelectedObjects()
226         {
227                 return _sceneManager->getNumSelectedObjects();
228         }
229
230         //=========================================================================     
231
232         
233         wxVtkSceneManager* wxGEditorTabPanel::getSceneManager()
234         {
235                 return _sceneManager;
236         }
237         
238         
239 }  // EO namespace bbtk
240
241 // EOF