From: eap Date: Thu, 17 Apr 2008 09:09:35 +0000 (+0000) Subject: PAL18352, PAL19290: Conflict in objects selections when switching modules X-Git-Tag: V3_2_10~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb49563f141b25a1d355abdb6b21ba75a55d5470;p=modules%2Fsmesh.git PAL18352, PAL19290: Conflict in objects selections when switching modules + virtual bool isSelectionCompatible(); --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 1a952b542..2aef79012 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -2938,6 +2938,30 @@ void SMESHGUI::initialize( CAM_Application* app ) this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) ); } +//================================================================================ +/*! + * \brief Return true if SMESH or GEOM objects are selected. + * Is called form LightApp_Module::activateModule() which clear selection if + * not isSelectionCompatible() + */ +//================================================================================ + +bool SMESHGUI::isSelectionCompatible() +{ + bool isCompatible = true; + SALOME_ListIO selected; + if ( LightApp_SelectionMgr *Sel = selectionMgr() ) + Sel->selectedObjects( selected ); + + SALOME_ListIteratorOfListIO It( selected ); + for ( ; isCompatible && It.More(); It.Next()) + isCompatible = + ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) || + ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 ); + + return isCompatible; +} + bool SMESHGUI::activateModule( SUIT_Study* study ) { bool res = SalomeApp_Module::activateModule( study ); diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index a2a8fb6dd..1f873c70f 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -132,6 +132,8 @@ protected: virtual LightApp_Operation* createOperation( const int ) const; + virtual bool isSelectionCompatible(); + private: void OnEditDelete();