From 1869f0701a3454d9586e118333beb9b5d3431cb3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 26 Oct 2011 10:13:22 +0000 Subject: [PATCH] + fix bug with loosing constraint with undo/redo git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5068 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Sketcher/App/PropertyConstraintList.cpp | 11 +++++++++-- src/Mod/Sketcher/App/PropertyConstraintList.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.cpp b/src/Mod/Sketcher/App/PropertyConstraintList.cpp index 11d0ab6ab..c291712cb 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.cpp +++ b/src/Mod/Sketcher/App/PropertyConstraintList.cpp @@ -91,6 +91,12 @@ void PropertyConstraintList::setValue(const Constraint* lValue) void PropertyConstraintList::setValues(const std::vector& lValue) { aboutToSetValue(); + applyValues(lValue); + hasSetValue(); +} + +void PropertyConstraintList::applyValues(const std::vector& lValue) +{ std::vector oldVals(_lValueList); _lValueList.resize(lValue.size()); // copy all objects @@ -98,7 +104,6 @@ void PropertyConstraintList::setValues(const std::vector& lValue) _lValueList[i] = lValue[i]->clone(); for (unsigned int i = 0; i < oldVals.size(); i++) delete oldVals[i]; - hasSetValue(); } PyObject *PropertyConstraintList::getPyObject(void) @@ -184,10 +189,12 @@ Property *PropertyConstraintList::Copy(void) const void PropertyConstraintList::Paste(const Property &from) { const PropertyConstraintList& FromList = dynamic_cast(from); + aboutToSetValue(); + applyValues(FromList._lValueList); setValidGeometryKeys(FromList.validGeometryKeys); if (FromList.invalidGeometry) invalidateGeometry(); - setValues(FromList._lValueList); + hasSetValue(); } unsigned int PropertyConstraintList::getMemSize(void) const diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.h b/src/Mod/Sketcher/App/PropertyConstraintList.h index 54336bf5b..56b9d2eb1 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.h +++ b/src/Mod/Sketcher/App/PropertyConstraintList.h @@ -96,6 +96,7 @@ private: std::vector validGeometryKeys; bool invalidGeometry; + void applyValues(const std::vector&); void setValidGeometryKeys(const std::vector &keys); static std::vector _emptyValueList;