From: nds Date: Thu, 7 Apr 2016 09:07:50 +0000 (+0300) Subject: Correction for case: Clean history should be disabled on features in diactivated... X-Git-Tag: V_2.3.0~273 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=422766fac97894eb5a7bf3a9ad0146ff708c36bf;p=modules%2Fshaper.git Correction for case: Clean history should be disabled on features in diactivated parts --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 250cff9ff..56d7d2dbf 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -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(aObj); ResultPtr aResult = std::dynamic_pointer_cast(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; } } diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index b4687584f..1c29e7a99 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -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 diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index ca96ae5cc..e257113e7 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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(aObject); diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 579be3621..cc6594557 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -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); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 88ff0c770..a4b1385fe 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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;