13
0

PluginPinDialog: subscribe to processor name changes

This commit is contained in:
Robin Gareus 2023-05-27 14:19:59 +02:00
parent 10b2380b14
commit c9e13d49d4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 21 additions and 8 deletions

View File

@ -2089,16 +2089,17 @@ PluginPinWidget::Control::control_changed ()
_ignore_ui_adjustment = false; _ignore_ui_adjustment = false;
} }
PluginPinDialog::PluginPinDialog (std::shared_ptr<ARDOUR::PluginInsert> pi) PluginPinDialog::PluginPinDialog (std::shared_ptr<ARDOUR::PluginInsert> pi)
: ArdourWindow (string_compose (_("Pin Configuration: %1"), pi->name ())) : ArdourWindow (string_compose (_("Pin Configuration: %1"), pi->name ()))
, _pi (pi)
{ {
ppw.push_back (PluginPinWidgetPtr(new PluginPinWidget (pi))); ppw.push_back (PluginPinWidgetPtr(new PluginPinWidget (pi)));
add (*ppw.back()); add (*ppw.back());
unset_transient_for (); unset_transient_for ();
}
_pi->PropertyChanged.connect (_connections, invalidator (*this), boost::bind (&PluginPinDialog::processor_property_changed, this, _1), gui_context());
/* Note: PluginPinWindowProxy handles DropReferences */
}
PluginPinDialog::PluginPinDialog (std::shared_ptr<ARDOUR::Route> r) PluginPinDialog::PluginPinDialog (std::shared_ptr<ARDOUR::Route> r)
: ArdourWindow (string_compose (_("Pin Configuration: %1"), r->name ())) : ArdourWindow (string_compose (_("Pin Configuration: %1"), r->name ()))
@ -2119,13 +2120,14 @@ PluginPinDialog::PluginPinDialog (std::shared_ptr<ARDOUR::Route> r)
_route->foreach_processor (sigc::mem_fun (*this, &PluginPinDialog::add_processor)); _route->foreach_processor (sigc::mem_fun (*this, &PluginPinDialog::add_processor));
_route->processors_changed.connect ( _route->processors_changed.connect (
_route_connections, invalidator (*this), boost::bind (&PluginPinDialog::route_processors_changed, this, _1), gui_context() _connections, invalidator (*this), boost::bind (&PluginPinDialog::route_processors_changed, this, _1), gui_context()
); );
_route->DropReferences.connect ( _route->DropReferences.connect (
_route_connections, invalidator (*this), boost::bind (&PluginPinDialog::route_going_away, this), gui_context() _connections, invalidator (*this), boost::bind (&PluginPinDialog::going_away, this), gui_context()
); );
} }
void void
PluginPinDialog::set_session (ARDOUR::Session *s) PluginPinDialog::set_session (ARDOUR::Session *s)
{ {
@ -2158,9 +2160,18 @@ PluginPinDialog::route_processors_changed (ARDOUR::RouteProcessorChange)
} }
void void
PluginPinDialog::route_going_away () PluginPinDialog::processor_property_changed (PropertyChange const& what_changed)
{
if (what_changed.contains (ARDOUR::Properties::name)) {
set_title (string_compose (_("Pin Configuration: %1"), _pi->name ()));
}
}
void
PluginPinDialog::going_away ()
{ {
ppw.clear (); ppw.clear ();
_pi.reset ();
_route.reset (); _route.reset ();
remove (); remove ();
} }

View File

@ -252,14 +252,16 @@ private:
typedef std::shared_ptr<PluginPinWidget> PluginPinWidgetPtr; typedef std::shared_ptr<PluginPinWidget> PluginPinWidgetPtr;
typedef std::vector<PluginPinWidgetPtr> PluginPinWidgetList; typedef std::vector<PluginPinWidgetPtr> PluginPinWidgetList;
void route_going_away (); void going_away ();
void processor_property_changed (PBD::PropertyChange const&);
void route_processors_changed (ARDOUR::RouteProcessorChange); void route_processors_changed (ARDOUR::RouteProcessorChange);
void add_processor (std::weak_ptr<ARDOUR::Processor>); void add_processor (std::weak_ptr<ARDOUR::Processor>);
void map_height (Gtk::Allocation&); void map_height (Gtk::Allocation&);
std::shared_ptr<ARDOUR::PluginInsert> _pi;
std::shared_ptr<ARDOUR::Route> _route; std::shared_ptr<ARDOUR::Route> _route;
PluginPinWidgetList ppw; PluginPinWidgetList ppw;
PBD::ScopedConnectionList _route_connections; PBD::ScopedConnectionList _connections;
bool _height_mapped; bool _height_mapped;
}; };