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);
147 //=========================================================================
149 bool wxTabPanelsManager::isActualDiagramComplexBox()
151 return _actual->isComplexBox();
154 //=========================================================================
156 void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
158 _actual->setComplexBox(val);
161 //=========================================================================
163 void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
165 _actual->addComplexInputPort(portName);
168 //=========================================================================
170 void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
172 _actual->addComplexOutputPort(portName);
175 //=========================================================================
177 void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
179 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
181 setActualDiagramComplexBox(true);
182 _actual->addObjects(mapSelected);
183 _parent->refreshGUIControls();
186 //=========================================================================
188 int wxTabPanelsManager::getNumActualSelectedObjects()
190 return _actual->getNumSelectedObjects();
193 //=========================================================================
195 void wxTabPanelsManager::VerifyLastTabPanel()
197 printf("wxTabPanelsManager::VerifyActualTabPanel %d \n", this->_notebook->GetPageCount() );
198 if (this->_notebook->GetPageCount()==0)
204 //=========================================================================
206 void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
208 int index = event.GetSelection();
209 wxGEditorTabPanel* tab = (wxGEditorTabPanel*)_notebook->GetPage(index);
210 int id = tab->getPanelId();
211 _actual = _panels[id];
212 _parent->refreshGUIControls();
215 //=========================================================================
216 std::string wxTabPanelsManager::GetCbName()
218 return _actual->GetCbName();
221 //=========================================================================
222 void wxTabPanelsManager::SetNameTabPanel(wxString tabpanelname)
224 int id = _notebook->GetSelection();
225 _notebook->SetPageText( id , tabpanelname );
228 //=========================================================================
230 std::string wxTabPanelsManager::GetCurrentTabPanelPath( )
232 int id = _notebook->GetSelection();
233 wxGEditorTabPanel* auxPanel = (wxGEditorTabPanel*) _notebook->GetPage(id);
234 return( auxPanel->GetFullPath( ) );
235 //return ( (wxGEditorTabPanel) _notebook->GetPage(id)->GetFullPath( ) );
239 //=========================================================================
240 std::string wxTabPanelsManager::GetCbPackageName()
242 return _actual->GetCbPackageName();
245 //=========================================================================
246 std::string wxTabPanelsManager::GetAuthor()
248 return _actual->GetAuthor();
251 //=========================================================================
252 std::string wxTabPanelsManager::GetDescription()
254 return _actual->GetDescription();
257 //=========================================================================
258 std::string wxTabPanelsManager::GetCategory()
260 return _actual->GetCategory();
263 //=========================================================================
264 void wxTabPanelsManager::SetCbName(std::string cbName)
266 _actual->SetCbName( cbName );
269 //=========================================================================
270 void wxTabPanelsManager::SetCbPackageName(std::string packagename)
272 _actual->SetCbPackageName( packagename );
276 //=========================================================================
277 void wxTabPanelsManager::SetAuthor(std::string author)
279 _actual->SetAuthor( author );
283 //=========================================================================
284 void wxTabPanelsManager::SetCategory(std::string category)
286 _actual->SetCategory( category );
290 //=========================================================================
291 void wxTabPanelsManager::SetDescription(std::string description)
293 _actual->SetDescription( description );
305 } // EO namespace bbtk