summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2017-04-18 20:00:12 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-04-19 09:36:54 +1000
commitbd3965e278977b39e5c818eff3199ce87ed5e733 (patch)
tree7521ef1905cca8b039d30efa45fac999c76b8e9a
parent0df955412e738efc3d100253d36abc70f53424b7 (diff)
Use XMLNode::get/set_property in Push2 surface
Fix push2 property names to use hyphen word separator.
-rw-r--r--libs/surfaces/push2/push2.cc30
1 files changed, 9 insertions, 21 deletions
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc
index 03e0175a91..30b521686c 100644
--- a/libs/surfaces/push2/push2.cc
+++ b/libs/surfaces/push2/push2.cc
@@ -40,6 +40,7 @@
#include "ardour/midi_port.h"
#include "ardour/session.h"
#include "ardour/tempo.h"
+#include "ardour/types_convert.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/rgb_macros.h"
@@ -994,10 +995,10 @@ Push2::get_state()
child->add_child_nocopy (_async_out->get_state());
node.add_child_nocopy (*child);
- node.add_property (X_("root"), to_string (_scale_root, std::dec));
- node.add_property (X_("root_octave"), to_string (_root_octave, std::dec));
- node.add_property (X_("in_key"), _in_key ? X_("yes") : X_("no"));
- node.add_property (X_("mode"), enum_2_string (_mode));
+ node.set_property (X_("root"), _scale_root);
+ node.set_property (X_("root-octave"), _root_octave);
+ node.set_property (X_("in-key"), _in_key);
+ node.set_property (X_("mode"), _mode);
return node;
}
@@ -1029,23 +1030,10 @@ Push2::set_state (const XMLNode & node, int version)
}
}
- XMLProperty const* prop;
-
- if ((prop = node.property (X_("root"))) != 0) {
- _scale_root = atoi (prop->value());
- }
-
- if ((prop = node.property (X_("root_octave"))) != 0) {
- _root_octave = atoi (prop->value());
- }
-
- if ((prop = node.property (X_("in_key"))) != 0) {
- _in_key = string_is_affirmative (prop->value());
- }
-
- if ((prop = node.property (X_("mode"))) != 0) {
- _mode = (MusicalMode::Type) string_2_enum (prop->value(), _mode);
- }
+ node.get_property (X_("root"), _scale_root);
+ node.get_property (X_("root-octave"), _root_octave);
+ node.get_property (X_("in-key"), _in_key);
+ node.get_property (X_("mode"), _mode);
return retval;
}