]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
33ad462b69e23b2ad2a1582be76ae18d9de5a0a3
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxTabPanelsManager.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::wxTabPanelsManager .
34 */
35
36
37 #include "wxTabPanelsManager.h"
38
39 namespace bbtk
40 {
41
42
43         //=========================================================================
44         wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
45         {
46                 _parent         = parent;
47                 _lastId         = 0;
48                 _notebook       = _parent->getAuiNotebook();
49                 addNewTab();
50                 _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
51         }
52
53         //=========================================================================
54         wxTabPanelsManager::~wxTabPanelsManager()
55         {
56         }
57
58         //=========================================================================
59         void wxTabPanelsManager::addNewTab(wxString tabName)
60         {
61 printf("EED wxTabPanelsManager::addNewTab 0\n");
62
63                 _lastId++;
64                 wxGEditorTabPanel *newPanel         = new wxGEditorTabPanel(_notebook,_lastId);
65                 newPanel->setPanelsManager(this);
66                 _panels[_lastId]                    = newPanel;
67                 _actual                             = newPanel;
68                 _notebook->AddPage(newPanel, tabName  ,true);
69 printf("EED wxTabPanelsManager::addNewTab 1\n");
70         }
71
72         //=========================================================================
73         wxAuiNotebook* wxTabPanelsManager::getAuiNotebook()
74         {
75                 return _notebook;
76         }
77
78         //=========================================================================
79         wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel()
80         {
81                 return _actual;
82         }
83
84         //=========================================================================
85
86         void wxTabPanelsManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
87         {
88                 _parent->displayBlackBoxInfo(packageName,boxName);
89         }
90
91         //=========================================================================
92
93         void wxTabPanelsManager::updateStatusBar(std::string textStatus)
94         {
95                 _parent->updateStatusBar(textStatus);
96         }
97
98         //=========================================================================
99
100         std::string wxTabPanelsManager::getActualDiagramBBS(bool wln)
101         {
102                 return _actual->getDiagramBBS(wln);
103         }
104
105         //=========================================================================
106
107         std::string wxTabPanelsManager::getActualComplexBoxBBS()
108         {
109                 return _actual->saveComplexBoxBBS();
110         }
111
112         //=========================================================================
113
114         void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
115         {
116                 _parent->editBlackBox(bbmodel);
117         }
118
119         //=========================================================================
120
121         void wxTabPanelsManager::deleteAllBoxesActualDiagram()
122         {
123                 _actual->deleteAllBoxes();
124         }
125
126         //=========================================================================
127
128         void wxTabPanelsManager::centerViewActualDiagram()
129         {
130                 _actual->centerView();
131         }
132
133         //=========================================================================
134
135         void wxTabPanelsManager::saveActualDiagram(std::string &content)
136         {
137                 _actual->saveDiagram(content);
138         }
139
140         //=========================================================================
141
142         void wxTabPanelsManager::loadDiagram(ifstream &inputStream)
143         {
144                 _actual->loadDiagram(inputStream);
145         }
146
147         //=========================================================================
148
149         bool wxTabPanelsManager::isActualDiagramComplexBox()
150         {
151                 return _actual->isComplexBox();
152         }
153
154         //=========================================================================
155
156         void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
157         {
158                 _actual->setComplexBox(val);
159         }
160
161         //=========================================================================
162
163         void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
164         {
165                 _actual->addComplexInputPort(portName);
166         }
167
168         //=========================================================================
169
170         void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
171         {
172                 _actual->addComplexOutputPort(portName);
173         }
174
175         //=========================================================================
176
177         void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
178         {
179                 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
180                 addNewTab();
181                 setActualDiagramComplexBox(true);
182                 _actual->addObjects(mapSelected);
183                 _parent->refreshGUIControls();
184         }
185
186         //=========================================================================
187
188         int wxTabPanelsManager::getNumActualSelectedObjects()
189         {
190                 return _actual->getNumSelectedObjects();
191         }
192
193         //=========================================================================
194
195         void wxTabPanelsManager::VerifyLastTabPanel()
196         {
197 printf("wxTabPanelsManager::VerifyActualTabPanel  %d \n", this->_notebook->GetPageCount() );
198             if (this->_notebook->GetPageCount()==0)
199             {
200                 this->_actual=NULL;
201             }
202         }
203
204         //=========================================================================
205
206         void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
207         {
208                 int index                   = event.GetSelection();
209                 wxGEditorTabPanel* tab      = (wxGEditorTabPanel*)_notebook->GetPage(index);
210                 int id                      = tab->getPanelId();
211                 _actual                     = _panels[id];
212                 _parent->refreshGUIControls();
213         }
214
215         //=========================================================================
216     std::string wxTabPanelsManager::GetCbName()
217         {
218             return _actual->GetCbName();
219         }
220
221         void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
222         {
223             int id          = _notebook->GetSelection();
224             _notebook->SetPageText( id , tabpanelname );
225         }
226
227
228
229         //=========================================================================
230     std::string wxTabPanelsManager::GetCbPackageName()
231         {
232             return _actual->GetCbPackageName();
233         }
234
235         //=========================================================================
236     std::string wxTabPanelsManager::GetAuthor()
237         {
238             return _actual->GetAuthor();
239         }
240
241         //=========================================================================
242     std::string wxTabPanelsManager::GetDescription()
243         {
244             return _actual->GetDescription();
245         }
246
247         //=========================================================================
248     std::string wxTabPanelsManager::GetCategory()
249         {
250             return _actual->GetCategory();
251         }
252
253         //=========================================================================
254     void wxTabPanelsManager::SetCbName(std::string cbName)
255     {
256         _actual->SetCbName( cbName );
257     }
258
259         //=========================================================================
260     void wxTabPanelsManager::SetCbPackageName(std::string packagename)
261     {
262         _actual->SetCbPackageName( packagename );
263     }
264
265
266         //=========================================================================
267     void wxTabPanelsManager::SetAuthor(std::string author)
268     {
269         _actual->SetAuthor( author );
270     }
271
272
273         //=========================================================================
274     void wxTabPanelsManager::SetCategory(std::string category)
275     {
276         _actual->SetCategory( category );
277     }
278
279
280         //=========================================================================
281     void wxTabPanelsManager::SetDescription(std::string description)
282     {
283         _actual->SetDescription( description );
284     }
285
286
287
288
289
290
291
292
293
294
295 }  // EO namespace bbtk
296
297 // EOF
298