summaryrefslogtreecommitdiff
path: root/gtk2_ardour/transport_masters_dialog.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2018-10-07 11:09:54 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2018-10-07 11:10:45 -0400
commiteab98962bcc51c313ca168bbb29ef22fbc0becf2 (patch)
treee7fb7e84e985601af7099e7c6d1c7bbec57fcc6f /gtk2_ardour/transport_masters_dialog.cc
parent0f6e67a32fed814003b69df0e35cd8caa770efba (diff)
add dialog for adding new transport masters
Diffstat (limited to 'gtk2_ardour/transport_masters_dialog.cc')
-rw-r--r--gtk2_ardour/transport_masters_dialog.cc74
1 files changed, 71 insertions, 3 deletions
diff --git a/gtk2_ardour/transport_masters_dialog.cc b/gtk2_ardour/transport_masters_dialog.cc
index 027d98964c..3b16007aca 100644
--- a/gtk2_ardour/transport_masters_dialog.cc
+++ b/gtk2_ardour/transport_masters_dialog.cc
@@ -83,8 +83,8 @@ TransportMastersWidget::TransportMastersWidget ()
table.set_spacings (6);
TransportMasterManager::instance().CurrentChanged.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::current_changed, this, _1, _2), gui_context());
- TransportMasterManager::instance().Added.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
- TransportMasterManager::instance().Removed.connect (current_connection, invalidator (*this), boost::bind (&TransportMastersWidget::rebuild, this), gui_context());
+ 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());
rebuild ();
}
@@ -116,7 +116,19 @@ TransportMastersWidget::current_changed (boost::shared_ptr<TransportMaster> old_
void
TransportMastersWidget::add_master ()
{
- TransportMasterManager::instance().add (LTC, "new ltc");
+ AddTransportMasterDialog d;
+
+ d.present ();
+ int r = d.run ();
+
+ switch (r) {
+ case RESPONSE_ACCEPT:
+ break;
+ default:
+ return;
+ }
+
+ TransportMasterManager::instance().add (d.get_type(), d.get_name());
}
void
@@ -553,3 +565,59 @@ TransportMastersWindow::set_session (ARDOUR::Session* s)
ArdourWindow::set_session (s);
w.set_session (s);
}
+
+TransportMastersWidget::AddTransportMasterDialog::AddTransportMasterDialog ()
+ : ArdourDialog (_("Add Transport Master"), true, false)
+ , name_label (_("Name"))
+ , type_label (_("Type"))
+{
+ name_hbox.set_spacing (6);
+ name_hbox.pack_start (name_label, false, false);
+ name_hbox.pack_start (name_entry, true, true);
+
+ type_hbox.set_spacing (6);
+ type_hbox.pack_start (type_label, false, false);
+ type_hbox.pack_start (type_combo, true, true);
+
+ vector<string> s;
+
+ s.push_back (X_("MTC"));
+ s.push_back (X_("LTC"));
+ s.push_back (X_("MIDI Clock"));
+
+ set_popdown_strings (type_combo, s);
+ type_combo.set_active_text (X_("LTC"));
+
+ get_vbox()->pack_start (name_hbox, false, false);
+ get_vbox()->pack_start (type_hbox, false, false);
+
+ add_button (_("Cancel"), RESPONSE_CANCEL);
+ add_button (_("Add"), RESPONSE_ACCEPT);
+
+ name_entry.show ();
+ type_combo.show ();
+ name_label.show ();
+ type_label.show ();
+ name_hbox.show ();
+ type_hbox.show ();
+}
+
+string
+TransportMastersWidget::AddTransportMasterDialog::get_name () const
+{
+ return name_entry.get_text ();
+}
+
+SyncSource
+TransportMastersWidget::AddTransportMasterDialog::get_type() const
+{
+ string t = type_combo.get_active_text ();
+
+ if (t == X_("MTC")) {
+ return MTC;
+ } else if (t == X_("MIDI Clock")) {
+ return MIDIClock;
+ }
+
+ return LTC;
+}