From 2ff65140e18b9b0ff71ea965bf53551ad459630d Mon Sep 17 00:00:00 2001 From: blobfish Date: Wed, 21 Jan 2015 17:37:52 -0500 Subject: [PATCH] task flow synchronize fill types on setEdit finishing up command make activate for commands similar don't call execute directly remove unneeded update calls --- src/Mod/Surface/Gui/BSurf.cpp | 11 +++++++++-- src/Mod/Surface/Gui/Command.cpp | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Mod/Surface/Gui/BSurf.cpp b/src/Mod/Surface/Gui/BSurf.cpp index 9daeb3cfcf..527317a5ac 100644 --- a/src/Mod/Surface/Gui/BSurf.cpp +++ b/src/Mod/Surface/Gui/BSurf.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -119,6 +120,7 @@ void BSurf::setEditedObject(Surface::BSurf* obj) printf("BSurf::setEditedObject: illegal fill type: %d\n", editedObject->filltype.getValue()); Standard_Failure::Raise("BSurf::setEditedObject: illegal fill type.");*/ } + fillType = oldFillType; } filltype_t BSurf::getFillType() const @@ -147,6 +149,8 @@ void BSurf::accept() { // applies the changes apply(); + Gui::Command::commitCommand(); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()"); QDialog::accept(); } @@ -156,8 +160,10 @@ void BSurf::reject() if(editedObject->filltype.getValue() != oldFillType) { editedObject->filltype.setValue(oldFillType); - editedObject->execute(); } + Gui::Command::commitCommand(); + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); + Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()"); QDialog::reject(); } @@ -167,7 +173,8 @@ void BSurf::apply() if(editedObject->filltype.getValue() != fillType) { editedObject->filltype.setValue(fillType); - editedObject->execute(); + oldFillType = fillType; + Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); } } diff --git a/src/Mod/Surface/Gui/Command.cpp b/src/Mod/Surface/Gui/Command.cpp index bb4ef5967d..b26ed27e7d 100644 --- a/src/Mod/Surface/Gui/Command.cpp +++ b/src/Mod/Surface/Gui/Command.cpp @@ -179,9 +179,8 @@ void CmdSurfaceBezier::activated(int iMsg) doCommand(Doc,"FreeCAD.ActiveDocument.addObject(\"Surface::BezSurf\",\"%s\")", FeatName.c_str()); doCommand(Doc, "FreeCAD.ActiveDocument.ActiveObject.filltype=1"); // TODO ask filltype from user and check it doCommand(Doc, "Gui.ActiveDocument.setEdit('%s',0)", FeatName.c_str()); - runCommand(Doc, bezListCmd.str().c_str()); + doCommand(Doc, bezListCmd.str().c_str()); updateActive(); - commitCommand(); } bool CmdSurfaceBezier::isActive(void) @@ -249,10 +248,9 @@ void CmdSurfaceBSpline::activated(int iMsg) openCommand("Create BSpline surface"); doCommand(Doc,"FreeCAD.ActiveDocument.addObject(\"Surface::BSplineSurf\",\"%s\")", FeatName.c_str()); doCommand(Doc, "FreeCAD.ActiveDocument.ActiveObject.filltype=1"); + doCommand(Doc, bspListCmd.str().c_str()); doCommand(Doc, "Gui.ActiveDocument.setEdit('%s',0)", FeatName.c_str()); - runCommand(Doc, bspListCmd.str().c_str()); updateActive(); - commitCommand(); } bool CmdSurfaceBSpline::isActive(void)