task flow

synchronize fill types on setEdit
    finishing up command
    make activate for commands similar
    don't call execute directly
    remove unneeded update calls
This commit is contained in:
blobfish
2015-01-21 17:37:52 -05:00
committed by wmayer
parent 9a11431b73
commit 2ff65140e1
2 changed files with 11 additions and 6 deletions

View File

@@ -40,6 +40,7 @@
#include <Gui/ViewProvider.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/Command.h>
#include <Base/Sequencer.h>
#include <Gui/Control.h>
@@ -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()");
}
}

View File

@@ -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)