FP8/16: include makeup gain control
[ardour.git] / libs / surfaces / faderport8 / gui.cc
index 8b8673bb3b17b707654bcee3c85987eafe676b68..3a537de028fffc01417ce6d51f0f6d196d1beb26 100644 (file)
@@ -20,6 +20,7 @@
 #include <gtkmm/alignment.h>
 #include <gtkmm/label.h>
 #include <gtkmm/liststore.h>
+#include <gtkmm/separator.h>
 
 #include "pbd/unwind.h"
 #include "pbd/strsplit.h"
 
 using namespace PBD;
 using namespace ARDOUR;
-using namespace ArdourSurface;
 using namespace std;
 using namespace Gtk;
 using namespace Gtkmm2ext;
+using namespace ArdourSurface::FP_NAMESPACE;
 
 void*
 FaderPort8::get_gui () const
@@ -81,6 +82,8 @@ FP8GUI::FP8GUI (FaderPort8& p)
        : fp (p)
        , table (2, 3)
        , ignore_active_change (false)
+       , two_line_text_cb (_("Two Line Trackname"))
+       , auto_pluginui_cb (_("Auto Show/Hide Plugin GUIs"))
 {
        set_border_width (12);
 
@@ -89,30 +92,59 @@ FP8GUI::FP8GUI (FaderPort8& p)
        table.set_border_width (12);
        table.set_homogeneous (false);
 
+       std::string data_file_path;
+#ifdef FADERPORT16
+       string name = "faderport16-small.png";
+#elif defined FADERPORT2
+       string name = "faderport2018-small.png";
+#else
+       string name = "faderport8-small.png";
+#endif
+       Searchpath spath(ARDOUR::ardour_data_search_path());
+       spath.add_subdirectory_to_paths ("icons");
+       find_file (spath, name, data_file_path);
+       if (!data_file_path.empty()) {
+               image.set (data_file_path);
+               hpacker.pack_start (image, false, false);
+       }
+
        Gtk::Label* l;
        int row = 0;
 
        input_combo.pack_start (midi_port_columns.short_name);
        output_combo.pack_start (midi_port_columns.short_name);
 
+       build_prefs_combos ();
+       update_prefs_combos ();
+
        input_combo.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FP8GUI::active_port_changed), &input_combo, true));
        output_combo.signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &FP8GUI::active_port_changed), &output_combo, false));
 
+       clock_combo.signal_changed().connect (sigc::mem_fun (*this, &FP8GUI::clock_mode_changed));
+       scribble_combo.signal_changed().connect (sigc::mem_fun (*this, &FP8GUI::scribble_mode_changed));
+       two_line_text_cb.signal_toggled().connect(sigc::mem_fun (*this, &FP8GUI::twolinetext_toggled));
+       auto_pluginui_cb.signal_toggled().connect(sigc::mem_fun (*this, &FP8GUI::auto_pluginui_toggled));
+
        l = manage (new Gtk::Label);
        l->set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Incoming MIDI on:")));
        l->set_alignment (1.0, 0.5);
