From 0958758e5e6a417c2e907b020d10afcd467c3ed2 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 16 Apr 2008 08:22:32 +0000 Subject: [PATCH] PAL18352, PAL19290: Conflict in objects selections when switching modules + virtual bool isSelectionCompatible(); --- src/SMESHGUI/SMESHGUI.cxx | 24 ++++++++++++++++++++++++ src/SMESHGUI/SMESHGUI.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 9c0f854b2..01e535f2d 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3039,6 +3039,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 33ced9a76..e5b4cec87 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -136,6 +136,8 @@ protected: virtual LightApp_Operation* createOperation( const int ) const; + virtual bool isSelectionCompatible(); + private: void OnEditDelete(); -- 2.39.2