add a new Tweak to ArdourButton that makes ImplicitActive state use a solid color (the "led active" color), and adjst rec-enable buttons to use pink (like ardour2) when in this state (which means rec-enabled but not recording). and yes, this means that you can't use ImplicitUsesSolidColor with a button that also uses an LED - acceptable limitation

git-svn-id: svn://localhost/ardour2/branches/3.0@13645 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-12-12 02:22:12 +00:00
parent 740c5aebab
commit 6e337459a9
4 changed files with 30 additions and 19 deletions

View file

@ -327,9 +327,9 @@
<Option name="record enable button: fill start active" value="280b0bff"/>
<Option name="record enable button: fill end active" value="b50e0eff"/>
<Option name="record enable button: led" value="00000000"/>
<Option name="record enable button: led active" value="00000000"/>
<Option name="record enable button: led active" value="fda0b1ff"/>
<Option name="record enable button: text" value="a5a5a5ff"/>
<Option name="record enable button: text active" value="d8d8d8ff"/>
<Option name="record enable button: text active" value="000000ff"/>
<Option name="send alert button: fill start" value="4e5647ff"/>
<Option name="send alert button: fill end" value="43493cff"/>
<Option name="send alert button: fill start active" value="91f928ff"/>

View file

@ -201,17 +201,26 @@ ArdourButton::render (cairo_t* cr)
}
if (active_state() == Gtkmm2ext::ImplicitActive) {
//background color
cairo_set_source (cr, fill_pattern);
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) {
// note: with this tweak, implicit-active
// background color uses "led active" color
UINT_TO_RGBA (fill_color_active, &r, &g, &b, &a);
cairo_set_source_rgba (cr, r/255.0, g/255.0, b/255.0, a/255.0);
cairo_fill (cr);
} else {
//background color
cairo_set_source (cr, fill_pattern);
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);
}
} else if (active_state() == Gtkmm2ext::ExplicitActive || ((_elements & Indicator)==Indicator) ) {
//background color
@ -431,11 +440,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 (_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 +466,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 {
@ -521,7 +530,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 {

View file

@ -54,6 +54,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
enum Tweaks {
ShowClick = 0x1,
NoModel = 0x2,
ImplicitUsesSolidColor = 0x4,
};
Tweaks tweaks() const { return _tweaks; }

View file

@ -120,6 +120,7 @@ RouteUI::init ()
rec_enable_button = manage (new ArdourButton);
rec_enable_button->set_name ("record enable button");
rec_enable_button->set_tweaks (ArdourButton::ImplicitUsesSolidColor);
UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), "");
show_sends_button = manage (new ArdourButton);