- all_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames());
-
- cnt = 0;
- last_xpos = 0;
-
- /* get the first bar spacing */
-
- gdouble last_beat = DBL_MAX;
- gdouble beat_spacing = 0;
-
- for (i = all_bbt_points->begin(); i != all_bbt_points->end() && beat_spacing == 0; ++i) {
- TempoMap::BBTPoint& p = (*i);
-
- switch (p.type) {
- case TempoMap::Bar:
- break;
-
- case TempoMap::Beat:
- xpos = frame_to_unit (p.frame);
- if (last_beat < xpos) {
- beat_spacing = xpos - last_beat;
- }
- last_beat = xpos;
- }
- }
-
- double x1, x2, y1, y2;
- track_canvas.get_scroll_region (x1, y1, x2, y2);
- y2 = 1000000000.0f;
-
- for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) {
-
- TempoMap::BBTPoint& p = (*i);
-
- switch (p.type) {
- case TempoMap::Bar:
- break;
-
- case TempoMap::Beat:
- xpos = frame_to_unit (p.frame);
-
- if (p.beat == 1) {
- color = color_map[cMeasureLineBeat];
- } else {
- color = color_map[cMeasureLineBar];
-
- /* only draw beat lines if the gaps between beats
- are large.
- */
-
- if (beat_spacing < 15.0) {
- break;
- }
- }
-
- if (cnt == 0 || xpos - last_xpos > 4.0) {
- line = get_time_line ();
- line->property_x1() = xpos;
- line->property_x2() = xpos;
- line->property_y2() = y2;
- line->property_color_rgba() = color;
- line->raise_to_top();
- line->show();
- last_xpos = xpos;
- ++cnt;
- }
- break;
- }
- }
-
- delete all_bbt_points;
-
- /* the cursors are always on top of everything */
-
- cursor_group->raise_to_top();
- time_line_group->lower_to_bottom();