mackie: fix stupid thinko, and use BaseUI::access_action() to correctly accesss GUI actions

This commit is contained in:
Paul Davis 2016-02-01 12:20:55 -05:00
parent c69514afe9
commit 5eccbbfbd6
3 changed files with 13 additions and 36 deletions

View 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;
}
}

View file

@ -392,11 +392,6 @@ class MackieControlProtocol
int set_device_info (const std::string& device_name); int set_device_info (const std::string& device_name);
void update_configuration_state (); 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 */ /* MIDI port connection management */
PBD::ScopedConnection port_connection; PBD::ScopedConnection port_connection;

View file

@ -60,7 +60,7 @@ LedState
MackieControlProtocol::option_press (Button &) MackieControlProtocol::option_press (Button &)
{ {
_modifier_state |= MODIFIER_OPTION; _modifier_state |= MODIFIER_OPTION;
gui_invoke ("Editor/set-loop-from-edit-range"); access_action ("Editor/set-loop-from-edit-range");
return on; return on;
} }
LedState LedState
@ -74,7 +74,7 @@ MackieControlProtocol::control_press (Button &)
{ {
_modifier_state |= MODIFIER_CONTROL; _modifier_state |= MODIFIER_CONTROL;
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("CONTROL Press: modifier state now set to %1\n", _modifier_state)); 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; return on;
} }
LedState LedState
@ -88,7 +88,7 @@ LedState
MackieControlProtocol::cmd_alt_press (Button &) MackieControlProtocol::cmd_alt_press (Button &)
{ {
_modifier_state |= MODIFIER_CMDALT; _modifier_state |= MODIFIER_CMDALT;
gui_invoke ("Editor/set-session-from-edit-range"); access_action ("Editor/set-session-from-edit-range");
return on; return on;
} }
LedState LedState
@ -346,26 +346,21 @@ MackieControlProtocol::scrub_release (Mackie::Button &)
LedState LedState
MackieControlProtocol::undo_press (Button&) MackieControlProtocol::undo_press (Button&)
{ {
if (main_modifier_state() & MODIFIER_SHIFT) { toggle_punch_out ();
Redo(); /* EMIT SIGNAL */ return none;
} else {
Undo(); /* EMIT SIGNAL */
}
return off;
} }
LedState LedState
MackieControlProtocol::undo_release (Button&) MackieControlProtocol::undo_release (Button&)
{ {
return off; return none;
} }
LedState LedState
MackieControlProtocol::drop_press (Button &) MackieControlProtocol::drop_press (Button &)
{ {
gui_invoke ("Editor/start-range-from-playhead"); access_action ("Editor/start-range-from-playhead");
update_global_button (Button::Replace, flashing); return none;
return on;
} }
LedState LedState
@ -511,7 +506,7 @@ MackieControlProtocol::rewind_press (Button &)
if (modifier_state() & MODIFIER_MARKER) { if (modifier_state() & MODIFIER_MARKER) {
prev_marker (); prev_marker ();
} else if (modifier_state() & MODIFIER_NUDGE) { } 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) { } else if (main_modifier_state() == MODIFIER_SHIFT) {
goto_start (); goto_start ();
} else { } else {
@ -532,7 +527,7 @@ MackieControlProtocol::ffwd_press (Button &)
if (modifier_state() & MODIFIER_MARKER) { if (modifier_state() & MODIFIER_MARKER) {
next_marker (); next_marker ();
} else if (modifier_state() & MODIFIER_NUDGE) { } 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) { } else if (main_modifier_state() == MODIFIER_SHIFT) {
goto_end(); goto_end();
} else { } else {
@ -1045,9 +1040,9 @@ MackieControlProtocol::nudge_release (Mackie::Button&)
*/ */
if (main_modifier_state() & MODIFIER_SHIFT) { if (main_modifier_state() & MODIFIER_SHIFT) {
gui_invoke ("Region/nudge-backward"); access_action ("Region/nudge-backward");
} else { } else {
gui_invoke ("Region/nudge-forward"); access_action ("Region/nudge-forward");
} }
return off; return off;
@ -1055,8 +1050,7 @@ MackieControlProtocol::nudge_release (Mackie::Button&)
Mackie::LedState Mackie::LedState
MackieControlProtocol::replace_press (Mackie::Button&) MackieControlProtocol::replace_press (Mackie::Button&)
{ {
gui_invoke ("Editor/finish-range-from-playhead"); access_action ("Editor/finish-range-from-playhead");
update_global_button (Button::Drop, off);
return off; return off;
} }
Mackie::LedState Mackie::LedState