X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_WidgetPoint2dDistance.cpp;h=ee59d8aeef8744ec7f610029c6f6488f914c03f8;hb=857b1f72d9703c46c6c8c9bb239821d314344c86;hp=07cf1877b7303c76a175fdc316933b3122bc3d61;hpb=8e54aaa6560497708620242e7f99a0d8e58366f7;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp index 07cf1877b..ee59d8aee 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp @@ -1,21 +1,19 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -// File: PartSet_WidgetPoint2dDistance.h +// File: PartSet_WidgetPoint2dDistance.cpp // Created: 23 June 2014 // Author: Vitaly Smetannikov #include "PartSet_WidgetPoint2dDistance.h" #include "PartSet_Tools.h" +#include "PartSet_LockApplyMgr.h" #include +#include #include +#include #include -#include -#include -#include -#include - #include #include #include @@ -26,10 +24,13 @@ #include PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& theParentId) - : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId) + ModuleBase_IWorkshop* theWorkshop, + const Config_WidgetAPI* theData, + const std::string& theParentId) + : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId), myWorkshop(theWorkshop) { + myLockApplyMgr = new PartSet_LockApplyMgr(theParent, myWorkshop); + myFirstPntName = theData->getProperty("first_point"); // Reconnect to local slot @@ -41,16 +42,6 @@ PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance() { } -// It is not clear a necesity of this method also it contradicts to scenario defined in parent class -//void PartSet_WidgetPoint2dDistance::reset() -//{ -// bool isOk; -// double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); -// -// ModuleBase_Tools::setSpinValue(mySpinBox, isOk ? aDefValue : 0.0); -// storeValueCustom(); -//} - void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const std::shared_ptr& thePnt) { @@ -78,11 +69,13 @@ double PartSet_WidgetPoint2dDistance::computeValue(const std::shared_ptrviewer(); - connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), + ModuleBase_IViewer* aViewer = myWorkshop->viewer(); + connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*))); + + myLockApplyMgr->activate(); } void PartSet_WidgetPoint2dDistance::deactivate() @@ -92,7 +85,8 @@ void PartSet_WidgetPoint2dDistance::deactivate() this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); disconnect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*))); - myWorkshop->operationMgr()->setLockValidating(false); + + myLockApplyMgr->deactivate(); } void PartSet_WidgetPoint2dDistance::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) @@ -116,11 +110,11 @@ void PartSet_WidgetPoint2dDistance::onMouseRelease(ModuleBase_IViewWindow* theWn void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - if (mySpinBox->hasVariable()) + if (isEditingMode()) return; - myWorkshop->operationMgr()->setLockValidating(true); - myWorkshop->operationMgr()->setApplyEnabled(false); + if (mySpinBox->hasVariable()) + return; gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView()); @@ -133,7 +127,7 @@ void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd, void PartSet_WidgetPoint2dDistance::onValuesChanged() { - myWorkshop->operationMgr()->setLockValidating(false); + myLockApplyMgr->valuesChanged(); emit valuesChanged(); }