make MIDI rubber band selects use the correct canvas item so that event processing...
[ardour.git] / gtk2_ardour / ardour_button.cc
index f24b60148d71cd8f0db4a8877bde5d065e15c0a9..a9eabd33d933abe0fe1dc45b65abf86fbf8fcf21 100644 (file)
@@ -201,17 +201,23 @@ ArdourButton::render (cairo_t* cr)
                }
 
                if (active_state() == Gtkmm2ext::ImplicitActive) {
-                       //background color
-                       cairo_set_source (cr, fill_pattern);
+                       
+                       if (!(_tweaks & ImplicitUsesSolidColor)) {
+                               cairo_set_source (cr, fill_pattern);
+                       } else {
+                               cairo_set_source (cr, fill_pattern_active);
+                       }
                        cairo_fill (cr);
-
-                       //border
-                       UINT_TO_RGBA (fill_color_active, &r, &g, &b, &a);
-                       cairo_set_line_width (cr, 1.0);
-                       rounded_function (cr, 2, 2, get_width()-4, get_height()-4, _corner_radius - 1.5);
-                       cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
-                       cairo_stroke (cr);
-
+                       
+                       if (!(_tweaks & ImplicitUsesSolidColor)) {
+                               //border
+                               UINT_TO_RGBA (fill_color_active, &r, &g, &b, &a);
+                               cairo_set_line_width (cr, 1.0);
+                               rounded_function (cr, 2, 2, get_width()-4, get_height()-4, _corner_radius - 1.5);
+                               cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
+                               cairo_stroke (cr);
+                       }
+                               
                } else if (active_state() == Gtkmm2ext::ExplicitActive || ((_elements & Indicator)==Indicator) ) {
 
                        //background color
@@ -431,11 +437,11 @@ ArdourButton::set_colors ()
        uint32_t text_color;
        uint32_t led_color;
 
-       /* we use the edge of the button to show Selected state, so the
-        * color/pattern used there will vary depending on that
-        */
-       
-       fill_color_active = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", get_name()));
+       if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
+               fill_color_active = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led active", get_name()));
+       } else {
+               fill_color_active = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", get_name()));
+       }
        fill_color_inactive = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name()));
        border_color = ARDOUR_UI::config()->color_by_name ( "button border" );
 
@@ -457,7 +463,7 @@ ArdourButton::set_colors ()
        if (_elements & Body) {
 
                start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start active", get_name()));
-
+               
                if (_flat_buttons) {
                        end_color = start_color;
                } else {
@@ -477,10 +483,10 @@ ArdourButton::set_colors ()
                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);
-               start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", get_name()));
                if (_flat_buttons) {
-                       end_color = start_color;
+                       end_color = start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name()));
                } else {
+                       start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", get_name()));
                        end_color = fill_color_inactive;
                }
                UINT_TO_RGBA (start_color, &r, &g, &b, &a);
@@ -489,11 +495,20 @@ ArdourButton::set_colors ()
                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);
-               start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start active", get_name()));
                if (_flat_buttons) {
-                       end_color = start_color;
+                       if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
+                               end_color = start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led active", get_name()));
+                       } else {
+                               end_color = start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", get_name()));
+                       }
                } else {
-                       end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", get_name()));
+                       if (active_state() == Gtkmm2ext::ImplicitActive && (_tweaks & ImplicitUsesSolidColor)) {
+                               start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led", get_name()));
+                               end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led active", get_name()));
+                       } else {
+                               start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start active", get_name()));
+                               end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end active", get_name()));
+                       }
                }
                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);
@@ -521,7 +536,7 @@ ArdourButton::set_colors ()
        
        /* text and LED colors */
 
-       if (active_state() == Gtkmm2ext::ExplicitActive) {
+       if (active_state() == Gtkmm2ext::ExplicitActive || ((_tweaks & ImplicitUsesSolidColor) && active_state() == Gtkmm2ext::ImplicitActive)) {
                text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: text active", get_name()));
                led_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led active", get_name()));
        } else {