X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fgtkmm2ext%2Ffastmeter.h;h=dbb3296c4653fe30c0d0844d7f3bc980d3edc134;hb=2a7a64a8738413df27e494e67c31695a429f6edc;hp=3a806262f1c8d75f4d4880423d0042dd0f989767;hpb=fa332f31fa43d8807b197a1cabfd39784cf3ef8a;p=ardour.git diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h index 3a806262f1..dbb3296c46 100644 --- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h +++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h @@ -24,12 +24,13 @@ #include #include #include -#include -#include +#include "gtkmm2ext/cairo_widget.h" + +#include "gtkmm2ext/visibility.h" namespace Gtkmm2ext { -class FastMeter : public Gtk::DrawingArea { +class LIBGTKMM2EXT_API FastMeter : public CairoWidget { public: enum Orientation { Horizontal, @@ -51,6 +52,7 @@ class FastMeter : public Gtk::DrawingArea { int styleflags = 3 ); virtual ~FastMeter (); + static void flush_pattern_cache(); void set (float level, float peak = -1); void clear (); @@ -65,10 +67,9 @@ class FastMeter : public Gtk::DrawingArea { bool get_highlight () { return highlight; } protected: - bool on_expose_event (GdkEventExpose*); + void render (cairo_t *, cairo_rectangle_t*); void on_size_request (GtkRequisition*); void on_size_allocate (Gtk::Allocation&); - private: Cairo::RefPtr fgpattern; @@ -95,20 +96,31 @@ private: float current_user_level; bool highlight; - bool vertical_expose (GdkEventExpose*); + void vertical_expose (cairo_t*, cairo_rectangle_t*); + void vertical_size_request (GtkRequisition*); + void vertical_size_allocate (Gtk::Allocation&); void queue_vertical_redraw (const Glib::RefPtr&, float); + void horizontal_expose (cairo_t*, cairo_rectangle_t*); + void horizontal_size_request (GtkRequisition*); + void horizontal_size_allocate (Gtk::Allocation&); + void queue_horizontal_redraw (const Glib::RefPtr&, float); + static bool no_rgba_overlay; static Cairo::RefPtr generate_meter_pattern ( - int, int, int *, float *, int); + int, int, int *, float *, int, bool); static Cairo::RefPtr request_vertical_meter ( int, int, int *, float *, int); + static Cairo::RefPtr request_horizontal_meter ( + int, int, int *, float *, int); static Cairo::RefPtr generate_meter_background ( - int, int, int *, bool); + int, int, int *, bool, bool); static Cairo::RefPtr request_vertical_background ( int, int, int *, bool); + static Cairo::RefPtr request_horizontal_background ( + int, int, int *, bool); struct Pattern10MapKey { Pattern10MapKey ( @@ -137,20 +149,24 @@ private: typedef std::map > Pattern10Map; struct PatternBgMapKey { - PatternBgMapKey (int w, int h, int c0, int c1) + PatternBgMapKey (int w, int h, int c0, int c1, bool shade) : dim(w, h) , cols(c0, c1) + , sh(shade) {} inline bool operator<(const PatternBgMapKey& rhs) const { - return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols); + return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh)); } boost::tuple dim; boost::tuple cols; + bool sh; }; typedef std::map > PatternBgMap; static Pattern10Map vm_pattern_cache; static PatternBgMap vb_pattern_cache; + static Pattern10Map hm_pattern_cache; + static PatternBgMap hb_pattern_cache; static int min_pattern_metric_size; // min dimension for axis that displays the meter level static int max_pattern_metric_size; // max dimension for axis that displays the meter level };