summaryrefslogtreecommitdiff
path: root/libs/surfaces/osc/osc_gui.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/osc/osc_gui.cc')
-rw-r--r--libs/surfaces/osc/osc_gui.cc193
1 files changed, 192 insertions, 1 deletions
diff --git a/libs/surfaces/osc/osc_gui.cc b/libs/surfaces/osc/osc_gui.cc
index 9fd2fce070..b32203cecc 100644
--- a/libs/surfaces/osc/osc_gui.cc
+++ b/libs/surfaces/osc/osc_gui.cc
@@ -25,6 +25,8 @@
#include <gtkmm/box.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
+#include <gtkmm/button.h>
+#include <gtkmm/spinbutton.h>
#include <gtkmm/comboboxtext.h>
#include "gtkmm2ext/gtk_ui.h"
@@ -45,8 +47,20 @@ class OSC_GUI : public Gtk::VBox
private:
Gtk::ComboBoxText debug_combo;
+ Gtk::ComboBoxText portmode_combo;
+ Gtk::SpinButton port_entry;
+ Gtk::SpinButton bank_entry;
+ Gtk::SpinButton striptypes_spin; // dropdown would be nicer
+ Gtk::SpinButton feedback_spin; // dropdown would be nicer
+ Gtk::ComboBoxText gainmode_combo;
void debug_changed ();
-
+ void portmode_changed ();
+ void gainmode_changed ();
+ void clear_device ();
+ void port_changed ();
+ void bank_changed ();
+ void strips_changed ();
+ void feedback_changed ();
OSC& cp;
};
@@ -96,13 +110,109 @@ OSC_GUI::OSC_GUI (OSC& p)
int n = 0; // table row
Table* table = manage (new Table);
Label* label;
+ Button* button;
+ // show our url
label = manage (new Gtk::Label(_("Connection:")));
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
label = manage (new Gtk::Label(cp.get_server_url()));
table->attach (*label, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
++n;
+ // show and set port to auto (default) or manual (one surface only)
+ label = manage (new Gtk::Label(_("Port Mode:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (portmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ std::vector<std::string> portmode_options;
+ portmode_options.push_back (_("Auto"));
+ portmode_options.push_back (_("Manual"));
+
+ set_popdown_strings (portmode_combo, portmode_options);
+ portmode_combo.set_active ((int)cp.get_portmode());
+ ++n;
+
+ // port entry box
+ label = manage (new Gtk::Label(_("Manual Port:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (port_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ port_entry.set_range(1024, 0xffff);
+ port_entry.set_increments (1, 100);
+ port_entry.set_text(cp.get_remote_port().c_str());
+ if (!cp.get_portmode()) {
+ port_entry.set_sensitive (false);
+ }
+ ++n;
+
+ // default banksize setting
+ label = manage (new Gtk::Label(_("Bank Size:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (bank_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ bank_entry.set_range (0, 0xffff);
+ bank_entry.set_increments (1, 8);
+ bank_entry.set_value (cp.get_banksize());
+
+ ++n;
+
+ // Default strip types
+ label = manage (new Gtk::Label(_("Strip Types:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (striptypes_spin, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ striptypes_spin.set_range (0, 0x3ff);
+ striptypes_spin.set_increments (1, 10);
+ striptypes_spin.set_value (cp.get_defaultstrip());
+
+/* std::vector<std::string> strip_options;
+ strip_options.push_back (_("Audio Tracks"));
+ strip_options.push_back (_("Midi Tracks"));
+ strip_options.push_back (_("Audio Buses"));
+ strip_options.push_back (_("Midi Buses"));
+ strip_options.push_back (_("Control Masters"));
+ strip_options.push_back (_("Master"));
+ strip_options.push_back (_("Monitor"));
+ strip_options.push_back (_("Selected"));
+ strip_options.push_back (_("Hidden"));*/
+
+ ++n;
+
+ // default feedback settings
+ label = manage (new Gtk::Label(_("Feedback:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (feedback_spin, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ feedback_spin.set_range (0, 0x3fff);
+ feedback_spin.set_increments (1, 10);
+ feedback_spin.set_value (cp.get_defaultfeedback());
+ /*std::vector<std::string> feedback_options;
+ feedback_options.push_back (_("Strip Buttons"));
+ feedback_options.push_back (_("Strip Controls"));
+ feedback_options.push_back (_("Use SSID as Path Extension"));
+ feedback_options.push_back (_("Send heart beat"));
+ feedback_options.push_back (_("Master and Transport Feedback"));
+ feedback_options.push_back (_("Send Bar and Beat"));
+ feedback_options.push_back (_("Send SMPTE Time"));
+ feedback_options.push_back (_("Send metering"));
+ feedback_options.push_back (_("Send LED strip metering"));
+ feedback_options.push_back (_("Signal Present"));
+ feedback_options.push_back (_("Strip Controls"));
+ feedback_options.push_back (_("Playhead Position as Samples"));
+ feedback_options.push_back (_("Playhead Position as Minutes Seconds"));
+ feedback_options.push_back (_("Playhead Position as per GUI Clock"));
+ feedback_options.push_back (_("Extra Select Channel Controls"));*/
+
+ ++n;
+
+ // Gain Mode
+ label = manage (new Gtk::Label(_("Gain Mode:")));
+ table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+ table->attach (gainmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+ std::vector<std::string> gainmode_options;
+ gainmode_options.push_back (_("dB"));
+ gainmode_options.push_back (_("Position"));
+
+ set_popdown_strings (gainmode_combo, gainmode_options);
+ gainmode_combo.set_active ((int)cp.get_gainmode());
+ ++n;
+
+ // debug setting
label = manage (new Gtk::Label(_("Debug:")));
table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (debug_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
@@ -114,11 +224,23 @@ OSC_GUI::OSC_GUI (OSC& p)
set_popdown_strings (debug_combo, debug_options);
debug_combo.set_active ((int)cp.get_debug_mode());
+ ++n;
+
+ // refresh button
+ button = manage (new Gtk::Button(_("Clear OSC Devices")));
+ table->attach (*button, 0, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->show_all ();
pack_start (*table, false, false);
debug_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::debug_changed));
+ portmode_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::portmode_changed));
+ gainmode_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::gainmode_changed));
+ button->signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::clear_device));
+ port_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::port_changed));
+ bank_entry.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::bank_changed));
+ striptypes_spin.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::strips_changed));
+ feedback_spin.signal_activate().connect (sigc::mem_fun (*this, &OSC_GUI::feedback_changed));
}
OSC_GUI::~OSC_GUI ()
@@ -143,3 +265,72 @@ OSC_GUI::debug_changed ()
assert (0);
}
}
+
+void
+OSC_GUI::portmode_changed ()
+{
+ std::string str = portmode_combo.get_active_text ();
+ if (str == _("Auto")) {
+ cp.set_portmode (0);
+ port_entry.set_sensitive (false);
+ }
+ else if (str == _("Manual")) {
+ cp.set_portmode (1);
+ port_entry.set_sensitive (true);
+ }
+ else {
+ std::cerr << "Invalid OSC Port Mode\n";
+ assert (0);
+ }
+}
+
+void
+OSC_GUI::port_changed ()
+{
+ std::string str = port_entry.get_text ();
+ cp.set_remote_port (str);
+}
+
+void
+OSC_GUI::bank_changed ()
+{
+ uint32_t bsize = bank_entry.get_value ();
+ cp.set_banksize (bsize);
+
+}
+
+void
+OSC_GUI::strips_changed ()
+{
+ uint32_t st = striptypes_spin.get_value ();
+ cp.set_defaultstrip (st);
+}
+
+void
+OSC_GUI::feedback_changed ()
+{
+ uint32_t fb = feedback_spin.get_value ();
+ cp.set_defaultfeedback (fb);
+}
+
+void
+OSC_GUI::gainmode_changed ()
+{
+ std::string str = gainmode_combo.get_active_text ();
+ if (str == _("dB")) {
+ cp.set_gainmode (0);
+ }
+ else if (str == _("Position")) {
+ cp.set_gainmode (1);
+ }
+ else {
+ std::cerr << "Invalid OSC Gain Mode\n";
+ assert (0);
+ }
+}
+
+void
+OSC_GUI::clear_device ()
+{
+ cp.clear_devices();
+}