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