]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h
Bug #1688 RaC 2012 Bug to avoid opening twice the same diagram. Corrected and tested.
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxTabPanelsManager.h
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
33 /**
34 *  \file
35 *  \brief Class bbtk::BlackBox : abstract black-box interface.
36 */
37
38 /****
39 * Design and Developpement of BBTK GEditor
40 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
41 * RaC - 2010
42 ****/
43
44 #ifndef __wxTabPanelsManager_h__
45 #define __wxTabPanelsManager_h__
46
47 #include <wx/aui/auibook.h>
48 #include <wx/panel.h>
49 #include <wx/string.h>
50 #include <map>
51 #include <iostream>
52 #include <creaWx.h>
53
54 #include "wxGEditorTabPanel.h"
55 #include "wxVtkSceneManager.h"
56 #include "bbtkwxGUIEditorGraphicBBS.h"
57
58 using namespace std;
59
60
61 namespace bbtk
62 {
63
64         class wxVtkSceneManager;
65         class wxGEditorTabPanel;
66         class wxGUIEditorGraphicBBS;
67
68         class wxTabPanelsManager : public wxEvtHandler
69         {
70
71         public:
72
73                 wxTabPanelsManager(wxGUIEditorGraphicBBS *parent);
74                 ~wxTabPanelsManager();
75
76                 void addNewTab(wxString tabName=_T("new_tab"));
77                 wxAuiNotebook* getAuiNotebook();
78                 wxGEditorTabPanel* getActualTabPanel();
79
80                 void displayBlackBoxInfo(std::string packageName, std::string boxName);
81                 void updateStatusBar(std::string textStatus);
82
83                 std::string getActualDiagramBBS(bool wln=false);
84                 std::string getActualComplexBoxBBS();
85
86                 void editBlackBox(GBlackBoxModel *bbmodel);
87                 void deleteAllBoxesActualDiagram();
88                 void centerViewActualDiagram();
89                 void saveActualDiagram(std::string &content, const std::string &path); //DFCH
90                 void loadDiagram(ifstream &inputStream, const std::string &path); //DFCH
91
92                 void saveTempActualDiagram(const std::string &); //FCY
93                 void saveTempandUpdate(const std::string &);
94                 void loadTempDiagram(unsigned short un); //FCY
95                 unsigned short getUndoState(std::string &);
96                 unsigned short getRedoState(std::string &);
97                 bool isActualDiagramComplexBox();
98                 void setActualDiagramComplexBox(bool val);
99                 void addActualDiagramComplexInputPort(std::string portName);
100                 void addActualDiagramComplexOutputPort(std::string portName);
101                 void copySelectedBBoxesToComplexDiagram();
102                 int getNumActualSelectedObjects();
103
104                 void OnTabChanged(wxAuiNotebookEvent& event);
105
106                 // Event handler. Runs in the moment of closing but not closed yet (for that exists the CLOSED event, but not working at all)
107                 void OnTabClose(wxAuiNotebookEvent& event);
108
109         void VerifyLastTabPanel();
110
111         // Getters and Setters of current diagram
112         void SetCbName(std::string cbName);
113         void SetCbPackageName(std::string packagename);
114         void SetAuthor(std::string author);
115         void SetCategory(std::string category);
116         void SetDescription(std::string description);
117         std::string GetCbName();
118         std::string GetCbPackageName();
119         std::string GetAuthor();
120         std::string GetDescription();
121         std::string GetCategory();
122
123             void SetNameTabPanel(wxString tabpanelname);
124                 std::string GetNameTabPanel();
125             std::string GetCurrentTabPanelPath( ); //DFCH
126             int  FindTab(std::string filename);
127
128
129
130         private:
131
132         // Private Attributes
133                 wxGUIEditorGraphicBBS           *_parent;
134                 map<int, wxGEditorTabPanel*>    _panels;
135                 wxGEditorTabPanel               *_actual;
136                 wxAuiNotebook                   *_notebook;
137                 int                             _lastId;
138
139         protected:
140
141         };
142
143
144 }
145 // namespace bbtk
146 #endif
147