From fba4d14f797d6f21ce29a636739a7f576ab39c50 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 2 May 2013 14:02:55 +0200 Subject: [PATCH] Implement Copy/Paste for PropertyEnumeration --- src/App/PropertyStandard.cpp | 23 +++++++++++++++++++++++ src/App/PropertyStandard.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index fb73ec4d0..9f6c37b6c 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -509,6 +509,29 @@ void PropertyEnumeration::setPyObject(PyObject *value) } } +Property *PropertyEnumeration::Copy(void) const +{ + PropertyEnumeration *p= new PropertyEnumeration(); + p->_lValue = _lValue; + if (_CustomEnum) { + p->_CustomEnum = true; + p->setEnumVector(getEnumVector()); + } + return p; +} + +void PropertyEnumeration::Paste(const Property &from) +{ + aboutToSetValue(); + const PropertyEnumeration& prop = dynamic_cast(from); + _lValue = prop._lValue; + if (prop._CustomEnum) { + this->_CustomEnum = true; + this->setEnumVector(prop.getEnumVector()); + } + hasSetValue(); +} + //************************************************************************** //************************************************************************** // PropertyIntegerConstraint diff --git a/src/App/PropertyStandard.h b/src/App/PropertyStandard.h index e611dd070..b23d9e4d7 100644 --- a/src/App/PropertyStandard.h +++ b/src/App/PropertyStandard.h @@ -183,6 +183,9 @@ public: virtual void Save (Base::Writer &writer) const; virtual void Restore(Base::XMLReader &reader); + virtual Property *Copy(void) const; + virtual void Paste(const Property &from); + private: bool _CustomEnum; const char** _EnumArray;