summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-25 17:31:33 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-25 17:31:33 +0000
commit7b2975244165b4ffd1dcf4080c1be4c8dcbc6708 (patch)
treeb3010f51f7c3fa0534c0813e51bbeef13200f6a0
parent167c439002bde2b20399d733cd5d38d3674668c3 (diff)
Rename various things in the property system.
git-svn-id: svn://localhost/ardour2/branches/3.0@7681 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/add_route_dialog.cc2
-rw-r--r--gtk2_ardour/editor_route_groups.cc2
-rw-r--r--gtk2_ardour/group_tabs.cc4
-rw-r--r--gtk2_ardour/route_group_dialog.cc2
-rw-r--r--gtk2_ardour/route_group_menu.cc2
-rw-r--r--libs/ardour/playlist.cc2
-rw-r--r--libs/ardour/region.cc2
-rw-r--r--libs/ardour/region_factory.cc6
-rw-r--r--libs/ardour/route_group.cc4
-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
-rw-r--r--libs/pbd/property_list.cc4
-rw-r--r--libs/pbd/stateful.cc21
-rw-r--r--libs/pbd/stateful_diff_command.cc8
17 files changed, 60 insertions, 66 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc
index e7ae4454aa..72a19ca6ef 100644
--- a/gtk2_ardour/add_route_dialog.cc
+++ b/gtk2_ardour/add_route_dialog.cc
@@ -416,7 +416,7 @@ AddRouteDialog::group_changed ()
PropertyList plist;
plist.add (Properties::active, true);
- g->set_properties (plist);
+ g->apply_changes (plist);
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
diff --git a/gtk2_ardour/editor_route_groups.cc b/gtk2_ardour/editor_route_groups.cc
index b66fa753da..2f9f27ae2c 100644
--- a/gtk2_ardour/editor_route_groups.cc
+++ b/gtk2_ardour/editor_route_groups.cc
@@ -366,7 +366,7 @@ EditorRouteGroups::row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel
group->set_hidden (!(*iter)[_columns.is_visible], this);
- group->set_properties (plist);
+ group->apply_changes (plist);
}
void
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index de8e45e854..560d1f7c11 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -379,7 +379,7 @@ void
GroupTabs::run_new_group_dialog (RouteList const & rl)
{
RouteGroup* g = new RouteGroup (*_session, "");
- g->set_properties (default_properties ());
+ g->apply_changes (default_properties ());
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
@@ -402,7 +402,7 @@ GroupTabs::create_and_add_group () const
{
RouteGroup* g = new RouteGroup (*_session, "");
- g->set_properties (default_properties ());
+ g->apply_changes (default_properties ());
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc
index 176c23d8e2..a65807d75d 100644
--- a/gtk2_ardour/route_group_dialog.cc
+++ b/gtk2_ardour/route_group_dialog.cc
@@ -140,7 +140,7 @@ RouteGroupDialog::do_run ()
plist.add (Properties::active, _active.get_active());
plist.add (Properties::name, string (_name.get_text()));
- _group->set_properties (plist);
+ _group->apply_changes (plist);
}
return r;
diff --git a/gtk2_ardour/route_group_menu.cc b/gtk2_ardour/route_group_menu.cc
index baf383be5d..42d09ab960 100644
--- a/gtk2_ardour/route_group_menu.cc
+++ b/gtk2_ardour/route_group_menu.cc
@@ -108,7 +108,7 @@ RouteGroupMenu::new_group ()
}
RouteGroup* g = new RouteGroup (*_session, "");
- g->set_properties (*_default_properties);
+ g->apply_changes (*_default_properties);
RouteGroupDialog d (g, Gtk::Stock::NEW);
int const r = d.do_run ();
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 851cf8596e..6ff51193d9 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2144,7 +2144,7 @@ Playlist::property_factory (const XMLNode& history_node) const
RegionListProperty* rlp = new RegionListProperty (*const_cast<Playlist*> (this));
- if (rlp->load_history_state (**i)) {
+ if (rlp->set_change (**i)) {
if (!prop_list) {
prop_list = new PropertyList();
}
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 65f7d6fedc..da26c87f26 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1216,7 +1216,7 @@ Region::_set_state (const XMLNode& node, int version, PropertyChange& what_chang
{
const XMLProperty* prop;
- what_changed = set_properties (node);
+ what_changed = set_values (node);
if ((prop = node.property (X_("id")))) {
_id = prop->value();
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index b4beddfb64..a8b0d436d6 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -123,7 +123,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, b
}
if (ret) {
- ret->set_properties (plist);
+ ret->apply_changes (plist);
map_add (ret);
if (announce) {
@@ -162,7 +162,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
if (ret) {
- ret->set_properties (plist);
+ ret->apply_changes (plist);
map_add (ret);
if (announce) {
@@ -207,7 +207,7 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
if (ret) {
- ret->set_properties (plist);
+ ret->apply_changes (plist);
map_add (ret);
if (announce) {
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index 0b0a072509..f1631e4375 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -235,7 +235,7 @@ RouteGroup::set_state (const XMLNode& node, int version)
return set_state_2X (node, version);
}
- set_properties (node);
+ set_values (node);
const XMLProperty *prop;
@@ -260,7 +260,7 @@ RouteGroup::set_state (const XMLNode& node, int version)
int
RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
{
- set_properties (node);
+ set_values (node);
if (node.name() == "MixGroup") {
_gain = true;
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
diff --git a/libs/pbd/property_list.cc b/libs/pbd/property_list.cc
index ffe1170dd5..5c0de4bacf 100644
--- a/libs/pbd/property_list.cc
+++ b/libs/pbd/property_list.cc
@@ -39,13 +39,13 @@ PropertyList::~PropertyList ()
}
void
-PropertyList::add_history_state (XMLNode* history_node)
+PropertyList::get_changes (XMLNode* history_node)
{
for (const_iterator i = begin(); i != end(); ++i) {
DEBUG_TRACE (DEBUG::Properties, string_compose ("Add before/after to %1 for %2\n",
history_node->name(),
i->second->property_name()));
- i->second->add_history_state (history_node);
+ i->second->get_change (history_node);
}
}
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index 1c3d08b3a9..f58c64603e 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -174,17 +174,18 @@ Stateful::diff (PropertyList& before, PropertyList& after, Command* cmd) const
}
}
-/** Set state of some/all _properties from an XML node.
- * @param owner_state Node.
- * @return PropertyChanges made.
+/** Set our property values from an XML node.
+ * Derived types can call this from ::set_state() (or elsewhere)
+ * to get basic property setting done.
+ * @return IDs of properties that were changed.
*/
PropertyChange
-Stateful::set_properties (XMLNode const & owner_state)
+Stateful::set_values (XMLNode const & node)
{
PropertyChange c;
for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) {
- if (i->second->set_state_from_owner_state (owner_state)) {
+ if (i->second->set_value (node)) {
c.add (i->first);
}
}
@@ -195,7 +196,7 @@ Stateful::set_properties (XMLNode const & owner_state)
}
PropertyChange
-Stateful::set_properties (const PropertyList& property_list)
+Stateful::apply_changes (const PropertyList& property_list)
{
PropertyChange c;
PropertyList::const_iterator p;
@@ -209,7 +210,7 @@ Stateful::set_properties (const PropertyList& property_list)
for (PropertyList::const_iterator i = property_list.begin(); i != property_list.end(); ++i) {
if ((p = _properties->find (i->first)) != _properties->end()) {
DEBUG_TRACE (DEBUG::Stateful, string_compose ("actually setting property %1\n", p->second->property_name()));
- if (set_property (*i->second)) {
+ if (apply_change (*i->second)) {
c.add (i->first);
}
} else {
@@ -232,7 +233,7 @@ void
Stateful::add_properties (XMLNode& owner_state)
{
for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) {
- i->second->add_state_to_owner_state (owner_state);
+ i->second->get_value (owner_state);
}
}
@@ -302,14 +303,14 @@ Stateful::changed() const
}
bool
-Stateful::set_property (const PropertyBase& prop)
+Stateful::apply_change (const PropertyBase& prop)
{
OwnedPropertyList::iterator i = _properties->find (prop.property_id());
if (i == _properties->end()) {
return false;
}
- i->second->set_state_from_property (&prop);
+ i->second->apply_change (&prop);
return true;
}
diff --git a/libs/pbd/stateful_diff_command.cc b/libs/pbd/stateful_diff_command.cc
index 2c58acee14..857235b803 100644
--- a/libs/pbd/stateful_diff_command.cc
+++ b/libs/pbd/stateful_diff_command.cc
@@ -85,7 +85,7 @@ StatefulDiffCommand::operator() ()
boost::shared_ptr<Stateful> s (_object.lock());
if (s) {
- s->set_properties (*_redo);
+ s->apply_changes (*_redo);
}
}
@@ -96,7 +96,7 @@ StatefulDiffCommand::undo ()
if (s) {
std::cerr << "Undoing a stateful diff command\n";
- s->set_properties (*_undo);
+ s->apply_changes (*_undo);
}
}
@@ -118,8 +118,8 @@ StatefulDiffCommand::get_state ()
XMLNode* undo = new XMLNode (X_("Undo"));
XMLNode* redo = new XMLNode (X_("Do"));
- _undo->add_history_state (undo);
- _redo->add_history_state (redo);
+ _undo->get_changes (undo);
+ _redo->get_changes (redo);
node->add_child_nocopy (*undo);
node->add_child_nocopy (*redo);