if (_session == 0) {
return;
}
- TempoMap::BBTPointList::iterator i;
+
+ TempoMap::BBTPointList::const_iterator i;
Timecode::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
_session->bbt_time (lower, lower_beat);
break;
}
- if (current_bbt_points.empty()) {
+ if (distance (current_bbt_points_begin, current_bbt_points_end) == 0) {
return;
}
- i = current_bbt_points.end();
+ i = current_bbt_points_end;
i--;
- if ((*i).beat >= (*current_bbt_points.begin()).beat) {
- bbt_bars = (*i).bar - (*current_bbt_points.begin()).bar;
+ if ((*i).beat >= (*current_bbt_points_begin).beat) {
+ bbt_bars = (*i).bar - (*current_bbt_points_begin).bar;
} else {
- bbt_bars = (*i).bar - (*current_bbt_points.begin()).bar - 1;
+ bbt_bars = (*i).bar - (*current_bbt_points_begin).bar - 1;
}
- beats = current_bbt_points.size() - bbt_bars;
+ beats = distance (current_bbt_points_begin, current_bbt_points_end) - bbt_bars;
/* Only show the bar helper if there aren't many bars on the screen */
if ((bbt_bars < 2) || (beats < 5)) {
return 0;
}
- TempoMap::BBTPointList::iterator i;
+ TempoMap::BBTPointList::const_iterator i;
char buf[64];
gint n = 0;
bool i_am_accented = false;
bool helper_active = false;
- if (current_bbt_points.empty()) {
+ if (distance (current_bbt_points_begin, current_bbt_points_end) == 0) {
return 0;
}
switch (bbt_ruler_scale) {
case bbt_show_beats:
- beats = current_bbt_points.size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = beats + 2;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
(*marks)[0].label = g_strdup(" ");
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
-
- for (n = 1, i = current_bbt_points.begin(); n < bbt_nmarks && i != current_bbt_points.end(); ++i) {
+
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
case bbt_show_ticks:
- beats = current_bbt_points.size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points.begin(); n < bbt_nmarks && i != current_bbt_points.end(); ++i) {
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
case bbt_show_ticks_detail:
- beats = current_bbt_points.size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points.begin(); n < bbt_nmarks && i != current_bbt_points.end(); ++i) {
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
case bbt_show_ticks_super_detail:
- beats = current_bbt_points.size();
+ beats = distance (current_bbt_points_begin, current_bbt_points_end);
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (30 * Editor::get_current_zoom ());
(*marks)[0].position = lower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = current_bbt_points.begin(); n < bbt_nmarks && i != current_bbt_points.end(); ++i) {
+ for (n = 1, i = current_bbt_points_begin; n < bbt_nmarks && i != current_bbt_points_end; ++i) {
if ((*i).frame < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
case bbt_show_64:
bbt_nmarks = (gint) (bbt_bars / 64) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points.begin(); i != current_bbt_points.end() && n < bbt_nmarks; i++) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
case bbt_show_16:
bbt_nmarks = (bbt_bars / 16) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points.begin(); i != current_bbt_points.end() && n < bbt_nmarks; i++) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
case bbt_show_4:
bbt_nmarks = (bbt_bars / 4) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
- for (n = 0, i = current_bbt_points.begin(); i != current_bbt_points.end() && n < bbt_nmarks; ++i) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; ++i) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
// default:
bbt_nmarks = bbt_bars + 2;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks );
- for (n = 0, i = current_bbt_points.begin(); i != current_bbt_points.end() && n < bbt_nmarks; i++) {
+ for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 4 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
}
void
-TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit)
+TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
+ const ARDOUR::TempoMap::BBTPointList::const_iterator& end,
+ double frames_per_unit)
{
- ARDOUR::TempoMap::BBTPointList::iterator i;
+ ARDOUR::TempoMap::BBTPointList::const_iterator i;
ArdourCanvas::SimpleLine *line = NULL;
gdouble xpos;
double who_cares;
uint32_t bars = 0;
uint32_t color;
- const size_t needed = points.size();
+ const size_t needed = distance (begin, end);
_canvas.get_scroll_region (x1, y1, x2, who_cares);
/* get the first bar spacing */
- i = points.end();
+ i = end;
i--;
- bars = (*i).bar - (*points.begin()).bar;
- beats = points.size() - bars;
+ bars = (*i).bar - (*begin).bar;
+ beats = distance (begin, end) - bars;
beat_density = (beats * 10.0f) / _canvas.get_width ();
xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
const double needed_right = xpos;
- i = points.begin();
+ i = begin;
xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
const double needed_left = xpos;
bool inserted_last_time = true;
bool invalidated = false;
- for (i = points.begin(); i != points.end(); ++i) {
+ for (i = begin; i != end; ++i) {
if ((*i).type == ARDOUR::TempoMap::Bar) {
color = ARDOUR_UI::config()->canvasvar_MeasureLineBar.get();