summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-10-15 15:57:35 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-10-15 15:57:35 +0000
commitcb84e71caa6faa3694a9c1958d24a67d02839326 (patch)
treef1f2c2732c14af8e27d93ce19fb7ba1dd39e0047 /gtk2_ardour
parent6ab663342df34cd5b9ceb27efda49ee65f5b6967 (diff)
create and manage a new config parameter that defines where LTC originates (still some tweaks to be done here and there)
git-svn-id: svn://localhost/ardour2/branches/3.0@13280 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/option_editor.h70
-rw-r--r--gtk2_ardour/rc_option_editor.cc15
-rw-r--r--gtk2_ardour/rc_option_editor.h1
3 files changed, 86 insertions, 0 deletions
diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h
index 3e64e4f125..6ea38648b0 100644
--- a/gtk2_ardour/option_editor.h
+++ b/gtk2_ardour/option_editor.h
@@ -285,6 +285,76 @@ private:
};
+/** Component which provides the UI to handle an enumerated option using a GTK ComboBox.
+ * The template parameter is the enumeration.
+ */
+class ComboStringOption : public Option
+{
+public:
+
+ /** Construct an ComboOption.
+ * @param i id
+ * @param n User-visible name.
+ * @param g Slot to get the variable's value.
+ * @param s Slot to set the variable's value.
+ */
+ ComboStringOption (
+ std::string const & i,
+ std::string const & n,
+ sigc::slot<std::string> g,
+ sigc::slot<bool, std::string> s
+ )
+ : Option (i, n),
+ _get (g),
+ _set (s)
+ {
+ _label = manage (new Gtk::Label (n + ":"));
+ _label->set_alignment (0, 0.5);
+ _combo = manage (new Gtk::ComboBoxText);
+ _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboStringOption::changed));
+ }
+
+ void set_state_from_config () {
+ _combo->set_active_text (_get());
+ }
+
+ void add_to_page (OptionEditorPage* p)
+ {
+ add_widgets_to_page (p, _label, _combo);
+ }
+
+ /** Set the allowed strings for this option
+ * @param strings a vector of allowed strings
+ */
+ void set_popdown_strings (const std::vector<std::string>& strings) {
+ _combo->clear_items ();
+ for (std::vector<std::string>::const_iterator i = strings.begin(); i != strings.end(); ++i) {
+ _combo->append_text (*i);
+ }
+ }
+
+ void clear () {
+ _combo->clear_items();
+ }
+
+ void changed () {
+ _set (_combo->get_active_text ());
+ }
+
+ void set_sensitive (bool yn) {
+ _combo->set_sensitive (yn);
+ }
+
+ Gtk::Widget& tip_widget() { return *_combo; }
+
+private:
+ sigc::slot<std::string> _get;
+ sigc::slot<bool, std::string> _set;
+ Gtk::Label* _label;
+ Gtk::ComboBoxText* _combo;
+};
+
+
/** Component which provides the UI to handle a boolean option which needs
* to be represented as a ComboBox to be clear to the user.
*/
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index 6b59e8718e..c889962158 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -1068,8 +1068,23 @@ RCOptionEditor::RCOptionEditor ()
(_sync_genlock->tip_widget(),
_("<b>When enabled</b> indicates that the selected external timecode source shares sync (Black &amp; Burst, Wordclock, etc) with the audio interface"));
+
add_option (_("Transport"), _sync_genlock);
+ _ltc_port = new ComboStringOption (
+ "ltc-source-port",
+ _("LTC incoming port"),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::get_ltc_source_port),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::set_ltc_source_port)
+ );
+
+ vector<string> physical_inputs;
+ physical_inputs.push_back (_("None"));
+ AudioEngine::instance()->get_physical_inputs (DataType::AUDIO, physical_inputs);
+ _ltc_port->set_popdown_strings (physical_inputs);
+
+ add_option (_("Transport"), _ltc_port);
+
parameter_changed ("sync-source");
/* EDITOR */
diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h
index eae27d323b..76978d4317 100644
--- a/gtk2_ardour/rc_option_editor.h
+++ b/gtk2_ardour/rc_option_editor.h
@@ -45,6 +45,7 @@ private:
ComboOption<ARDOUR::SyncSource>* _sync_source;
BoolOption* _sync_framerate;
BoolOption* _sync_genlock;
+ ComboStringOption* _ltc_port;
PBD::ScopedConnection parameter_change_connection;
};