save/load generic-midi motorized setting - fixes #5296

This commit is contained in:
Robin Gareus 2015-08-20 00:19:06 +02:00
parent 84845833c1
commit b8b6f61d6c
2 changed files with 10 additions and 1 deletions

View File

@ -533,6 +533,8 @@ GenericMidiControlProtocol::get_state ()
snprintf (buf, sizeof (buf), "%d", _threshold);
node.add_property (X_("threshold"), buf);
node.add_property (X_("motorized"), _motorised ? "yes" : "no");
if (!_current_binding.empty()) {
node.add_property ("binding", _current_binding);
}
@ -584,6 +586,12 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
_threshold = 10;
}
if ((prop = node.property ("motorized")) != 0) {
_motorised = string_is_affirmative (prop->value ());
} else {
_motorised = false;
}
boost::shared_ptr<Controllable> c;
{
@ -709,7 +717,7 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
_current_bank = 0;
}
if ((prop = (*citer)->property ("motorised")) != 0 || ((prop = (*citer)->property ("motorized")) != 0)) {
if ((prop = (*citer)->property ("motorized")) != 0) {
_motorised = string_is_affirmative (prop->value ());
} else {
_motorised = false;

View File

@ -154,6 +154,7 @@ GMCPGUI::GMCPGUI (GenericMidiControlProtocol& p)
++n;
motorised_button.show ();
motorised_button.set_active (p.motorised ());
threshold_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &GMCPGUI::threshold_changed));