From 15e43ce4e968a935d5276d8e3102b0bd795212b0 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 28 Oct 2015 14:25:19 +0300 Subject: [PATCH] Fill circle start point by click in the viewer when the opeation is restarted. --- src/PartSet/PartSet_SketcherMgr.cpp | 6 +++--- src/PartSet/PartSet_SketcherReetntrantMgr.cpp | 16 +++++++++++++--- src/PartSet/PartSet_SketcherReetntrantMgr.h | 9 ++++++--- src/PartSet/PartSet_WidgetPoint2d.h | 1 - 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 572bea5a2..62a37589c 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -337,7 +337,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE if (!(theEvent->buttons() & Qt::LeftButton)) return; - if (myModule->sketchReentranceMgr()->processMousePressed()) + if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent)) return; // Clear dragging mode @@ -438,7 +438,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - if (myModule->sketchReentranceMgr()->processMouseReleased()) + if (myModule->sketchReentranceMgr()->processMouseReleased(theWnd, theEvent)) return; ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); @@ -476,7 +476,7 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - if (myModule->sketchReentranceMgr()->processMouseMoved()) + if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent)) return; if (isNestedCreateOperation(getCurrentOperation()) && !myIsMouseOverViewProcessed) { diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index a243e762f..96050b878 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -141,7 +141,8 @@ void PartSet_SketcherReetntrantMgr::operationAborted(ModuleBase_Operation* theOp breakOperationSequence(); } -bool PartSet_SketcherReetntrantMgr::processMouseMoved() +bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow*/* theWnd*/, + QMouseEvent*/* theEvent*/) { bool aProcessed = false; if (!isActiveMgr()) @@ -159,12 +160,14 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved() return aProcessed; } -bool PartSet_SketcherReetntrantMgr::processMousePressed() +bool PartSet_SketcherReetntrantMgr::processMousePressed(ModuleBase_IViewWindow*/* theWnd*/, + QMouseEvent*/* theEvent*/) { return isActiveMgr() && myIsInternalEditOperation; } -bool PartSet_SketcherReetntrantMgr::processMouseReleased() +bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* theWnd, + QMouseEvent* theEvent) { bool aProcessed = false; if (!isActiveMgr()) @@ -175,7 +178,14 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased() //if (operationMgr()->isApplyEnabled()) anOperation->commit(); aProcessed = true; + + // fill the widget by the mouse event point + PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast(module()->activeWidget()); + if (aPoint2DWdg) { + aPoint2DWdg->onMouseRelease(theWnd, theEvent); + } } + return aProcessed; } diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReetntrantMgr.h index e08054fa3..0c232eef0 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.h @@ -14,6 +14,9 @@ class ModuleBase_IWorkshop; class ModuleBase_Operation; class ModuleBase_ModelWidget; +class ModuleBase_IViewWindow; + +class QMouseEvent; class XGUI_Workshop; class PartSet_Module; @@ -63,17 +66,17 @@ public: /// It happens if the current operation is an internal edit operation and the first /// control can be filled by the mouse move event. The operation is committed. /// \return true if operation is committed. - bool processMouseMoved(); + bool processMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// Return true if the manager processes the mouse press event /// \return true if the current operation is an internal edit operation. - bool processMousePressed(); + bool processMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// Return true if the manager processes the mouse enter event /// It happens if the current operation is an internal edit operation. /// The operation is committed. /// \return true if operation is committed. - bool processMouseReleased(); + bool processMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); /// Activates the operation widgets relatively the internal reentrant flags void propertyPanelDefined(ModuleBase_Operation* theOperation); diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index 216d058f4..4481eb60d 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -101,7 +101,6 @@ public slots: /// \param theEvent a mouse event void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); -protected slots: /// Process mouse release event /// \param theWnd a view window /// \param theEvent a mouse event -- 2.39.2