13
0

TMM: do not allow changing transport master while slaved (GUI edition)

This commit is contained in:
Paul Davis 2020-05-15 21:06:40 -06:00
parent c57df5a7e5
commit a9fff59229
2 changed files with 29 additions and 0 deletions

View File

@ -715,6 +715,19 @@ TransportMastersWindow::set_session (ARDOUR::Session* s)
w.set_session (s);
}
void
TransportMastersWidget::set_session (ARDOUR::Session* s)
{
session_config_connection.disconnect ();
SessionHandlePtr::set_session (s);
if (_session) {
_session->config.ParameterChanged.connect (session_config_connection, invalidator (*this), boost::bind (&TransportMastersWidget::param_changed, this, _1), gui_context());
allow_master_select (!_session->config.get_external_sync());
}
}
TransportMastersWidget::AddTransportMasterDialog::AddTransportMasterDialog ()
: ArdourDialog (_("Add Transport Master"), true, false)
, name_label (_("Name"))
@ -791,5 +804,17 @@ TransportMastersWidget::param_changed (string const & p)
{
if (p == "transport-masters-just_roll-when-sync-lost") {
lost_sync_changed ();
} else if (p == "external-sync") {
if (_session) {
allow_master_select (!_session->config.get_external_sync());
}
}
}
void
TransportMastersWidget::allow_master_select (bool yn)
{
for (vector<Row*>::iterator r = rows.begin(); r != rows.end(); ++r) {
(*r)->use_button.set_sensitive (yn);
}
}

View File

@ -53,6 +53,8 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
void update (ARDOUR::samplepos_t);
void set_transport_master (boost::shared_ptr<ARDOUR::TransportMaster>);
void set_session (ARDOUR::Session*);
protected:
void on_map ();
void on_unmap ();
@ -166,11 +168,13 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);
bool add_master (GdkEventButton* ev);
void update_usability ();
void allow_master_select (bool);
void lost_sync_changed ();
void lost_sync_button_toggled ();
void param_changed (std::string const &);
PBD::ScopedConnection config_connection;
PBD::ScopedConnection session_config_connection;
public:
bool idle_remove (Row*);