]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
Feature #1347
[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, const std::string &path) //DFCH
136         {
137                 _actual->saveDiagram(content, path);
138         }
139
140         //=========================================================================
141
142         void wxTabPanelsManager::loadDiagram(ifstream &inputStream, const std::string &path) //DFCH
143         {
144                 _actual->loadDiagram(inputStream, path);
145         }
146         //=========================================================================
147         void wxTabPanelsManager::saveTempActualDiagram() //FCY
148         {
149                 _actual->saveTempDiagram();
150         }
151         //=========================================================================
152         unsigned short wxTabPanelsManager::loadTempDiagram(unsigned short un) //FCY
153         {
154                 return _actual->loadTempDiagram(un);
155         }
156
157         //=========================================================================
158
159         bool wxTabPanelsManager::isActualDiagramComplexBox()
160         {
161                 return _actual->isComplexBox();
162         }
163
164         //=========================================================================
165
166         void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
167         {
168                 _actual->setComplexBox(val);
169         }
170
171         //=========================================================================
172
173         void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
174         {
175                 _actual->addComplexInputPort(portName);
176         }
177
178         //=========================================================================
179
180         void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
181         {
182                 _actual->addComplexOutputPort(portName);
183         }
184
185         //=========================================================================
186
187         void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
188         {
189                 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
190                 addNewTab();
191                 setActualDiagramComplexBox(true);
192                 _actual->addObjects(mapSelected);
193                 _parent->refreshGUIControls();
194         }
195
196         //=========================================================================
197
198         int wxTabPanelsManager::getNumActualSelectedObjects()
199         {
200                 return _actual->getNumSelectedObjects();
201         }
202
203         //=========================================================================
204
205         void wxTabPanelsManager::VerifyLastTabPanel()
206         {
207 printf("wxTabPanelsManager::VerifyActualTabPanel  %d \n", this->_notebook->GetPageCount() );
208             if (this->_notebook->GetPageCount()==0)
209             {
210                 this->_actual=NULL;
211             }
212         }
213
214         //=========================================================================
215
216         void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
217         {
218                 int index                   = event.GetSelection();
219                 wxGEditorTabPanel* tab      = (wxGEditorTabPanel*)_notebook->GetPage(index);
220                 int id                      = tab->getPanelId();
221                 _actual                     = _panels[id];
222                 _parent->refreshGUIControls();
223         }
224
225         //=========================================================================
226     std::string wxTabPanelsManager::GetCbName()
227         {
228             return _actual->GetCbName();
229         }
230         
231         //=========================================================================
232         void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
233         {
234             int id          = _notebook->GetSelection();
235             _notebook->SetPageText( id , tabpanelname );
236         }
237
238         //=========================================================================
239         //DFCH
240         std::string wxTabPanelsManager::GetCurrentTabPanelPath( )
241         {
242                 int id          = _notebook->GetSelection();
243                 wxGEditorTabPanel* auxPanel = (wxGEditorTabPanel*) _notebook->GetPage(id);
244                 return( auxPanel->GetFullPath( ) );
245             //return ( (wxGEditorTabPanel) _notebook->GetPage(id)->GetFullPath( ) );
246         }
247
248
249         //=========================================================================
250     std::string wxTabPanelsManager::GetCbPackageName()
251         {
252             return _actual->GetCbPackageName();
253         }
254
255         //=========================================================================
256     std::string wxTabPanelsManager::GetAuthor()
257         {
258             return _actual->GetAuthor();
259         }
260
261         //=========================================================================
262     std::string wxTabPanelsManager::GetDescription()
263         {
264             return _actual->GetDescription();
265         }
266
267         //=========================================================================
268     std::string wxTabPanelsManager::GetCategory()
269         {
270             return _actual->GetCategory();
271         }
272
273         //=========================================================================
274     void wxTabPanelsManager::SetCbName(std::string cbName)
275     {
276         _actual->SetCbName( cbName );
277     }
278
279         //=========================================================================
280     void wxTabPanelsManager::SetCbPackageName(std::string packagename)
281     {
282         _actual->SetCbPackageName( packagename );
283     }
284
285
286         //=========================================================================
287     void wxTabPanelsManager::SetAuthor(std::string author)
288     {
289         _actual->SetAuthor( author );
290     }
291
292
293         //=========================================================================
294     void wxTabPanelsManager::SetCategory(std::string category)
295     {
296         _actual->SetCategory( category );
297     }
298
299
300         //=========================================================================
301     void wxTabPanelsManager::SetDescription(std::string description)
302     {
303         _actual->SetDescription( description );
304     }
305
306
307
308
309
310
311
312
313
314
315 }  // EO namespace bbtk
316
317 // EOF
318