From: asv Date: Wed, 8 Jun 2005 12:37:31 +0000 (+0000) Subject: activateModule/deactivateModule functions are made "bool". X-Git-Tag: T3_0_0_a2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5bceb2b3488eca1eb72c1c2f549e9c730e9afc27;p=modules%2Fgui.git activateModule/deactivateModule functions are made "bool". --- diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index 5f9696d46..f8ca14f3b 100755 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -233,8 +233,12 @@ bool CAM_Application::activateModule( CAM_Module* mod ) return true; if ( myModule ) - myModule->deactivateModule( activeStudy() ); - + { + if ( !myModule->deactivateModule( activeStudy() ) ) + { + // .... + } + } myModule = mod; if ( myModule ){ @@ -253,7 +257,14 @@ bool CAM_Application::activateModule( CAM_Module* mod ) prev = dm; } } - myModule->activateModule( activeStudy() ); + if ( !myModule->activateModule( activeStudy() ) ) + { + myModule->setMenuShown( false ); + myModule->setToolShown( false ); + SUIT_MessageBox::error1( desktop(), tr( "ERROR_TLT" ), tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ), tr( "BUT_OK" ) ); + myModule = 0; + return false; + } } updateCommandsStatus(); diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index aed6c2646..f00054e78 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -89,12 +89,14 @@ CAM_Application* CAM_Module::application() const return myApp; } -void CAM_Module::activateModule( SUIT_Study* study ) +bool CAM_Module::activateModule( SUIT_Study* study ) { + return true; } -void CAM_Module::deactivateModule( SUIT_Study* ) +bool CAM_Module::deactivateModule( SUIT_Study* ) { + return true; } void CAM_Module::studyClosed( SUIT_Study* study ) diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index ed95b21ae..97f43e31f 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -39,8 +39,8 @@ public: virtual void updateCommandsStatus() {}; public slots: - virtual void activateModule( SUIT_Study* ); - virtual void deactivateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); + virtual bool deactivateModule( SUIT_Study* ); virtual void studyClosed( SUIT_Study* ); virtual void studyChanged( SUIT_Study*, SUIT_Study* ); diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 4dc328eb6..7f377c5d7 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -203,11 +203,14 @@ void SALOME_PYQT_Module::initialize( CAM_Application* app ) * Activation of the module. * Inherited from CAM_Module. */ -void SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy ) +bool SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy ) { MESSAGE( "SALOME_PYQT_Module::activateModule" ); - SalomeApp_Module::activateModule( theStudy ); + bool res = SalomeApp_Module::activateModule( theStudy ); + + if ( !res ) + return res; // activate menus, toolbars, etc setMenuShown( true ); @@ -239,17 +242,19 @@ void SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy ) // connect desktop activation signal connect( application()->desktop(), SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) ); + + return true; } /*! * Deactivation of the module. * Inherited from CAM_Module. */ -void SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy ) +bool SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy ) { MESSAGE( "SALOME_PYQT_Module::deactivateModule" ); - SalomeApp_Module::deactivateModule( theStudy ); + bool res = SalomeApp_Module::deactivateModule( theStudy ); // deactivate menus, toolbars, etc setMenuShown( false ); @@ -282,6 +287,8 @@ void SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy ) // disconnect desktop activation signal disconnect( application()->desktop(), SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) ); + + return res; } /*! diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h index 755895df0..8509bf79c 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h @@ -99,9 +99,9 @@ protected: public slots: /* activation */ - void activateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); /* deactivation */ - void deactivateModule( SUIT_Study* ); + virtual bool deactivateModule( SUIT_Study* ); /****************************** * Internal methods diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index 4eb303e59..f131285ab 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -37,16 +37,19 @@ void SalomeApp_Module::initialize( CAM_Application* app ) resMgr->raiseTranslators( name() ); } -void SalomeApp_Module::activateModule( SUIT_Study* study ) +bool SalomeApp_Module::activateModule( SUIT_Study* study ) { - CAM_Module::activateModule( study ); + bool res = CAM_Module::activateModule( study ); - if ( application() && application()->resourceMgr() ) + if ( res && application() && application()->resourceMgr() ) application()->resourceMgr()->raiseTranslators( name() ); + + return res; } -void SalomeApp_Module::deactivateModule( SUIT_Study* ) +bool SalomeApp_Module::deactivateModule( SUIT_Study* ) { + return true; } void SalomeApp_Module::selectionChanged() diff --git a/src/SalomeApp/SalomeApp_Module.h b/src/SalomeApp/SalomeApp_Module.h index 0668c193a..d2ac7699d 100644 --- a/src/SalomeApp/SalomeApp_Module.h +++ b/src/SalomeApp/SalomeApp_Module.h @@ -64,8 +64,8 @@ public: virtual void selectionChanged(); public slots: - virtual void activateModule( SUIT_Study* ); - virtual void deactivateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); + virtual bool deactivateModule( SUIT_Study* ); void MenuItem(); protected slots: