From a996645ef17f2a971c48d5426de5c16bcb866ffb Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 22 Jun 2023 15:28:37 +0200 Subject: [PATCH] Update plugin-pin dialog when route or plugin name changes --- gtk2_ardour/plugin_pin_dialog.cc | 21 +++++++++++++++++++++ gtk2_ardour/plugin_pin_dialog.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/gtk2_ardour/plugin_pin_dialog.cc b/gtk2_ardour/plugin_pin_dialog.cc index 108f1f2b8a..2beae7d42a 100644 --- a/gtk2_ardour/plugin_pin_dialog.cc +++ b/gtk2_ardour/plugin_pin_dialog.cc @@ -262,6 +262,9 @@ PluginPinWidget::PluginPinWidget (std::shared_ptr pi) _add_sc_audio.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::add_sidechain_port), DataType::AUDIO)); _add_sc_midi.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::add_sidechain_port), DataType::MIDI)); + _route ()->PropertyChanged.connect (_plugin_connections, invalidator (*this), boost::bind (&PluginPinWidget::property_changed, this, _1), gui_context ()); + _pi->PropertyChanged.connect (_plugin_connections, invalidator (*this), boost::bind (&PluginPinWidget::property_changed, this, _1), gui_context ()); + AudioEngine::instance ()->PortConnectedOrDisconnected.connect ( _io_connection, invalidator (*this), boost::bind (&PluginPinWidget::port_connected_or_disconnected, this, _1, _3), gui_context () ); @@ -1990,6 +1993,14 @@ PluginPinWidget::port_pretty_name_changed (std::string pn) } } +void +PluginPinWidget::property_changed (PBD::PropertyChange const& what_changed) +{ + if (what_changed.contains (ARDOUR::Properties::name)) { + darea.queue_draw (); + } +} + /* lifted from ProcessorEntry::Control */ PluginPinWidget::Control::Control (std::shared_ptr c, string const & n) : _control (c) @@ -2126,6 +2137,8 @@ PluginPinDialog::PluginPinDialog (std::shared_ptr r) _route->DropReferences.connect ( _connections, invalidator (*this), boost::bind (&PluginPinDialog::going_away, this), gui_context() ); + + _route->PropertyChanged.connect ( _connections, invalidator (*this), boost::bind (&PluginPinDialog::route_property_changed, this, _1), gui_context()); } void @@ -2170,6 +2183,14 @@ PluginPinDialog::processor_property_changed (PropertyChange const& what_changed) } } +void +PluginPinDialog::route_property_changed (PropertyChange const& what_changed) +{ + if (what_changed.contains (ARDOUR::Properties::name)) { + set_title (string_compose (_("Pin Configuration: %1"), _route->name ())); + } +} + void PluginPinDialog::going_away () { diff --git a/gtk2_ardour/plugin_pin_dialog.h b/gtk2_ardour/plugin_pin_dialog.h index cf3b743cac..ea42dd26bf 100644 --- a/gtk2_ardour/plugin_pin_dialog.h +++ b/gtk2_ardour/plugin_pin_dialog.h @@ -183,6 +183,7 @@ private: uint32_t maybe_add_route_to_input_menu (std::shared_ptr, ARDOUR::DataType, std::weak_ptr); void port_connected_or_disconnected (std::weak_ptr, std::weak_ptr); void port_pretty_name_changed (std::string); + void property_changed (PBD::PropertyChange const&); bool sc_input_press (GdkEventButton *, std::weak_ptr); bool sc_input_release (GdkEventButton *); @@ -254,6 +255,7 @@ private: void going_away (); void processor_property_changed (PBD::PropertyChange const&); + void route_property_changed (PBD::PropertyChange const&); void route_processors_changed (ARDOUR::RouteProcessorChange); void add_processor (std::weak_ptr); void map_height (Gtk::Allocation&);