summaryrefslogtreecommitdiff
path: root/gtk2_ardour/gui_object.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-01-20 18:02:48 +0000
committerCarl Hetherington <carl@carlh.net>2012-01-20 18:02:48 +0000
commit5a53f2f1b9977e909f7720c9aa30333b0ec0572b (patch)
tree06fb01663d41dcef3f9952e3d8b58e6b823b4071 /gtk2_ardour/gui_object.cc
parent3396a9a851180ef73c6af9c42fc63897bb965390 (diff)
Simple approach to putting plugin controls into the
processor box. git-svn-id: svn://localhost/ardour2/branches/3.0@11288 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/gui_object.cc')
-rw-r--r--gtk2_ardour/gui_object.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/gtk2_ardour/gui_object.cc b/gtk2_ardour/gui_object.cc
index 2b516d04da..84c9fe7c67 100644
--- a/gtk2_ardour/gui_object.cc
+++ b/gtk2_ardour/gui_object.cc
@@ -34,9 +34,9 @@ GUIObjectState::GUIObjectState ()
}
XMLNode *
-GUIObjectState::find_node (const string& id) const
+GUIObjectState::get_node (const XMLNode* parent, const string& id)
{
- XMLNodeList const & children = _state.children ();
+ XMLNodeList const & children = parent->children ();
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() != X_("Object")) {
continue;
@@ -51,6 +51,25 @@ GUIObjectState::find_node (const string& id) const
return 0;
}
+XMLNode *
+GUIObjectState::get_or_add_node (XMLNode* parent, const string& id)
+{
+ XMLNode* child = get_node (parent, id);
+ if (!child) {
+ child = new XMLNode (X_("Object"));
+ child->add_property (X_("id"), id);
+ parent->add_child_nocopy (*child);
+ }
+
+ return child;
+}
+
+XMLNode *
+GUIObjectState::get_or_add_node (const string& id)
+{
+ return get_or_add_node (&_state, id);
+}
+
/** Get a string from our state.
* @param id property of Object node to look for.
* @param prop_name name of the Object property to return.
@@ -61,7 +80,7 @@ GUIObjectState::find_node (const string& id) const
string
GUIObjectState::get_string (const string& id, const string& prop_name, bool* empty)
{
- XMLNode* child = find_node (id);
+ XMLNode* child = get_node (&_state, id);
if (!child) {
if (empty) {
*empty = true;