diff --git a/gtk2_ardour/pianoroll.cc b/gtk2_ardour/pianoroll.cc index 9f5d91c832..a3da4bfd0c 100644 --- a/gtk2_ardour/pianoroll.cc +++ b/gtk2_ardour/pianoroll.cc @@ -1955,18 +1955,9 @@ Pianoroll::visual_changer (const VisualChange& vc) vertical_adjustment.set_value (vc.y_origin); } - /** - * Now the canvas is in the final state before render the canvas items that - * support the Item::prepare_for_render interface can calculate the correct - * item to visible canvas intersection. - */ if (vc.pending & VisualChange::ZoomLevel) { on_samples_per_pixel_changed (); - - // update_tempo_based_rulers (); - } - - if (!(vc.pending & VisualChange::ZoomLevel)) { + } else { /* If the canvas is not being zoomed then the canvas items will not change * and cause Item::prepare_for_render to be called so do it here manually. * Not ideal, but I can't think of a better solution atm. @@ -1984,9 +1975,7 @@ Pianoroll::visual_changer (const VisualChange& vc) void Pianoroll::on_samples_per_pixel_changed () { - if (view) { - view->set_samples_per_pixel (samples_per_pixel); - } + update_tempo_based_rulers (); } void @@ -3043,3 +3032,15 @@ Pianoroll::instrument_info () const return &view->midi_track()->instrument_info (); } + +void +Pianoroll::update_tempo_based_rulers () +{ + if (!_session) { + return; + } + + bbt_metric.units_per_pixel = samples_per_pixel; + compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples()); + bbt_ruler->set_range (_leftmost_sample, _leftmost_sample+current_page_samples()); +} diff --git a/gtk2_ardour/pianoroll.h b/gtk2_ardour/pianoroll.h index 4762f1db53..619f839a72 100644 --- a/gtk2_ardour/pianoroll.h +++ b/gtk2_ardour/pianoroll.h @@ -347,4 +347,5 @@ class Pianoroll : public CueEditor bool bbt_ruler_event (GdkEvent*); void ruler_locate (GdkEventButton*); void scrolled (); + void update_tempo_based_rulers (); };