From ddd085cf4e4e626d4622e9ac42cc3096707905d8 Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 23 Dec 2016 05:07:22 +1100 Subject: hide ghost events appropriately (e.g. after split). --- gtk2_ardour/ghostregion.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gtk2_ardour/ghostregion.cc') diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index d9b267cfd7..843fa57706 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -336,8 +336,9 @@ MidiGhostRegion::add_note (NoteBase* n) uint8_t const note_num = n->note()->note(); double const h = note_height(trackview, mv); double const y = note_y(trackview, mv, note_num); - - if (note_num < mv->lowest_note() || note_num > mv->highest_note()) { + if (n->x0() < base_rect->x0() || n->x1() > base_rect->x1()) { + event->item->hide(); + } else if (note_num < mv->lowest_note() || note_num > mv->highest_note()) { event->item->hide(); } else { if ((_tmp_rect = dynamic_cast(event->item))) { @@ -367,7 +368,7 @@ MidiGhostRegion::clear_events() * @param parent The CanvasNote from the parent MidiRegionView. */ void -MidiGhostRegion::update_note (Note* note) +MidiGhostRegion::update_note (Note* note, bool hide) { MidiStreamView* mv = midi_view(); @@ -386,7 +387,7 @@ MidiGhostRegion::update_note (Note* note) double const y = note_y(trackview, mv, note_num); double const h = note_height(trackview, mv); - if (note_num < mv->lowest_note() || note_num > mv->highest_note()) { + if (hide || note_num < mv->lowest_note() || note_num > mv->highest_note()) { ev->item->hide(); } else { if ((_tmp_rect = dynamic_cast(ev->item))) { @@ -400,7 +401,7 @@ MidiGhostRegion::update_note (Note* note) * @param hit The CanvasHit from the parent MidiRegionView. */ void -MidiGhostRegion::update_hit (Hit* hit) +MidiGhostRegion::update_hit (Hit* hit, bool hide) { MidiStreamView* mv = midi_view(); @@ -418,7 +419,7 @@ MidiGhostRegion::update_hit (Hit* hit) double const h = note_height(trackview, mv); double const y = note_y(trackview, mv, note_num); - if (note_num < mv->lowest_note() || note_num > mv->highest_note()) { + if (hide || note_num < mv->lowest_note() || note_num > mv->highest_note()) { ev->item->hide(); } else { if ((_tmp_poly = dynamic_cast(ev->item))) { -- cgit v1.2.3