+ 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
This commit is contained in:
wmayer 2011-10-26 10:13:22 +00:00
parent 50e37c4d47
commit 1869f0701a
2 changed files with 10 additions and 2 deletions

View File

@ -91,6 +91,12 @@ void PropertyConstraintList::setValue(const Constraint* lValue)
void PropertyConstraintList::setValues(const std::vector<Constraint*>& lValue)
{
aboutToSetValue();
applyValues(lValue);
hasSetValue();
}
void PropertyConstraintList::applyValues(const std::vector<Constraint*>& lValue)
{
std::vector<Constraint*> oldVals(_lValueList);
_lValueList.resize(lValue.size());
// copy all objects
@ -98,7 +104,6 @@ void PropertyConstraintList::setValues(const std::vector<Constraint*>& 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<const PropertyConstraintList&>(from);
aboutToSetValue();
applyValues(FromList._lValueList);
setValidGeometryKeys(FromList.validGeometryKeys);
if (FromList.invalidGeometry)
invalidateGeometry();
setValues(FromList._lValueList);
hasSetValue();
}
unsigned int PropertyConstraintList::getMemSize(void) const

View File

@ -96,6 +96,7 @@ private:
std::vector<unsigned int> validGeometryKeys;
bool invalidGeometry;
void applyValues(const std::vector<Constraint*>&);
void setValidGeometryKeys(const std::vector<unsigned int> &keys);
static std::vector<Constraint *> _emptyValueList;