X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_MenuMgr.cpp;h=f39331b6270ec89594ad50fb38349e03c71d8cbc;hb=031179ada6681b874314c450eeda806f9f8abd28;hp=28013c9df0d51abdfbe71b16c82de80c221718d2;hpb=6f45fd08debf5174c1c404bbe912f7a76c77bcd5;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 28013c9df..f39331b62 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -149,28 +150,7 @@ bool PartSet_MenuMgr::addViewerMenu(QMenu* theMenu, const QMap& aRefsList = aFeature->data()->refsToMe(); - std::set::const_iterator aIt; - FeaturePtr aCoincident; - for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) { - std::shared_ptr aAttr = (*aIt); - FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); - if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { - std::shared_ptr a2dPnt = - PartSet_Tools::getPoint(aConstrFeature, SketchPlugin_ConstraintCoincidence::ENTITY_A()); - if (a2dPnt.get() && aSelPnt->isEqual(a2dPnt)) { - aCoincident = aConstrFeature; - break; - } else { - a2dPnt = PartSet_Tools::getPoint(aConstrFeature, - SketchPlugin_ConstraintCoincidence::ENTITY_B()); - if (a2dPnt.get() && aSelPnt->isEqual(a2dPnt)) { - aCoincident = aConstrFeature; - break; - } - } - } - } + FeaturePtr aCoincident = PartSet_Tools::findFirstCoincidence(aFeature, aSelPnt); // If we have coincidence then add Detach menu if (aCoincident.get() != NULL) { mySelectedFeature = aCoincident; @@ -467,6 +447,7 @@ void PartSet_MenuMgr::onActivatePart(bool) } if (aPart.get()) aPart->activate(); + myModule->workshop()->updateCommandStatus(); } } @@ -485,6 +466,8 @@ void PartSet_MenuMgr::activatePartSet() const if (isNewTransaction) aMgr->startOperation("Activation"); aMgr->setActiveDocument(aMgr->moduleDocument()); if (isNewTransaction) aMgr->finishOperation(); + + myModule->workshop()->updateCommandStatus(); } void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation* theOperation, @@ -527,3 +510,13 @@ void PartSet_MenuMgr::onSelectParentFeature() aSelection.append( aParentFeature ); myModule->workshop()->selection()->setSelectedObjects( aSelection ); } + +bool PartSet_MenuMgr::eventFilter(QObject* theObj, QEvent* theEvent) +{ + if (theEvent->type() == QEvent::MouseButtonDblClick) { + SessionPtr aMgr = ModelAPI_Session::get(); + if (aMgr->activeDocument() != aMgr->moduleDocument()) + activatePartSet(); + } + return QObject::eventFilter(theObj, theEvent); +} \ No newline at end of file