diff options
Diffstat (limited to 'gtk2_ardour/note_base.cc')
-rw-r--r-- | gtk2_ardour/note_base.cc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index 3e6bb402da..b525b8bac9 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -68,7 +68,7 @@ NoteBase::NoteBase(MidiRegionView& region, bool with_events, const boost::shared , _state(None) , _note(note) , _with_events (with_events) - , _selected(false) + , _flags (Flags (0)) , _valid (true) , _mouse_x_fraction (-1.0) , _mouse_y_fraction (-1.0) @@ -142,10 +142,10 @@ NoteBase::on_channel_selection_change(uint16_t selection) if ( (selection & (1 << _note->channel())) == 0 ) { const Gtkmm2ext::Color inactive_ch = UIConfiguration::instance().color ("midi note inactive channel"); set_fill_color(inactive_ch); - set_outline_color(calculate_outline(inactive_ch, _selected)); + set_outline_color(calculate_outline(inactive_ch, (_flags == Selected))); } else { // set the color according to the notes selection state - set_selected(_selected); + set_selected (_flags == Selected); } // this forces the item to update..... maybe slow... _item->hide(); @@ -166,12 +166,16 @@ NoteBase::set_selected(bool selected) return; } - _selected = selected; + if (selected) { + _flags = Flags (_flags | Selected); + } else { + _flags = Flags (_flags & ~Selected); + } const uint32_t base_col = base_color(); set_fill_color (base_col); - set_outline_color(calculate_outline(base_col, _selected)); + set_outline_color(calculate_outline(base_col, (_flags == Selected))); } #define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257) @@ -364,3 +368,21 @@ NoteBase::meter_style_fill_color(uint8_t vel, bool /* selected */) return velocity_color_table[vel]; } +void +NoteBase::set_hide_selection (bool yn) +{ + if (yn) { + _flags = Flags (_flags | HideSelection); + } else { + _flags = Flags (_flags & ~HideSelection); + } + + if (_flags & Selected) { + /* maybe (?) change outline color */ + set_outline_color (calculate_outline (base_color(), !yn)); + } + + /* no need to redo color if it wasn't selected and we just changed + * "hide selected" since nothing will change + */ +} |