From a796853f9991a4e85afee7ca8724e7fb502457a0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 21 May 2012 12:31:05 +0000 Subject: [PATCH] introduce flat button option,which right now is on all the time. GUI nit-pickers, do your best git-svn-id: svn://localhost/ardour2/branches/3.0@12358 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_button.cc | 32 ++++++++++++++++++++++++++++---- gtk2_ardour/ardour_button.h | 5 +++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 1d98a7b84f..e875116cf0 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -49,6 +49,7 @@ using namespace std; ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text); ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator); ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator); +bool ArdourButton::_flat_buttons = true; ArdourButton::ArdourButton (Element e) : _elements (e) @@ -382,10 +383,18 @@ ArdourButton::set_colors () edge_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()); if (visual_state() & Gtkmm2ext::Selected) { start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border start selected", get_name())); - end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end selected", get_name())); + if (_flat_buttons) { + end_color = start_color; + } else { + end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end selected", get_name())); + } } else { start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border start", get_name())); - end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end", get_name())); + if (_flat_buttons) { + end_color = start_color; + } else { + end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end", get_name())); + } } UINT_TO_RGBA (start_color, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgba (edge_pattern, 0, r/255.0,g/255.0,b/255.0, 0.7); @@ -407,7 +416,12 @@ ArdourButton::set_colors () active_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()); 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())); + + if (_flat_buttons) { + end_color = start_color; + } else { + 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); active_r = r/255.0; @@ -421,7 +435,11 @@ ArdourButton::set_colors () inactive_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height()); start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", get_name())); - end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name())); + if (_flat_buttons) { + end_color = start_color; + } else { + end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name())); + } UINT_TO_RGBA (start_color, &r, &g, &b, &a); cairo_pattern_add_color_stop_rgba (inactive_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0); UINT_TO_RGBA (end_color, &r, &g, &b, &a); @@ -764,3 +782,9 @@ ArdourButton::set_elements (Element e) _elements = e; set_colors (); } + +void +ArdourButton::set_flat_buttons (bool yn) +{ + _flat_buttons = yn; +} diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h index a2c65006ff..94b3c6d399 100644 --- a/gtk2_ardour/ardour_button.h +++ b/gtk2_ardour/ardour_button.h @@ -44,6 +44,9 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable static Element led_default_elements; static Element just_led_default_elements; + static void set_flat_buttons (bool yn); + static bool flat_buttons() { return _flat_buttons; } + ArdourButton (Element e = default_elements); ArdourButton (const std::string&, Element e = default_elements); virtual ~ArdourButton (); @@ -142,6 +145,8 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable bool _distinct_led_click; bool _hovering; + static bool _flat_buttons; + void setup_led_rect (); void set_colors (); void color_handler ();