change Metric element of a Canvas::Ruler item into a pointer internally

This commit is contained in:
Paul Davis 2014-09-05 14:42:06 -04:00
parent d9aeb8084d
commit 1a6136e1e3
2 changed files with 8 additions and 8 deletions

View file

@ -66,7 +66,7 @@ public:
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const; void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
private: private:
const Metric& _metric; const Metric* _metric;
/* lower and upper and sample positions, which are also canvas coordinates /* lower and upper and sample positions, which are also canvas coordinates
*/ */

View file

@ -33,7 +33,7 @@ using namespace ArdourCanvas;
Ruler::Ruler (Canvas* c, const Metric& m) Ruler::Ruler (Canvas* c, const Metric& m)
: Rectangle (c) : Rectangle (c)
, _metric (m) , _metric (&m)
, _lower (0) , _lower (0)
, _upper (0) , _upper (0)
, _need_marks (true) , _need_marks (true)
@ -42,7 +42,7 @@ Ruler::Ruler (Canvas* c, const Metric& m)
Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r) Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
: Rectangle (c, r) : Rectangle (c, r)
, _metric (m) , _metric (&m)
, _lower (0) , _lower (0)
, _upper (0) , _upper (0)
, _need_marks (true) , _need_marks (true)
@ -51,7 +51,7 @@ Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
Ruler::Ruler (Item* parent, const Metric& m) Ruler::Ruler (Item* parent, const Metric& m)
: Rectangle (parent) : Rectangle (parent)
, _metric (m) , _metric (&m)
, _lower (0) , _lower (0)
, _upper (0) , _upper (0)
, _need_marks (true) , _need_marks (true)
@ -60,7 +60,7 @@ Ruler::Ruler (Item* parent, const Metric& m)
Ruler::Ruler (Item* parent, const Metric& m, Rect const& r) Ruler::Ruler (Item* parent, const Metric& m, Rect const& r)
: Rectangle (parent, r) : Rectangle (parent, r)
, _metric (m) , _metric (&m)
, _lower (0) , _lower (0)
, _upper (0) , _upper (0)
, _need_marks (true) , _need_marks (true)
@ -106,7 +106,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
if (_need_marks) { if (_need_marks) {
marks.clear (); marks.clear ();
_metric.get_marks (marks, _lower, _upper, 50); _metric->get_marks (marks, _lower, _upper, 50);
_need_marks = false; _need_marks = false;
} }
@ -142,7 +142,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
for (vector<Mark>::const_iterator m = marks.begin(); m != marks.end(); ++m) { for (vector<Mark>::const_iterator m = marks.begin(); m != marks.end(); ++m) {
Duple pos; Duple pos;
pos.x = floor ((m->position - _lower) / _metric.units_per_pixel); pos.x = floor ((m->position - _lower) / _metric->units_per_pixel);
pos.y = self.y1; /* bottom edge */ pos.y = self.y1; /* bottom edge */
if (_outline_width == 1.0) { if (_outline_width == 1.0) {