From efd6d9e388a55ba4582c319d3c11d9337ddd0be7 Mon Sep 17 00:00:00 2001 From: mpech Date: Mon, 23 May 2011 13:49:48 +0200 Subject: [PATCH 1/1] disable tools at startup of vv tools are enabled when a ImageInfosChanged is triggered. --- vv/vvMainWindow.cxx | 3 ++- vv/vvToolManager.cxx | 12 +++++++++++- vv/vvToolManager.h | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 30ef801..882e8f1 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -318,6 +318,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() // Adding all new tools (insertion in the menu) vvToolManager::GetInstance()->InsertToolsInMenu(this); + vvToolManager::GetInstance()->EnableToolsInMenu(this, false); if (!CLITK_EXPERIMENTAL) menuExperimental->menuAction()->setVisible(false); @@ -329,7 +330,6 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() timerMemory->start(2000); } //------------------------------------------------------------------------------ - void vvMainWindow::show(){ vvMainWindowBase::show(); PopupRegisterForm(true); @@ -1018,6 +1018,7 @@ void vvMainWindow::ImageInfoChanged() actionNorth_West_Window->setEnabled(1); actionSouth_East_Window->setEnabled(1); actionSouth_West_Window->setEnabled(1); + vvToolManager::GetInstance()->EnableToolsInMenu(this, true); inverseButton->setEnabled(1); goToCursorPushButton->setEnabled(1); diff --git a/vv/vvToolManager.cxx b/vv/vvToolManager.cxx index ac699ce..01835f8 100644 --- a/vv/vvToolManager.cxx +++ b/vv/vvToolManager.cxx @@ -19,7 +19,7 @@ #include "vvToolManager.h" #include "vvToolCreatorBase.h" #include "vvMainWindowBase.h" - +#include //------------------------------------------------------------------------------ /// Unique static instance vvToolManager* vvToolManager::mSingleton=0; @@ -55,3 +55,13 @@ void vvToolManager::InsertToolsInMenu(vvMainWindowBase * m) } //------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +void vvToolManager::EnableToolsInMenu(vvMainWindowBase * m, bool enable){ + std::vector::iterator it; + for(it=GetInstance()->mListOfTools.begin(); it!=GetInstance()->mListOfTools.end(); ++it){ + if((*it)->mAction){ + (*it)->mAction->setEnabled(enable); + } + } +} diff --git a/vv/vvToolManager.h b/vv/vvToolManager.h index 1c62f16..82d2e5b 100644 --- a/vv/vvToolManager.h +++ b/vv/vvToolManager.h @@ -40,6 +40,9 @@ public: /// Called in MainWindow, insert all tools into the menu static void InsertToolsInMenu(vvMainWindowBase * m); + /// Called in MainWindow, make the tools enabled/disabled + static void EnableToolsInMenu(vvMainWindowBase * m, bool enable); + protected: /// Singleton object pointer -- 2.45.1