X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Module.cpp;h=3cc5c73ab56937be16e516537be005bb4d13fa83;hb=75a52b87325dd36217603277b84bab5fa345b642;hp=a9905b884dc62de59a87ab43aec89b36067f81bd;hpb=312c60ce13126a82e02b4db09e0885ef526199f8;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index a9905b884..3cc5c73ab 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1,4 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// 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_Module.h" #include "PartSet_WidgetSketchLabel.h" @@ -9,7 +27,6 @@ #include "PartSet_WidgetPoint2DFlyout.h" #include "PartSet_WidgetShapeSelector.h" #include "PartSet_WidgetMultiSelector.h" -#include "PartSet_WidgetSubShapeSelector.h" #include "PartSet_WidgetFeaturePointSelector.h" #include "PartSet_WidgetEditor.h" #include "PartSet_WidgetFileSelector.h" @@ -238,6 +255,7 @@ void PartSet_Module::registerValidators() aFactory->registerValidator("PartSet_CollinearSelection", new PartSet_CollinearSelection); aFactory->registerValidator("PartSet_MiddlePointSelection", new PartSet_MiddlePointSelection); aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); + aFactory->registerValidator("PartSet_DifferentPoints", new PartSet_DifferentPointsValidator); aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr); aFactory->registerValidator("PartSet_MultyTranslationSelection", new PartSet_MultyTranslationSelection); @@ -256,6 +274,9 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) if (sketchMgr()->isNestedSketchOperation(theOperation)) { mySketchMgr->commitNestedSketch(theOperation); } + /// deactivate of overconstraint listener should be performed after Sketch commit (#2176) + if (PartSet_SketcherMgr::isSketchOperation(theOperation)) + overconstraintListener()->setActive(false); /// Restart sketcher operations automatically if (!mySketchReentrantMgr->operationCommitted(theOperation)) { @@ -275,6 +296,9 @@ void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation) { /// Restart sketcher operations automatically mySketchReentrantMgr->operationAborted(theOperation); + /// deactivate of overconstraint listener should be performed after Sketch abort (#2176) + if (PartSet_SketcherMgr::isSketchOperation(theOperation)) + overconstraintListener()->setActive(false); } void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) @@ -752,12 +776,6 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aShapeSelectorWgt; } - else if (theType == "sketch_sub_shape_selector") { - PartSet_WidgetSubShapeSelector* aSubShapeSelectorWgt = - new PartSet_WidgetSubShapeSelector(theParent, aWorkshop, theWidgetApi); - aSubShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); - aWgt = aSubShapeSelectorWgt; - } else if (theType == "sketch_feature_point_selector") { PartSet_WidgetFeaturePointSelector* aPointSelectorWgt = new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, theWidgetApi); @@ -1244,10 +1262,15 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess DocumentPtr aActiveDoc = aMgr->activeDocument(); if (myActivePartIndex.isValid()) aTreeView->setExpanded(myActivePartIndex, false); + XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel(); myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc); - if (myActivePartIndex.isValid()) - aTreeView->setExpanded(myActivePartIndex, true); + bool needUpdate = false; + if (myActivePartIndex.isValid()) { + needUpdate = aTreeView->isExpanded(myActivePartIndex); + if (!needUpdate) + aTreeView->setExpanded(myActivePartIndex, true); + } aLabel->setPalette(aPalet); aWorkshop->updateCommandStatus(); @@ -1263,6 +1286,10 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess aDisplayer->redisplay(aObj, false); } aDisplayer->updateViewer(); + // Update tree items if they are expanded + if (needUpdate) { + aTreeView->viewport()->repaint(aTreeView->viewport()->rect()); + } } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) { std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage);