From: mpech Date: Mon, 23 May 2011 11:49:48 +0000 (+0200) Subject: disable tools at startup of vv X-Git-Tag: v1.3.0~345^2~5 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=efd6d9e388a55ba4582c319d3c11d9337ddd0be7;p=clitk.git disable tools at startup of vv tools are enabled when a ImageInfosChanged is triggered. --- 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