13
0

add shift modifier support

This commit is contained in:
Paul Davis 2016-06-17 00:32:06 -04:00
parent 98335084c7
commit c6faede00c
3 changed files with 28 additions and 1 deletions

View File

@ -93,3 +93,16 @@ Push2::button_fixed_length ()
id_button_map[FixedLength]->set_state (LED::NoTransition);
write (id_button_map[FixedLength]->state_msg());
}
void
Push2::button_shift_press ()
{
modifier_state = ModifierState (modifier_state | ModShift);
}
void
Push2::button_shift_release ()
{
modifier_state = ModifierState (modifier_state & ~ModShift);
}

View File

@ -60,6 +60,7 @@ Push2::Push2 (ARDOUR::Session& s)
, handle (0)
, device_buffer (0)
, frame_buffer (Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, cols, rows))
, modifier_state (None)
{
context = Cairo::Context::create (frame_buffer);
tc_clock_layout = Pango::Layout::create (context);
@ -679,6 +680,10 @@ Push2::build_maps ()
button = new WhiteButton ((i), (cc), (p)); \
cc_button_map.insert (make_pair (button->controller_number(), button)); \
id_button_map.insert (make_pair (button->id, button))
#define MAKE_WHITE_BUTTON_PRESS_RELEASE(i,cc,p,r) \
button = new WhiteButton ((i), (cc), (p), (r)); \
cc_button_map.insert (make_pair (button->controller_number(), button)); \
id_button_map.insert (make_pair (button->id, button))
MAKE_WHITE_BUTTON (TapTempo, 3);
MAKE_WHITE_BUTTON_PRESS (Metronome, 9, &Push2::button_metronome);
@ -712,7 +717,7 @@ Push2::build_maps ()
MAKE_WHITE_BUTTON (PageRight, 63);
MAKE_WHITE_BUTTON (OctaveDown, 54);
MAKE_WHITE_BUTTON (PageLeft, 62);
MAKE_WHITE_BUTTON (Shift, 49);
MAKE_WHITE_BUTTON_PRESS_RELEASE (Shift, 49, &Push2::button_shift_press, &Push2::button_shift_release);
MAKE_WHITE_BUTTON (Select, 48);
}

View File

@ -86,6 +86,13 @@ class Push2 : public ARDOUR::ControlProtocol
sigc::connection vblank_connection;
sigc::connection periodic_connection;
enum ModifierState {
None = 0,
ModShift = 0x1,
};
ModifierState modifier_state;
static const int cols;
static const int rows;
static const int pixels_per_row;
@ -337,6 +344,8 @@ class Push2 : public ARDOUR::ControlProtocol
void button_solo ();
void button_fixed_length ();
void button_new ();
void button_shift_press ();
void button_shift_release ();
/* widgets */