+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: PartSet_WidgetPoint2dDistance.h
// Created: 23 June 2014
// Author: Vitaly Smetannikov
#include "PartSet_WidgetPoint2dDistance.h"
#include "PartSet_Tools.h"
-#include <ModuleBase_WidgetValueFeature.h>
#include <ModuleBase_DoubleSpinBox.h>
#include <ModuleBase_IViewWindow.h>
#include <XGUI_ViewerProxy.h>
#include <XGUI_Workshop.h>
+#include <XGUI_PropertyPanel.h>
+#include <XGUI_OperationMgr.h>
#include <GeomAPI_Pnt2d.h>
#include <Config_WidgetAPI.h>
: ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
{
myFirstPntName = theData->getProperty("first_point");
+
+ // Reconnect to local slot
+ disconnect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged()));
+ connect(mySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValuesChanged()));
}
PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance()
{
}
-//bool PartSet_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue)
-//{
-// bool isDone = false;
-//
-// if (theValue) {
-// ModuleBase_WidgetValueFeature* aFeatureValue =
-// dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
-// if (aFeatureValue) {
-// std::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
-// ObjectPtr aObject = aFeatureValue->object();
-// FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
-// if (aFeature && aPnt) {
-// setPoint(aFeature, aPnt);
-// isDone = true;
-// }
-// }
-// }
-// return isDone;
-//}
-
void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
const std::shared_ptr<GeomAPI_Pnt2d>& thePnt)
{
AttributeDoublePtr aReal = aData->real(attributeID());
if (aReal && (aReal->value() != aRadius)) {
aReal->setValue(aRadius);
+ mySpinBox->blockSignals(true);
mySpinBox->setValue(aRadius);
+ mySpinBox->blockSignals(false);
+ emit valuesChanged();
}
}
-void PartSet_WidgetPoint2dDistance::activate()
+void PartSet_WidgetPoint2dDistance::activateCustom()
{
XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
disconnect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
+ myWorkshop->operationMgr()->setLockValidating(false);
}
void PartSet_WidgetPoint2dDistance::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
+ myWorkshop->operationMgr()->setLockValidating(true);
+ myWorkshop->operationMgr()->setApplyEnabled(false);
+
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
double aX, aY;
setPoint(feature(), aPnt);
}
+void PartSet_WidgetPoint2dDistance::onValuesChanged()
+{
+ myWorkshop->operationMgr()->setLockValidating(false);
+ emit valuesChanged();
+}