Skip to content

Commit

Permalink
Sketcher: Improvement Continuous Creation Mode: Leave Sketch
Browse files Browse the repository at this point in the history
============================================================

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
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Jun 24, 2015
1 parent f3592c1 commit 86f0df4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Mod/Sketcher/Gui/Command.cpp
Expand Up @@ -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<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
if (vp && vp->getSketchMode() != ViewProviderSketch::STATUS_NONE)
vp->purgeHandler();
}

openCommand("Sketch changed");
doCommand(Gui,"Gui.activeDocument().resetEdit()");
doCommand(Doc,"App.ActiveDocument.recompute()");
Expand All @@ -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<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
if (vp && vp->getSketchMode() == ViewProviderSketch::STATUS_NONE)
if (vp /*&& vp->getSketchMode() == ViewProviderSketch::STATUS_NONE*/)
return true;
}
return false;
Expand Down

0 comments on commit 86f0df4

Please sign in to comment.