From 62de0655d75d9d2e35fa7e7fbb87d27fc96a4b2c Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 16 Nov 2014 19:13:06 +0100 Subject: [PATCH] + fix inconsistency problem after undo/redo --- src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp | 20 +++++++++++++++++++- src/Mod/Sketcher/Gui/TaskDlgEditSketch.h | 13 +++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp index cd0a003b7..d7d9850e9 100644 --- a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp +++ b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include #endif #include "TaskDlgEditSketch.h" @@ -46,16 +47,33 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView) Elements = new TaskSketcherElements(sketchView); General = new TaskSketcherGeneral(sketchView); Messages = new TaskSketcherMessages(sketchView); - + Content.push_back(Messages); Content.push_back(General); Content.push_back(Constraints); Content.push_back(Elements); + + App::Document* document = sketchView->getObject()->getDocument(); + connectUndoDocument = + document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, _1)); + connectRedoDocument = + document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, _1)); } TaskDlgEditSketch::~TaskDlgEditSketch() { + connectUndoDocument.disconnect(); + connectRedoDocument.disconnect(); +} +void TaskDlgEditSketch::slotUndoDocument(const App::Document& doc) +{ + const_cast(doc).recomputeFeature(sketchView->getObject()); +} + +void TaskDlgEditSketch::slotRedoDocument(const App::Document& doc) +{ + const_cast(doc).recomputeFeature(sketchView->getObject()); } //==== calls from the TaskView =============================================================== diff --git a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h index b1ec85303..445b84994 100644 --- a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h +++ b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h @@ -31,6 +31,9 @@ #include "TaskSketcherElements.h" #include "TaskSketcherGeneral.h" #include "TaskSketcherMessages.h" +#include + +typedef boost::signals::connection Connection; namespace SketcherGui { @@ -65,11 +68,17 @@ public: { return QDialogButtonBox::Close|QDialogButtonBox::Help; } protected: - ViewProviderSketch *sketchView; + void slotUndoDocument(const App::Document&); + void slotRedoDocument(const App::Document&); + +protected: + ViewProviderSketch *sketchView; TaskSketcherConstrains *Constraints; - TaskSketcherElements *Elements; + TaskSketcherElements *Elements; TaskSketcherGeneral *General; TaskSketcherMessages *Messages; + Connection connectUndoDocument; + Connection connectRedoDocument; };