From 37d9ec34c86bb18f95e35987b8b62bd4d275787c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 Sep 2019 13:46:06 -0600 Subject: add ::usable() method to TransportMaster objects to allow GUI to show their usability after backend/engine changes --- gtk2_ardour/transport_masters_dialog.cc | 15 +++++++++++++++ gtk2_ardour/transport_masters_dialog.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/transport_masters_dialog.cc b/gtk2_ardour/transport_masters_dialog.cc index bbf846e688..dcc97e6201 100644 --- a/gtk2_ardour/transport_masters_dialog.cc +++ b/gtk2_ardour/transport_masters_dialog.cc @@ -86,6 +86,8 @@ TransportMastersWidget::TransportMastersWidget () TransportMasterManager::instance().Added.connect (add_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context()); TransportMasterManager::instance().Removed.connect (remove_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context()); + AudioEngine::instance()->Running.connect (engine_running_connection, invalidator (*this), boost::bind (&TransportMastersWidget::update_usability, this), gui_context()); + rebuild (); } @@ -244,6 +246,19 @@ TransportMastersWidget::rebuild () r->prop_change (all_change); } + + update_usability (); +} + +void +TransportMastersWidget::update_usability () +{ + for (vector::iterator r= rows.begin(); r != rows.end(); ++r) { + const bool usable = (*r)->tm->usable(); + (*r)->use_button.set_sensitive (usable); + (*r)->collect_button.set_sensitive (usable); + (*r)->request_options.set_sensitive (usable); + } } TransportMastersWidget::Row::Row (TransportMastersWidget& p) diff --git a/gtk2_ardour/transport_masters_dialog.h b/gtk2_ardour/transport_masters_dialog.h index eb9689490a..695bfc9a9f 100644 --- a/gtk2_ardour/transport_masters_dialog.h +++ b/gtk2_ardour/transport_masters_dialog.h @@ -143,11 +143,13 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr PBD::ScopedConnection current_connection; PBD::ScopedConnection add_connection; PBD::ScopedConnection remove_connection; + PBD::ScopedConnection engine_running_connection; void rebuild (); void clear (); void current_changed (boost::shared_ptr old_master, boost::shared_ptr new_master); void add_master (); + void update_usability (); public: bool idle_remove (Row*); -- cgit v1.2.3