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);
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;

View 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