diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-09-22 10:47:34 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-09-27 14:59:31 -0500 |
commit | f12150a1edc629aedacf2719f2505315bb82e9d5 (patch) | |
tree | e58c006a510814e7db4cd452c384cdcddde8936d | |
parent | cb340bf190f2835761392a581e22a6c6d5635928 (diff) |
push2: always use a contrasting color when flashing played pads
-rw-r--r-- | libs/surfaces/push2/push2.cc | 8 | ||||
-rw-r--r-- | libs/surfaces/push2/push2.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index b6ac5f5b02..22b9ade398 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -136,6 +136,7 @@ Push2::Push2 (ARDOUR::Session& s) , percussion (false) , _pressure_mode (AfterTouch) , selection_color (LED::Green) + , contrast_color (LED::Green) { build_maps (); @@ -817,10 +818,7 @@ Push2::handle_midi_note_on_message (MIDI::Parser& parser, MIDI::EventTwoBytes* e pad->set_state (LED::OneShot24th); write (pad->state_msg()); } else if (pad->do_when_pressed == Pad::FlashOff) { - /* XXX really need to pick a contrasting color from - selection color here. - */ - pad->set_color (LED::Green); + pad->set_color (contrast_color); pad->set_state (LED::OneShot24th); write (pad->state_msg()); } @@ -1530,9 +1528,11 @@ Push2::stripable_selection_change (StripableNotificationListPtr selected) new_pad_target->input()->connect (new_pad_target->input()->nth (0), pad_port->name(), this); current_pad_target = new_pad_target; selection_color = get_color_index (new_pad_target->presentation_info().color()); + contrast_color = get_color_index (ArdourCanvas::HSV (new_pad_target->presentation_info().color()).opposite().color()); } else { current_pad_target.reset (); selection_color = LED::Green; + contrast_color = LED::Green; } reset_pad_colors (); diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 56229fc8ef..88ecd52e93 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -593,6 +593,7 @@ class Push2 : public ARDOUR::ControlProtocol void request_pressure_mode (); uint8_t selection_color; + uint8_t contrast_color; }; } /* namespace */ |