diff options
author | Carl Hetherington <carl@carlh.net> | 2010-03-31 22:17:01 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-03-31 22:17:01 +0000 |
commit | 7f8b337d309fe62a442ef8c3086b7eb97c7e57e9 (patch) | |
tree | cc842e1a34520822a8cb9a1b887aac093775640a /libs/pbd/pbd/properties.h | |
parent | cc227eb75e8c920424313286417d325e58efaa94 (diff) |
A few small cleanups to the property code.
git-svn-id: svn://localhost/ardour2/branches/3.0@6816 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/properties.h')
-rw-r--r-- | libs/pbd/pbd/properties.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h index 8d2f465ebf..691ab9c4ad 100644 --- a/libs/pbd/pbd/properties.h +++ b/libs/pbd/pbd/properties.h @@ -40,6 +40,7 @@ class PropertyTemplate : public PropertyBase public: PropertyTemplate (PropertyDescriptor<T> p, T const& v) : PropertyBase (p.property_id) + , _have_old (false) , _current (v) {} @@ -79,6 +80,10 @@ public: return _current; } + void clear_history () { + _have_old = false; + } + /** If this property has been changed since the last clear_history() call (or its construction), add an (XML) property describing the old value to the XMLNode @param old and another describing the current value to @@ -112,6 +117,8 @@ public: owner_state.add_property (property_name(), to_string (_current)); } + bool changed () const { return _have_old; } + protected: /** Constructs a PropertyTemplate with a default value for _old and _current. @@ -132,6 +139,7 @@ protected: virtual std::string to_string (T const& v) const = 0; virtual T from_string (std::string const& s) const = 0; + bool _have_old; T _current; T _old; }; |