Subscribe to pretty-port name changes (GUI)

This commit is contained in:
Robin Gareus 2021-01-13 19:04:44 +01:00
parent 21e66216be
commit b2c4e71a45
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
13 changed files with 75 additions and 4 deletions

View File

@ -538,6 +538,10 @@ FoldbackStrip::init ()
*this, invalidator (*this), boost::bind (&FoldbackStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
AudioEngine::instance()->PortPrettyNameChanged.connect (
*this, invalidator (*this), boost::bind (&FoldbackStrip::port_pretty_name_changed, this, _1), gui_context ()
);
//watch for mouse enter/exit so we can do some stuff
signal_enter_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_enter_event ));
signal_leave_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_leave_event ));
@ -1174,6 +1178,14 @@ FoldbackStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::
}
}
void
FoldbackStrip::port_pretty_name_changed (std::string pn)
{
if (_route->output()->connected_to (pn)) {
update_output_display ();
}
}
void
FoldbackStrip::setup_comment_button ()
{

View File

@ -275,6 +275,7 @@ private:
void update_io_button ();
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
void port_pretty_name_changed (std::string);
bool mixer_strip_enter_event ( GdkEventCrossing * );
bool mixer_strip_leave_event ( GdkEventCrossing * );

View File

@ -415,6 +415,10 @@ MixerStrip::init ()
*this, invalidator (*this), boost::bind (&MixerStrip::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
AudioEngine::instance()->PortPrettyNameChanged.connect (
*this, invalidator (*this), boost::bind (&MixerStrip::port_pretty_name_changed, this, _1), gui_context ()
);
/* Add the widgets under visibility control to the VisibilityGroup; the names used here
must be the same as those used in RCOptionEditor so that the configuration changes
are recognised when they occur.
@ -1611,6 +1615,19 @@ MixerStrip::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost::wea
}
}
void
MixerStrip::port_pretty_name_changed (std::string pn)
{
if (_route->input()->connected_to (pn)) {
update_input_display ();
set_width_enum (_width, this);
}
if (_route->output()->connected_to (pn)) {
update_output_display ();
set_width_enum (_width, this);
}
}
void
MixerStrip::setup_comment_button ()
{

View File

@ -320,6 +320,7 @@ private:
void update_io_button (bool input_button);
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
void port_pretty_name_changed (std::string);
bool mixer_strip_enter_event ( GdkEventCrossing * );
bool mixer_strip_leave_event ( GdkEventCrossing * );

View File

@ -507,6 +507,9 @@ MonitorSection::MonitorSection ()
AudioEngine::instance()->PortConnectedOrDisconnected.connect (
*this, invalidator (*this), boost::bind (&MonitorSection::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
AudioEngine::instance()->PortPrettyNameChanged.connect (
*this, invalidator (*this), boost::bind (&MonitorSection::port_pretty_name_changed, this, _1), gui_context ()
);
Config->ParameterChanged.connect (config_connection, invalidator (*this), boost::bind (&MonitorSection::parameter_changed, this, _1), gui_context());
}
@ -1590,6 +1593,18 @@ MonitorSection::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost:
}
}
void
MonitorSection::port_pretty_name_changed (std::string pn)
{
if (!_route) {
return;
}
if (_route->output()->connected_to (pn)) {
update_output_display ();
}
}
void
MonitorSection::load_bindings ()
{

View File

@ -174,6 +174,7 @@ private:
void unassign_controllables ();
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
void port_pretty_name_changed (std::string);
void update_processor_box ();

View File

@ -260,6 +260,9 @@ PluginPinWidget::PluginPinWidget (boost::shared_ptr<ARDOUR::PluginInsert> pi)
AudioEngine::instance ()->PortConnectedOrDisconnected.connect (
_io_connection, invalidator (*this), boost::bind (&PluginPinWidget::port_connected_or_disconnected, this, _1, _3), gui_context ()
);
AudioEngine::instance ()->PortPrettyNameChanged.connect (
_io_connection, invalidator (*this), boost::bind (&PluginPinWidget::port_pretty_name_changed, this, _1), gui_context ()
);
}
PluginPinWidget::~PluginPinWidget ()
@ -1906,6 +1909,15 @@ PluginPinWidget::port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port> w
}
}
void
PluginPinWidget::port_pretty_name_changed (std::string pn)
{
boost::shared_ptr<IO> io = _pi->sidechain_input ();
if (io && io->connected_to (pn)) {
queue_idle_update ();
}
}
/* lifted from ProcessorEntry::Control */
PluginPinWidget::Control::Control (boost::shared_ptr<AutomationControl> c, string const & n)
: _control (c)

View File

@ -171,12 +171,13 @@ private:
uint32_t add_port_to_table (boost::shared_ptr<ARDOUR::Port>, uint32_t, bool);
uint32_t maybe_add_route_to_input_menu (boost::shared_ptr<ARDOUR::Route>, ARDOUR::DataType, boost::weak_ptr<ARDOUR::Port>);
void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
void port_pretty_name_changed (std::string);
bool sc_input_press (GdkEventButton *, boost::weak_ptr<ARDOUR::Port>);
bool sc_input_release (GdkEventButton *);
PBD::ScopedConnectionList _plugin_connections;
PBD::ScopedConnection _io_connection;
PBD::ScopedConnectionList _io_connection;
boost::shared_ptr<ARDOUR::PluginInsert> _pi;
void queue_idle_update ();

View File

@ -170,6 +170,8 @@ PortMatrix::init ()
/* and also ports */
_session->engine().PortRegisteredOrUnregistered.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
_session->engine().PortPrettyNameChanged.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_all_ports, this), gui_context());
/* watch for route order keys changing, which changes the order of things in our global ports list(s) */
PresentationInfo::Change.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());

