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
This commit is contained in:
Abdullah Tahiri 2015-06-21 14:24:49 +02:00 committed by wmayer
parent f3592c1216
commit 86f0df4f3c

View File

@ -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()");
@ -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;