2 Copyright (C) 2016 Robin Gareus <robin@gareus.org
3 Copyright (C) 2009-2012 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <gtkmm/box.h>
26 #include <gtkmm/table.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/comboboxtext.h>
30 #include "gtkmm2ext/gtk_ui.h"
31 #include "gtkmm2ext/gui_thread.h"
32 #include "gtkmm2ext/utils.h"
38 namespace ArdourSurface {
40 class OSC_GUI : public Gtk::VBox
47 Gtk::ComboBoxText debug_combo;
48 void debug_changed ();
58 const_cast<OSC*>(this)->build_gui ();
60 static_cast<Gtk::VBox*>(gui)->show_all();
68 Gtk::Widget *w = static_cast<Gtk::VBox*>(gui)->get_parent();
74 delete (OSC_GUI*) gui;
81 gui = (void*) new OSC_GUI (*this);
86 ///////////////////////////////////////////////////////////////////////////////
90 using namespace Gtkmm2ext;
91 using namespace ArdourSurface;
93 OSC_GUI::OSC_GUI (OSC& p)
96 int n = 0; // table row
97 Table* table = manage (new Table);
100 label = manage (new Gtk::Label(_("Connection:")));
101 table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
102 label = manage (new Gtk::Label(cp.get_server_url()));
103 table->attach (*label, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
106 label = manage (new Gtk::Label(_("Debug:")));
107 table->attach (*label, 0, 1, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0));
108 table->attach (debug_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
110 std::vector<std::string> debug_options;
111 debug_options.push_back (_("Off"));
112 debug_options.push_back (_("Log invalid messages"));
113 debug_options.push_back (_("Log all messages"));
115 set_popdown_strings (debug_combo, debug_options);
116 debug_combo.set_active ((int)cp.get_debug_mode());
119 pack_start (*table, false, false);
121 debug_combo.signal_changed().connect (sigc::mem_fun (*this, &OSC_GUI::debug_changed));
129 OSC_GUI::debug_changed ()
131 std::string str = debug_combo.get_active_text ();
132 if (str == _("Off")) {
133 cp.set_debug_mode (OSC::Off);
135 else if (str == _("Log invalid messages")) {
136 cp.set_debug_mode (OSC::Unhandled);
138 else if (str == _("Log all messages")) {
139 cp.set_debug_mode (OSC::All);
142 std::cerr << "Invalid OSC Debug Mode\n";