X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fcanvas%2Fcanvas%2Fruler.h;h=59ce625dca8145ecfe34c4e70e6d7d86d24d68c9;hb=aacb2d7be7f9c34b39f1acf9a408e05addab409e;hp=25040247c91e924923491b05d97082077f8b350c;hpb=ff46a3c3a216afc97fee0c796ac2eaa92d58becb;p=ardour.git diff --git a/libs/canvas/canvas/ruler.h b/libs/canvas/canvas/ruler.h index 25040247c9..59ce625dca 100644 --- a/libs/canvas/canvas/ruler.h +++ b/libs/canvas/canvas/ruler.h @@ -28,7 +28,7 @@ namespace ArdourCanvas { - + class LIBCANVAS_API Ruler : public Rectangle { public: @@ -42,7 +42,7 @@ public: double position; Style style; }; - + struct Metric { Metric () : units_per_pixel (0) {} virtual ~Metric() {} @@ -51,28 +51,37 @@ public: /* lower and upper and sample positions, which are also canvas coordinates */ - + virtual void get_marks (std::vector&, double lower, double upper, int maxchars) const = 0; }; - + Ruler (Canvas*, const Metric& m); Ruler (Canvas*, const Metric& m, Rect const&); Ruler (Item*, const Metric& m); Ruler (Item*, const Metric& m, Rect const&); - + + virtual ~Ruler () { + delete _font_description; + } + void set_range (double lower, double upper); void set_font_description (Pango::FontDescription); - + void set_metric (const Metric&); + void render (Rect const & area, Cairo::RefPtr) const; - + + void set_divide_colors (Gtkmm2ext::Color top, Gtkmm2ext::Color bottom); + void set_divide_height (double); 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 */ - Coord _lower; - Coord _upper; + Coord _lower; + Coord _upper; + double _divide_height; + Gtkmm2ext::Color _divider_color_top; + Gtkmm2ext::Color _divider_color_bottom; Pango::FontDescription* _font_description; mutable std::vector marks;