2 Copyright (C) 2009-2012 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <gtkmm/comboboxtext.h>
25 #include <gtkmm/label.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/adjustment.h>
28 #include <gtkmm/spinbutton.h>
29 #include <gtkmm/table.h>
31 #include "gtkmm2ext/gtk_ui.h"
32 #include "gtkmm2ext/utils.h"
34 #include "faderport.h"
38 namespace ArdourSurface {
40 class GMCPGUI : public Gtk::VBox
48 Gtk::ComboBoxText map_combo;
49 Gtk::Adjustment bank_adjustment;
50 Gtk::SpinButton bank_spinner;
51 Gtk::CheckButton motorised_button;
52 Gtk::Adjustment threshold_adjustment;
53 Gtk::SpinButton threshold_spinner;
55 void binding_changed ();
57 void motorised_changed ();
58 void threshold_changed ();
64 using namespace ARDOUR;
65 using namespace ArdourSurface;
68 using namespace Gtkmm2ext;
71 FaderPort::get_gui () const
74 const_cast<FaderPort*>(this)->build_gui ();
76 static_cast<Gtk::VBox*>(gui)->show_all();
81 FaderPort::tear_down_gui ()
84 Gtk::Widget *w = static_cast<Gtk::VBox*>(gui)->get_parent();
90 delete (GMCPGUI*) gui;
95 FaderPort::build_gui ()
97 gui = (void*) new GMCPGUI (*this);
100 /*--------------------*/
102 GMCPGUI::GMCPGUI (FaderPort& p)
104 , bank_adjustment (1, 1, 100, 1, 10)
105 , bank_spinner (bank_adjustment)
106 , motorised_button ("Motorised")
107 , threshold_adjustment (p.threshold(), 1, 127, 1, 10)
108 , threshold_spinner (threshold_adjustment)
117 GMCPGUI::bank_changed ()
119 // int new_bank = bank_adjustment.get_value() - 1;
120 // cp.set_current_bank (new_bank);
124 GMCPGUI::binding_changed ()
129 GMCPGUI::motorised_changed ()
131 // cp.set_motorised (motorised_button.get_active ());
135 GMCPGUI::threshold_changed ()
137 // cp.set_threshold (threshold_adjustment.get_value());