From b5fd753886f69c99edbd437c99c130d03808ee60 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 18 Sep 2022 22:51:58 +0200 Subject: [PATCH] Set tooltip for send polarity button --- gtk2_ardour/route_ui.cc | 28 ++++++++++++++++++++++------ gtk2_ardour/route_ui.h | 1 + 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 39b5773f3d..48a1bd3ce4 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -2071,6 +2071,7 @@ RouteUI::setup_invert_buttons () if (_n_polarity_invert == N) { /* buttons are already setup for this strip, but we should still set the values */ update_polarity_display (); + update_polarity_tooltips (); return; } _n_polarity_invert = N; @@ -2104,12 +2105,6 @@ RouteUI::setup_invert_buttons () b->set_text (string_compose (X_("Ø%1"), i + 1)); } - if (N <= _max_invert_buttons) { - UI::instance()->set_tip (*b, string_compose (_("Left-click to invert polarity of channel %1 of this track. Right-click to show menu."), i + 1)); - } else { - UI::instance()->set_tip (*b, _("Click to show a menu of channels to invert polarity")); - } - _invert_buttons.push_back (b); invert_button_box.pack_start (*b); } @@ -2118,6 +2113,7 @@ RouteUI::setup_invert_buttons () invert_button_box.show_all (); update_polarity_display (); + update_polarity_tooltips (); } void @@ -2164,6 +2160,21 @@ RouteUI::update_polarity_display () } } +void +RouteUI::update_polarity_tooltips () +{ + boost::shared_ptr send = boost::dynamic_pointer_cast(_current_delivery); + int i = 0; + for (auto const& b : _invert_buttons) { + if (send) { + UI::instance()->set_tip (*b, _("Click to invert polarity of all send channels")); + } else if (_n_polarity_invert <= _max_invert_buttons) { + UI::instance()->set_tip (*b, string_compose (_("Left-click to invert polarity of channel %1 of this track. Right-click to show menu."), ++i)); + } else { + UI::instance()->set_tip (*b, _("Click to show a menu of channels to invert polarity")); + } + } +} bool RouteUI::invert_release (GdkEventButton* ev, uint32_t i) @@ -2198,6 +2209,11 @@ RouteUI::invert_press (GdkEventButton* ev) return false; } + if (boost::dynamic_pointer_cast(_current_delivery)) { + /* do not show context menu for send polarity */ + return false; + } + delete _invert_menu; _invert_menu = new Menu; _invert_menu->set_name ("ArdourContextMenu"); diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 70907fb256..41015f2e35 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -275,6 +275,7 @@ private: void update_solo_display (); void update_mute_display (); void update_polarity_display (); + void update_polarity_tooltips (); void update_solo_button (); void solo_changed_so_update_mute (); void session_rec_enable_changed ();