13
0

MidiRegionView::redisplay_model() - code cleanup

This commit is contained in:
nick_m 2017-01-27 00:56:39 +11:00
parent 7ef09f98ff
commit e7415c6619

View File

@ -1204,43 +1204,11 @@ MidiRegionView::redisplay_model()
if (note_in_region_range (note, visible)) { if (note_in_region_range (note, visible)) {
if (!empty_when_starting && (cne = find_canvas_note (note)) != 0) { if (!empty_when_starting && (cne = find_canvas_note (note)) != 0) {
cne->validate (); cne->validate ();
bool update = false;
if (note_in_region_range (note, visible)) {
if (visible) { if (visible) {
update = true;
cne->show (); cne->show ();
} else { } else {
cne->hide (); cne->hide ();
} }
} 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->trackview.hidden()) {
gr->update_note (sus, !update);
}
}
} 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->trackview.hidden()) {
gr->update_hit (hit, !update);
}
}
}
} else { } else {
missing_notes.insert (note); missing_notes.insert (note);
} }
@ -1267,6 +1235,33 @@ MidiRegionView::redisplay_model()
i = _events.erase (i); i = _events.erase (i);
} else { } else {
bool visible = cne->item()->visible();
if ((sus = dynamic_cast<Note*>(cne))) {
if (visible) {
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, !visible || gr->trackview.hidden());
}
}
} else if ((hit = dynamic_cast<Hit*>(cne))) {
if (visible) {
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, !visible || gr->trackview.hidden());
}
}
}
++i; ++i;
} }
} }