Salome HOME
Selection validators improvements
[modules/shaper.git] / src / PartSet / PartSet_OperationFeatureCreate.cpp
index 096f56f40eb1febed05833eeef5e3e8c94f4c304..d1d5d409b42d33d6fef7bc2c638862227450ed61 100644 (file)
@@ -24,8 +24,8 @@
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_WidgetPoint2D.h>
 #include <ModuleBase_WidgetValueFeature.h>
+#include <ModuleBase_ViewerPrs.h>
 
-#include <XGUI_ViewerPrs.h>
 #include <XGUI_Constants.h>
 
 #include <V3d_View.hxx>
@@ -83,8 +83,8 @@ std::list<int> PartSet_OperationFeatureCreate::getSelectionModes(FeaturePtr theF
   return aModes;
 }
 
-void PartSet_OperationFeatureCreate::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-                                                   const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                   const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   myPreSelection = theSelected;
 }
@@ -101,8 +101,8 @@ FeaturePtr PartSet_OperationFeatureCreate::sketch() const
 }
 
 void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                                const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   if (canBeCommitted())
   {
@@ -113,14 +113,14 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
     return;
   }
 
-  double aX = 0, anY = 0;
-
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+  double aX = aPoint.X(), anY = aPoint.Y();
+
   if (theSelected.empty()) {
     PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
   }
   else {
-    XGUI_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = theSelected.front();
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) // the point is selected
     {
@@ -147,7 +147,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
   }
   FeaturePtr aFeature;
   if (!theSelected.empty()) {
-    XGUI_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = theSelected.front();
     aFeature = aPrs.feature();
   }
   else
@@ -190,7 +190,7 @@ void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* t
 {
   myActiveWidget = theWidget;
   if ((myPreSelection.size() > 0) && myActiveWidget) {
-    const XGUI_ViewerPrs& aPrs = myPreSelection.front();
+    const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
     ModuleBase_WidgetValueFeature aValue;
     aValue.setFeature(aPrs.feature());
     if (myActiveWidget->setValue(&aValue)) {
@@ -286,6 +286,6 @@ bool PartSet_OperationFeatureCreate::setWidgetValue(FeaturePtr theFeature, doubl
   bool isApplyed = myActiveWidget->setValue(aValue);
 
   delete aValue;
-
+  myIsModified = (myIsModified || isApplyed);
   return isApplyed;
 }