mackie: fix stupid thinko, and use BaseUI::access_action() to correctly accesss GUI...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 1 Feb 2016 17:20:55 +0000 (12:20 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 1 Feb 2016 17:20:55 +0000 (12:20 -0500)
libs/surfaces/mackie/gui.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/mcp_buttons.cc

index 096543e1128db7d1ec64890e616193fe201ee004..632a9f57c36de69c88cc88e5ef98fcbf72f8b596 100644 (file)
@@ -916,15 +916,3 @@ MackieControlProtocolGUI::active_port_changed (Gtk::ComboBox* combo, boost::weak
        }
 }
 
-/* special case: MackieControlProtocol object method that requires GUI headers */
-
-void
-MackieControlProtocol::gui_invoke (string const& action_name)
-{
-       Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (action_name.c_str());
-       if (act) {
-               act->activate ();
-       } else {
-               std::cerr << "no such action: " << action_name << std::endl;
-       }
-}
index 3b0337e49a84d9c764fa4109a59737091a92cf79..f31929da56e2ca327d1e0792862217e094a8e22d 100644 (file)
@@ -392,11 +392,6 @@ class MackieControlProtocol
         int set_device_info (const std::string& device_name);
        void update_configuration_state ();
 
-       /* accepts an Action name from the application GUI definitions, and
-          invokes it
-       */
-       void gui_invoke (std::string const &);
-
        /* MIDI port connection management */
 
        PBD::ScopedConnection port_connection;
index c1cd6739312ccd52fc90f2076fda8a2af9d5a219..ff1b85874ff4a522870f1690f75649427f8dffaf 100644 (file)
@@ -60,7 +60,7 @@ LedState
 MackieControlProtocol::option_press (Button &)
 {
        _modifier_state |= MODIFIER_OPTION;
-       gui_invoke ("Editor/set-loop-from-edit-range");
+       access_action ("Editor/set-loop-from-edit-range");
        return on;
 }
 LedState
@@ -74,7 +74,7 @@ MackieControlProtocol::control_press (Button &)
 {
        _modifier_state |= MODIFIER_CONTROL;
        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("CONTROL Press: modifier state now set to %1\n", _modifier_state));
-       gui_invoke ("Editor/set-punch-from-edit-range");
+       access_action ("Editor/set-punch-from-edit-range");
        return on;
 }
 LedState
@@ -88,7 +88,7 @@ LedState
 MackieControlProtocol::cmd_alt_press (Button &)
 {
        _modifier_state |= MODIFIER_CMDALT;
-       gui_invoke ("Editor/set-session-from-edit-range");
+       access_action ("Editor/set-session-from-edit-range");
        return on;
 }
 LedState
@@ -346,26 +346,21 @@ MackieControlProtocol::scrub_release (Mackie::Button &)
 LedState
 MackieControlProtocol::undo_press (Button&)
 {
-       if (main_modifier_state() & MODIFIER_SHIFT) {
-               Redo(); /* EMIT SIGNAL */
-       } else {
-               Undo(); /* EMIT SIGNAL */
-       }
-       return off;
+       toggle_punch_out ();
+       return none;
 }
 
 LedState
 MackieControlProtocol::undo_release (Button&)
 {
-       return off;
+       return none;
 }
 
 LedState
 MackieControlProtocol::drop_press (Button &)
 {
-       gui_invoke ("Editor/start-range-from-playhead");
-       update_global_button (Button::Replace, flashing);
-       return on;
+       access_action ("Editor/start-range-from-playhead");
+       return none;
 }
 
 LedState
@@ -511,7 +506,7 @@ MackieControlProtocol::rewind_press (Button &)
        if (modifier_state() & MODIFIER_MARKER) {
                prev_marker ();
        } else if (modifier_state() & MODIFIER_NUDGE) {
-               gui_invoke ("Editor/nudge-playhead-backward");
+               access_action ("Editor/nudge-playhead-backward");
        } else if (main_modifier_state() == MODIFIER_SHIFT) {
                goto_start ();
        } else {
@@ -532,7 +527,7 @@ MackieControlProtocol::ffwd_press (Button &)
        if (modifier_state() & MODIFIER_MARKER) {
                next_marker ();
        } else if (modifier_state() & MODIFIER_NUDGE) {
-               gui_invoke ("Editor/nudge-playhead-forward");
+               access_action ("Editor/nudge-playhead-forward");
        } else if (main_modifier_state() == MODIFIER_SHIFT) {
                goto_end();
        } else {
@@ -1045,9 +1040,9 @@ MackieControlProtocol::nudge_release (Mackie::Button&)
         */
 
        if (main_modifier_state() & MODIFIER_SHIFT) {
-               gui_invoke ("Region/nudge-backward");
+               access_action ("Region/nudge-backward");
        } else {
-               gui_invoke ("Region/nudge-forward");
+               access_action ("Region/nudge-forward");
        }
 
        return off;
@@ -1055,8 +1050,7 @@ MackieControlProtocol::nudge_release (Mackie::Button&)
 Mackie::LedState
 MackieControlProtocol::replace_press (Mackie::Button&)
 {
-       gui_invoke ("Editor/finish-range-from-playhead");
-       update_global_button (Button::Drop, off);
+       access_action ("Editor/finish-range-from-playhead");
        return off;
 }
 Mackie::LedState