From 29158eafac67faf2d18542e935552aa2756fbbf5 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 14 May 2008 15:07:33 +0000 Subject: [PATCH] *** empty log message *** --- src/CAM/CAM_ViewExtender.h | 5 +++-- src/SVTK/SVTK_ViewModel.cxx | 36 ++++++++++++++++++------------------ src/SVTK/SVTK_ViewModel.h | 6 ++++++ src/SVTK/SVTK_ViewWindow.cxx | 6 +++--- src/SVTK/SVTK_ViewWindow.h | 2 ++ 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/CAM/CAM_ViewExtender.h b/src/CAM/CAM_ViewExtender.h index eae28e51d..46032b4b3 100644 --- a/src/CAM/CAM_ViewExtender.h +++ b/src/CAM/CAM_ViewExtender.h @@ -23,6 +23,7 @@ class QtxActionToolMgr; class QMenu; +class SUIT_ViewModel; /*! An interface which can be used as a module dedicated extension for Viewer */ @@ -32,8 +33,8 @@ public: //! Creates a New toolbar containing extending actions. Returns New Toolbar Id virtual int createToolbar(QtxActionToolMgr* ) = 0; virtual void contextMenuPopup(QMenu* ) = 0; - virtual void activate() = 0; - virtual void deactivate() = 0; + virtual void activate(SUIT_ViewModel*) = 0; + virtual void deactivate(SUIT_ViewModel*) = 0; }; #endif diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 71990b72b..ecd4da93a 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -129,7 +129,12 @@ createView( SUIT_Desktop* theDesktop ) aViewWindow->setBackgroundColor( backgroundColor() ); aViewWindow->SetTrihedronSize( trihedronSize(), trihedronRelative() ); - + + connect(aViewWindow, SIGNAL( actorAdded(VTKViewer_Actor*) ), + this, SLOT(onActorAdded(VTKViewer_Actor*))); + connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ), + this, SLOT(onActorRemoved(VTKViewer_Actor*))); + if (myActiveModule) { CAM_ViewExtender* aExtender = myActiveModule->getViewExtender(); if (aExtender) { @@ -519,21 +524,6 @@ SVTK_Viewer void SVTK_Viewer::connectToApplication( CAM_Application* theApp ) { onModuleActivated(theApp->activeModule()); -// CAM_Module* aModule = dynamic_cast(theApp->activeModule()); -// if (aModule) { -// if (myActiveModule != aModule) { -// CAM_ViewExtender* aExtender = (myActiveModule)? myActiveModule->getViewExtender() : 0; -// if (aExtender) -// aExtender->deactivate(); - -// myActiveModule = aModule; -// aExtender = myActiveModule->getViewExtender(); -// if (aExtender) -// aExtender->activate(); - -// updateToolBars(); -// } -// } connect(theApp, SIGNAL(moduleActivated(CAM_Module*)), this, SLOT(onModuleActivated(CAM_Module*))); } @@ -546,12 +536,12 @@ void SVTK_Viewer::onModuleActivated( CAM_Module* mod ) if (myActiveModule != aModule) { CAM_ViewExtender* aExtender = (myActiveModule)? myActiveModule->getViewExtender() : 0; if (aExtender) - aExtender->deactivate(); + aExtender->deactivate(this); myActiveModule = aModule; aExtender = myActiveModule->getViewExtender(); if (aExtender) - aExtender->activate(); + aExtender->activate(this); updateToolBars(); } @@ -579,3 +569,13 @@ void SVTK_Viewer::updateToolBars() } myExtToolBarId = aNewId; } + +void SVTK_Viewer::onActorAdded(VTKViewer_Actor* theActor) +{ + emit actorAdded((SVTK_ViewWindow*)sender(), theActor); +} + +void SVTK_Viewer::onActorRemoved(VTKViewer_Actor* theActor) +{ + emit actorRemoved((SVTK_ViewWindow*)sender(), theActor); +} diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index 46b595669..9b36f63f0 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -34,6 +34,7 @@ class SVTK_ViewWindow; class CAM_Module; class CAM_Application; class CAM_Module; +class VTKViewer_Actor; //! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View @@ -114,6 +115,9 @@ public: virtual void connectToApplication(CAM_Application* theApp); + signals: + void actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*); + void actorRemoved(SVTK_ViewWindow*, VTKViewer_Actor*); protected slots: void onMousePress(SUIT_ViewWindow*, QMouseEvent*); @@ -124,6 +128,8 @@ protected slots: void onChangeBgColor(); void onModuleActivated( CAM_Module* mod ); + void onActorAdded(VTKViewer_Actor*); + void onActorRemoved(VTKViewer_Actor*); private: void updateToolBars(); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index be2e4468f..c89b4fb4a 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -688,12 +688,11 @@ SVTK_ViewWindow /*! Redirect the request to #SVTK_Renderer::AddActor */ -void -SVTK_ViewWindow -::AddActor( VTKViewer_Actor* theActor, +void SVTK_ViewWindow::AddActor( VTKViewer_Actor* theActor, bool theUpdate ) { myMainWindow->AddActor( theActor, theUpdate ); + emit actorAdded(theActor); } /*! @@ -705,6 +704,7 @@ SVTK_ViewWindow bool theUpdate ) { myMainWindow->RemoveActor( theActor, theUpdate ); + emit actorRemoved(theActor); } /*! diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 811752c97..75f7acf48 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -274,6 +274,8 @@ public slots: signals: void selectionChanged(); + void actorAdded(VTKViewer_Actor*); + void actorRemoved(VTKViewer_Actor*); public slots: //! Redirect the request to #SVTK_Renderer::OnFrontView -- 2.39.2