View File

@ -628,6 +628,8 @@ ProcessorEntry::name (Width w) const
std::string send_name;
bool pretty_ok = true;
// TODO, subscribe to PortPrettyNameChanged
if (send->remove_on_disconnect ()) {
// assume it's a sidechain, find pretty name of connected port(s)
PortSet& ps (send->output ()->ports ());

View File

@ -1365,7 +1365,7 @@ private:
PortColumns _port_columns;
Glib::RefPtr<Gtk::ListStore> _store;
PBD::ScopedConnection _engine_connection;
PBD::ScopedConnectionList _engine_connection;
void on_map ()
{
@ -1374,11 +1374,17 @@ private:
invalidator (*this),
boost::bind (&LTCPortSelectOption::update_port_combo, this),
gui_context());
AudioEngine::instance()->PortPrettyNameChanged.connect (
_engine_connection,
invalidator (*this),
boost::bind (&LTCPortSelectOption::update_port_combo, this),
gui_context());
}
void on_unmap ()
{
_engine_connection.disconnect ();
_engine_connection.drop_connections ();
}
void port_changed ()

View File

@ -58,6 +58,7 @@ TransportMastersWidget::TransportMastersWidget ()
audio_port_store = ListStore::create (port_columns);
AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_reg_connection, invalidator (*this), boost::bind (&TransportMastersWidget::update_ports, this), gui_context());
AudioEngine::instance()->PortPrettyNameChanged.connect (port_reg_connection, invalidator (*this), boost::bind (&TransportMastersWidget::update_ports, this), gui_context());
update_ports ();
Gtk::Table *add_table = manage(new Gtk::Table(1,2));

View File

@ -158,7 +158,7 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
Glib::RefPtr<Gtk::ListStore> midi_port_store;
Glib::RefPtr<Gtk::ListStore> audio_port_store;
PBD::ScopedConnection port_reg_connection;
PBD::ScopedConnectionList port_reg_connection;
void update_ports ();
bool ignore_active_change;
void build_port_model (Glib::RefPtr<Gtk::ListStore>, std::vector<std::string> const &);