MCP: reverse operation of cursor up/down in zoom mode; more tracign for vpot
[ardour.git] / libs / surfaces / generic_midi / generic_midi_control_protocol.cc
index f5f75ce50d7973582bb3af7b766c11d3b9aac957..bff46462a70fbc5666f2375a1e2cfc9529a6aba8 100644 (file)
@@ -55,9 +55,9 @@ using namespace std;
 
 GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
        : ControlProtocol (s, _("Generic MIDI"), midi_ui_context())
+       , _motorised (false)
        , gui (0)
 {
-
        _input_port = MIDI::Manager::instance()->midi_input_port ();
        _output_port = MIDI::Manager::instance()->midi_output_port ();
 
@@ -320,7 +320,7 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
        }
 
        if (!mc) {
-               mc = new MIDIControllable (*_input_port, *c, false);
+               mc = new MIDIControllable (this, *_input_port, *c, false);
        }
        
        {
@@ -417,7 +417,7 @@ GenericMidiControlProtocol::create_binding (PBD::Controllable* control, int pos,
                MIDI::byte value = control_number;
                
                // Create a MIDIControllable
-               MIDIControllable* mc = new MIDIControllable (*_input_port, *control, false);
+               MIDIControllable* mc = new MIDIControllable (this, *_input_port, *control, false);
 
                // Remove any old binding for this midi channel/type/value pair
                // Note:  can't use delete_binding() here because we don't know the specific controllable we want to remove, only the midi information
@@ -533,7 +533,7 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
                                 cerr << "\tresult = " << c << endl;
                                
                                if (c) {
-                                       MIDIControllable* mc = new MIDIControllable (*_input_port, *c, false);
+                                       MIDIControllable* mc = new MIDIControllable (this, *_input_port, *c, false);
                                         
                                        if (mc->set_state (**niter, version) == 0) {
                                                controllables.push_back (mc);
@@ -622,6 +622,12 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
                                _bank_size = atoi (prop->value());
                                _current_bank = 0;
                        }
+
+                       if ((prop = (*citer)->property ("motorised")) != 0) {
+                               _motorised = string_is_affirmative (prop->value ());
+                       } else {
+                               _motorised = false;
+                       }
                }
 
                if ((*citer)->name() == "Binding") {
@@ -714,7 +720,7 @@ GenericMidiControlProtocol::create_binding (const XMLNode& node)
        prop = node.property (X_("uri"));
        uri = prop->value();
 
-       MIDIControllable* mc = new MIDIControllable (*_input_port, momentary);
+       MIDIControllable* mc = new MIDIControllable (this, *_input_port, momentary);
 
        if (mc->init (uri)) {
                delete mc;
@@ -980,3 +986,9 @@ GenericMidiControlProtocol::prev_bank()
                reset_controllables ();
        }
 }
+
+void
+GenericMidiControlProtocol::set_motorised (bool m)
+{
+       _motorised = m;
+}