-       table.attach (*l, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
-       table.attach (input_combo, 2, 6, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       table.attach (*l, 1, 4, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       table.attach (input_combo, 4, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
        row++;
 
        l = manage (new Gtk::Label);
        l->set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Outgoing MIDI on:")));
        l->set_alignment (1.0, 0.5);
-       table.attach (*l, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
-       table.attach (output_combo, 2, 6, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       table.attach (*l, 1, 4, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       table.attach (output_combo, 4, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
        row++;
 
-       pack_start (table);
+       Gtk::HSeparator *hsep = manage(new Gtk::HSeparator);
+       table.attach (*hsep, 0, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 6);
+       row++;
+
+       hpacker.pack_start (table, true, true);
+       pack_start (hpacker, false, false);
 
        /* actions */
        build_available_action_menu ();
@@ -128,18 +160,54 @@ FP8GUI::FP8GUI (FaderPort8& p)
                l = manage (new Gtk::Label);
                l->set_markup (string_compose ("<span weight=\"bold\">%1:</span>", i->second));
                l->set_alignment (1.0, 0.5);
-               table.attach (*l, 2 * action_col, 2 * action_col + 1, row + action_row, row + action_row + 1, AttachOptions(FILL|EXPAND), AttachOptions (0));
+               table.attach (*l, 3 * action_col, 3 * action_col + 1, row + action_row, row + action_row + 1, AttachOptions(FILL|EXPAND), AttachOptions (0));
                align = manage (new Alignment);
                align->set (0.0, 0.5);
                align->add (*user_combo);
-               table.attach (*align, 2 * action_col + 1, 2 * action_col + 2, row + action_row, row + action_row + 1, AttachOptions(FILL|EXPAND), AttachOptions (0));
-
-               if (++action_row == 4) {
+               table.attach (*align, 3 * action_col + 1, 3 * action_col + 2, row + action_row, row + action_row + 1, AttachOptions(FILL|EXPAND), AttachOptions (0));
+
+#ifdef FADERPORT2
+               if (++action_row == 2)
+#else
+               if (++action_row == 4)
+#endif
+               {
                        action_row = 0;
                        ++action_col;
                }
        }
 
+       for (int c = 0; c < 2; ++c) {
+               Gtk::VSeparator *vsep = manage(new Gtk::VSeparator);
+               table.attach (*vsep, 3 * c + 2, 3 * c + 3, row, row + 4, AttachOptions(0), AttachOptions(FILL), 6, 0);
+       }
+
+       row += 4;
+
+#ifndef FADERPORT2
+       hsep = manage(new Gtk::HSeparator);
+       table.attach (*hsep, 0, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 6);
+       row++;
+
+       l = manage (new Gtk::Label);
+       l->set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Clock:")));
+       l->set_alignment (1.0, 0.5);
+       table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       table.attach (clock_combo, 1, 4, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+
+       table.attach (two_line_text_cb, 4, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       row++;
+
+       l = manage (new Gtk::Label);
+       l->set_markup (string_compose ("<span weight=\"bold\">%1</span>", _("Display:")));
+       l->set_alignment (1.0, 0.5);
+       table.attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
+       table.attach (scribble_combo, 1, 4, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+
+       table.attach (auto_pluginui_cb, 4, 8, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
+       row++;
+#endif
+
        /* update the port connection combos */
        update_port_combos ();
 
@@ -422,3 +490,101 @@ FP8GUI::action_changed (Gtk::ComboBox* cb, FP8Controls::ButtonId id)
        string action_path = (*row)[action_columns.path];
        fp.set_button_action (id, false, action_path);
 }
+
+
+void
+FP8GUI::build_prefs_combos ()
+{
+       vector<string> clock_strings;
+       vector<string> scribble_strings;
+
+       //clock_strings.push_back (_("Off"));
+       clock_strings.push_back (_("Timecode"));
+       clock_strings.push_back (_("BBT"));
+       clock_strings.push_back (_("Timecode + BBT"));
+
+       scribble_strings.push_back (_("Off"));
+       scribble_strings.push_back (_("Meter"));
+       scribble_strings.push_back (_("Pan"));
+       scribble_strings.push_back (_("Meter + Pan"));
+
+       set_popdown_strings (clock_combo, clock_strings);
+       set_popdown_strings (scribble_combo, scribble_strings);
+}
+
+void
+FP8GUI::update_prefs_combos ()
+{
+       switch (fp.clock_mode()) {
+               default:
+                       clock_combo.set_active_text (_("Off"));
+                       break;
+               case 1:
+                       clock_combo.set_active_text (_("Timecode"));
+                       break;
+               case 2:
+                       clock_combo.set_active_text (_("BBT"));
+                       break;
+               case 3:
+                       clock_combo.set_active_text (_("Timecode + BBT"));
+                       break;
+       }
+
+       switch (fp.scribble_mode()) {
+               default:
+                       scribble_combo.set_active_text (_("Off"));
+                       break;
+               case 1:
+                       scribble_combo.set_active_text (_("Meter"));
+                       break;
+               case 2:
+                       scribble_combo.set_active_text (_("Pan"));
+                       break;
+               case 3:
+                       scribble_combo.set_active_text (_("Meter + Pan"));
+                       break;
+       }
+       two_line_text_cb.set_active (fp.twolinetext ());
+       auto_pluginui_cb.set_active (fp.auto_pluginui ());
+}
+
+void
+FP8GUI::clock_mode_changed ()
+{
+       string str = clock_combo.get_active_text();
+       if (str == _("BBT")) {
+               fp.set_clock_mode (2);
+       } else if (str == _("Timecode + BBT")) {
+               fp.set_clock_mode (3);
+       } else {
+               fp.set_clock_mode (1);
+       }
+}
+
+void
+FP8GUI::scribble_mode_changed ()
+{
+       string str = scribble_combo.get_active_text();
+       if (str == _("Off")) {
+               fp.set_scribble_mode (0);
+       } else if (str == _("Meter")) {
+               fp.set_scribble_mode (1);
+       } else if (str == _("Pan")) {
+               fp.set_scribble_mode (2);
+       } else {
+               fp.set_scribble_mode (3);
+       }
+}
+
+void
+FP8GUI::twolinetext_toggled ()
+{
+       fp.set_two_line_text (two_line_text_cb.get_active ());
+}
+
+
+void
+FP8GUI::auto_pluginui_toggled ()
+{
+       fp.set_auto_pluginui (auto_pluginui_cb.get_active ());
+}