- TempoMap::BBTPointList::iterator i;
- ArdourCanvas::SimpleLine *line;
- gdouble xpos;
- double x1, x2, y1, y2, beat_density;
-
- uint32_t beats = 0;
- uint32_t bars = 0;
- uint32_t color;
-
- if (current_bbt_points == 0 || current_bbt_points->empty()) {
- return;
- }
-
- track_canvas.get_scroll_region (x1, y1, x2, y2);
-
- /* get the first bar spacing */
-
- i = current_bbt_points->end();
- i--;
- bars = (*i).bar - (*current_bbt_points->begin()).bar;
- beats = current_bbt_points->size() - bars;
-
- beat_density = (beats * 10.0f) / track_canvas.get_width ();
-
- if (beat_density > 2.0f) {
- /* if the lines are too close together, they become useless */
- return;
- }
-
- for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
-
- switch ((*i).type) {
- case TempoMap::Bar:
- break;
-
- case TempoMap::Beat:
-
- if ((*i).beat == 1) {
- color = color_map[cMeasureLineBeat];
- } else {
- color = color_map[cMeasureLineBar];
-
- /* only draw beat lines if the gaps between beats are large. */
-
- if (beat_density > 0.25) {
- break;
- }
- }
-
- xpos = frame_to_unit ((*i).frame);
- 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();
- break;
- }