using namespace std;
-#define MAX_CACHED_LINES 512
+#define MAX_CACHED_LINES 128
-TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group)
+TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height)
: _canvas(canvas)
, _group(group)
, _clean_left(DBL_MAX)
, _clean_right(0.0)
+ , _height(screen_height)
{
}
_clean_left = DBL_MAX;
_clean_right = 0.0;
- size_t d = 0;
+ size_t d = 1;
// TODO: Dirty/slow, but 'needed' for zoom :(
for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++d) {
Lines::iterator next = i;
++next;
- i->second->property_x1() = DBL_MAX - d;
- i->second->property_x2() = DBL_MAX - d;
+ i->second->property_x1() = - d;
+ i->second->property_x2() = - d;
_lines.erase(i);
- _lines.insert(make_pair(DBL_MAX - d, i->second));
+ _lines.insert(make_pair(- d, i->second));
i = next;
}
}
ArdourCanvas::SimpleLine *line = NULL;
gdouble xpos;
double who_cares;
- double x1, x2, y1, y2, beat_density;
+ double x1, x2, y1, beat_density;
uint32_t beats = 0;
uint32_t bars = 0;
const size_t needed = points.size();
_canvas.get_scroll_region (x1, y1, x2, who_cares);
- _canvas.root()->get_bounds(who_cares, who_cares, who_cares, y2);
/* get the first bar spacing */
if (beat_density > 4.0f) {
/* if the lines are too close together, they become useless */
+ tempo_map_changed();
return;
}
line = new ArdourCanvas::SimpleLine (*_group);
line->property_x1() = xpos;
line->property_x2() = xpos;
- line->property_y2() = y2;
+ line->property_y1() = 0.0;
+ line->property_y2() = _height;
line->property_color_rgba() = color;
_lines.insert(make_pair(xpos, line));
inserted_last_time = true;