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;