13
0

partially fix scaling issues with pathological MIDI regions (e.g. 15k notes per region), particularly during loading. more to be done, perhaps, for editing purposes where we redisplay the entire model after a change

This commit is contained in:
Paul Davis 2013-04-16 09:25:53 -04:00
parent be23e48e7f
commit e3db2d3ca5

View File

@ -1118,6 +1118,8 @@ MidiRegionView::redisplay_model()
MidiModel::Notes& notes (_model->notes()); MidiModel::Notes& notes (_model->notes());
_optimization_iterator = _events.begin(); _optimization_iterator = _events.begin();
bool empty_when_starting = !_events.empty();
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) { for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n); boost::shared_ptr<NoteType> note (*n);
@ -1126,7 +1128,7 @@ MidiRegionView::redisplay_model()
if (note_in_region_range (note, visible)) { if (note_in_region_range (note, visible)) {
if ((cne = find_canvas_note (note)) != 0) { if (empty_when_starting && (cne = find_canvas_note (note)) != 0) {
cne->validate (); cne->validate ();
@ -1152,7 +1154,7 @@ MidiRegionView::redisplay_model()
} else { } else {
if ((cne = find_canvas_note (note)) != 0) { if (empty_when_starting && (cne = find_canvas_note (note)) != 0) {
cne->validate (); cne->validate ();
cne->hide (); cne->hide ();
} }
@ -1162,6 +1164,7 @@ MidiRegionView::redisplay_model()
/* remove note items that are no longer valid */ /* remove note items that are no longer valid */
if (empty_when_starting) {
for (Events::iterator i = _events.begin(); i != _events.end(); ) { for (Events::iterator i = _events.begin(); i != _events.end(); ) {
if (!(*i)->valid ()) { if (!(*i)->valid ()) {
@ -1179,6 +1182,7 @@ MidiRegionView::redisplay_model()
++i; ++i;
} }
} }
}
_patch_changes.clear(); _patch_changes.clear();
_sys_exes.clear(); _sys_exes.clear();
@ -1360,16 +1364,13 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
redisplay_model(); redisplay_model();
} }
// CAIROCANVAS
#if 0
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) { for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
if ((*x)->width() >= _pixel_width) { if ((*x)->canvas_item()->width() >= _pixel_width) {
(*x)->hide(); (*x)->hide();
} else { } else {
(*x)->show(); (*x)->show();
} }
} }
#endif
move_step_edit_cursor (_step_edit_cursor_position); move_step_edit_cursor (_step_edit_cursor_position);
set_step_edit_cursor_width (_step_edit_cursor_width); set_step_edit_cursor_width (_step_edit_cursor_width);