mackie: make nudge work as modifier and on its own
This commit is contained in:
@@ -92,6 +92,7 @@ const int MackieControlProtocol::MODIFIER_CMDALT = 0x8;
|
||||
const int MackieControlProtocol::MODIFIER_ZOOM = 0x10;
|
||||
const int MackieControlProtocol::MODIFIER_SCRUB = 0x20;
|
||||
const int MackieControlProtocol::MODIFIER_MARKER = 0x40;
|
||||
const int MackieControlProtocol::MODIFIER_NUDGE = 0x80;
|
||||
const int MackieControlProtocol::MAIN_MODIFIER_MASK = (MackieControlProtocol::MODIFIER_OPTION|
|
||||
MackieControlProtocol::MODIFIER_CONTROL|
|
||||
MackieControlProtocol::MODIFIER_SHIFT|
|
||||
@@ -125,6 +126,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
|
||||
, configuration_state (0)
|
||||
, state_version (0)
|
||||
, marker_modifier_consumed_by_button (false)
|
||||
, nudge_modifier_consumed_by_button (false)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
|
||||
|
||||
@@ -1525,6 +1527,10 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
|
||||
marker_modifier_consumed_by_button = true;
|
||||
}
|
||||
|
||||
if ((button_id != Button::Nudge) && (modifier_state() & MODIFIER_NUDGE)) {
|
||||
nudge_modifier_consumed_by_button = true;
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2 (%3)\n", (bs == press ? "press" : "release"), button.id(),
|
||||
Button::id_to_name (button.bid())));
|
||||
|
||||
|
||||
@@ -363,6 +363,7 @@ class MackieControlProtocol
|
||||
int state_version;
|
||||
int _last_bank[9];
|
||||
bool marker_modifier_consumed_by_button;
|
||||
bool nudge_modifier_consumed_by_button;
|
||||
|
||||
boost::shared_ptr<ArdourSurface::Mackie::Surface> _master_surface;
|
||||
|
||||
|
||||
@@ -509,6 +509,8 @@ MackieControlProtocol::rewind_press (Button &)
|
||||
{
|
||||
if (modifier_state() & MODIFIER_MARKER) {
|
||||
prev_marker ();
|
||||
} else if (modifier_state() & MODIFIER_NUDGE) {
|
||||
gui_invoke ("Editor/nudge-playhead-backward");
|
||||
} else if (main_modifier_state() == MODIFIER_SHIFT) {
|
||||
goto_start ();
|
||||
} else {
|
||||
@@ -528,6 +530,8 @@ MackieControlProtocol::ffwd_press (Button &)
|
||||
{
|
||||
if (modifier_state() & MODIFIER_MARKER) {
|
||||
next_marker ();
|
||||
} else if (modifier_state() & MODIFIER_NUDGE) {
|
||||
gui_invoke ("Editor/nudge-playhead-forward");
|
||||
} else if (main_modifier_state() == MODIFIER_SHIFT) {
|
||||
goto_end();
|
||||
} else {
|
||||
@@ -1018,12 +1022,26 @@ MackieControlProtocol::grp_release (Mackie::Button&)
|
||||
Mackie::LedState
|
||||
MackieControlProtocol::nudge_press (Mackie::Button&)
|
||||
{
|
||||
return none;
|
||||
_modifier_state |= MODIFIER_NUDGE;
|
||||
nudge_modifier_consumed_by_button = false;
|
||||
return on;
|
||||
}
|
||||
Mackie::LedState
|
||||
MackieControlProtocol::nudge_release (Mackie::Button&)
|
||||
{
|
||||
return none;
|
||||
_modifier_state &= ~MODIFIER_NUDGE;
|
||||
|
||||
/* XXX these action names are stupid, because the action can affect
|
||||
* regions, markers or the playhead depending on selection state.
|
||||
*/
|
||||
|
||||
if (main_modifier_state() & MODIFIER_SHIFT) {
|
||||
gui_invoke ("Region/nudge-backward");
|
||||
} else {
|
||||
gui_invoke ("Region/nudge-forward");
|
||||
}
|
||||
|
||||
return off;
|
||||
}
|
||||
Mackie::LedState
|
||||
MackieControlProtocol::replace_press (Mackie::Button&)
|
||||
|
||||
Reference in New Issue
Block a user