From 768c38e8d9e24aa069fedba00704cc862ebbf7ec Mon Sep 17 00:00:00 2001 From: corredor <> Date: Tue, 11 May 2010 15:00:55 +0000 Subject: [PATCH] Now it works when a tab is changed ... --- .../bbsKernelEditorGraphic/GlobalConstants.h | 2 ++ .../bbsKernelEditorGraphic/wxVtkSceneManager.cxx | 3 +-- .../bbtkwxGUIEditorGraphicBBS.cxx | 2 +- .../bbtkwxGUIEditorGraphicBBS.h | 1 + .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx | 9 ++++++++- .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.h | 1 + .../bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx | 16 +++++++++++++--- .../bbsWxGUIEditorGraphic/wxTabPanelsManager.h | 6 ++++-- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 7949d5b..0431d7e 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index ddc5a52..c32ed02 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -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:"<getObjectId()<getObjectId()); } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index b07e136..35c4e77 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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()); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index b54d8ab..0945a49 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 0fba895..4cfa95d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index ea7c426..c3a9a77 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -88,6 +88,7 @@ namespace bbtk void centerView(); void saveDiagram(std::string &content); void loadDiagram(ifstream &inputStream); + int getPanelId(); //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 7998bc4..97fa011 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index 42681b7..3cdfcde 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -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 _panels; + map _panels; wxGEditorTabPanel* _actual; wxAuiNotebook *_notebook; int _lastId; -- 2.45.1