save/load generic-midi motorized setting - fixes #5296
authorRobin Gareus <robin@gareus.org>
Wed, 19 Aug 2015 22:19:06 +0000 (00:19 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 19 Aug 2015 22:19:32 +0000 (00:19 +0200)
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/gmcp_gui.cc

index 0ed6a90942ab522bcf55a4100994980b8bdd7fe8..8c47f736885340e6a7e4e7a92650e40def184faa 100644 (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;
index 379f7c822c70bb1d0e34bb18c80c587a0a30b532..3ed37a9eac691a9a0bca2eb8ace187eddd795e53 100644 (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));