From 42b4ea89f4107cfaf5cb609a97c8d49166ca36c7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 24 Apr 2020 00:52:13 +0200 Subject: [PATCH] Use send-API for pan-link, indicate status in tooltip and name --- gtk2_ardour/processor_box.cc | 77 +++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 13a1dd2448..9194b5c5db 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -413,13 +413,13 @@ ProcessorEntry::setup_visuals () _button.set_name ("processor sidechain"); return; } - } - boost::shared_ptr aux; - if ((aux = boost::dynamic_pointer_cast (_processor))) { - if (aux->allow_feedback ()) { - _button.set_name ("processor auxfeedback"); - return; + boost::shared_ptr aux; + if ((aux = boost::dynamic_pointer_cast (_processor))) { + if (aux->allow_feedback ()) { + _button.set_name ("processor auxfeedback"); + return; + } } } @@ -440,7 +440,6 @@ ProcessorEntry::setup_visuals () } } - boost::shared_ptr ProcessorEntry::processor () const { @@ -509,6 +508,11 @@ ProcessorEntry::processor_property_changed (const PropertyChange& what_changed) if (what_changed.contains (ARDOUR::Properties::name)) { _button.set_text (name (_width)); setup_tooltip (); + } else if (boost::dynamic_pointer_cast (_processor) != 0) { + /* Any property change for a send needs to trigger an update. + * e.g. target-bus is updated, panner-link changes, etc */ + _button.set_text (name (_width)); + setup_tooltip (); } } @@ -554,12 +558,26 @@ ProcessorEntry::setup_tooltip () return; } boost::shared_ptr send; - if ((send = boost::dynamic_pointer_cast (_processor)) != 0 && - !boost::dynamic_pointer_cast(_processor)) { - if (send->remove_on_disconnect ()) { - set_tooltip (_button, string_compose ("> %1\nThis (sidechain) send will be removed when disconnected.", _processor->name())); + if ((send = boost::dynamic_pointer_cast (_processor)) != 0) { + std::string pan_suffix; + if (send->has_panner ()) { + bool panlinked = send->panner_linked_to_route(); + pan_suffix = panlinked ? "\n(Send panner is linked)" : "\n(Send has independent panner)"; + } + + boost::shared_ptr aux; + if ((aux = boost::dynamic_pointer_cast (_processor)) != 0) { + if (aux->target_route() && aux->target_route()->name() != aux->display_name()) { + set_tooltip (_button, string_compose ("Aux: %1\nsend to '%2'%3", aux->display_name(), aux->target_route()->name(), pan_suffix)); + } else { + set_tooltip (_button, string_compose ("Aux: %1%2", aux->display_name(), pan_suffix)); + } } else { - set_tooltip (_button, string_compose ("> %1", _processor->name())); + if (send->remove_on_disconnect ()) { + set_tooltip (_button, string_compose ("> %1\nThis (sidechain) send will be removed when disconnected.%2", _processor->name(), pan_suffix)); + } else { + set_tooltip (_button, string_compose ("> %1%2", _processor->name(), pan_suffix)); + } } return; } @@ -570,16 +588,37 @@ ProcessorEntry::setup_tooltip () string ProcessorEntry::name (Width w) const { - boost::shared_ptr send; - string name_display; - if (!_processor) { return string(); } - if ((send = boost::dynamic_pointer_cast (_processor)) != 0 && - !boost::dynamic_pointer_cast(_processor)) { + string name_display; + boost::shared_ptr send; + boost::shared_ptr aux; + + if ((aux = boost::dynamic_pointer_cast (_processor)) != 0) { + + if (aux->has_panner () && !aux->panner_linked_to_route()) { + switch (w) { + case Wide: + name_display += "^ "; + break; + case Narrow: + name_display += "^"; + break; + } + } + switch (w) { + case Wide: + name_display += aux->display_name(); + break; + case Narrow: + name_display += PBD::short_version (aux->display_name(), 5); + break; + } + + } else if ((send = boost::dynamic_pointer_cast (_processor)) != 0) { name_display += '>'; std::string send_name; bool pretty_ok = true; @@ -802,7 +841,7 @@ ProcessorEntry::build_send_options_menu () if (send) { items.push_back (CheckMenuElem (_("Link panner controls"))); Gtk::CheckMenuItem* c = dynamic_cast (&items.back ()); - c->set_active (send->panner_shell()->is_linked_to_route()); + c->set_active (send->panner_linked_to_route ()); c->signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::toggle_panner_link)); } @@ -821,7 +860,7 @@ ProcessorEntry::toggle_panner_link () { boost::shared_ptr send = boost::dynamic_pointer_cast (_processor); if (send) { - send->panner_shell()->set_linked_to_route(!send->panner_shell()->is_linked_to_route()); + send->set_panner_linked_to_route (!send->panner_linked_to_route ()); } }