From 3315a6588ac414bfeabcf160a37c886b3478710e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 17 Apr 2022 12:02:18 -0600 Subject: [PATCH] midi regon view: fix logic error introduced when redisplay was split between model_changed and view_changed --- gtk2_ardour/midi_region_view.cc | 45 +++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 3cba8036c1..6ee190e340 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1170,21 +1170,28 @@ MidiRegionView::model_changed() i = _events.erase (i); } else { - bool visible = cne->item()->visible(); - if ((sus = dynamic_cast(cne))) { + bool visible; + + if (note_in_region_range (cne->note(), visible)) { if (visible) { - update_sustained (sus); + cne->item()->show (); + + if ((sus = dynamic_cast(cne))) { + update_sustained (sus); + } else if ((hit = dynamic_cast(cne))) { + update_hit (hit); + } + } else { + cne->item()->hide (); } - } else if ((hit = dynamic_cast(cne))) { - - if (visible) { - update_hit (hit); - } + } else { + cne->item()->hide (); } + ++i; } } @@ -1266,13 +1273,25 @@ MidiRegionView::view_changed() for (Events::iterator i = _events.begin(); i != _events.end(); ) { NoteBase* cne = i->second; + bool visible; - if (cne->item()->visible()) { - if ((sus = dynamic_cast(cne))) { - update_sustained (sus); + if (note_in_region_range (cne->note(), visible)) { + + if (visible) { + cne->item()->show (); + + if ((sus = dynamic_cast(cne))) { + update_sustained (sus); + } else if ((hit = dynamic_cast(cne))) { + update_hit (hit); + } + } else { + cne->item()->hide (); } - } else if ((hit = dynamic_cast(cne))) { - update_hit (hit); + + } else { + + cne->item()->hide (); } ++i;