]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_ModuleConnector.cpp
Salome HOME
Use activation only for objects which are not result of a current operation
[modules/shaper.git] / src / XGUI / XGUI_ModuleConnector.cpp
index 1405ba5d620fb6d7da7997fa9a59a24b169597aa..e92c772c6ac88a81ed27aa25daa382791d3721ba 100644 (file)
@@ -61,6 +61,18 @@ ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const
 }
 
 
+QObjectPtrList XGUI_ModuleConnector::activeObjects(const QObjectPtrList& theObjList) const
+{
+  QObjectPtrList aActiveOPbjects;
+  ModuleBase_IModule* aModule = myWorkshop->module();
+  // Activate objects only which can be activated
+  foreach (ObjectPtr aObj, theObjList) {
+    if (aModule->canActivateSelection(aObj))
+      aActiveOPbjects.append(aObj);
+  }
+  return aActiveOPbjects;
+}
+
 void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
 {
   XGUI_Displayer* aDisp = myWorkshop->displayer();
@@ -75,7 +87,7 @@ void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
     else
       aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType));
   }
-  aDisp->activateObjects(aModes);
+  aDisp->activateObjects(aModes, activeObjects(aDisp->displayedObjects()));
   //TODO: We have to open Local context because at neutral point filters don't work (bug 25340)
   //aDisp->addSelectionFilter(myDocumentShapeFilter);
 }
@@ -93,7 +105,7 @@ void XGUI_ModuleConnector::deactivateSubShapesSelection()
   // the OCC6.9.0 release. Moreother, it is possible that ClearOutdatedSelection will be called inside
   // Deactivate method of AIS_InteractiveContext. In this case, we need not call it.
   module()->activeSelectionModes(aModes);
-  aDisp->activateObjects(aModes);
+  aDisp->activateObjects(aModes, activeObjects(aDisp->displayedObjects()));
   // The document limitation selection has to be only during operation
   //aDisp->removeSelectionFilter(myDocumentShapeFilter);
   //aDisp->closeLocalContexts(false);