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 void wxTabPanelsManager::loadTempDiagram(unsigned short un) //FCY
154 _actual->loadTempDiagram(un);
157 //=========================================================================
158 unsigned short wxTabPanelsManager::getUndoState() //FCY
160 return _actual->getUndoState();
162 //=========================================================================
163 unsigned short wxTabPanelsManager::getRedoState() //FCY
165 return _actual->getRedoState();
167 //=========================================================================
169 bool wxTabPanelsManager::isActualDiagramComplexBox()
171 return _actual->isComplexBox();
174 //=========================================================================
176 void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
178 _actual->setComplexBox(val);
181 //=========================================================================
183 void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
185 _actual->addComplexInputPort(portName);
188 //=========================================================================
190 void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
192 _actual->addComplexOutputPort(portName);
195 //=========================================================================
197 void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
199 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
201 setActualDiagramComplexBox(true);
202 _actual->addObjects(mapSelected);
203 _parent->refreshGUIControls();
206 //=========================================================================
208 int wxTabPanelsManager::getNumActualSelectedObjects()
210 return _actual->getNumSelectedObjects();
213 //=========================================================================
215 void wxTabPanelsManager::VerifyLastTabPanel()
217 printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
218 if (this->_notebook->GetPageCount()==0)
224 //=========================================================================
226 void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
228 int index = event.GetSelection();
229 wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index);
230 int id = tab->getPanelId();
231 _actual = _panels[id];
232 _parent->refreshGUIControls();
236 //=========================================================================
237 std::string wxTabPanelsManager::GetCbName()
239 return _actual->GetCbName();
242 //=========================================================================
243 void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
245 int id = _notebook->GetSelection();
246 _notebook->SetPageText( id , tabpanelname );
249 std::string wxTabPanelsManager::GetNameTabPanel()
251 int id = _notebook->GetSelection();
252 return crea::wx2std(_notebook->GetPageText(id));
255 //=========================================================================
257 std::string wxTabPanelsManager::GetCurrentTabPanelPath( )
259 int id = _notebook->GetSelection();
260 wxGEditorTabPanel* auxPanel = (wxGEditorTabPanel*) _notebook->GetPage(id);
261 return( auxPanel->GetFullPath( ) );
262 //return ( (wxGEditorTabPanel) _notebook->GetPage(id)->GetFullPath( ) );
266 //=========================================================================
267 std::string wxTabPanelsManager::GetCbPackageName()
269 return _actual->GetCbPackageName();
272 //=========================================================================
273 std::string wxTabPanelsManager::GetAuthor()
275 return _actual->GetAuthor();
278 //=========================================================================
279 std::string wxTabPanelsManager::GetDescription()
281 return _actual->GetDescription();
284 //=========================================================================
285 std::string wxTabPanelsManager::GetCategory()
287 return _actual->GetCategory();
290 //=========================================================================
291 void wxTabPanelsManager::SetCbName(std::string cbName)
293 _actual->SetCbName( cbName );
296 //=========================================================================
297 void wxTabPanelsManager::SetCbPackageName(std::string packagename)
299 _actual->SetCbPackageName( packagename );
303 //=========================================================================
304 void wxTabPanelsManager::SetAuthor(std::string author)
306 _actual->SetAuthor( author );
310 //=========================================================================
311 void wxTabPanelsManager::SetCategory(std::string category)
313 _actual->SetCategory( category );
317 //=========================================================================
318 void wxTabPanelsManager::SetDescription(std::string description)
320 _actual->SetDescription( description );
332 } // EO namespace bbtk