}
events.clear();
+ _optimization_iterator = events.end ();
}
/** Update the x positions of our representation of a parent's note.
}
}
+void
+MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
+{
+ Event* ev = find_event (note);
+ if (!ev) {
+ return;
+ }
+
+ events.remove (ev);
+ delete ev;
+ _optimization_iterator = events.end ();
+}
+
/** Given a note in our parent region (ie the actual MidiRegionView), find our
* representation of it.
* @return Our Event, or 0 if not found.
*/
MidiGhostRegion::Event *
-MidiGhostRegion::find_event (ArdourCanvas::CanvasNote* parent)
+MidiGhostRegion::find_event (ArdourCanvas::CanvasNoteEvent* parent)
{
/* we are using _optimization_iterator to speed up the common case where a caller
is going through our notes in order.
void add_note(ArdourCanvas::CanvasNote*);
void update_note (ArdourCanvas::CanvasNote *);
+ void remove_note (ArdourCanvas::CanvasNoteEvent *);
void clear_events();
private:
- MidiGhostRegion::Event* find_event (ArdourCanvas::CanvasNote *);
+ MidiGhostRegion::Event* find_event (ArdourCanvas::CanvasNoteEvent *);
typedef std::list<MidiGhostRegion::Event*> EventList;
EventList events;
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;
}