MCP: map the well-known EQ knobs more explicitly, not heuristically.
[ardour.git] / libs / surfaces / mackie / mcp_buttons.cc
index 2e2c936f9110a2274ccada68b5f38daa64f1885d..3bdf51c4b9e44840c44caaac72c97c61a66c6b02 100644 (file)
@@ -32,7 +32,7 @@
 #include "surface.h"
 #include "fader.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 /* handlers for all buttons, broken into a separate file to avoid clutter in
  * mackie_control_protocol.cc
@@ -364,7 +364,7 @@ MackieControlProtocol::drop_press (Button &)
                toggle_punch_in();
                return none;
        } else {
-               access_action ("Editor/start-range-from-playhead");
+               access_action ("Common/start-range-from-playhead");
        }
        return none;
 }
@@ -425,7 +425,7 @@ LedState
 MackieControlProtocol::marker_press (Button &)
 {
        if (main_modifier_state() & MODIFIER_SHIFT) {
-               access_action ("Editor/remove-location-from-playhead");
+               access_action ("Common/remove-location-from-playhead");
                return off;
        } else {
                _modifier_state |= MODIFIER_MARKER;
@@ -439,10 +439,12 @@ MackieControlProtocol::marker_release (Button &)
 {
        _modifier_state &= ~MODIFIER_MARKER;
 
-       if (main_modifier_state() & MODIFIER_SHIFT)
+       if (main_modifier_state() & MODIFIER_SHIFT) {
                return off;   //if shift was held, we already did the action
+       }
 
        if (marker_modifier_consumed_by_button) {
+               DEBUG_TRACE (DEBUG::MackieControl, "marked modifier consumed by button, ignored\n");
                /* marker was used a modifier for some other button(s), so do
                   nothing
                */
@@ -461,7 +463,7 @@ MackieControlProtocol::marker_release (Button &)
                return off;
        }
 
-       session->locations()->next_available_name (markername,"marker");
+       session->locations()->next_available_name (markername,"mark");
        add_marker (markername);
 
        return off;
@@ -525,7 +527,7 @@ MackieControlProtocol::rewind_press (Button &)
        if (modifier_state() & MODIFIER_MARKER) {
                prev_marker ();
        } else if (modifier_state() & MODIFIER_NUDGE) {
-               access_action ("Editor/nudge-playhead-backward");
+               access_action ("Common/nudge-playhead-backward");
        } else if (main_modifier_state() & MODIFIER_SHIFT) {
                goto_start ();
        } else {
@@ -546,7 +548,7 @@ MackieControlProtocol::ffwd_press (Button &)
        if (modifier_state() & MODIFIER_MARKER) {
                next_marker ();
        } else if (modifier_state() & MODIFIER_NUDGE) {
-               access_action ("Editor/nudge-playhead-forward");
+               access_action ("Common/nudge-playhead-forward");
        } else if (main_modifier_state() & MODIFIER_SHIFT) {
                goto_end();
        } else {
@@ -565,11 +567,11 @@ LedState
 MackieControlProtocol::loop_press (Button &)
 {
        if (main_modifier_state() & MODIFIER_SHIFT) {
-               access_action ("Editor/set-loop-from-edit-range");
+               access_action ("Common/set-loop-from-edit-range");
                return off;
        } else {
                bool was_on = session->get_play_loop();
-               session->request_play_loop (!was_on);
+               loop_toggle ();
                return was_on ? off : on;
        }
 }
@@ -615,50 +617,51 @@ MackieControlProtocol::bank_release (Button& b, uint32_t basic_bank_num)
        return on;
 }
 
+/*  F-KEYS are only used for actions that are bound from the control panel; no need to address them here
 LedState
 MackieControlProtocol::F1_press (Button &b)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F1_release (Button &b)
 {
-       return bank_release (b, 0);
+       return off;
 }
 LedState
 MackieControlProtocol::F2_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F2_release (Button &b)
 {
-       return bank_release (b, 1);
+       return off;
 }
 LedState
 MackieControlProtocol::F3_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F3_release (Button &b)
 {
-       return bank_release (b, 2);
+       return off;
 }
 LedState
 MackieControlProtocol::F4_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F4_release (Button &b)
 {
-       return bank_release (b, 3);
+       return off;
 }
 LedState
 MackieControlProtocol::F5_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F5_release (Button &)
@@ -668,7 +671,7 @@ MackieControlProtocol::F5_release (Button &)
 LedState
 MackieControlProtocol::F6_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F6_release (Button &)
@@ -678,7 +681,7 @@ MackieControlProtocol::F6_release (Button &)
 LedState
 MackieControlProtocol::F7_press (Button &)
 {
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F7_release (Button &)
@@ -688,14 +691,15 @@ MackieControlProtocol::F7_release (Button &)
 LedState
 MackieControlProtocol::F8_press (Button &)
 {
-       CloseDialog (); /* EMIT SIGNAL */
-       return off;
+       return on;
 }
 LedState
 MackieControlProtocol::F8_release (Button &)
 {
        return off;
 }
+*/
+
 
 /* UNIMPLEMENTED */
 
@@ -883,14 +887,11 @@ MackieControlProtocol::clearsolo_press (Mackie::Button&)
        // clears all solos and listens (pfl/afl)
 
        if (main_modifier_state() & MODIFIER_SHIFT) {
-               access_action ("Editor/set-session-from-edit-range");
+               access_action ("Common/set-session-from-edit-range");
                return none;
        }
 
-       if (session) {
-               session->set_controls (route_list_to_control_list (session->get_routes(), &Stripable::solo_control), 0.0, Controllable::NoGroup);
-               session->clear_all_solo_state (session->get_routes()); 
-       }
+       cancel_all_solo ();
        return none;
 }
 
@@ -937,6 +938,9 @@ MackieControlProtocol::miditracks_release (Mackie::Button&)
 Mackie::LedState
 MackieControlProtocol::inputs_press (Mackie::Button&)
 {
+#ifdef MIXBUS
+       set_view_mode (Mixer);  //in Mixbus, this is the same as Global View (avoid dead buttons)
+#endif
        return none;
 }
 Mackie::LedState
@@ -958,6 +962,9 @@ MackieControlProtocol::audiotracks_release (Mackie::Button&)
 Mackie::LedState
 MackieControlProtocol::audioinstruments_press (Mackie::Button& b)
 {
+#ifdef MIXBUS
+       set_view_mode (MidiTracks);  //in Mixbus, we do the same thing as MIDI Tracks ( aviod dead buttons )
+#endif
        return none;
 }
 
@@ -1076,7 +1083,7 @@ MackieControlProtocol::replace_press (Mackie::Button&)
                toggle_punch_out();
                return none;
        } else {
-               access_action ("Editor/finish-range-from-playhead");
+               access_action ("Common/finish-range-from-playhead");
        }
        return none;
 }
@@ -1089,7 +1096,7 @@ Mackie::LedState
 MackieControlProtocol::click_press (Mackie::Button&)
 {
        if (main_modifier_state() & MODIFIER_SHIFT) {
-               access_action ("Editor/set-punch-from-edit-range");
+               access_action ("Common/set-punch-from-edit-range");
                return off;
        } else {
                bool state = !Config->get_clicking();