summaryrefslogtreecommitdiff
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
parent0f6e67a32fed814003b69df0e35cd8caa770efba (diff)
add dialog for adding new transport masters
-rw-r--r--gtk2_ardour/transport_masters_dialog.cc74
-rw-r--r--gtk2_ardour/transport_masters_dialog.h18
2 files changed, 89 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;
+}
diff --git a/gtk2_ardour/transport_masters_dialog.h b/gtk2_ardour/transport_masters_dialog.h
index f90854b1eb..ee6f1cfdb1 100644
--- a/gtk2_ardour/transport_masters_dialog.h
+++ b/gtk2_ardour/transport_masters_dialog.h
@@ -28,6 +28,7 @@
#include <gtkmm/radiobutton.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
+#include <gtkmm/entry.h>
#include <gtkmm/treestore.h>
#include "ardour_window.h"
@@ -57,6 +58,21 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
private:
+ struct AddTransportMasterDialog : public ArdourDialog {
+ public:
+ AddTransportMasterDialog ();
+ std::string get_name () const;
+ ARDOUR::SyncSource get_type () const;
+
+ private:
+ Gtk::Label name_label;
+ Gtk::Label type_label;
+ Gtk::HBox name_hbox;
+ Gtk::HBox type_hbox;
+ Gtk::Entry name_entry;
+ Gtk::ComboBoxText type_combo;
+ };
+
struct Row : sigc::trackable, PBD::ScopedConnectionList {
TransportMastersWidget& parent;
Gtk::EventBox label_box;
@@ -125,6 +141,8 @@ class TransportMastersWidget : public Gtk::VBox, public ARDOUR::SessionHandlePtr
sigc::connection update_connection;
PBD::ScopedConnection current_connection;
+ PBD::ScopedConnection add_connection;
+ PBD::ScopedConnection remove_connection;
void rebuild ();
void current_changed (boost::shared_ptr<ARDOUR::TransportMaster> old_master, boost::shared_ptr<ARDOUR::TransportMaster> new_master);