diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-11 15:35:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-11 15:35:34 +0000 |
commit | 106024330230fca331e2f611fec42ec1f4f43e5a (patch) | |
tree | 56342e0e544be5223d2fa360caaec80ac0fe6fa4 /libs/pbd | |
parent | 7468fdb9ca9892cec9b298690bf0edf3655d6453 (diff) |
major, substantive reworking of how we store GUI information (visibility, height) for automation data. old design stored (insufficient) identifying information plus actual data in a GUI-only XML node; new scheme adds GUI data via extra_xml node to each AutomationControl object. reworked public/private methods for showing/hiding TimeAxisView objects; changed labelling of automation tracks to just show the name of the controlled parameter - more info can be viewed in the tooltip for the track headers. NOTE: Session file format ALTERED. No data loss but track visibility may be different than previous ardour3 versions
git-svn-id: svn://localhost/ardour2/branches/3.0@9703 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/controllable.cc | 6 | ||||
-rw-r--r-- | libs/pbd/pbd/stateful.h | 3 | ||||
-rw-r--r-- | libs/pbd/stateful.cc | 37 |
3 files changed, 34 insertions, 12 deletions
diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index 0112ff2b1c..959abe443d 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -113,6 +113,10 @@ Controllable::get_state () snprintf (buf, sizeof (buf), "%2.12f", get_value()); node->add_property (X_("value"), buf); + if (_extra_xml) { + node->add_child_copy (*_extra_xml); + } + return *node; } @@ -123,6 +127,8 @@ Controllable::set_state (const XMLNode& node, int /*version*/) LocaleGuard lg (X_("POSIX")); const XMLProperty* prop; + Stateful::save_extra_xml (node); + if ((prop = node.property (X_("id"))) != 0) { _id = prop->value(); } else { diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h index 80a5a2f75f..dd1659db55 100644 --- a/libs/pbd/pbd/stateful.h +++ b/libs/pbd/pbd/stateful.h @@ -61,7 +61,8 @@ class Stateful { */ void add_extra_xml (XMLNode&); - XMLNode *extra_xml (const std::string& str); + XMLNode *extra_xml (const std::string& str, bool add_if_missing = false); + void save_extra_xml (const XMLNode&); const PBD::ID& id() const { return _id; } diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 4eb8434af2..47d1e66ef4 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -68,22 +68,37 @@ Stateful::add_extra_xml (XMLNode& node) } XMLNode * -Stateful::extra_xml (const string& str) +Stateful::extra_xml (const string& str, bool add_if_missing) { - if (_extra_xml == 0) { - return 0; + XMLNode* node = 0; + + if (_extra_xml) { + node = _extra_xml->child (str.c_str()); } - const XMLNodeList& nlist = _extra_xml->children(); - XMLNodeConstIterator i; + if (!node && add_if_missing) { + node = new XMLNode (str); + add_extra_xml (*node); + } - for (i = nlist.begin(); i != nlist.end(); ++i) { - if ((*i)->name() == str) { - return (*i); - } - } + return node; +} - return 0; +void +Stateful::save_extra_xml (const XMLNode& node) +{ + /* Looks for the child node called "Extra" and makes _extra_xml + point to a copy of it. Will delete any existing node pointed + to by _extra_xml if a new Extra node is found, but not + otherwise. + */ + + const XMLNode* xtra = node.child ("Extra"); + + if (xtra) { + delete _extra_xml; + _extra_xml = new XMLNode (*xtra); + } } void |