Fix inconsistencies if currently edited object is not in active document

This commit is contained in:
wmayer
2012-04-13 17:02:23 +02:00
parent 591e36511d
commit 51fdef23da
3 changed files with 13 additions and 5 deletions

View File

@@ -42,6 +42,7 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView)
: TaskDialog(),sketchView(sketchView)
{
assert(sketchView);
documentName = sketchView->getObject()->getDocument()->getName();
Constraints = new TaskSketcherConstrains(sketchView);
General = new TaskSketcherGeneral(sketchView);
Messages = new TaskSketcherMessages(sketchView);
@@ -76,10 +77,9 @@ bool TaskDlgEditSketch::accept()
bool TaskDlgEditSketch::reject()
{
// Gui::Command::openCommand("Sketch changed");
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
// Gui::Command::commitCommand();
std::string document = documentName; // needed because resetEdit() deletes this instance
Gui::Command::doCommand(Gui::Command::Gui,"Gui.getDocument('%s').resetEdit()", document.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').recompute()", document.c_str());
return true;
}

View File

@@ -65,6 +65,7 @@ public:
protected:
ViewProviderSketch *sketchView;
std::string documentName;
TaskSketcherConstrains *Constraints;
TaskSketcherGeneral *General;