1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::wxTabPanelsManager .
37 #include "wxTabPanelsManager.h"
43 //=========================================================================
44 wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
48 _notebook = _parent->getAuiNotebook();
50 _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
53 //=========================================================================
54 wxTabPanelsManager::~wxTabPanelsManager()
58 //=========================================================================
59 void wxTabPanelsManager::addNewTab(wxString tabName)
61 printf("EED wxTabPanelsManager::addNewTab 0\n");
64 wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
65 newPanel->setPanelsManager(this);
66 _panels[_lastId] = newPanel;
68 _notebook->AddPage(newPanel, tabName ,true);
69 printf("EED wxTabPanelsManager::addNewTab 1\n");
72 //=========================================================================
73 wxAuiNotebook* wxTabPanelsManager::getAuiNotebook()
78 //=========================================================================
79 wxGEditorTabPanel* wxTabPanelsManager::getActualTabPanel()
84 //=========================================================================
86 void wxTabPanelsManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
88 _parent->displayBlackBoxInfo(packageName,boxName);
91 //=========================================================================
93 void wxTabPanelsManager::updateStatusBar(std::string textStatus)
95 _parent->updateStatusBar(textStatus);
98 //=========================================================================
100 std::string wxTabPanelsManager::getActualDiagramBBS(bool wln)
102 return _actual->getDiagramBBS(wln);
105 //=========================================================================
107 std::string wxTabPanelsManager::getActualComplexBoxBBS()
109 return _actual->saveComplexBoxBBS();
112 //=========================================================================
114 void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
116 _parent->editBlackBox(bbmodel);
119 //=========================================================================
121 void wxTabPanelsManager::deleteAllBoxesActualDiagram()
123 _actual->deleteAllBoxes();
126 //=========================================================================
128 void wxTabPanelsManager::centerViewActualDiagram()
130 _actual->centerView();
133 //=========================================================================
135 void wxTabPanelsManager::saveActualDiagram(std::string &content, const std::string &path) //DFCH
137 _actual->saveDiagram(content, path);
140 //=========================================================================
142 void wxTabPanelsManager::loadDiagram(ifstream &inputStream, const std::string &path) //DFCH
144 _actual->loadDiagram(inputStream, path);
146 //=========================================================================
147 void wxTabPanelsManager::saveTempActualDiagram() //FCY
149 _actual->saveTempDiagram();
151 //=========================================================================
152 unsigned short wxTabPanelsManager::loadTempDiagram(unsigned short un) //FCY
154 return _actual->loadTempDiagram(un);
157 //=========================================================================
159 bool wxTabPanelsManager::isActualDiagramComplexBox()
161 return _actual->isComplexBox();
164 //=========================================================================
166 void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
168 _actual->setComplexBox(val);
171 //=========================================================================
173 void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
175 _actual->addComplexInputPort(portName);
178 //=========================================================================
180 void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
182 _actual->addComplexOutputPort(portName);
185 //=========================================================================
187 void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
189 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
191 setActualDiagramComplexBox(true);
192 _actual->addObjects(mapSelected);
193 _parent->refreshGUIControls();
196 //=========================================================================
198 int wxTabPanelsManager::getNumActualSelectedObjects()
200 return _actual->getNumSelectedObjects();
203 //=========================================================================
205 void wxTabPanelsManager::VerifyLastTabPanel()
207 printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
208 if (this->_notebook->GetPageCount()==0)
214 //=========================================================================
216 void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
218 int index = event.GetSelection();
219 wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index);
220 int id = tab->getPanelId();
221 _actual = _panels[id];
222 _parent->refreshGUIControls();
225 //=========================================================================
226 std::string wxTabPanelsManager::GetCbName()
228 return _actual->GetCbName();
231 //=========================================================================
232 void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
234 int id = _notebook->GetSelection();
235 _notebook->SetPageText( id , tabpanelname );
238 //=========================================================================
240 std::string wxTabPanelsManager::GetCurrentTabPanelPath( )
242 int id = _notebook->GetSelection();
243 wxGEditorTabPanel* auxPanel = (wxGEditorTabPanel*) _notebook->GetPage(id);
244 return( auxPanel->GetFullPath( ) );
245 //return ( (wxGEditorTabPanel) _notebook->GetPage(id)->GetFullPath( ) );
249 //=========================================================================
250 std::string wxTabPanelsManager::GetCbPackageName()
252 return _actual->GetCbPackageName();
255 //=========================================================================
256 std::string wxTabPanelsManager::GetAuthor()
258 return _actual->GetAuthor();
261 //=========================================================================
262 std::string wxTabPanelsManager::GetDescription()
264 return _actual->GetDescription();
267 //=========================================================================
268 std::string wxTabPanelsManager::GetCategory()
270 return _actual->GetCategory();
273 //=========================================================================
274 void wxTabPanelsManager::SetCbName(std::string cbName)
276 _actual->SetCbName( cbName );
279 //=========================================================================
280 void wxTabPanelsManager::SetCbPackageName(std::string packagename)
282 _actual->SetCbPackageName( packagename );
286 //=========================================================================
287 void wxTabPanelsManager::SetAuthor(std::string author)
289 _actual->SetAuthor( author );
293 //=========================================================================
294 void wxTabPanelsManager::SetCategory(std::string category)
296 _actual->SetCategory( category );
300 //=========================================================================
301 void wxTabPanelsManager::SetDescription(std::string description)
303 _actual->SetDescription( description );
315 } // EO namespace bbtk