f8268b9e35d645c823f7e485f12e096ba7e39583
[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
20 #include <gtkmm/comboboxtext.h>
21 #include <gtkmm/box.h>
22 #include <gtkmm/spinbutton.h>
23 #include <gtkmm/table.h>
24 #include <gtkmm/treeview.h>
25 #include <gtkmm/liststore.h>
26 #include <gtkmm/notebook.h>
27 #include <gtkmm/scrolledwindow.h>
28
29 namespace Gtk {
30         class CellRendererCombo;
31 }
32
33 class MackieControlProtocol;
34
35 #include "button.h"
36
37 #include "i18n.h"
38
39 class MackieControlProtocolGUI : public Gtk::Notebook
40 {
41   public:
42         MackieControlProtocolGUI (MackieControlProtocol &);
43         
44   private:
45     MackieControlProtocol& _cp;
46     Gtk::ComboBoxText _surface_combo;
47     Gtk::ComboBoxText _profile_combo;
48
49     struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord {
50             AvailableActionColumns() {
51                     add (name);
52                     add (path);
53             }
54             Gtk::TreeModelColumn<std::string> name;
55             Gtk::TreeModelColumn<std::string> path;
56     };
57     
58     struct FunctionKeyColumns : public Gtk::TreeModel::ColumnRecord {
59         FunctionKeyColumns() {
60                 add (name);
61                 add (id);
62                 add (plain);
63                 add (shift);
64                 add (control);
65                 add (option);
66                 add (cmdalt);
67                 add (shiftcontrol);
68         };
69         Gtk::TreeModelColumn<std::string> name;
70         Gtk::TreeModelColumn<Mackie::Button::ID>  id;
71         Gtk::TreeModelColumn<std::string> plain;
72         Gtk::TreeModelColumn<std::string> shift;
73         Gtk::TreeModelColumn<std::string> control;
74         Gtk::TreeModelColumn<std::string> option;
75         Gtk::TreeModelColumn<std::string> cmdalt;
76         Gtk::TreeModelColumn<std::string> shiftcontrol;
77     };
78
79     AvailableActionColumns available_action_columns;
80     FunctionKeyColumns function_key_columns;
81
82     Gtk::ScrolledWindow function_key_scroller;
83     Gtk::TreeView function_key_editor;
84     Glib::RefPtr<Gtk::ListStore> function_key_model;
85     Glib::RefPtr<Gtk::TreeStore> available_action_model;
86
87     void build_available_action_menu ();
88     void refresh_function_key_editor ();
89     void build_function_key_editor ();
90     void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase);
91     Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr<Gtk::TreeStore> model, Gtk::TreeModelColumnBase);
92
93     void surface_combo_changed ();
94     void profile_combo_changed ();
95
96     std::map<std::string,std::string> action_map; // map from action names to paths
97
98     Gtk::CheckButton relay_click_button;
99     Gtk::CheckButton backlight_button;
100     Gtk::RadioButton absolute_touch_mode_button;
101     Gtk::RadioButton touch_move_mode_button;
102     Gtk::Adjustment  touch_sensitivity_adjustment;
103     Gtk::HScale      touch_sensitivity_scale;
104     Gtk::Button      recalibrate_fader_button;
105     Gtk::Adjustment  ipmidi_base_port_adjustment;
106     Gtk::SpinButton  ipmidi_base_port_spinner;
107 };
108