X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fwidgets%2Fardour_button.cc;h=ebd23b2aac3b590496eea9f1b2ce1c03bb3fd6b2;hb=b61146365f827fd04fe54a79e0c08926c9e2e9b5;hp=913e18bae890c49b28b5f48b442f0cb3ce451434;hpb=5c926136988757f1f11a14c11720ed3daac3195f;p=ardour.git diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc index 913e18bae8..ebd23b2aac 100644 --- a/libs/widgets/ardour_button.cc +++ b/libs/widgets/ardour_button.cc @@ -22,18 +22,17 @@ #include #include +#include #include "pbd/compose.h" #include "pbd/controllable.h" #include "pbd/error.h" #include "pbd/stacktrace.h" -#include "gtkmm2ext/utils.h" -#include "gtkmm2ext/rgb_macros.h" +#include "gtkmm2ext/colors.h" #include "gtkmm2ext/gui_thread.h" - -#include "canvas/utils.h" -#include "canvas/colors.h" +#include "gtkmm2ext/rgb_macros.h" +#include "gtkmm2ext/utils.h" #include "widgets/ardour_button.h" #include "widgets/tooltips.h" @@ -60,7 +59,7 @@ ArdourButton::ArdourButton (Element e) : _sizing_text("") , _markup (false) , _elements (e) - , _icon (Gtkmm2ext::ArdourIcon::NoIcon) + , _icon (ArdourIcon::NoIcon) , _icon_render_cb (0) , _icon_render_cb_data (0) , _tweaks (Tweaks (0)) @@ -108,7 +107,7 @@ ArdourButton::ArdourButton (const std::string& str, Element e) : _sizing_text("") , _markup (false) , _elements (e) - , _icon (Gtkmm2ext::ArdourIcon::NoIcon) + , _icon (ArdourIcon::NoIcon) , _tweaks (Tweaks (0)) , _char_pixel_width (0) , _char_pixel_height (0) @@ -222,13 +221,7 @@ ArdourButton::set_sizing_text (const std::string& str) return; } _sizing_text = str; - if (!is_realized()) { - return; - } - ensure_layout (); - if (_layout) { - queue_resize (); - } + queue_resize (); } void @@ -313,15 +306,15 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ if ((_elements & Body)==Body) { rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius); if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) { - ArdourCanvas::set_source_rgba (cr, fill_inactive_color); + Gtkmm2ext::set_source_rgba (cr, fill_inactive_color); cairo_fill (cr); } else if ( (active_state() == Gtkmm2ext::ExplicitActive) && !((_elements & Indicator)==Indicator) ) { //background color - ArdourCanvas::set_source_rgba (cr, fill_active_color); + Gtkmm2ext::set_source_rgba (cr, fill_active_color); cairo_fill (cr); } else { //inactive, or it has an indicator //background color - ArdourCanvas::set_source_rgba (cr, fill_inactive_color); + Gtkmm2ext::set_source_rgba (cr, fill_inactive_color); } cairo_fill (cr); } @@ -331,7 +324,7 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) { cairo_set_line_width (cr, 2.0); rounded_function (cr, 2, 2, get_width() - 4, get_height() - 4, corner_radius-0.5); - ArdourCanvas::set_source_rgba (cr, fill_active_color); + Gtkmm2ext::set_source_rgba (cr, fill_active_color); cairo_stroke (cr); } } @@ -379,7 +372,7 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ vw -= _diameter + 4; } if (_elements & VectorIcon) { - Gtkmm2ext::ArdourIcon::render (cr, _icon, vw, vh, active_state(), text_color); + ArdourIcon::render (cr, _icon, vw, vh, active_state(), text_color); } else { cairo_save (cr); rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius + 1.5); @@ -417,7 +410,7 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ cairo_clip(cr); cairo_new_path (cr); - ArdourCanvas::set_source_rgba (cr, text_color); + Gtkmm2ext::set_source_rgba (cr, text_color); const double text_ypos = (get_height() - _text_height) * .5; if (_elements & Menu) { @@ -519,7 +512,7 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ cairo_fill(cr); //led color - ArdourCanvas::set_source_rgba (cr, led_color); + Gtkmm2ext::set_source_rgba (cr, led_color); cairo_arc (cr, 0, 0, _diameter * .5 - 3 * UIConfigurationBase::instance().get_ui_scale(), 0, 2 * M_PI); cairo_fill(cr); @@ -530,7 +523,7 @@ ArdourButton::render (Cairo::RefPtr const& ctx, cairo_rectangle_ if ((visual_state() & Gtkmm2ext::Insensitive)) { rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius); uint32_t ins_color = UIConfigurationBase::instance().color ("gtk_background"); - ArdourCanvas::set_source_rgb_a (cr, ins_color, 0.6); + Gtkmm2ext::set_source_rgb_a (cr, ins_color, 0.6); cairo_fill (cr); } @@ -735,8 +728,8 @@ ArdourButton::set_colors () } } - text_active_color = ArdourCanvas::contrasting_text_color (fill_active_color); - text_inactive_color = ArdourCanvas::contrasting_text_color (fill_inactive_color); + text_active_color = Gtkmm2ext::contrasting_text_color (fill_active_color); + text_inactive_color = Gtkmm2ext::contrasting_text_color (fill_inactive_color); led_active_color = UIConfigurationBase::instance().color (string_compose ("%1: led active", name), &failed); if (failed) { @@ -747,7 +740,7 @@ ArdourButton::set_colors () * active color. */ - ArdourCanvas::HSV inactive (led_active_color); + Gtkmm2ext::HSV inactive (led_active_color); inactive.v = 0.35; led_inactive_color = inactive.color (); @@ -1303,7 +1296,7 @@ ArdourButton::add_elements (Element e) } void -ArdourButton::set_icon (Gtkmm2ext::ArdourIcon::Icon i) +ArdourButton::set_icon (ArdourIcon::Icon i) { _icon = i; _icon_render_cb = 0;