From 90858279bca28183395af9e089029414fa4db03e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 30 Sep 2024 14:07:57 -0600 Subject: [PATCH] tweak drawing of clip recording rec-enable icon --- gtk2_ardour/triggerbox_ui.cc | 32 ++++++++++++++++++++++++-------- gtk2_ardour/triggerbox_ui.h | 4 ++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/triggerbox_ui.cc b/gtk2_ardour/triggerbox_ui.cc index c04cfb70ad..2d5bd86ee6 100644 --- a/gtk2_ardour/triggerbox_ui.cc +++ b/gtk2_ardour/triggerbox_ui.cc @@ -42,7 +42,6 @@ #include "canvas/polygon.h" #include "canvas/text.h" -#include "gtkmm2ext/colors.h" #include "gtkmm2ext/utils.h" #include "ardour_ui.h" @@ -139,9 +138,20 @@ TriggerEntry::~TriggerEntry () void TriggerEntry::rec_enable_change () { + set_play_button_tooltip (); redraw (); } +void +TriggerEntry::set_play_button_tooltip () +{ + if (tref.box()->record_enabled()) { + play_button->set_tooltip (_("Record into this clip\nRight-click to select Launch Options for this clip")); + } else { + play_button->set_tooltip (_("Stop other clips on this track.\nRight-click to select Launch Options for this clip")); + } +} + void TriggerEntry::owner_prop_change (PropertyChange const& pc) { @@ -283,13 +293,13 @@ TriggerEntry::draw_launch_icon (Cairo::RefPtr context, float sz, if (!trigger ()->region ()) { if (tref.box()->record_enabled()) { - context->arc (margin + size/2., margin + size/2., size/2., 0., 360.0 * (M_PI/180.0)); + context->arc (margin + (size * 0.75), margin + (size * 0.75), (size * 0.75), 0., 360.0 * (M_PI/180.0)); if (trigger()->armed()) { set_source_rgba (context, UIConfiguration::instance ().color ("record enable button: fill active")); context->fill (); } else { - set_source_rgba (context, UIConfiguration::instance ().color ("neutral:midground")); + set_source_rgba (context, bg_color()); context->fill_preserve (); set_source_rgba (context, UIConfiguration::instance ().color ("record enable button: fill active")); context->stroke (); @@ -493,11 +503,10 @@ TriggerEntry::on_trigger_changed (PropertyChange const& change) if (change.contains (ARDOUR::Properties::name)) { if (trigger ()->region ()) { name_text->set (short_version (trigger ()->name (), 16)); - play_button->set_tooltip (_("Launch this clip\nRight-click to select Launch Options for this clip")); } else { name_text->set (""); - play_button->set_tooltip (_("Stop other clips on this track.\nRight-click to select Launch Options for this clip")); } + set_play_button_tooltip (); } set_widget_colors (); //depending on the state, this might change a color and queue a redraw @@ -518,16 +527,23 @@ TriggerEntry::on_trigger_changed (PropertyChange const& change) } } -void -TriggerEntry::set_widget_colors (TriggerEntry::EnteredState es) +Color +TriggerEntry::bg_color() const { - color_t bg_col = UIConfiguration::instance ().color ("theme:bg"); + Color bg_col = UIConfiguration::instance ().color ("theme:bg"); //alternating darker bands if ((tref.slot() / 2) % 2 == 0) { bg_col = HSV (bg_col).darker (0.25).color (); } + return bg_col; +} + +void +TriggerEntry::set_widget_colors (TriggerEntry::EnteredState es) +{ + color_t bg_col = bg_color (); set_fill_color (bg_col); //child widgets highlight when entered diff --git a/gtk2_ardour/triggerbox_ui.h b/gtk2_ardour/triggerbox_ui.h index 1c779e6019..432ebb70e1 100644 --- a/gtk2_ardour/triggerbox_ui.h +++ b/gtk2_ardour/triggerbox_ui.h @@ -28,6 +28,8 @@ #include "canvas/canvas.h" #include "canvas/rectangle.h" +#include "gtkmm2ext/colors.h" + #include "fitted_canvas_widget.h" #include "trigger_ui.h" @@ -103,6 +105,8 @@ private: void owner_prop_change (PBD::PropertyChange const&); void owner_color_changed (); void rec_enable_change (); + void set_play_button_tooltip (); + Gtkmm2ext::Color bg_color () const; PBD::ScopedConnection _owner_prop_connection; PBD::ScopedConnectionList _rec_enable_connections;