- std::vector<TempoMap::BBTPoint> grid;
- compute_current_bbt_points (grid, leftmost_frame, leftmost_frame + current_page_samples());
- draw_measures (grid);
- update_tempo_based_rulers (grid);
+
+ tempo_curves.sort (CurveComparator());
+
+ const double min_tempo_range = 5.0;
+ const double tempo_delta = fabs (max_tempo - min_tempo);
+
+ if (tempo_delta < min_tempo_range) {
+ max_tempo += min_tempo_range - tempo_delta;
+ min_tempo += tempo_delta - min_tempo_range;
+ }
+
+ for (Curves::iterator x = tempo_curves.begin(); x != tempo_curves.end(); ) {
+ Curves::iterator tmp = x;
+ (*x)->set_max_tempo (max_tempo);
+ (*x)->set_min_tempo (min_tempo);
+ ++tmp;
+ if (tmp != tempo_curves.end()) {
+ (*x)->set_position ((*x)->tempo().sample(), (*tmp)->tempo().sample());
+ } else {
+ (*x)->set_position ((*x)->tempo().sample(), UINT32_MAX);
+ }
+
+ if (!(*x)->tempo().active()) {
+ (*x)->hide();
+ } else {
+ (*x)->show();
+ }
+
+ ++x;
+ }
+
+ for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) {
+ TempoMarker* tempo_marker;
+ if ((tempo_marker = dynamic_cast<TempoMarker*> (*x)) != 0) {
+ tempo_marker->update_height_mark ((tempo_marker->tempo().note_types_per_minute() - min_tempo) / max (max_tempo - min_tempo, 10.0));
+ }
+ }
+
+ compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
+
+ update_tempo_based_rulers ();
+
+ maybe_draw_grid_lines ();