]> Creatis software - bbtkGEditor.git/commitdiff
Now it works when a tab is changed ...
authorcorredor <>
Tue, 11 May 2010 15:00:55 +0000 (15:00 +0000)
committercorredor <>
Tue, 11 May 2010 15:00:55 +0000 (15:00 +0000)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h

index 7949d5b..0431d7e 100644 (file)
@@ -138,6 +138,8 @@ namespace bbtk
        const int ID_RUN = 1003;
        const int ID_DELETEALL = 1004;
        const int ID_CENTERVIEW = 1005;
+
+       const int wxID_NOTEBOOK = 1010;
 }
 // namespace bbtk
 #endif
index ddc5a52..c32ed02 100644 (file)
@@ -65,7 +65,7 @@ namespace bbtk
        void wxVtkSceneManager::disconnectDrop()
        {
                _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL);
-       }
+       }
 
        //=========================================================================
 
@@ -767,7 +767,6 @@ namespace bbtk
                else if(control->getGObjectType()==GCONNECTOR)
                {                       
                        GConnectorModel *conMod = (GConnectorModel*)control->getModel();
-                       cout<<"RaC wxVtkSceneManager::deleteObject id:"<<id<<" modelId:" <<conMod->getObjectId()<<endl;
                        controllersToRemove.push_back(conMod->getObjectId());
                }
 
index b07e136..35c4e77 100644 (file)
@@ -150,7 +150,7 @@ namespace bbtk
        //=========================================================================
        void wxGUIEditorGraphicBBS::initTabPanelsManager()
        {
-               _notebook = new wxAuiNotebook(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
+               _notebook = new wxAuiNotebook(this,wxID_NOTEBOOK,wxDefaultPosition,wxDefaultSize,wxAUI_NB_TOP|wxAUI_NB_TAB_MOVE|wxAUI_NB_CLOSE_ON_ACTIVE_TAB|wxAUI_NB_TAB_FIXED_WIDTH|wxAUI_NB_WINDOWLIST_BUTTON);
                _tabsMgr = new wxTabPanelsManager(this);
                _frameAUIMgr->AddPane(_notebook,wxAuiPaneInfo().CenterPane());  
 
index b54d8ab..0945a49 100644 (file)
@@ -47,6 +47,7 @@
 #include "wxTabPanelsManager.h"
 #include "wxBlackBoxEditionDialog.h"
 #include "wxVtkSceneManager.h"
+#include "GlobalConstants.h"
 
 //#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm" // JPR
 #include "wxart_new.xpm" // JPR
index 0fba895..4cfa95d 100644 (file)
@@ -39,6 +39,7 @@ Version:   $Revision$
 
 namespace bbtk
 {
+
        //=========================================================================
        wxGEditorTabPanel::wxGEditorTabPanel()
        {
@@ -50,7 +51,6 @@ namespace bbtk
                _id=id;
                _panelAUIMgr = new wxAuiManager(this);
                _sceneManager = NULL;
-
                initWxVtkCanvas();
        }
 
@@ -168,6 +168,13 @@ namespace bbtk
 
        //=========================================================================
 
+       int wxGEditorTabPanel::getPanelId()
+       {
+               return _id;
+       }
+
+       //=========================================================================
+
 }  // EO namespace bbtk
 
 // EOF
index ea7c426..c3a9a77 100644 (file)
@@ -88,6 +88,7 @@ namespace bbtk
                void centerView();
                void saveDiagram(std::string &content);
                void loadDiagram(ifstream &inputStream);
+               int getPanelId();
 
        //=========================================================================
                
index 7998bc4..97fa011 100644 (file)
@@ -48,6 +48,7 @@ namespace bbtk
                _lastId = 0;
                _notebook = _parent->getAuiNotebook();
                addNewTab();
+               _notebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,wxAuiNotebookEventHandler(wxTabPanelsManager::OnTabChanged),0,this);
        }
 
        //=========================================================================
@@ -58,13 +59,11 @@ namespace bbtk
        //=========================================================================
        void wxTabPanelsManager::addNewTab()
        {
-               _lastId++;              
-
+               _lastId++;
                wxGEditorTabPanel *newPanel = new wxGEditorTabPanel(_notebook,_lastId);
                newPanel->setPanelsManager(this);
                _panels[_lastId]=newPanel;
                _actual = newPanel;
-
                _notebook->AddPage(newPanel,_T("Diagram"),true);
        }
 
@@ -145,6 +144,17 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
+       {
+               int index = event.GetSelection();
+               wxGEditorTabPanel* tab =(wxGEditorTabPanel*)_notebook->GetPage(index);          
+               int id = tab->getPanelId();
+               _actual = _panels[id];  
+       }
+
+       //=========================================================================
+
+
 }  // EO namespace bbtk
 
 // EOF
index 42681b7..3cdfcde 100644 (file)
@@ -62,7 +62,7 @@ namespace bbtk
        class wxGEditorTabPanel;
        class wxGUIEditorGraphicBBS;
 
-       class wxTabPanelsManager
+       class wxTabPanelsManager : public wxEvtHandler
        {
        public: 
                wxTabPanelsManager(wxGUIEditorGraphicBBS *parent);
@@ -81,6 +81,8 @@ namespace bbtk
                void centerViewActualDiagram();
                void saveActualDiagram(std::string &content);
                void loadDiagram(ifstream &inputStream);
+               
+               void OnTabChanged(wxAuiNotebookEvent& event);
 
        private:
 
@@ -88,7 +90,7 @@ namespace bbtk
        ** The map 
        */
                wxGUIEditorGraphicBBS *_parent;
-               map<int, wxPanel*> _panels;
+               map<int, wxGEditorTabPanel*> _panels;
                wxGEditorTabPanel* _actual;
                wxAuiNotebook  *_notebook;
                int _lastId;