From f290be21ee896912553efbe5ec7f75d1d027ac13 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 17 Jun 2016 01:59:01 -0400 Subject: [PATCH] use right-side buttons to goto_nth_marker() --- libs/surfaces/push2/buttons.cc | 67 ++++++++++++++++++++++++++++++++++ libs/surfaces/push2/push2.cc | 18 ++++----- libs/surfaces/push2/push2.h | 9 +++++ 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/libs/surfaces/push2/buttons.cc b/libs/surfaces/push2/buttons.cc index b009b148ff..a8aa6d0150 100644 --- a/libs/surfaces/push2/buttons.cc +++ b/libs/surfaces/push2/buttons.cc @@ -165,3 +165,70 @@ Push2::button_lower (uint32_t n) mc->set_value (!mc->get_value(), PBD::Controllable::UseGroup); } } + +void +Push2::button_undo () +{ + if (modifier_state & ModShift) { + ControlProtocol::Redo (); + } else { + ControlProtocol::Undo (); + } +} + +void +Push2::button_fwd32t () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (0+n); +} + +void +Push2::button_fwd32 () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (1+n); +} + +void +Push2::button_fwd16t () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (2+n); +} + +void +Push2::button_fwd16 () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (3+n); +} + +void +Push2::button_fwd8t () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (4+n); +} + +void +Push2::button_fwd8 () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (5+n); +} + +void +Push2::button_fwd4t () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (6+n); +} + +void +Push2::button_fwd4 () +{ + const int n = (modifier_state & ModShift) ? 8 : 0; + goto_nth_marker (7+n); +} + diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index 38415e35ca..369af80f9e 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -684,14 +684,14 @@ Push2::build_maps () MAKE_COLOR_BUTTON (Mute, 60); MAKE_COLOR_BUTTON_PRESS (Solo, 61, &Push2::button_solo); MAKE_COLOR_BUTTON (Stop, 29); - MAKE_COLOR_BUTTON (Fwd32ndT, 43); - MAKE_COLOR_BUTTON (Fwd32nd,42 ); - MAKE_COLOR_BUTTON (Fwd16thT, 41); - MAKE_COLOR_BUTTON (Fwd16th, 40); - MAKE_COLOR_BUTTON (Fwd8thT, 39 ); - MAKE_COLOR_BUTTON (Fwd8th, 38); - MAKE_COLOR_BUTTON (Fwd4trT, 37); - MAKE_COLOR_BUTTON (Fwd4tr, 36); + MAKE_COLOR_BUTTON_PRESS (Fwd32ndT, 43, &Push2::button_fwd32t); + MAKE_COLOR_BUTTON_PRESS (Fwd32nd,42 , &Push2::button_fwd32); + MAKE_COLOR_BUTTON_PRESS (Fwd16thT, 41, &Push2::button_fwd16t); + MAKE_COLOR_BUTTON_PRESS (Fwd16th, 40, &Push2::button_fwd16); + MAKE_COLOR_BUTTON_PRESS (Fwd8thT, 39 , &Push2::button_fwd8t); + MAKE_COLOR_BUTTON_PRESS (Fwd8th, 38, &Push2::button_fwd8); + MAKE_COLOR_BUTTON_PRESS (Fwd4trT, 37, &Push2::button_fwd4t); + MAKE_COLOR_BUTTON_PRESS (Fwd4tr, 36, &Push2::button_fwd4); MAKE_COLOR_BUTTON (Automate, 89); MAKE_COLOR_BUTTON_PRESS (RecordEnable, 86, &Push2::button_recenable); MAKE_COLOR_BUTTON_PRESS (Play, 85, &Push2::button_play); @@ -717,7 +717,7 @@ Push2::build_maps () MAKE_WHITE_BUTTON (AddDevice, 52); MAKE_WHITE_BUTTON (Device, 110); MAKE_WHITE_BUTTON (Mix, 112); - MAKE_WHITE_BUTTON (Undo, 119); + MAKE_WHITE_BUTTON_PRESS (Undo, 119, &Push2::button_undo); MAKE_WHITE_BUTTON (AddTrack, 53); MAKE_WHITE_BUTTON_PRESS (Browse, 111, &Push2::button_browse); MAKE_WHITE_BUTTON_PRESS (Clip, 113, &Push2::button_clip); diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 60bfa2b07f..0ddfad2f15 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -366,6 +366,15 @@ class Push2 : public ARDOUR::ControlProtocol void button_lower_6 () { button_lower (5); } void button_lower_7 () { button_lower (6); } void button_lower_8 () { button_lower (7); } + void button_undo (); + void button_fwd32t (); + void button_fwd32 (); + void button_fwd16t (); + void button_fwd16 (); + void button_fwd8t (); + void button_fwd8 (); + void button_fwd4t (); + void button_fwd4 (); /* widgets */