make a start on providing direct choice of MIDI ports where an MCP device can be...
[ardour.git] / libs / surfaces / mackie / gui.h
1 /*
2   Copyright (C) 2010-2012 Paul Davis
3   
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.
8   
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.
13   
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.
17 */
18
19 #include <gtkmm/comboboxtext.h>
20 #include <gtkmm/box.h>
21 #include <gtkmm/spinbutton.h>
22 #include <gtkmm/table.h>
23 #include <gtkmm/treeview.h>
24 #include <gtkmm/liststore.h>
25 #include <gtkmm/notebook.h>
26 #include <gtkmm/scrolledwindow.h>
27
28 namespace Gtk {
29 class CellRendererCombo;
30 }
31
32 #include "button.h"
33
34 #include "i18n.h"
35
36 namespace ArdourSurface {
37
38 class MackieControlProtocol;
39
40 class MackieControlProtocolGUI : public Gtk::Notebook
41 {
42    public:
43         MackieControlProtocolGUI (MackieControlProtocol &);
44         
45    private:
46         MackieControlProtocol& _cp;
47         Gtk::ComboBoxText _surface_combo;
48         Gtk::ComboBoxText _profile_combo;
49         Gtk::ComboBoxText _input_port_combo;
50         Gtk::ComboBoxText _output_port_combo;
51         
52         struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord {
53                 AvailableActionColumns() {
54                         add (name);
55                         add (path);
56                 }
57                 Gtk::TreeModelColumn<std::string> name;
58                 Gtk::TreeModelColumn<std::string> path;
59         };
60     
61         struct FunctionKeyColumns : public Gtk::TreeModel::ColumnRecord {
62                 FunctionKeyColumns() {
63                         add (name);
64                         add (id);
65                         add (plain);
66                         add (shift);
67                         add (control);
68                         add (option);
69                         add (cmdalt);
70                         add (shiftcontrol);
71                 };
72                 Gtk::TreeModelColumn<std::string> name;
73                 Gtk::TreeModelColumn<Mackie::Button::ID>  id;
74                 Gtk::TreeModelColumn<std::string> plain;
75                 Gtk::TreeModelColumn<std::string> shift;
76                 Gtk::TreeModelColumn<std::string> control;
77                 Gtk::TreeModelColumn<std::string> option;
78                 Gtk::TreeModelColumn<std::string> cmdalt;
79                 Gtk::TreeModelColumn<std::string> shiftcontrol;
80         };
81
82         AvailableActionColumns available_action_columns;
83         FunctionKeyColumns function_key_columns;
84
85         Gtk::ScrolledWindow function_key_scroller;
86         Gtk::TreeView function_key_editor;
87         Glib::RefPtr<Gtk::ListStore> function_key_model;
88         Glib::RefPtr<Gtk::TreeStore> available_action_model;
89
90         void build_available_action_menu ();
91         void refresh_function_key_editor ();
92         void build_function_key_editor ();
93         void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase);
94         Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr<Gtk::TreeStore> model, Gtk::TreeModelColumnBase);
95
96         void surface_combo_changed ();
97         void profile_combo_changed ();
98         void ipmidi_spinner_changed ();
99
100         std::map<std::string,std::string> action_map; // map from action names to paths
101
102         Gtk::CheckButton relay_click_button;
103         Gtk::CheckButton backlight_button;
104         Gtk::RadioButton absolute_touch_mode_button;
105         Gtk::RadioButton touch_move_mode_button;
106         Gtk::Adjustment  touch_sensitivity_adjustment;
107         Gtk::HScale      touch_sensitivity_scale;
108         Gtk::Button      recalibrate_fader_button;
109         Gtk::Adjustment  ipmidi_base_port_adjustment;
110         Gtk::SpinButton  ipmidi_base_port_spinner;
111         Gtk::Button      discover_button;
112
113         void discover_clicked ();
114         void recalibrate_faders ();
115         void toggle_backlight ();
116         void touch_sensitive_change ();
117 };
118
119 }
120