summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_region_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-02-28 04:00:38 +0000
committerCarl Hetherington <carl@carlh.net>2011-02-28 04:00:38 +0000
commitc75b17e3bab17b852ab69868bbfdffd7ad1f73bf (patch)
tree06d25a67352757a16ee1592e1bc23de49e19c564 /gtk2_ardour/midi_region_view.cc
parent60f48d24f40e6d73b1ccf5dc2885d45570626212 (diff)
Update ghost MIDI regions in automation tracks when zoom changes. Fixes #3803.
git-svn-id: svn://localhost/ardour2/branches/3.0@8985 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r--gtk2_ardour/midi_region_view.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index e76433bcae..f7b9c8f9e0 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -1457,8 +1457,12 @@ MidiRegionView::note_in_region_range(const boost::shared_ptr<NoteType> note, boo
return !outside;
}
+/** Update a canvas note's size from its model note.
+ * @param ev Canvas note to update.
+ * @param update_ghost_regions true to update the note in any ghost regions that we have, otherwise false.
+ */
void
-MidiRegionView::update_note (CanvasNote* ev)
+MidiRegionView::update_note (CanvasNote* ev, bool update_ghost_regions)
{
boost::shared_ptr<NoteType> note = ev->note();
@@ -1501,6 +1505,15 @@ MidiRegionView::update_note (CanvasNote* ev)
/* outline all edges */
ev->property_outline_what() = (guint32) 0xF;
}
+
+ if (update_ghost_regions) {
+ for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
+ MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
+ if (gr) {
+ gr->update_note (ev);
+ }
+ }
+ }
}
double
@@ -3148,7 +3161,8 @@ MidiRegionView::update_ghost_note (double x, double y)
_ghost_note->note()->set_length (length);
_ghost_note->note()->set_note (midi_stream_view()->y_to_note (y));
- update_note (_ghost_note);
+ /* the ghost note does not appear in ghost regions, so pass false in here */
+ update_note (_ghost_note, false);
show_verbose_canvas_cursor (_ghost_note->note ());
}