OSC: /cue/previous_aux should always refresh
[ardour.git] / libs / surfaces / osc / osc_gui.cc
index 9fe6b6e798c69cc410e96a789ce4785f51b5396d..e1ae8bdea5d0eaf05548c78d3fb8e66839b1a007 100644 (file)
@@ -22,7 +22,6 @@
 #include <list>
 #include <string>
 #include <vector>
-//#include <glibmm/miscutils.h>
 
 #include <errno.h>
 
@@ -33,6 +32,7 @@
 #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"
@@ -90,6 +90,8 @@ OSC_GUI::OSC_GUI (OSC& p)
        label->set_alignment(1, .5);
        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);
@@ -101,7 +103,9 @@ OSC_GUI::OSC_GUI (OSC& p)
        label->set_alignment(1, .5);
        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_text (string_compose ("%1", cp.get_banksize()).c_str());
+       bank_entry.set_range (0, 0xffff);
+       bank_entry.set_increments (1, 8);
+       bank_entry.set_value (cp.get_banksize());
 
        ++n;
 
@@ -110,7 +114,9 @@ OSC_GUI::OSC_GUI (OSC& p)
        label->set_alignment(1, .5);
        table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
        table->attach (send_page_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
-       send_page_entry.set_text (string_compose ("%1", cp.get_send_size()).c_str());
+       send_page_entry.set_range (0, 0xffff);
+       send_page_entry.set_increments (1, 8);
+       send_page_entry.set_value (cp.get_send_size());
 
        ++n;
 
@@ -119,7 +125,9 @@ OSC_GUI::OSC_GUI (OSC& p)
        label->set_alignment(1, .5);
        table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
        table->attach (plugin_page_entry, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
-       plugin_page_entry.set_text (string_compose ("%1", cp.get_plugin_size()).c_str());
+       plugin_page_entry.set_range (0, 0xffff);
+       plugin_page_entry.set_increments (1, 8);
+       plugin_page_entry.set_value (cp.get_send_size());
 
        ++n;
 
@@ -264,6 +272,12 @@ OSC_GUI::OSC_GUI (OSC& p)
        sttable->attach (hidden_tracks, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
        ++stn;
 
+       label = manage (new Gtk::Label(_("Use Groups:")));
+       label->set_alignment(1, .5);
+       sttable->attach (*label, 0, 1, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       sttable->attach (usegroups, 1, 2, stn, stn+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       ++stn;
+
 
        sttable->show_all ();
        append_page (*sttable, _("Default Strip Types"));
@@ -394,6 +408,7 @@ OSC_GUI::OSC_GUI (OSC& p)
        monitor_type.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        selected_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        hidden_tracks.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
+       usegroups.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        strip_buttons_button.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        strip_control_button.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
        ssid_as_path.signal_clicked().connect (sigc::mem_fun (*this, &OSC_GUI::set_bitsets));
@@ -503,15 +518,13 @@ void
 OSC_GUI::port_changed ()
 {
        std::string str = port_entry.get_text ();
-       uint32_t prt = atoi (str.c_str());
-       if (str == "3819" || prt < 1024) {
-
+       int prt = atoi (str.c_str());
+       if (prt == 3819 || prt < 1024) {
+               // indicate non-valid text
                port_entry.set_progress_fraction (1.0);
-               //str = "8000";
        } else {
-
                port_entry.set_progress_fraction (0.0);
-               cp.set_remote_port (str);
+               cp.set_remote_port (string_compose ("%1", prt));
                save_user ();
        }
 }
@@ -520,10 +533,9 @@ bool
 OSC_GUI::port_focus_out (GdkEventFocus* )
 {
        std::string str = port_entry.get_text ();
-       uint32_t prt = atoi (str.c_str());
-       if (str == "3819" || prt < 1024) {
+       int prt = atoi (str.c_str());
+       if (prt == 3819 || prt < 1024) {
                port_entry.set_text(cp.get_remote_port().c_str());
-
                port_entry.set_progress_fraction (0.0);
        }
        return false;
@@ -617,8 +629,8 @@ OSC_GUI::factory_reset ()
        reshow_values ();
        cp.set_gainmode (0);
        gainmode_combo.set_active (0);
-       cp.set_portmode (0);
-       portmode_combo.set_active (0);
+       cp.set_portmode (1);
+       portmode_combo.set_active (1);
        cp.set_remote_port ("8000");
        port_entry.set_text ("8000");
        cp.clear_devices ();
@@ -639,6 +651,7 @@ OSC_GUI::reshow_values ()
        audio_auxes.set_active(def_strip & 128);
        selected_tracks.set_active(def_strip & 256);
        hidden_tracks.set_active(def_strip & 512);
+       usegroups.set_active(def_strip & 1024);
        def_feedback = cp.get_defaultfeedback();
        strip_buttons_button.set_active(def_feedback & 1);
        strip_control_button.set_active(def_feedback & 2);
@@ -747,6 +760,9 @@ OSC_GUI::calculate_strip_types ()
        if (hidden_tracks.get_active()) {
                stvalue += 512;
        }
+       if (usegroups.get_active()) {
+               stvalue += 1024;
+       }
 
        current_strip_types.set_text(string_compose("%1", stvalue));
 }
@@ -964,6 +980,7 @@ OSC_GUI::load_preset (std::string preset)
                        gainmode_combo.set_active (atoi (prop->value().c_str()));
                }
                cp.gui_changed();
+               clear_device ();
 
        }
 }