summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/color_aliases.h11
-rw-r--r--gtk2_ardour/default_ui_config.in65
-rw-r--r--gtk2_ardour/editor_regions.cc9
-rw-r--r--gtk2_ardour/meter_patterns.cc37
-rw-r--r--gtk2_ardour/mono_panner.cc3
-rw-r--r--gtk2_ardour/panner2d.cc8
-rw-r--r--gtk2_ardour/stereo_panner.cc7
-rw-r--r--gtk2_ardour/ui_config.cc62
-rw-r--r--gtk2_ardour/ui_config.h5
-rw-r--r--gtk2_ardour/utils.cc105
-rw-r--r--gtk2_ardour/utils.h4
11 files changed, 78 insertions, 238 deletions
diff --git a/gtk2_ardour/color_aliases.h b/gtk2_ardour/color_aliases.h
index e117a02b8d..9a9acaf6df 100644
--- a/gtk2_ardour/color_aliases.h
+++ b/gtk2_ardour/color_aliases.h
@@ -137,6 +137,12 @@ COLOR_ALIAS(MeterbridgePeakindicatorLEDActive,"meterbridge peakindicator: led ac
COLOR_ALIAS(MeterbridgePeakindicatorText,"meterbridge peakindicator: text","color 9")
COLOR_ALIAS(MeterbridgePeakindicatorTextActive,"meterbridge peakindicator: text active","color 9")
COLOR_ALIAS(MeterMarker,"meterbridge peaklabel","color 9")
+COLOR_ALIAS(MeterStripDPMForeground, "meterstrip dpm fg", "color 9")
+COLOR_ALIAS(MeterStripPPMForeground, "meterstrip ppm fg", "color 13")
+COLOR_ALIAS(MeterStripVUForeground, "meterstrip vu fg", "color 4")
+COLOR_ALIAS(MeterStripDPMBackground, "meterstrip dpm bg", "color 9")
+COLOR_ALIAS(MeterStripPPMBackground, "meterstrip ppm bg", "color 27")
+COLOR_ALIAS(MeterStripVUBackground, "meterstrip vu bg", "color 32")
COLOR_ALIAS(MidiBusBase,"midi bus base","color 4")
COLOR_ALIAS(MidiDeviceButtonFillActive,"midi device: fill","color 25")
COLOR_ALIAS(MidiDeviceButtonFill,"midi device: fill active","color 42")
@@ -362,6 +368,7 @@ COLOR_ALIAS(SelectionClockEditedText,"selection clock: cursor","color 9")
COLOR_ALIAS(SelectionClockText,"selection clock: edited text","color 9")
COLOR_ALIAS(Selection,"selection clock: text","color 12")
COLOR_ALIAS(SelectionRect,"selection rect","color 95")
+COLOR_ALIAS(SendBg,"send bg","color 71")
COLOR_ALIAS(SendButtonFillActive,"send alert button: fill","color 71")
COLOR_ALIAS(SendButtonFill,"send alert button: fill active","color 96")
COLOR_ALIAS(SendButtonLEDActive,"send alert button: led","color 4")
@@ -377,14 +384,10 @@ COLOR_ALIAS(SoloIsolateButtonFillActive,"solo isolate: fill","color 25")
COLOR_ALIAS(SoloIsolateButtonFill,"solo isolate: fill active","color 42")
COLOR_ALIAS(SoloIsolateButtonLEDActive,"solo isolate: led","color 69")
COLOR_ALIAS(SoloIsolateButtonLED,"solo isolate: led active","color 9")
-COLOR_ALIAS(SoloIsolateButtonTextActive,"solo isolate: text","color 26")
-COLOR_ALIAS(SoloIsolateButtonText,"solo isolate: text active","color 26")
COLOR_ALIAS(SoloSafeButtonFillActive,"solo safe: fill","color 25")
COLOR_ALIAS(SoloSafeButtonFill,"solo safe: fill active","color 42")
COLOR_ALIAS(SoloSafeButtonLEDActive,"solo safe: led","color 69")
COLOR_ALIAS(SoloSafeButtonLED,"solo safe: led active","color 9")
-COLOR_ALIAS(SoloSafeButtonTextActive,"solo safe: text","color 26")
-COLOR_ALIAS(SoloSafeButtonText,"solo safe: text active","color 26")
COLOR_ALIAS(StereoPannerBackground,"stereo panner bg","color 61")
COLOR_ALIAS(StereoPannerFill,"stereo panner fill","color 74")
COLOR_ALIAS(StereoPannerInvertedBackground,"stereo panner inverted bg","color 61")
diff --git a/gtk2_ardour/default_ui_config.in b/gtk2_ardour/default_ui_config.in
index 0e2082b231..1294a3d09f 100644
--- a/gtk2_ardour/default_ui_config.in
+++ b/gtk2_ardour/default_ui_config.in
@@ -132,8 +132,6 @@
<ColorAlias name="generic button: fill active" alias="color 9"/>
<ColorAlias name="generic button: led" alias="color 15"/>
<ColorAlias name="generic button: led active" alias="color 18"/>
- <ColorAlias name="generic button: text" alias="color 26"/>
- <ColorAlias name="generic button: text active" alias="color 27"/>
<ColorAlias name="ghost track base" alias="color 28"/>
<ColorAlias name="ghost track midi outline" alias="color 4"/>
<ColorAlias name="ghost track wave" alias="color 29"/>
@@ -173,7 +171,7 @@
<ColorAlias name="gtk_processor_postfader_frame" alias="color 103"/>
<ColorAlias name="gtk_processor_prefader" alias="color 69"/>
<ColorAlias name="gtk_processor_prefader_frame" alias="color 69"/>
- <ColorAlias name="gtk_send_bg" alias="color 70"/>
+ <ColorAlias name="gtk_send_bg" alias="color 38"/>
<ColorAlias name="gtk_send_fg" alias="color 24"/>
<ColorAlias name="gtk_solo" alias="color 91"/>
<ColorAlias name="gtk_somewhat_bright_indicator" alias="color 89"/>
@@ -188,8 +186,6 @@
<ColorAlias name="invert button: fill active" alias="color 35"/>
<ColorAlias name="invert button: led" alias="color 36"/>
<ColorAlias name="invert button: led active" alias="color 37"/>
- <ColorAlias name="invert button: text" alias="color 26"/>
- <ColorAlias name="invert button: text active" alias="color 33"/>
<ColorAlias name="location cd marker" alias="color 38"/>
<ColorAlias name="location loop" alias="color 39"/>
<ColorAlias name="location marker" alias="color 32"/>
@@ -199,8 +195,6 @@
<ColorAlias name="lock button: fill active" alias="color 42"/>
<ColorAlias name="lock button: led" alias="color 4"/>
<ColorAlias name="lock button: led active" alias="color 4"/>
- <ColorAlias name="lock button: text" alias="color 43"/>
- <ColorAlias name="lock button: text active" alias="color 26"/>
<ColorAlias name="marker bar" alias="color 11"/>
<ColorAlias name="marker bar separator" alias="color 2"/>
<ColorAlias name="marker drag line" alias="color 44"/>
@@ -217,15 +211,17 @@
<ColorAlias name="meterbridge label: fill active" alias="color 46"/>
<ColorAlias name="meterbridge label: led" alias="color 9"/>
<ColorAlias name="meterbridge label: led active" alias="color 9"/>
- <ColorAlias name="meterbridge label: text" alias="color 26"/>
- <ColorAlias name="meterbridge label: text active" alias="color 9"/>
<ColorAlias name="meterbridge peakindicator: fill" alias="color 34"/>
<ColorAlias name="meterbridge peakindicator: fill active" alias="color 9"/>
<ColorAlias name="meterbridge peakindicator: led" alias="color 9"/>
<ColorAlias name="meterbridge peakindicator: led active" alias="color 9"/>
- <ColorAlias name="meterbridge peakindicator: text" alias="color 9"/>
- <ColorAlias name="meterbridge peakindicator: text active" alias="color 9"/>
<ColorAlias name="meterbridge peaklabel" alias="color 9"/>
+ <ColorAlias name="meterstrip dpm fg" alias="color 9"/>
+ <ColorAlias name="meterstrip ppm fg" alias="color 13"/>
+ <ColorAlias name="meterstrip vu fg" alias="color 4"/>
+ <ColorAlias name="meterstrip dpm bg" alias="color 9"/>
+ <ColorAlias name="meterstrip ppm bg" alias="color 27"/>
+ <ColorAlias name="meterstrip vu bg" alias="color 32"/>
<ColorAlias name="midi bus base" alias="color 4"/>
<ColorAlias name="midi device: fill" alias="color 25"/>
<ColorAlias name="midi device: fill active" alias="color 42"/>
@@ -238,8 +234,6 @@
<ColorAlias name="midi input button: fill active" alias="color 48"/>
<ColorAlias name="midi input button: led" alias="color 4"/>
<ColorAlias name="midi input button: led active" alias="color 4"/>
- <ColorAlias name="midi input button: text" alias="color 4"/>
- <ColorAlias name="midi input button: text active" alias="color 4"/>
<ColorAlias name="midi meter fill: 0" alias="color 52"/>
<ColorAlias name="midi meter fill: 1" alias="color 53"/>
<ColorAlias name="midi meter fill: 2" alias="color 53"/>
@@ -269,20 +263,14 @@
<ColorAlias name="mixer strip button: fill active" alias="color 8"/>
<ColorAlias name="mixer strip button: led" alias="color 66"/>
<ColorAlias name="mixer strip button: led active" alias="color 8"/>
- <ColorAlias name="mixer strip button: text" alias="color 26"/>
- <ColorAlias name="mixer strip button: text active" alias="color 4"/>
<ColorAlias name="mixer strip name button: fill" alias="color 25"/>
<ColorAlias name="mixer strip name button: fill active" alias="color 67"/>
<ColorAlias name="mixer strip name button: led" alias="color 66"/>
<ColorAlias name="mixer strip name button: led active" alias="color 8"/>
- <ColorAlias name="mixer strip name button: text" alias="color 26"/>
- <ColorAlias name="mixer strip name button: text active" alias="color 26"/>
<ColorAlias name="monitor button: fill" alias="color 25"/>
<ColorAlias name="monitor button: fill active" alias="color 68"/>
<ColorAlias name="monitor button: led" alias="color 69"/>
<ColorAlias name="monitor button: led active" alias="color 9"/>
- <ColorAlias name="monitor button: text" alias="color 26"/>
- <ColorAlias name="monitor button: text active" alias="color 27"/>
<ColorAlias name="monitor knob" alias="color 60"/>
<ColorAlias name="monitor knob: arc end" alias="color 70"/>
<ColorAlias name="monitor knob: arc start" alias="color 16"/>
@@ -344,22 +332,16 @@
<ColorAlias name="mouse mode button: fill active" alias="color 12"/>
<ColorAlias name="mouse mode button: led" alias="color 66"/>
<ColorAlias name="mouse mode button: led active" alias="color 8"/>
- <ColorAlias name="mouse mode button: text" alias="color 26"/>
- <ColorAlias name="mouse mode button: text active" alias="color 4"/>
<ColorAlias name="mute button: fill" alias="color 25"/>
<ColorAlias name="mute button: fill active" alias="color 75"/>
<ColorAlias name="mute button: led" alias="color 4"/>
<ColorAlias name="mute button: led active" alias="color 4"/>
- <ColorAlias name="mute button: text" alias="color 26"/>
- <ColorAlias name="mute button: text active" alias="color 27"/>
<ColorAlias name="name highlight fill" alias="color 18"/>
<ColorAlias name="name highlight outline" alias="color 23"/>
<ColorAlias name="nudge button: fill" alias="color 20"/>
<ColorAlias name="nudge button: fill active" alias="color 42"/>
<ColorAlias name="nudge button: led" alias="color 66"/>
<ColorAlias name="nudge button: led active" alias="color 8"/>
- <ColorAlias name="nudge button: text" alias="color 26"/>
- <ColorAlias name="nudge button: text active" alias="color 26"/>
<ColorAlias name="nudge clock: background" alias="color 7"/>
<ColorAlias name="nudge clock: cursor" alias="color 8"/>
<ColorAlias name="nudge clock: edited text" alias="color 8"/>
@@ -372,15 +354,11 @@
<ColorAlias name="plugin bypass button: fill active" alias="color 42"/>
<ColorAlias name="plugin bypass button: led" alias="color 69"/>
<ColorAlias name="plugin bypass button: led active" alias="color 9"/>
- <ColorAlias name="plugin bypass button: text" alias="color 26"/>
- <ColorAlias name="plugin bypass button: text active" alias="color 26"/>
<ColorAlias name="processor automation line" alias="color 77"/>
<ColorAlias name="processor control button: fill" alias="color 29"/>
<ColorAlias name="processor control button: fill active" alias="color 46"/>
<ColorAlias name="processor control button: led" alias="color 67"/>
<ColorAlias name="processor control button: led active" alias="color 16"/>
- <ColorAlias name="processor control button: text" alias="color 13"/>
- <ColorAlias name="processor control button: text active" alias="color 13"/>
<ColorAlias name="processor fader: fill" alias="color 16"/>
<ColorAlias name="processor fader: fill active" alias="color 78"/>
<ColorAlias name="processor fader: led" alias="color 44"/>
@@ -403,8 +381,6 @@
<ColorAlias name="punch button: fill active" alias="color 9"/>
<ColorAlias name="punch button: led" alias="color 4"/>
<ColorAlias name="punch button: led active" alias="color 4"/>
- <ColorAlias name="punch button: text" alias="color 81"/>
- <ColorAlias name="punch button: text active" alias="color 82"/>
<ColorAlias name="punch clock: background" alias="color 4"/>
<ColorAlias name="punch clock: cursor" alias="color 9"/>
<ColorAlias name="punch clock: edited text" alias="color 9"/>
@@ -417,8 +393,6 @@
<ColorAlias name="record enable button: fill active" alias="color 83"/>
<ColorAlias name="record enable button: led" alias="color 84"/>
<ColorAlias name="record enable button: led active" alias="color 85"/>
- <ColorAlias name="record enable button: text" alias="color 81"/>
- <ColorAlias name="record enable button: text active" alias="color 4"/>
<ColorAlias name="recorded waveform fill" alias="color 13"/>
<ColorAlias name="recorded waveform outline" alias="color 43"/>
<ColorAlias name="recording rect" alias="color 86"/>
@@ -428,8 +402,6 @@
<ColorAlias name="route button: fill active" alias="color 67"/>
<ColorAlias name="route button: led" alias="color 66"/>
<ColorAlias name="route button: led active" alias="color 8"/>
- <ColorAlias name="route button: text" alias="color 26"/>
- <ColorAlias name="route button: text active" alias="color 27"/>
<ColorAlias name="rubber band rect" alias="color 88"/>
<ColorAlias name="rude audition: fill" alias="color 20"/>
<ColorAlias name="rude audition: fill active" alias="color 86"/>
@@ -475,12 +447,11 @@
<ColorAlias name="selection clock: edited text" alias="color 9"/>
<ColorAlias name="selection clock: text" alias="color 12"/>
<ColorAlias name="selection rect" alias="color 95"/>
+ <ColorAlias name="send bg" alias="color 38"/>
<ColorAlias name="send alert button: fill" alias="color 71"/>
- <ColorAlias name="send alert button: fill active" alias="color 96"/>
+ <ColorAlias name="send alert button: fill active" alias="color 38"/>
<ColorAlias name="send alert button: led" alias="color 4"/>
<ColorAlias name="send alert button: led active" alias="color 4"/>
- <ColorAlias name="send alert button: text" alias="color 97"/>
- <ColorAlias name="send alert button: text active" alias="color 4"/>
<ColorAlias name="shuttle" alias="color 12"/>
<ColorAlias name="silence" alias="color 98"/>
<ColorAlias name="silence text" alias="color 99"/>
@@ -488,8 +459,6 @@
<ColorAlias name="solo button: fill active" alias="color 12"/>
<ColorAlias name="solo button: led" alias="color 4"/>
<ColorAlias name="solo button: led active" alias="color 4"/>
- <ColorAlias name="solo button: text" alias="color 26"/>
- <ColorAlias name="solo button: text active" alias="color 27"/>
<ColorAlias name="solo isolate: fill" alias="color 25"/>
<ColorAlias name="solo isolate: fill active" alias="color 42"/>
<ColorAlias name="solo isolate: led" alias="color 69"/>
@@ -530,14 +499,10 @@
<ColorAlias name="transport active option button: fill active" alias="color 48"/>
<ColorAlias name="transport active option button: led" alias="color 66"/>
<ColorAlias name="transport active option button: led active" alias="color 8"/>
- <ColorAlias name="transport active option button: text" alias="color 26"/>
- <ColorAlias name="transport active option button: text active" alias="color 4"/>
<ColorAlias name="transport button: fill" alias="color 25"/>
<ColorAlias name="transport button: fill active" alias="color 48"/>
<ColorAlias name="transport button: led" alias="color 4"/>
<ColorAlias name="transport button: led active" alias="color 4"/>
- <ColorAlias name="transport button: text" alias="color 4"/>
- <ColorAlias name="transport button: text active" alias="color 4"/>
<ColorAlias name="transport clock: background" alias="color 7"/>
<ColorAlias name="transport clock: cursor" alias="color 8"/>
<ColorAlias name="transport clock: edited text" alias="color 8"/>
@@ -553,15 +518,11 @@
<ColorAlias name="transport option button: fill active" alias="color 42"/>
<ColorAlias name="transport option button: led" alias="color 66"/>
<ColorAlias name="transport option button: led active" alias="color 8"/>
- <ColorAlias name="transport option button: text" alias="color 26"/>
- <ColorAlias name="transport option button: text active" alias="color 26"/>
<ColorAlias name="transport punch rect" alias="color 80"/>
<ColorAlias name="transport recenable button: fill" alias="color 20"/>
<ColorAlias name="transport recenable button: fill active" alias="color 83"/>
<ColorAlias name="transport recenable button: led" alias="color 4"/>
<ColorAlias name="transport recenable button: led active" alias="color 4"/>
- <ColorAlias name="transport recenable button: text" alias="color 4"/>
- <ColorAlias name="transport recenable button: text active" alias="color 4"/>
<ColorAlias name="trim handle" alias="color 18"/>
<ColorAlias name="trim handle locked" alias="color 86"/>
<ColorAlias name="verbose canvas cursor" alias="color 32"/>
@@ -574,13 +535,5 @@
<ColorAlias name="zoom button: fill active" alias="color 48"/>
<ColorAlias name="zoom button: led" alias="color 66"/>
<ColorAlias name="zoom button: led active" alias="color 8"/>
- <ColorAlias name="zoom button: text" alias="color 26"/>
- <ColorAlias name="zoom button: text active" alias="color 4"/>
- <ColorAlias name="zoom menu: fill" alias="color 105"/>
- <ColorAlias name="zoom menu: fill active" alias="color 42"/>
- <ColorAlias name="zoom menu: led" alias="color 66"/>
- <ColorAlias name="zoom menu: led active" alias="color 8"/>
- <ColorAlias name="zoom menu: text" alias="color 26"/>
- <ColorAlias name="zoom menu: text active" alias="color 26"/>
</ColorAliases>
</Ardour>
diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc
index 78c45c7d8d..f406694e4d 100644
--- a/gtk2_ardour/editor_regions.cc
+++ b/gtk2_ardour/editor_regions.cc
@@ -341,14 +341,15 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
row = *(_model->append());
if (missing_source) {
- c.set_rgb(65535,0,0); // FIXME: error color from style
+ // c.set_rgb(65535,0,0); // FIXME: error color from style
+ set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list missing source"));
} else if (region->automatic()){
- c.set_rgb(0,65535,0); // FIXME: error color from style
+ // c.set_rgb(0,65535,0); // FIXME: error color from style
+ set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list automatic"));
} else {
- set_color_from_rgba (c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
-
+ set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list whole file"));
}
row[_columns.color_] = c;
diff --git a/gtk2_ardour/meter_patterns.cc b/gtk2_ardour/meter_patterns.cc
index 0158ff794c..6e602553e9 100644
--- a/gtk2_ardour/meter_patterns.cc
+++ b/gtk2_ardour/meter_patterns.cc
@@ -226,15 +226,11 @@ static void mtr_red_stripe(cairo_t* cr, float l, float w, int h, float top, floa
cairo_fill (cr);
}
-static void set_bg_color(Gtk::Widget& w, cairo_t* cr, MeterType type) {
- float r,g,b;
+static void set_bg_color (Gtk::Widget& w, cairo_t* cr, MeterType type) {
+ double r,g,b,a;
switch(type) {
case MeterVU:
- if (rgba_p_from_style("meterstripVU", &r, &g, &b, "bg")) {
- cairo_set_source_rgb (cr, r, g, b);
- } else {
- cairo_set_source_rgb (cr, 1.0, 1.0, 0.85);
- }
+ ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu bg"), r, g, b, a);
break;
case MeterIEC1DIN:
case MeterIEC1NOR:
@@ -243,39 +239,32 @@ static void set_bg_color(Gtk::Widget& w, cairo_t* cr, MeterType type) {
case MeterK12:
case MeterK14:
case MeterK20:
- if (rgba_p_from_style("meterstripPPM", &r, &g, &b, "bg")) {
- cairo_set_source_rgb (cr, r, g, b);
- } else {
- cairo_set_source_rgb (cr, 0.1, 0.1, 0.1);
- }
+ ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip ppm bg"), r, g, b, a);
break;
default:
{
Gdk::Color c = w.get_style()->get_bg (Gtk::STATE_ACTIVE);
- cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
+ r = c.get_red_p();
+ g = c.get_green_p();
+ b = c.get_blue_p();
}
break;
}
+ cairo_set_source_rgb (cr, r, g, b);
}
static void set_fg_color(Gtk::Widget&, MeterType type, Gdk::Color * c) {
- float r,g,b;
+ double r,g,b,a;
switch(type) {
case MeterVU:
- if (rgba_p_from_style("meterstripVU", &r, &g, &b)) {
- c->set_rgb_p(r, g, b);
- } else {
- c->set_rgb_p(0.0, 0.0, 0.0);
- }
+ ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu fg"), r, g, b, a);
+
break;
default:
- if (rgba_p_from_style("meterstripPPM", &r, &g, &b)) {
- c->set_rgb_p(r, g, b);
- } else {
- c->set_rgb_p(1.0, 1.0, 1.0);
- }
+ ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("meterstrip vu fg"), r, g, b, a);
break;
}
+ c->set_rgb_p (r, g, b);
}
static cairo_pattern_t*
diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc
index 1a137538d6..a29a295def 100644
--- a/gtk2_ardour/mono_panner.cc
+++ b/gtk2_ardour/mono_panner.cc
@@ -158,8 +158,7 @@ MonoPanner::on_expose_event (GdkEventExpose*)
}
if (_send_mode) {
- b = rgba_from_style("SendStripBase",
- UINT_RGBA_R(b), UINT_RGBA_G(b), UINT_RGBA_B(b), 255, "fg");
+ b = ARDOUR_UI::config()->color ("send bg");
}
/* background */
context->set_source_rgba (UINT_RGBA_R_FLT(b), UINT_RGBA_G_FLT(b), UINT_RGBA_B_FLT(b), UINT_RGBA_A_FLT(b));
diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc
index be9581629a..8de18dd2c7 100644
--- a/gtk2_ardour/panner2d.cc
+++ b/gtk2_ardour/panner2d.cc
@@ -33,6 +33,9 @@
#include "ardour/pannable.h"
#include "ardour/speakers.h"
+#include "canvas/colors.h"
+
+#include "ardour_ui.h"
#include "panner2d.h"
#include "keyboard.h"
#include "gui_thread.h"
@@ -424,10 +427,9 @@ Panner2d::on_expose_event (GdkEventExpose *event)
cairo_rectangle (cr, event->area.x, event->area.y, event->area.width, event->area.height);
- float r, g, b;
- r = g = b = 0.1;
+ double r, g, b, a;
if (_send_mode) {
- rgba_p_from_style("SendStripBase", &r, &g, &b, "fg");
+ ArdourCanvas::color_to_rgba (ARDOUR_UI::config()->color ("send strip base"), r, g, b, a);
}
if (!panner_shell->bypassed()) {
cairo_set_source_rgba (cr, r, g, b, 1.0);
diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc
index a52e696e90..f632d65de7 100644
--- a/gtk2_ardour/stereo_panner.cc
+++ b/gtk2_ardour/stereo_panner.cc
@@ -180,9 +180,10 @@ StereoPanner::on_expose_event (GdkEventExpose*)
}
if (_send_mode) {
- b = rgba_from_style("SendStripBase",
- UINT_RGBA_R(b), UINT_RGBA_G(b), UINT_RGBA_B(b), 255,
- "fg");
+ b = ARDOUR_UI::config()->color ("send strip base");
+ // b = rgba_from_style("SendStripBase",
+ // UINT_RGBA_R(b), UINT_RGBA_G(b), UINT_RGBA_B(b), 255,
+ // "fg");
}
/* background */
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index d6fba7e2eb..23bbd5b9ea 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -108,7 +108,7 @@ UIConfiguration::UIConfiguration ()
ParameterChanged.connect (sigc::mem_fun (*this, &UIConfiguration::parameter_changed));
- /* force GTK theme setting, so that RC file will work */
+ /* force GTK theme setting, so that loading an RC file will work */
reset_gtk_theme ();
}
@@ -183,7 +183,13 @@ UIConfiguration::color_as_relative_hsv (Color c)
std::map<std::string,HSV> palette;
for (f = configurable_colors.begin(); f != configurable_colors.end(); ++f) {
- palette.insert (make_pair (f->first, HSV (f->second->get())));
+ /* Do not include any specialized base colors in the palette
+ we use to do comparisons
+ */
+
+ if (f->first.find ("color") == 0) {
+ palette.insert (make_pair (f->first, HSV (f->second->get())));
+ }
}
for (map<string,HSV>::iterator f = palette.begin(); f != palette.end(); ++f) {
@@ -231,6 +237,23 @@ UIConfiguration::color_as_relative_hsv (Color c)
return RelativeHSV (closest_name, delta);
}
+string
+UIConfiguration::color_as_alias (Color c)
+{
+ string closest;
+ double shortest_distance = DBL_MAX;
+ HSV target (c);
+
+ for (RelativeColors::const_iterator a = relative_colors.begin(); a != relative_colors.end(); ++a) {
+ HSV hsv (a->second.get());
+ double d = hsv.distance (target);
+ if (d < shortest_distance) {
+ shortest_distance = d;
+ closest = a->first;
+ }
+ }
+ return closest;
+}
void
UIConfiguration::map_parameters (boost::function<void (std::string)>& functor)
{
@@ -538,36 +561,6 @@ UIConfiguration::base_color_by_name (const std::string& name) const
return i->second->get();
}
-#if 0 // yet unsed experimental style postfix
- /* Idea: use identical colors but different font/sizes
- * for variants of the same 'widget'.
- *
- * example:
- * set_name("mute button"); // in route_ui.cc
- * set_name("mute button small"); // in mixer_strip.cc
- *
- * ardour3_widget_list.rc:
- * widget "*mute button" style:highest "small_button"
- * widget "*mute button small" style:highest "very_small_text"
- *
- * both use color-schema of defined in
- * BUTTON_VARS(MuteButton, "mute button")
- *
- * (in this particular example the widgets should be packed
- * vertically shinking the mixer strip ones are currently not)
- */
- const size_t name_len = name.size();
- const size_t name_sep = name.find(':');
- for (i = configurable_colors.begin(); i != configurable_colors.end(), name_sep != string::npos; ++i) {
- const size_t cmp_len = i->first.size();
- const size_t cmp_sep = i->first.find(':');
- if (cmp_len >= name_len || cmp_sep == string::npos) continue;
- if (name.substr(name_sep) != i->first.substr(cmp_sep)) continue;
- if (name.substr(0, cmp_sep) != i->first.substr(0, cmp_sep)) continue;
- return i->second->get();
- }
-#endif
-
cerr << string_compose (_("Base Color %1 not found"), name) << endl;
return RGBA_TO_UINT (g_random_int()%256,g_random_int()%256,g_random_int()%256,0xff);
}
@@ -674,3 +667,8 @@ UIConfiguration::load_rc_file (const string& filename, bool themechange)
Gtkmm2ext::UI::instance()->load_rcfile (rc_file_path, themechange);
}
+
+std::ostream& operator<< (std::ostream& o, const UIConfiguration::RelativeHSV& rhsv)
+{
+ return o << rhsv.base_color << " + HSV(" << rhsv.modifier << ")";
+}
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h
index 7637bcf228..b343333371 100644
--- a/gtk2_ardour/ui_config.h
+++ b/gtk2_ardour/ui_config.h
@@ -93,7 +93,7 @@ class UIConfiguration : public PBD::Stateful
double quantized_hue;
ArdourCanvas::HSV get() const;
- };
+};
UIConfiguration();
~UIConfiguration();
@@ -127,6 +127,7 @@ class UIConfiguration : public PBD::Stateful
void reset_relative (const std::string& name, const RelativeHSV& new_value);
RelativeHSV color_as_relative_hsv (ArdourCanvas::Color c);
+ std::string color_as_alias (ArdourCanvas::Color c);
ArdourCanvas::Color quantized (ArdourCanvas::Color) const;
ArdourCanvas::Color base_color_by_name (const std::string&) const;
@@ -197,5 +198,7 @@ class UIConfiguration : public PBD::Stateful
int _saved_state_version;
};
+std::ostream& operator<< (std::ostream& o, const UIConfiguration::RelativeHSV& rhsv);
+
#endif /* __ardour_ui_configuration_h__ */
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index e353d609cc..15d119cf20 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -263,111 +263,6 @@ ARDOUR_UI_UTILS::get_font_for_style (string widgetname)
return Pango::FontDescription (pfd); /* make a copy */
}
-uint32_t
-ARDOUR_UI_UTILS::rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, string attr, int state, bool rgba)
-{
- /* In GTK+2, styles aren't set up correctly if the widget is not
- attached to a toplevel window that has a screen pointer.
- */
-
- static Gtk::Window* window = 0;
-
- if (window == 0) {
- window = new Window (WINDOW_TOPLEVEL);
- }
-
- Gtk::Label foo;
-
- window->add (foo);
-
- foo.set_name (style);
- foo.ensure_style ();
-
- GtkRcStyle* rc = foo.get_style()->gobj()->rc_style;
-
- if (rc) {
- if (attr == "fg") {
- r = rc->fg[state].red / 257;
- g = rc->fg[state].green / 257;
- b = rc->fg[state].blue / 257;
-
- /* what a hack ... "a" is for "active" */
- if (state == Gtk::STATE_NORMAL && rgba) {
- a = rc->fg[GTK_STATE_ACTIVE].red / 257;
- }
- } else if (attr == "bg") {
- r = rc->bg[state].red / 257;
- g = rc->bg[state].green / 257;
- b = rc->bg[state].blue / 257;
- } else if (attr == "base") {
- r = rc->base[state].red / 257;
- g = rc->base[state].green / 257;
- b = rc->base[state].blue / 257;
- } else if (attr == "text") {
- r = rc->text[state].red / 257;
- g = rc->text[state].green / 257;
- b = rc->text[state].blue / 257;
- }
- } else {
- warning << string_compose (_("missing RGBA style for \"%1\""), style) << endl;
- }
-
- window->remove ();
-
- if (state == Gtk::STATE_NORMAL && rgba) {
- return (uint32_t) RGBA_TO_UINT(r,g,b,a);
- } else {
- return (uint32_t) RGBA_TO_UINT(r,g,b,255);
- }
-}
-
-bool
-ARDOUR_UI_UTILS::rgba_p_from_style (string style, float *r, float *g, float *b, string attr, int state)
-{
- static Gtk::Window* window = 0;
- assert (r && g && b);
-
- if (window == 0) {
- window = new Window (WINDOW_TOPLEVEL);
- }
-
- Gtk::EventBox foo;
-
- window->add (foo);
-
- foo.set_name (style);
- foo.ensure_style ();
-
- GtkRcStyle* rc = foo.get_style()->gobj()->rc_style;
-
- if (!rc) {
- warning << string_compose (_("missing RGBA style for \"%1\""), style) << endl;
- return false;
- }
- if (attr == "fg") {
- *r = rc->fg[state].red / 65535.0;
- *g = rc->fg[state].green / 65535.0;
- *b = rc->fg[state].blue / 65535.0;
- } else if (attr == "bg") {
- *r = rc->bg[state].red / 65535.0;
- *g = rc->bg[state].green / 65535.0;
- *b = rc->bg[state].blue / 65535.0;
- } else if (attr == "base") {
- *r = rc->base[state].red / 65535.0;
- *g = rc->base[state].green / 65535.0;
- *b = rc->base[state].blue / 65535.0;
- } else if (attr == "text") {
- *r = rc->text[state].red / 65535.0;
- *g = rc->text[state].green / 65535.0;
- *b = rc->text[state].blue / 65535.0;
- } else {
- return false;
- }
-
- window->remove ();
- return true;
-}
-
void
ARDOUR_UI_UTILS::set_color_from_rgb (Gdk::Color& c, uint32_t rgb)
{
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 7f0b285945..fe8a0f5cb5 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -62,10 +62,6 @@ ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
Pango::FontDescription sanitized_font (std::string const&);
Pango::FontDescription get_font_for_style (std::string widgetname);
-uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true);
-
-bool rgba_p_from_style (std::string, float*, float*, float*, std::string = "fg", int = Gtk::STATE_NORMAL);
-
void decorate (Gtk::Window& w, Gdk::WMDecoration d);
void set_color_from_rgb (Gdk::Color&, uint32_t);