summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-12-21 03:18:18 +1100
committernick_m <mainsbridge@gmail.com>2016-12-21 03:18:18 +1100
commiteecc9ed743d0623bf03ce1ead44ed329fa11211c (patch)
tree1bfb7a21e150f8504a2e77c68e0283a37cf5bf78 /gtk2_ardour/midi_region_view.cc
parent1a500bc00b526972f319621ff5b846b1e6df9b2d (diff)
fix various midi display bugs introduced by 9038be49d8.
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r--gtk2_ardour/midi_region_view.cc35
1 files changed, 25 insertions, 10 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index ecc39dde6b..4e0e2af1e4 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1191,10 +1191,26 @@ MidiRegionView::redisplay_model()
MidiModel::Notes missing_notes = _model->notes(); // copy
if (!empty_when_starting) {
+ MidiModel::Notes::iterator f;
for (Events::iterator i = _events.begin(); i != _events.end(); ) {
- boost::shared_ptr<NoteType> note ((*i)->note());
+ boost::shared_ptr<NoteType> note = (*i)->note();
+
+ /* if event item's note exists in the model, we can just update it.
+ * don't mark it as missing.
+ */
+ if ((f = missing_notes.find (note)) != missing_notes.end()) {
+ if ((*f) == note) {
+ (*i)->validate();
+ missing_notes.erase (f);
+ } else {
+ (*i)->invalidate();
+ }
+
+ } else {
+ (*i)->invalidate();
+ }
/* remove note items that are no longer valid */
- if (!(*i)->valid () || !_model->find_note (note)) {
+ if (!(*i)->valid()) {
for (vector<GhostRegion*>::iterator j = ghosts.begin(); j != ghosts.end(); ++j) {
MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*j);
@@ -1207,7 +1223,6 @@ MidiRegionView::redisplay_model()
i = _events.erase (i);
} else {
- MidiModel::Notes::iterator f;
NoteBase* cne = (*i);
bool visible;
@@ -1222,33 +1237,33 @@ MidiRegionView::redisplay_model()
cne->hide ();
}
- if ((f = missing_notes.find (note)) != missing_notes.end()) {
- missing_notes.erase (f);
- }
-
++i;
}
-
}
}
- NoteBase* cne;
for (MidiModel::Notes::iterator n = missing_notes.begin(); n != missing_notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
+ NoteBase* cne = add_note (note, true);
bool visible;
if (note_in_region_range (note, visible)) {
if (visible) {
- cne = add_note (note, true);
set<Evoral::event_id_t>::iterator it;
+ cne->show ();
+
for (it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) {
if ((*it) == note->id()) {
add_to_selection (cne);
}
}
+ } else {
+ cne->hide ();
}
+ } else {
+ cne->hide ();
}
}