]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction for case: Clean history should be disabled on features in diactivated...
authornds <nds@opencascade.com>
Thu, 7 Apr 2016 09:07:50 +0000 (12:07 +0300)
committernds <nds@opencascade.com>
Thu, 7 Apr 2016 09:08:13 +0000 (12:08 +0300)
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index 250cff9ff5bbccb90ac0b7fc3f661d217c4e1933..56d7d2dbfa14dab00070f3d5ab25d20ba8e7a7af 100755 (executable)
@@ -304,12 +304,13 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
   return TopAbs_SHAPE;
 }
 
-void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasSubFeature)
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature,
+                  bool& hasParameter, bool& hasCompositeOwner)
 {
   hasResult = false;
   hasFeature = false;
   hasParameter = false;
-  hasSubFeature = false;
+  hasCompositeOwner = false;
   foreach(ObjectPtr aObj, theObjects) {
     FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
@@ -319,8 +320,8 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe
     hasFeature |= (aFeature.get() != NULL);
     hasParameter |= (aConstruction.get() != NULL);
     if (hasFeature) 
-      hasSubFeature |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
-    if (hasFeature && hasResult  && hasParameter && hasSubFeature)
+      hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
+    if (hasFeature && hasResult  && hasParameter && hasCompositeOwner)
       break;
   }
 }
index b4687584fda75ccfba864767b672b9edfd9bbebe..1c29e7a991ea0fcdc77ae60fbb3982f4ca6896a9 100755 (executable)
@@ -138,10 +138,10 @@ Check types of objects which are in the given list
 \param hasResult will be set to true if list contains Result objects
 \param hasFeature will be set to true if list contains Feature objects
 \param hasParameter will be set to true if list contains Parameter objects
-\param hasSubFeature will be set to true if list contains Sub-Feature objects
+\param hasCompositeOwner will be set to true if list contains Sub-Feature objects
 */
 MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult,
-                           bool& hasFeature, bool& hasParameter, bool& hasSubFeature);
+                           bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner);
 
 /*! Sets the default coeffient into the driver calculated accordingly the shape type.
 It provides 1.e-4 for a shape withe Edge shape type
index ca96ae5ccc909a026946596c02bc70fc8c8698f1..e257113e774650107e5fafee31f5802c0bec8266 100755 (executable)
@@ -1063,9 +1063,9 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
     bool hasResult = false;
     bool hasFeature = false;
     bool hasParameter = false;
-    bool hasSubFeature = false;
-    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
-
+    bool hasCompositeOwner = false;
+    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
+                                   hasCompositeOwner);
     ObjectPtr aObject = aObjects.first();
     if (aObject) {
       ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
index 579be3621db1f647d1b28e799c2b3976803a7292..cc6594557aa351c52e8d8306034aae96a4ed167c 100644 (file)
@@ -209,9 +209,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
     bool hasResult = false;
     bool hasFeature = false;
     bool hasParameter = false;
-    bool hasSubFeature = false;
-    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
-
+    bool hasCompositeOwner = false;
+    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
+                                   hasCompositeOwner);
     //Process Feature
     if (aSelected == 1) {
       ObjectPtr aObject = aObjects.first();
@@ -246,13 +246,12 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         else if (hasFeature && myWorkshop->canMoveFeature())
           action("MOVE_CMD")->setEnabled(true);
 
-        else if (hasFeature || hasParameter)
-          action("CLEAN_HISTORY_CMD")->setEnabled(!hasSubFeature);
-
         if( aMgr->activeDocument() == aObject->document() )
         {
           action("RENAME_CMD")->setEnabled(true);
-          action("DELETE_CMD")->setEnabled(!hasSubFeature);
+          action("DELETE_CMD")->setEnabled(!hasCompositeOwner);
+          action("CLEAN_HISTORY_CMD")->setEnabled(!hasCompositeOwner &&
+                                                  (hasFeature || hasParameter));
         }
       }
     } else {
@@ -271,11 +270,11 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         allActive = false;
         break;
       }
-    if (!hasSubFeature && allActive ) {
+    if (!hasCompositeOwner && allActive ) {
       if (hasFeature || hasParameter)
         action("DELETE_CMD")->setEnabled(true);
     }
-    if (!hasSubFeature && allActive && (hasFeature|| hasParameter))
+    if (!hasCompositeOwner && allActive && (hasFeature|| hasParameter))
       action("CLEAN_HISTORY_CMD")->setEnabled(true);
 
     action("SHOW_RESULTS_CMD")->setEnabled(hasFeature);
index 88ff0c7705c5bbccbc9badd3f864e64959f4b3a3..a4b1385fe27dea82891cb5b5d72a530338247c6f 100755 (executable)
@@ -1211,8 +1211,8 @@ void XGUI_Workshop::deleteObjects()
   bool hasResult = false;
   bool hasFeature = false;
   bool hasParameter = false;
-  bool hasSubFeature = false;
-  ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
+  bool hasCompositeOwner = false;
+  ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner);
   if (!(hasFeature || hasParameter))
     return;