From 86f0df4f3c13ca5c18e38e5560d9bcb891162f10 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 21 Jun 2015 14:24:49 +0200 Subject: [PATCH] Sketcher: Improvement Continuous Creation Mode: Leave Sketch ============================================================ This enables to exit the sketch by clicking the corresponding toolbar icon, even when in creation mode, i.e. with a drawHandler active. Requested here: http://forum.freecadweb.org/viewtopic.php?f=10&t=11051&start=30#p92181 --- src/Mod/Sketcher/Gui/Command.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index 64a90c989..b91d61e2e 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -223,6 +223,15 @@ CmdSketcherLeaveSketch::CmdSketcherLeaveSketch() void CmdSketcherLeaveSketch::activated(int iMsg) { + Gui::Document *doc = getActiveGuiDocument(); + + if (doc) { + // checks if a Sketch Viewprovider is in Edit and is in no special mode + SketcherGui::ViewProviderSketch* vp = dynamic_cast(doc->getInEdit()); + if (vp && vp->getSketchMode() != ViewProviderSketch::STATUS_NONE) + vp->purgeHandler(); + } + openCommand("Sketch changed"); doCommand(Gui,"Gui.activeDocument().resetEdit()"); doCommand(Doc,"App.ActiveDocument.recompute()"); @@ -236,7 +245,7 @@ bool CmdSketcherLeaveSketch::isActive(void) if (doc) { // checks if a Sketch Viewprovider is in Edit and is in no special mode SketcherGui::ViewProviderSketch* vp = dynamic_cast(doc->getInEdit()); - if (vp && vp->getSketchMode() == ViewProviderSketch::STATUS_NONE) + if (vp /*&& vp->getSketchMode() == ViewProviderSketch::STATUS_NONE*/) return true; } return false;