summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r--libs/pbd/pbd/properties.h17
-rw-r--r--libs/pbd/pbd/property_basics.h20
-rw-r--r--libs/pbd/pbd/property_list.h2
-rw-r--r--libs/pbd/pbd/sequence_property.h17
-rw-r--r--libs/pbd/pbd/stateful.h11
5 files changed, 30 insertions, 37 deletions
diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h
index 1e17ddafb0..13790973e2 100644
--- a/libs/pbd/pbd/properties.h
+++ b/libs/pbd/pbd/properties.h
@@ -85,20 +85,16 @@ public:
_have_old = false;
}
- void add_history_state (XMLNode* history_node) const {
+ void get_change (XMLNode* history_node) const {
/* We can get to the current state of a scalar property like this one simply
by knowing what the new state is.
*/
history_node->add_property (property_name(), to_string (_current));
}
- /** Try to set state from the property of an XML node.
- * @param node XML node.
- * @return true if the value of the property is changed
- */
- bool set_state_from_owner_state (XMLNode const& owner_state) {
+ bool set_value (XMLNode const & node) {
- XMLProperty const* p = owner_state.property (property_name());
+ XMLProperty const* p = node.property (property_name());
if (p) {
T const v = from_string (p->value ());
@@ -112,12 +108,13 @@ public:
return false;
}
- void add_state_to_owner_state (XMLNode& owner_state) const {
- owner_state.add_property (property_name(), to_string (_current));
+ void get_value (XMLNode & node) const {
+ node.add_property (property_name(), to_string (_current));
}
bool changed () const { return _have_old; }
- void set_state_from_property (PropertyBase const * p) {
+
+ void apply_change (PropertyBase const * p) {
T v = dynamic_cast<const PropertyTemplate<T>* > (p)->val ();
if (v != _current) {
set (v);
diff --git a/libs/pbd/pbd/property_basics.h b/libs/pbd/pbd/property_basics.h
index 2dea20e251..39a7c043e9 100644
--- a/libs/pbd/pbd/property_basics.h
+++ b/libs/pbd/pbd/property_basics.h
@@ -89,10 +89,8 @@ public:
/** Forget about any old value for this state */
virtual void clear_history () = 0;
- /** Make XML that allows us to get from some previous state to the current state
- * of this property, and add it to @param history_node
- */
- virtual void add_history_state (XMLNode* history_node) const = 0;
+ /** Get any change in this property as XML and add it to a node */
+ virtual void get_change (XMLNode *) const = 0;
/** Add information to two property lists: one that allows
* undo of the changes in this property's state betwen now and
@@ -103,19 +101,21 @@ public:
virtual PropertyBase* maybe_clone_self_if_found_in_history_node (const XMLNode&) const { return 0; }
- /** Set state from an XML node previously generated by add_history_state */
- virtual bool set_state_from_owner_state (XMLNode const&) = 0;
+ /** Set our value from an XML node.
+ * @return true if the value was set.
+ */
+ virtual bool set_value (XMLNode const &) = 0;
- /** Add complete current state in XML form to an existing XML node @param node */
- virtual void add_state_to_owner_state (XMLNode& node) const = 0;
+ /** Get our value and put it into an XML node */
+ virtual void get_value (XMLNode& node) const = 0;
/** @return true if this property has changed in value since construction or since
* the last call to clear_history(), whichever was more recent.
*/
virtual bool changed() const = 0;
- /** Set the value of this property from another */
- virtual void set_state_from_property (PropertyBase const *) = 0;
+ /** Apply a change contained in another Property to this one */
+ virtual void apply_change (PropertyBase const *) = 0;
const gchar*property_name () const { return g_quark_to_string (_property_id); }
PropertyID property_id () const { return _property_id; }
diff --git a/libs/pbd/pbd/property_list.h b/libs/pbd/pbd/property_list.h
index db7d934fc0..04112bad80 100644
--- a/libs/pbd/pbd/property_list.h
+++ b/libs/pbd/pbd/property_list.h
@@ -36,7 +36,7 @@ public:
virtual ~PropertyList();
- void add_history_state (XMLNode* before);
+ void get_changes (XMLNode *);
/** Add a property (of some kind) to the list. Used when
constructing PropertyLists that describe a change/operation.
diff --git a/libs/pbd/pbd/sequence_property.h b/libs/pbd/pbd/sequence_property.h
index aab6a57ea1..1486437f58 100644
--- a/libs/pbd/pbd/sequence_property.h
+++ b/libs/pbd/pbd/sequence_property.h
@@ -94,12 +94,8 @@ class SequenceProperty : public PropertyBase
_change.removed.swap (_change.added);
}
- void add_history_state (XMLNode* history_node) const {
+ void get_change (XMLNode* history_node) const {
- /* We could record the whole of the current state here, but its
- obviously more efficient just to record what has changed.
- */
-
XMLNode* child = new XMLNode (PBD::capitalize (property_name()));
history_node->add_child_nocopy (*child);
@@ -121,14 +117,15 @@ class SequenceProperty : public PropertyBase
}
}
- bool set_state_from_owner_state (XMLNode const& owner_state) {
+ bool set_value (XMLNode const &) {
+ /* XXX: not used, but probably should be */
assert (false);
return false;
}
- void add_state_to_owner_state (XMLNode& owner_state_node) const {
+ void get_value (XMLNode & node) const {
for (typename Container::const_iterator i = _val.begin(); i != _val.end(); ++i) {
- owner_state_node.add_child_nocopy ((*i)->get_state ());
+ node.add_child_nocopy ((*i)->get_state ());
}
}
@@ -141,7 +138,7 @@ class SequenceProperty : public PropertyBase
_change.removed.clear ();
}
- void set_state_from_property (PropertyBase const * p) {
+ void apply_change (PropertyBase const * p) {
const ChangeRecord& change (dynamic_cast<const SequenceProperty*> (p)->change ());
update (change);
}
@@ -301,7 +298,7 @@ class SequenceProperty : public PropertyBase
* @return true if loading succeeded, false otherwise
*/
- bool load_history_state (const XMLNode& history_node) {
+ bool set_change (XMLNode const & history_node) {
const XMLNodeList& children (history_node.children());
diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h
index 1272a735f9..619de5d06f 100644
--- a/libs/pbd/pbd/stateful.h
+++ b/libs/pbd/pbd/stateful.h
@@ -48,9 +48,10 @@ class Stateful {
virtual XMLNode& get_state (void) = 0;
virtual int set_state (const XMLNode&, int version) = 0;
- virtual bool set_property (const PropertyBase&);
- PropertyChange set_properties (const PropertyList&);
+ virtual bool apply_change (PropertyBase const &);
+ PropertyChange apply_changes (PropertyList const &);
+
const OwnedPropertyList& properties() const { return *_properties; }
void add_property (PropertyBase& s);
@@ -92,10 +93,8 @@ class Stateful {
void add_instant_xml (XMLNode&, const sys::path& directory_path);
XMLNode *instant_xml (const std::string& str, const sys::path& directory_path);
void add_properties (XMLNode &);
- /* derived types can call this from ::set_state() (or elsewhere)
- to get basic property setting done.
- */
- PropertyChange set_properties (XMLNode const &);
+
+ PropertyChange set_values (XMLNode const &);
/* derived classes can implement this to do cross-checking
of property values after either a PropertyList or XML