diff options
author | nick_m <mainsbridge@gmail.com> | 2016-12-23 00:51:34 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-12-23 00:51:34 +1100 |
commit | 96048ad4c09aca166dcccce9abe91da209a09b93 (patch) | |
tree | 104a5187eba11481301ffe382be3e0f93c5f5209 /gtk2_ardour/midi_region_view.cc | |
parent | ebf60feb130569e97ef12d1cb592eb2365a5909a (diff) |
midi scrooming performance updates.
- MGR visibility is handled by update_note/hit()
MRV unconditionally updates MGR events
- remove MidiGhostRegion::update_range()
- rename set_contents_height -> update_contents_height
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 4e0e2af1e4..90a1e36883 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1189,6 +1189,8 @@ MidiRegionView::redisplay_model() bool empty_when_starting = _events.empty(); MidiModel::ReadLock lock(_model->read_lock()); MidiModel::Notes missing_notes = _model->notes(); // copy + Note* sus = NULL; + Hit* hit = NULL; if (!empty_when_starting) { MidiModel::Notes::iterator f; @@ -1225,10 +1227,11 @@ MidiRegionView::redisplay_model() } else { NoteBase* cne = (*i); bool visible; + bool update = false; if (note_in_region_range (note, visible)) { if (visible) { - update_note (cne); + update = true; cne->show (); } else { cne->hide (); @@ -1236,7 +1239,31 @@ MidiRegionView::redisplay_model() } else { cne->hide (); } + if ((sus = dynamic_cast<Note*>(cne))) { + + if (update) { + update_sustained (sus); + } + + for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { + MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i); + if (gr) { + gr->update_note (sus); + } + } + } else if ((hit = dynamic_cast<Hit*>(cne))) { + if (update) { + update_hit (hit); + } + + for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { + MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i); + if (gr) { + gr->update_hit (hit); + } + } + } ++i; } } @@ -1248,18 +1275,14 @@ MidiRegionView::redisplay_model() NoteBase* cne = add_note (note, true); bool visible; - if (note_in_region_range (note, visible)) { - if (visible) { - set<Evoral::event_id_t>::iterator it; - - cne->show (); + for (set<Evoral::event_id_t>::iterator it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) { + if ((*it) == note->id()) { + add_to_selection (cne); + } + } - for (it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) { - if ((*it) == note->id()) { - add_to_selection (cne); - } - } - } else { + if (note_in_region_range (note, visible)) { + if (!visible) { cne->hide (); } } else { @@ -1747,14 +1770,6 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions) ev->set_fill_color(base_col); ev->set_outline_color(ev->calculate_outline(base_col, ev->selected())); - if (update_ghost_regions) { - for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { - MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i); - if (gr) { - gr->update_note (ev); - } - } - } } void @@ -1784,14 +1799,6 @@ MidiRegionView::update_hit (Hit* ev, bool update_ghost_regions) ev->set_fill_color(base_col); ev->set_outline_color(ev->calculate_outline(base_col, ev->selected())); - if (update_ghost_regions) { - for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { - MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i); - if (gr) { - gr->update_hit (ev); - } - } - } } /** Add a MIDI note to the view (with length). |