From 236e715187b0ab4ea0c5515443a9a6beddd146f1 Mon Sep 17 00:00:00 2001 From: akl Date: Tue, 24 Mar 2015 10:42:59 +0400 Subject: [PATCH] FIX of INTPAL 52634: "Camera Controls" and "Center Axes Controls" tool-bars are always active in the ParaVis module. --- src/PVViewer/PVViewer_GUIElements.cxx | 14 ++++++++++++++ src/PVViewer/PVViewer_GUIElements.h | 1 + src/PVViewer/PVViewer_ViewManager.cxx | 14 ++++++++++++++ src/PVViewer/PVViewer_ViewManager.h | 3 +++ 4 files changed, 32 insertions(+) diff --git a/src/PVViewer/PVViewer_GUIElements.cxx b/src/PVViewer/PVViewer_GUIElements.cxx index 411dccf1c..ac4a45367 100644 --- a/src/PVViewer/PVViewer_GUIElements.cxx +++ b/src/PVViewer/PVViewer_GUIElements.cxx @@ -198,3 +198,17 @@ QList PVViewer_GUIElements::getToolbars() << commonToolbar << dataToolbar; return l; } + +void PVViewer_GUIElements::setToolBarEnabled(bool enabled) +{ + mainToolBar ->setEnabled(enabled); + vcrToolbar ->setEnabled(enabled); + timeToolbar ->setEnabled(enabled); + colorToolbar ->setEnabled(enabled); + reprToolbar ->setEnabled(enabled); + cameraToolbar->setEnabled(enabled); + axesToolbar ->setEnabled(enabled); + macrosToolbar->setEnabled(enabled); + commonToolbar->setEnabled(enabled); + dataToolbar ->setEnabled(enabled); +} diff --git a/src/PVViewer/PVViewer_GUIElements.h b/src/PVViewer/PVViewer_GUIElements.h index 382f9f7b4..92d5d7111 100644 --- a/src/PVViewer/PVViewer_GUIElements.h +++ b/src/PVViewer/PVViewer_GUIElements.h @@ -59,6 +59,7 @@ public: void myBuildToolbars(SUIT_Desktop* desk); void addToolbars(SUIT_Desktop* desk); void setToolBarVisible(bool show); + void setToolBarEnabled(bool enabled); QList getToolbars(); public slots: diff --git a/src/PVViewer/PVViewer_ViewManager.cxx b/src/PVViewer/PVViewer_ViewManager.cxx index 8fa82f047..0e5ed8656 100644 --- a/src/PVViewer/PVViewer_ViewManager.cxx +++ b/src/PVViewer/PVViewer_ViewManager.cxx @@ -70,6 +70,8 @@ PVViewer_ViewManager::PVViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* des // Initialize minimal paraview stuff (if not already done) ParaviewInitApp(desk, logWindow); + connect( desk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); // connect(this, SIGNAL(viewCreated(SUIT_ViewWindow*)), this, SLOT(onPVViewCreated(SUIT_ViewWindow*))); } @@ -238,3 +240,15 @@ void PVViewer_ViewManager::onEmulateApply() PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desktop); guiElements->onEmulateApply(); } + +/*!Enable toolbars if view \a view is ParaView viewer and disable otherwise. +*/ +void PVViewer_ViewManager::onWindowActivated(SUIT_ViewWindow* view) +{ + if (view) + { + PVViewer_ViewWindow* pvWindow = dynamic_cast(view); + PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desktop); + guiElements->setToolBarEnabled(pvWindow!=0); + } +} diff --git a/src/PVViewer/PVViewer_ViewManager.h b/src/PVViewer/PVViewer_ViewManager.h index 9bbc74aa4..65871c883 100644 --- a/src/PVViewer/PVViewer_ViewManager.h +++ b/src/PVViewer/PVViewer_ViewManager.h @@ -58,6 +58,9 @@ public: public slots: void onEmulateApply(); +protected slots: + void onWindowActivated(SUIT_ViewWindow*); + private: static pqPVApplicationCore* MyCoreApp; static bool ConfigLoaded; -- 2.39.2