13
0

OSC: Tweak GUI to be more user obvious.

This commit is contained in:
Len Ovens 2016-08-22 13:23:04 -07:00
parent 44a04be437
commit 81c481f975

View File

@ -52,18 +52,19 @@ private:
Gtk::ComboBoxText portmode_combo;
Gtk::SpinButton port_entry;
Gtk::SpinButton bank_entry;
Gtk::SpinButton striptypes_spin;
Gtk::SpinButton feedback_spin;
Gtk::ComboBoxText gainmode_combo;
void debug_changed ();
void portmode_changed ();
void gainmode_changed ();
void clear_device ();
void factory_reset ();
void reshow_values ();
void port_changed ();
void bank_changed ();
void strips_changed ();
void feedback_changed ();
// Strip types calculator
uint32_t def_strip;
void calculate_strip_types ();
void push_strip_types ();
Gtk::Label current_strip_types;
@ -78,6 +79,7 @@ private:
Gtk::CheckButton hidden_tracks;
int stvalue;
// feedback calculator
uint32_t def_feedback;
void calculate_feedback ();
void push_feedback ();
Gtk::Label current_feedback;
@ -144,11 +146,10 @@ OSC_GUI::OSC_GUI (OSC& p)
: cp (p)
{
int n = 0; // table row
uint32_t def_feedback;
uint32_t def_strip;
Table* table = manage (new Table);
Label* label;
Button* button;
Button* frbutton;
Button* fbbutton;
Button* stbutton;
table->set_row_spacings (10);
@ -200,29 +201,6 @@ OSC_GUI::OSC_GUI (OSC& p)
++n;
// Default strip types
label = manage (new Gtk::Label(_("Strip Types:")));
label->set_alignment(1, .5);
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);
def_strip = cp.get_defaultstrip();
striptypes_spin.set_value (def_strip);
++n;
// default feedback settings
label = manage (new Gtk::Label(_("Feedback:")));
label->set_alignment(1, .5);
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);
def_feedback = cp.get_defaultfeedback();
feedback_spin.set_value (def_feedback);
++n;
// Gain Mode
label = manage (new Gtk::Label(_("Gain Mode:")));
label->set_alignment(1, .5);
@ -253,7 +231,12 @@ OSC_GUI::OSC_GUI (OSC& p)
// refresh button
button = manage (new Gtk::Button(_("Clear OSC Devices")));
table->attach (*button, 0, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
table->attach (*button, 0, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 10);
++n;
// Factory reset
frbutton = manage (new Gtk::Button(_("Factory Reset")));
table->attach (*frbutton, 0, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 15);
table->show_all ();
append_page (*table, _("OSC Setup"));
@ -262,11 +245,9 @@ OSC_GUI::OSC_GUI (OSC& p)
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));
frbutton->signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::factory_reset));
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));
// Strip Types Calculate Page
int stn = 0; // table row
@ -293,7 +274,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (audio_tracks, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
audio_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
audio_tracks.set_active(def_strip & 1);
++stn;
label = manage (new Gtk::Label(_("Midi Tracks:")));
@ -301,7 +281,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (midi_tracks, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
midi_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
midi_tracks.set_active(def_strip & 2);
++stn;
label = manage (new Gtk::Label(_("Audio Buses:")));
@ -309,7 +288,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (audio_buses, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
audio_buses.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
audio_buses.set_active(def_strip & 4);
++stn;
label = manage (new Gtk::Label(_("Midi Buses:")));
@ -317,7 +295,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (midi_buses, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
midi_buses.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
midi_buses.set_active(def_strip & 8);
++stn;
label = manage (new Gtk::Label(_("Control Masters:")));
@ -325,7 +302,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (control_masters, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
control_masters.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
control_masters.set_active(def_strip & 16);
++stn;
label = manage (new Gtk::Label(_("Master (use /master instead):")));
@ -333,7 +309,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (master_type, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
master_type.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
master_type.set_active(def_strip & 32);
++stn;
label = manage (new Gtk::Label(_("Monitor (use /monitor instead):")));
@ -341,7 +316,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (monitor_type, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
monitor_type.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
monitor_type.set_active(def_strip & 64);
++stn;
label = manage (new Gtk::Label(_("Selected Tracks (use for selected tracks only):")));
@ -349,7 +323,6 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (selected_tracks, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
selected_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
selected_tracks.set_active(def_strip & 256);
++stn;
label = manage (new Gtk::Label(_("Hidden Tracks:")));
@ -357,16 +330,15 @@ OSC_GUI::OSC_GUI (OSC& p)
sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
sttable->attach (hidden_tracks, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
hidden_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_strip_types));
hidden_tracks.set_active(def_strip & 512);
++stn;
stbutton = manage (new Gtk::Button(_("Use Value as Strip Types Default")));
stbutton = manage (new Gtk::Button(_("Set Default Strip Types")));
sttable->attach (*stbutton, 0, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 15);
stbutton->signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::push_strip_types));
sttable->show_all ();
append_page (*sttable, _("Calculate Strip Types"));
append_page (*sttable, _("Default Strip Types"));
// Feedback Calculate Page
@ -394,7 +366,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (strip_buttons_button, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
strip_buttons_button.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
strip_buttons_button.set_active(def_feedback & 1);
++fn;
label = manage (new Gtk::Label(_("Strip Controls:")));
@ -402,7 +373,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (strip_control_button, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
strip_control_button.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
strip_control_button.set_active(def_feedback & 2);
++fn;
label = manage (new Gtk::Label(_("Use SSID as Path Extension:")));
@ -410,7 +380,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (ssid_as_path, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
ssid_as_path.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
ssid_as_path.set_active(def_feedback & 4);
++fn;
label = manage (new Gtk::Label(_("Use Heart Beat:")));
@ -418,7 +387,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (heart_beat, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
heart_beat.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
heart_beat.set_active(def_feedback & 8);
++fn;
label = manage (new Gtk::Label(_("Master Section:")));
@ -426,7 +394,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (master_fb, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
master_fb.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
master_fb.set_active(def_feedback & 16);
++fn;
label = manage (new Gtk::Label(_("Play Head Position as Bar and Beat:")));
@ -434,7 +401,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (bar_and_beat, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
bar_and_beat.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
bar_and_beat.set_active(def_feedback & 32);
++fn;
label = manage (new Gtk::Label(_("Play Head Position as SMPTE Time:")));
@ -442,7 +408,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (smpte, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
smpte.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
smpte.set_active(def_feedback & 64);
++fn;
label = manage (new Gtk::Label(_("Metering as a Float:")));
@ -450,7 +415,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (meter_float, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
meter_float.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
meter_float.set_active(def_feedback & 128);
++fn;
label = manage (new Gtk::Label(_("Metering as a LED Strip:")));
@ -458,7 +422,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (meter_led, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
meter_led.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
meter_led.set_active(def_feedback & 256);
++fn;
label = manage (new Gtk::Label(_("Signal Present:")));
@ -466,7 +429,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (signal_present, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
signal_present.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
signal_present.set_active(def_feedback & 512);
++fn;
label = manage (new Gtk::Label(_("Play Head Position as Samples:")));
@ -474,7 +436,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (hp_samples, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
hp_samples.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
hp_samples.set_active(def_feedback & 1024);
++fn;
label = manage (new Gtk::Label(_("Playhead Position as Minutes Seconds:")));
@ -482,7 +443,6 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (hp_min_sec, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
hp_min_sec.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
hp_min_sec.set_active(def_feedback & 2048);
++fn;
label = manage (new Gtk::Label(_("Playhead Position as per GUI Clock:")));
@ -498,16 +458,16 @@ OSC_GUI::OSC_GUI (OSC& p)
fbtable->attach (*label, 0, 1, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
fbtable->attach (select_fb, 1, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
select_fb.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::calculate_feedback));
select_fb.set_active(def_feedback & 8192);
++fn;
fbbutton = manage (new Gtk::Button(_("Use Value as Feedback Default")));
fbbutton = manage (new Gtk::Button(_("Set Default Feedback")));
fbtable->attach (*fbbutton, 0, 2, fn, fn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 15);
fbbutton->signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::push_feedback));
fbtable->show_all ();
append_page (*fbtable, _("Calculate Feedback"));
append_page (*fbtable, _("Default Feedback"));
reshow_values ();
}
@ -571,20 +531,6 @@ OSC_GUI::bank_changed ()
}
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 ()
{
@ -607,6 +553,53 @@ OSC_GUI::clear_device ()
cp.clear_devices();
}
void
OSC_GUI::factory_reset ()
{
cp.set_banksize (0);
bank_entry.set_value (0);
cp.set_defaultstrip (31);
cp.set_defaultfeedback (0);
reshow_values ();
cp.set_gainmode (0);
gainmode_combo.set_active (0);
cp.set_portmode (0);
portmode_combo.set_active (0);
cp.clear_devices();
}
void
OSC_GUI::reshow_values ()
{
def_strip = cp.get_defaultstrip();
audio_tracks.set_active(def_strip & 1);
midi_tracks.set_active(def_strip & 2);
audio_buses.set_active(def_strip & 4);
midi_buses.set_active(def_strip & 8);
control_masters.set_active(def_strip & 16);
master_type.set_active(def_strip & 32);
monitor_type.set_active(def_strip & 64);
selected_tracks.set_active(def_strip & 256);
hidden_tracks.set_active(def_strip & 512);
def_feedback = cp.get_defaultfeedback();
strip_buttons_button.set_active(def_feedback & 1);
strip_control_button.set_active(def_feedback & 2);
ssid_as_path.set_active(def_feedback & 4);
heart_beat.set_active(def_feedback & 8);
master_fb.set_active(def_feedback & 16);
bar_and_beat.set_active(def_feedback & 32);
smpte.set_active(def_feedback & 64);
meter_float.set_active(def_feedback & 128);
meter_led.set_active(def_feedback & 256);
signal_present.set_active(def_feedback & 512);
hp_samples.set_active(def_feedback & 1024);
//hp_gui.set_active (false); // we don't have this yet (Mixbus wants)
select_fb.set_active(def_feedback & 8192);
calculate_strip_types ();
calculate_feedback ();
}
void
OSC_GUI::calculate_feedback ()
{
@ -660,8 +653,7 @@ OSC_GUI::calculate_feedback ()
void
OSC_GUI::push_feedback ()
{
feedback_spin.set_value (fbvalue);
feedback_changed ();
cp.set_defaultfeedback (fbvalue);
}
void
@ -705,6 +697,5 @@ OSC_GUI::calculate_strip_types ()
void
OSC_GUI::push_strip_types ()
{
striptypes_spin.set_value (stvalue);
strips_changed ();
cp.set_defaultstrip (stvalue);
}