- if (_flat_buttons) {
- end_color = start_color = fill_start_active_color;
- } else {
- start_color = fill_start_active_color;
- end_color = fill_end_active_color;
- }
- UINT_TO_RGBA (start_color, &r, &g, &b, &a);
-
- active_r = r/255.0;
- active_g = g/255.0;
- active_b = b/255.0;
- active_a = a/255.0;
-
- shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
- cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
- cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.1);
- cairo_pattern_add_color_stop_rgba (shine_pattern, 0.7, 1,1,1,0.2);
- cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.1);
-
- fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()-3);
- if (_flat_buttons) {
- end_color = start_color = fill_start_inactive_color;
- } else {
- start_color = fill_start_inactive_color;
- end_color = fill_end_inactive_color;
- }
- UINT_TO_RGBA (start_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0);
- UINT_TO_RGBA (end_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0);
-
- fill_pattern_active = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()-3);
- if (_flat_buttons) {
- if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
- end_color = start_color = led_active_color;
- } else {
- end_color = start_color = fill_end_active_color;
- }
- } else {
- if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
- end_color = start_color = led_active_color;
- } else {
- start_color = fill_start_active_color;
- end_color = fill_end_active_color;
- }
- }
- UINT_TO_RGBA (start_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern_active, 0, r/255.0,g/255.0,b/255.0, a/255.0);
- UINT_TO_RGBA (end_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern_active, 1, r/255.0,g/255.0,b/255.0, a/255.0);
+ text_inactive_color = (white_contrast > black_contrast) ?
+ RGBA_TO_UINT(255, 255, 255, 255) : /* use white */
+ RGBA_TO_UINT( 0, 0, 0, 255); /* use black */
+
+ /* XXX what about led colors ? */
+ CairoWidget::set_dirty ();
+}
+
+void
+ArdourButton::build_patterns ()
+{
+ if (convex_pattern) {
+ cairo_pattern_destroy (convex_pattern);
+ convex_pattern = 0;
+ }
+
+ if (concave_pattern) {
+ cairo_pattern_destroy (concave_pattern);
+ concave_pattern = 0;