From 5b97b1a191c6e1025236fc029d4a2c2cb4d58249 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Mon, 29 Aug 2016 20:16:08 +1000 Subject: [PATCH] Use XMLNode::get/set_property API in ProcessorBox and ProcessorWindowProxy classes --- gtk2_ardour/processor_box.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 94cd4e5314..37645f0185 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -27,7 +27,6 @@ #include -#include "pbd/convert.h" #include "canvas/utils.h" #include @@ -971,8 +970,8 @@ void ProcessorEntry::Control::add_state (XMLNode* node) const { XMLNode* c = new XMLNode (X_("Object")); - c->add_property (X_("id"), state_id ()); - c->add_property (X_("visible"), _visible); + c->set_property (X_("id"), state_id ()); + c->set_property (X_("visible"), _visible); node->add_child_nocopy (*c); } @@ -981,8 +980,10 @@ ProcessorEntry::Control::set_state (XMLNode const * node) { XMLNode* n = GUIObjectState::get_node (node, state_id ()); if (n) { - XMLProperty const * p = n->property (X_("visible")); - set_visible (p && string_is_affirmative (p->value ())); + bool visible; + if (n->get_property (X_("visible"), visible)) { + set_visible (visible); + } } else { set_visible (false); } @@ -4263,7 +4264,7 @@ ProcessorWindowProxy::get_state () { XMLNode *node; node = &ProxyBase::get_state(); - node->add_property (X_("custom-ui"), is_custom? X_("yes") : X_("no")); + node->set_property (X_("custom-ui"), is_custom); return *node; } @@ -4273,18 +4274,15 @@ ProcessorWindowProxy::set_state (const XMLNode& node, int /*version*/) XMLNodeList children = node.children (); XMLNodeList::const_iterator i = children.begin (); while (i != children.end()) { - XMLProperty const * prop = (*i)->property (X_("name")); - if ((*i)->name() == X_("Window") && prop && prop->value() == _name) { + std::string name; + if ((*i)->name() == X_("Window") && (*i)->get_property (X_("name"), name) && name == _name) { break; } ++i; } if (i != children.end()) { - XMLProperty const * prop; - if ((prop = (*i)->property (X_("custom-ui"))) != 0) { - want_custom = PBD::string_is_affirmative (prop->value ()); - } + (*i)->get_property (X_("custom-ui"), want_custom); } return ProxyBase::set_state (node, 0);