summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-07-04 01:29:59 +0200
committerRobin Gareus <robin@gareus.org>2013-07-10 15:27:07 +0200
commit8a16e61b1153042a0cb97be13c58521c2bd60309 (patch)
tree7ba6ebf7b6bb74007bb7ceb3240f8b22a846d71b /libs/gtkmm2ext
parent571b2d70e9f6e7799f74bd3eec90835101fddbe6 (diff)
make all meter-colors configurable,..
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/fastmeter.cc17
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/fastmeter.h18
2 files changed, 21 insertions, 14 deletions
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc
index 367747b78a..941b51ae25 100644
--- a/libs/gtkmm2ext/fastmeter.cc
+++ b/libs/gtkmm2ext/fastmeter.cc
@@ -44,7 +44,10 @@ FastMeter::PatternBgMap FastMeter::vb_pattern_cache;
FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
int clr0, int clr1, int clr2, int clr3,
int clr4, int clr5, int clr6, int clr7,
- int clr8, int clr9, int bgc0, int bgc1)
+ int clr8, int clr9, int bgc0, int bgc1,
+ float stp0, float stp1,
+ float stp2, float stp3
+ )
{
orientation = o;
hold_cnt = hold;
@@ -69,10 +72,10 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
_bgc[0] = bgc0;
_bgc[1] = bgc1;
- _stp[0] = 55.0; // log_meter(-18);
- _stp[1] = 77.5; // log_meter(-9);
- _stp[2] = 92.5; // log_meter(-3);
- _stp[2] = 95.0; // log_meter(-2);
+ _stp[0] = stp0;
+ _stp[1] = stp1;
+ _stp[2] = stp2;
+ _stp[3] = stp3;
set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
@@ -116,7 +119,7 @@ FastMeter::generate_meter_pattern (
cairo_pattern_add_color_stop_rgb (pat, 0.0,
r/255.0, g/255.0, b/255.0);
- knee = (int)floor((float)height * 100.0f / 115.0f); // -0dB
+ knee = (int)floor((float)height * stp[3] / 115.0f); // -0dB
UINT_TO_RGBA (clr[8], &r, &g, &b, &a);
cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height),
@@ -198,7 +201,7 @@ FastMeter::request_vertical_meter(
height = max_pattern_metric_size;
const Pattern10MapKey key (width, height,
- stp[0], stp[1], stp[2],
+ stp[0], stp[1], stp[2], stp[3],
clr[0], clr[1], clr[2], clr[3],
clr[4], clr[5], clr[6], clr[7],
clr[8], clr[9]);
diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
index c0b380ed1b..ac81f46151 100644
--- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
+++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
@@ -39,10 +39,14 @@ class FastMeter : public Gtk::DrawingArea {
FastMeter (long hold_cnt, unsigned long width, Orientation, int len=0,
int clr0=0x008800ff, int clr1=0x008800ff,
int clr2=0x00ff00ff, int clr3=0x00ff00ff,
- int clr4=0x80ff00ff, int clr5=0x80ff00ff,
- int clr6=0xffaa00ff, int clr7=0xffaa00ff,
+ int clr4=0xffaa00ff, int clr5=0xffaa00ff,
+ int clr6=0xffff00ff, int clr7=0xffff00ff,
int clr8=0xff0000ff, int clr9=0xff0000ff,
- int bgc0=0x333333ff, int bgc1=0x444444ff
+ int bgc0=0x333333ff, int bgc1=0x444444ff,
+ float stp0 = 55.0, // log_meter(-18);
+ float stp1 = 77.5, // log_meter(-9);
+ float stp2 = 92.5, // log_meter(-3); // 95.0, // log_meter(-2);
+ float stp3 = 100.0
);
virtual ~FastMeter ();
@@ -68,7 +72,7 @@ private:
gint pixheight;
gint pixwidth;
- float _stp[3];
+ float _stp[4];
int _clr[10];
int _bgc[2];
@@ -100,13 +104,13 @@ private:
struct Pattern10MapKey {
Pattern10MapKey (
int w, int h,
- float stp0, float stp1, float stp2,
+ float stp0, float stp1, float stp2, float stp3,
int c0, int c1, int c2, int c3,
int c4, int c5, int c6, int c7,
int c8, int c9
)
: dim(w, h)
- , stp(stp0, stp1, stp2)
+ , stp(stp0, stp1, stp2, stp3)
, cols(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9)
{}
inline bool operator<(const Pattern10MapKey& rhs) const {
@@ -115,7 +119,7 @@ private:
|| (dim == rhs.dim && stp == rhs.stp && cols < rhs.cols);
}
boost::tuple<int, int> dim;
- boost::tuple<float, float, float> stp;
+ boost::tuple<float, float, float, float> stp;
boost::tuple<int, int, int, int, int, int, int, int, int, int> cols;
};
typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;