MidiModel::Notes& notes (_model->notes());
_optimization_iterator = _events.begin();
+ bool empty_when_starting = !_events.empty();
+
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
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 ();
} else {
- if ((cne = find_canvas_note (note)) != 0) {
+ if (empty_when_starting && (cne = find_canvas_note (note)) != 0) {
cne->validate ();
cne->hide ();
}
/* remove note items that are no longer valid */
- for (Events::iterator i = _events.begin(); i != _events.end(); ) {
- if (!(*i)->valid ()) {
-
- for (vector<GhostRegion*>::iterator j = ghosts.begin(); j != ghosts.end(); ++j) {
- MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*j);
- if (gr) {
- gr->remove_note (*i);
+ if (empty_when_starting) {
+ for (Events::iterator i = _events.begin(); i != _events.end(); ) {
+ if (!(*i)->valid ()) {
+
+ for (vector<GhostRegion*>::iterator j = ghosts.begin(); j != ghosts.end(); ++j) {
+ MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*j);
+ if (gr) {
+ gr->remove_note (*i);
+ }
}
+
+ delete *i;
+ i = _events.erase (i);
+
+ } else {
+ ++i;
}
-
- delete *i;
- i = _events.erase (i);
-
- } else {
- ++i;
}
}
redisplay_model();
}
-// CAIROCANVAS
-#if 0
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();
} else {
(*x)->show();
}
}
-#endif
move_step_edit_cursor (_step_edit_cursor_position);
set_step_edit_cursor_width (_step_edit_cursor_width);
midi_stream_view()->highest_note(),
height != old_height + FUDGE);
- if (name_pixbuf) {
- name_pixbuf->raise_to_top();
+ if (name_text) {
+ name_text->raise_to_top();
}
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
{
Note* note;
- double unit_position = _region->position () / frames_per_pixel;
+ double unit_position = _region->position () / samples_per_pixel;
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&tv);
MidiGhostRegion* ghost;
}
ghost->set_height ();
- ghost->set_duration (_region->length() / frames_per_pixel);
+ ghost->set_duration (_region->length() / samples_per_pixel);
ghosts.push_back (ghost);
GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context());
// calculate the colors: get the color settings
uint32_t fill_color = UINT_RGBA_CHANGE_A(
- ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(),
128);
// make the resize preview notes more transparent and bright
0.85));
resize_rect->set_outline_color (NoteBase::calculate_outline (
- ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected()));
resize_data->resize_rect = resize_rect;
_resize_data.push_back(resize_data);
}
if (_selected) {
- f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
+ f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
} else if (high_enough_for_name) {
- f= ARDOUR_UI::config()->canvasvar_MidiFrameBase.get();
+ f= ARDOUR_UI::config()->get_canvasvar_MidiFrameBase();
} else {
f = fill_color;
}