diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 0b0140ab8a..6fd96f3481 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1226,15 +1226,9 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force) } else if (CanvasHit* chit = dynamic_cast(event)) { - double x = trackview.editor().frame_to_pixel( - beats_to_frames(note->time()) - _region->start()); - const double diamond_size = midi_stream_view()->note_height() / 2.0; - double y = midi_stream_view()->note_to_y(event->note()->note()) - + ((diamond_size-2.0) / 4.0); + const double diamond_size = update_hit (chit); chit->set_height (diamond_size); - chit->move (x - chit->x1(), y - chit->y1()); - chit->show (); } } } @@ -1432,7 +1426,7 @@ MidiRegionView::update_note (CanvasNote* ev) } } -void +double MidiRegionView::update_hit (CanvasHit* ev) { boost::shared_ptr note = ev->note(); @@ -1443,6 +1437,8 @@ MidiRegionView::update_hit (CanvasHit* ev) const double y = midi_stream_view()->note_to_y(note->note()) + ((diamond_size-2) / 4.0); ev->move_to (x, y); + + return diamond_size; } /** Add a MIDI note to the view (with length). diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 5b01bcb7b8..fa033782d9 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -402,7 +402,7 @@ class MidiRegionView : public RegionView Events::iterator _optimization_iterator; void update_note (ArdourCanvas::CanvasNote*); - void update_hit (ArdourCanvas::CanvasHit*); + double update_hit (ArdourCanvas::CanvasHit *); void create_ghost_note (double, double); void update_ghost_note (double, double);