X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_MenuMgr.cpp;h=d2025cf6c6b8cb4dca9c42bc517d16fabc694479;hb=3ef3b583309df4b9d0593c7abd181ab9d6fed42e;hp=24953f5a600d23f01f8a94773b53016988133b67;hpb=5b6031b015602aa07f5a6fc668c13ac3faf7a8a9;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 24953f5a6..d2025cf6c 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_MenuMgr.cpp -// Created: 03 April 2015 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include "PartSet_MenuMgr.h" #include "PartSet_Module.h" @@ -160,10 +174,13 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions if (aCoincident.get() != NULL) { QList aCoins; mySelectedFeature = aCoincident; + QList anIsAttributes; PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_A()); + SketchPlugin_ConstraintCoincidence::ENTITY_A(), + anIsAttributes); PartSet_Tools::findCoincidences(mySelectedFeature, myCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_B()); + SketchPlugin_ConstraintCoincidence::ENTITY_B(), + anIsAttributes); if (myCoinsideLines.size() > 0) { aIsDetach = true; QMenu* aSubMenu = new QMenu(tr("Detach"), theParent); @@ -171,7 +188,12 @@ bool PartSet_MenuMgr::addViewerMenu(const QMap& theStdActions QAction* aAction; int i = 0; foreach (FeaturePtr aCoins, myCoinsideLines) { - aAction = aSubMenu->addAction(aCoins->data()->name().c_str()); + QString anItemText = aCoins->data()->name().c_str(); +#ifdef _DEBUG + if (anIsAttributes[i]) + anItemText += " [attribute]"; +#endif + aAction = aSubMenu->addAction(anItemText); aAction->setData(QVariant(i)); i++; } @@ -299,7 +321,8 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction) // the active nested sketch operation should be aborted unconditionally // the Delete action should be additionally granted for the Sketch operation // in order to do not abort/commit it - if (!anOpMgr->canStartOperation(tr("Detach"))) + bool isCommitted; + if (!anOpMgr->canStartOperation(tr("Detach"), isCommitted)) return; // the objects are processed but can not be deleted anOpMgr->startOperation(anOpAction); @@ -358,7 +381,8 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) anOpAction = new ModuleBase_OperationAction(anAction->text(), myModule); bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation); - if (!anOpMgr->canStartOperation(anOpAction->id())) + bool isCommitted; + if (!anOpMgr->canStartOperation(anOpAction->id(), isCommitted)) return; // the objects are processed but can not be deleted anOpMgr->startOperation(anOpAction); @@ -510,13 +534,21 @@ void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation* theOperation, void PartSet_MenuMgr::onEdit(bool) { QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects(); - FeaturePtr aFeature = std::dynamic_pointer_cast(aObjects.first()); - if (aFeature == NULL) { - ResultParameterPtr aParam = - std::dynamic_pointer_cast(aObjects.first()); - if (aParam.get() != NULL) { - aFeature = ModelAPI_Feature::feature(aParam); + FeaturePtr aFeature; + foreach(ObjectPtr aObj, aObjects) { + aFeature = std::dynamic_pointer_cast(aObj); + if (aFeature.get()) + break; + } + if (aFeature.get() == NULL) { + ResultParameterPtr aParam; + foreach(ObjectPtr aObj, aObjects) { + aParam = std::dynamic_pointer_cast(aObj); + if (aParam.get()) + break; } + if (aParam.get() != NULL) + aFeature = ModelAPI_Feature::feature(aParam); } if (aFeature.get() != NULL) myModule->editFeature(aFeature);