enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / surfaces / mackie / mcp_buttons.cc
index 6bdbbe2b71ba4dc0741a7421c7de6336180e4de7..4733327d2c4ff0bb672474fa631f30f8a81947c7 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
@@ -102,7 +102,7 @@ MackieControlProtocol::left_press (Button &)
                return none;
        }
 
-       Sorted sorted = get_sorted_routes();
+       Sorted sorted = get_sorted_stripables();
        uint32_t strip_cnt = n_strips ();
 
        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
@@ -130,7 +130,7 @@ MackieControlProtocol::right_press (Button &)
                return none;
        }
 
-       Sorted sorted = get_sorted_routes();
+       Sorted sorted = get_sorted_stripables();
        uint32_t strip_cnt = n_strips();
        uint32_t route_cnt = sorted.size();
        uint32_t max_bank = route_cnt / strip_cnt * strip_cnt;
@@ -270,7 +270,7 @@ MackieControlProtocol::channel_left_press (Button &)
        if (_subview_mode != None) {
                return none;
        }
-       Sorted sorted = get_sorted_routes();
+       Sorted sorted = get_sorted_stripables();
        if (sorted.size() > n_strips()) {
                prev_track();
                return on;
@@ -291,7 +291,7 @@ MackieControlProtocol::channel_right_press (Button &)
        if (_subview_mode != None) {
                return none;
        }
-       Sorted sorted = get_sorted_routes();
+       Sorted sorted = get_sorted_stripables();
        if (sorted.size() > n_strips()) {
                next_track();
                return on;
@@ -362,6 +362,7 @@ MackieControlProtocol::drop_press (Button &)
 {
        if (main_modifier_state() == MODIFIER_SHIFT) {
                toggle_punch_in();
+               return none;
        } else {
                access_action ("Editor/start-range-from-playhead");
        }
@@ -382,7 +383,7 @@ MackieControlProtocol::save_press (Button &)
        } else {
                save_state ();
        }
-       
+
        return none;
 }
 
@@ -423,9 +424,14 @@ MackieControlProtocol::timecode_beats_release (Button &)
 LedState
 MackieControlProtocol::marker_press (Button &)
 {
-       _modifier_state |= MODIFIER_MARKER;
-       marker_modifier_consumed_by_button = false;
-       return on;
+       if (main_modifier_state() & MODIFIER_SHIFT) {
+               access_action ("Editor/remove-location-from-playhead");
+               return off;
+       } else {
+               _modifier_state |= MODIFIER_MARKER;
+               marker_modifier_consumed_by_button = false;
+               return on;
+       }
 }
 
 LedState
@@ -433,6 +439,9 @@ MackieControlProtocol::marker_release (Button &)
 {
        _modifier_state &= ~MODIFIER_MARKER;
 
+       if (main_modifier_state() & MODIFIER_SHIFT)
+               return off;   //if shift was held, we already did the action
+
        if (marker_modifier_consumed_by_button) {
                /* marker was used a modifier for some other button(s), so do
                   nothing
@@ -694,7 +703,7 @@ LedState
 MackieControlProtocol::pan_press (Button &)
 {
        /* XXX eventually pan may have its own subview mode */
-       set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Route>());
+       set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Stripable>());
        return none;
 }
 LedState
@@ -717,8 +726,7 @@ MackieControlProtocol::plugin_release (Button &)
 LedState
 MackieControlProtocol::eq_press (Button &)
 {
-       boost::shared_ptr<Route> r = first_selected_route ();
-       set_subview_mode (EQ, r);
+       set_subview_mode (EQ, first_selected_stripable ());
        return none; /* led state handled by set_subview_mode() */
 
 }
@@ -730,8 +738,7 @@ MackieControlProtocol::eq_release (Button &)
 LedState
 MackieControlProtocol::dyn_press (Button &)
 {
-       boost::shared_ptr<Route> r = first_selected_route ();
-       set_subview_mode (Dynamics, r);
+       set_subview_mode (Dynamics, first_selected_stripable ());
        return none; /* led state handled by set_subview_mode() */
 }
 
@@ -787,7 +794,7 @@ MackieControlProtocol::cancel_press (Button &)
        if (main_modifier_state() & MODIFIER_SHIFT) {
                access_action ("Transport/ToggleExternalSync");
        } else {
-               access_action ("Editor/escape");
+               access_action ("Main/Escape");
        }
        return none;
 }
@@ -875,14 +882,13 @@ MackieControlProtocol::clearsolo_press (Mackie::Button&)
 {
        // clears all solos and listens (pfl/afl)
 
-       if (session) {
-               if (session->soloing()) {
-                       session->set_solo (session->get_routes(), false);
-               } else if (session->listening()) {
-                       session->set_listen (session->get_routes(), false);
-               }
+       if (main_modifier_state() & MODIFIER_SHIFT) {
+               access_action ("Editor/set-session-from-edit-range");
+               return none;
+       }
 
-               session->clear_all_solo_state (session->get_routes()); // safeguard, ideally this won't do anything, check the log-window
+       if (session) {
+               session->cancel_all_solo ();
        }
        return none;
 }
@@ -897,7 +903,7 @@ MackieControlProtocol::clearsolo_release (Mackie::Button&)
 Mackie::LedState
 MackieControlProtocol::track_press (Mackie::Button&)
 {
-       set_subview_mode (TrackView, first_selected_route());
+       set_subview_mode (TrackView, first_selected_stripable());
        return none;
 }
 Mackie::LedState
@@ -908,8 +914,7 @@ MackieControlProtocol::track_release (Mackie::Button&)
 Mackie::LedState
 MackieControlProtocol::send_press (Mackie::Button&)
 {
-       boost::shared_ptr<Route> r = first_selected_route ();
-       set_subview_mode (Sends, r);
+       set_subview_mode (Sends, first_selected_stripable());
        return none; /* led state handled by set_subview_mode() */
 }
 Mackie::LedState
@@ -1052,7 +1057,7 @@ MackieControlProtocol::nudge_release (Mackie::Button&)
        _modifier_state &= ~MODIFIER_NUDGE;
 
        /* XXX these action names are stupid, because the action can affect
-        * regions, markers or the playhead depending on selection state. 
+        * regions, markers or the playhead depending on selection state.
         */
 
        if (main_modifier_state() & MODIFIER_SHIFT) {
@@ -1068,10 +1073,11 @@ MackieControlProtocol::replace_press (Mackie::Button&)
 {
        if (main_modifier_state() == MODIFIER_SHIFT) {
                toggle_punch_out();
+               return none;
        } else {
                access_action ("Editor/finish-range-from-playhead");
        }
-       return off;
+       return none;
 }
 Mackie::LedState
 MackieControlProtocol::replace_release (Mackie::Button&)
@@ -1084,9 +1090,6 @@ MackieControlProtocol::click_press (Mackie::Button&)
        if (main_modifier_state() & MODIFIER_SHIFT) {
                access_action ("Editor/set-punch-from-edit-range");
                return off;
-       } else if (main_modifier_state() & MODIFIER_OPTION) {
-               access_action ("Editor/set-session-from-edit-range");
-               return off;
        } else {
                bool state = !Config->get_clicking();
                Config->set_clicking (state);