]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
*** empty log message ***
[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
40 namespace bbtk
41 {
42
43
44         //=========================================================================
45         wxTabPanelsManager::wxTabPanelsManager(wxGUIEditorGraphicBBS *parent)
46         {
47                 printf ("EED %p wxTabPanelsManager()\n" , this );
48                 _parent = parent;
49                 _lastId = 0;
50                 _notebook = _parent->getAuiNotebook();
51                 addNewTab();
52                 _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
53         }
54
55         //=========================================================================
56         wxTabPanelsManager::~wxTabPanelsManager()
57         {
58                 printf ("EED %p ~wxTabPanelsManager()\n" , this );
59         }
60         
61         //=========================================================================
62         void wxTabPanelsManager::addNewTab()
63         {
64                 _lastId++;
65                 wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
66                 newPanel->setPanelsManager(this);
67                 _panels[_lastId]=newPanel;
68                 _actual = newPanel;
69                 _notebook->AddPage(newPanel,_T("Diagram"),true);
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()
101         {
102                 return _actual->getDiagramBBS();
103         }
104
105         //=========================================================================
106
107         std::string wxTabPanelsManager::getActualComplexBoxBBS(std::string cbName,std::string cbAuthor,std::string cbCategory,std::string cbDescription)
108         {
109                 return _actual->saveComplexBoxBBS(cbName,cbAuthor,cbCategory,cbDescription);
110         }
111
112         //=========================================================================
113
114         void wxTabPanelsManager::editBlackBox(GBlackBoxModel *bbmodel)
115         {
116                 _parent->editBlackBox(bbmodel);
117         }
118
119         //=========================================================================
120
121         void wxTabPanelsManager::editDiagramParameters(wxVtkSceneManager* scene)
122         {
123                 _parent->editDiagramParameters(scene);
124         }
125
126         //=========================================================================
127
128         void wxTabPanelsManager::deleteAllBoxesActualDiagram()
129         {
130                 _actual->deleteAllBoxes();
131         }
132
133         //=========================================================================
134
135         void wxTabPanelsManager::centerViewActualDiagram()
136         {
137                 _actual->centerView();
138         }
139
140         //=========================================================================
141
142         void wxTabPanelsManager::saveActualDiagram(std::string &content)
143         {
144                 _actual->saveDiagram(content);
145         }
146
147         //=========================================================================
148
149         void wxTabPanelsManager::loadDiagram(ifstream &inputStream)
150         {
151                 _actual->loadDiagram(inputStream);
152         }
153
154         //=========================================================================
155
156         bool wxTabPanelsManager::isActualDiagramComplexBox()
157         {
158                 return _actual->isComplexBox();
159         }
160
161         //=========================================================================
162
163         void wxTabPanelsManager::setActualDiagramComplexBox(bool val)
164         {
165                 _actual->setComplexBox(val);    
166         }
167
168         //=========================================================================
169         
170         void wxTabPanelsManager::addActualDiagramComplexInputPort(std::string portName)
171         {
172                 _actual->addComplexInputPort(portName);
173         }
174
175         //=========================================================================
176
177         void wxTabPanelsManager::addActualDiagramComplexOutputPort(std::string portName)
178         {
179                 _actual->addComplexOutputPort(portName);
180         }
181
182         //=========================================================================
183
184         void wxTabPanelsManager::copySelectedBBoxesToComplexDiagram()
185         {
186                 std::map<int,GObjectController*> mapSelected = _actual->getSelectedObjects();
187                 addNewTab();
188                 setActualDiagramComplexBox(true);
189                 _actual->addObjects(mapSelected);
190                 _parent->refreshGUIControls();
191         }
192
193         //=========================================================================
194
195         int wxTabPanelsManager::getNumActualSelectedObjects()
196         {
197                 return _actual->getNumSelectedObjects();
198         }
199
200         //=========================================================================
201
202         void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
203         {
204                 int index = event.GetSelection();
205                 wxGEditorTabPanel* tab =(wxGEditorTabPanel*)_notebook->GetPage(index);          
206                 int id = tab->getPanelId();
207                 _actual = _panels[id];
208                 _parent->refreshGUIControls();
209         }
210
211         //=========================================================================
212
213
214
215 }  // EO namespace bbtk
216
217 // EOF
218