MCP: catch noteOff to see note-on+velocity=zero messages; more GUI tweaks
[ardour.git] / libs / surfaces / mackie / gui.h
1 /*
2         Copyright (C) 2010 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 "i18n.h"
36
37 class MackieControlProtocolGUI : public Gtk::Notebook
38 {
39   public:
40     MackieControlProtocolGUI (MackieControlProtocol &);
41     
42   private:
43     void surface_combo_changed ();
44     
45     MackieControlProtocol& _cp;
46     Gtk::ComboBoxText _surface_combo;
47
48     struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord {
49             AvailableActionColumns() {
50                     add (name);
51                     add (path);
52             }
53             Gtk::TreeModelColumn<std::string> name;
54             Gtk::TreeModelColumn<std::string> path;
55     };
56     
57     struct FunctionKeyColumns : public Gtk::TreeModel::ColumnRecord {
58         FunctionKeyColumns() {
59                 add (name);
60                 add (number);
61                 add (plain);
62                 add (shift);
63                 add (control);
64                 add (option);
65                 add (cmdalt);
66                 add (shiftcontrol);
67         };
68         Gtk::TreeModelColumn<std::string> name;
69         Gtk::TreeModelColumn<uint32_t>    number;
70         Gtk::TreeModelColumn<std::string> plain;
71         Gtk::TreeModelColumn<std::string> shift;
72         Gtk::TreeModelColumn<std::string> control;
73         Gtk::TreeModelColumn<std::string> option;
74         Gtk::TreeModelColumn<std::string> cmdalt;
75         Gtk::TreeModelColumn<std::string> shiftcontrol;
76     };
77
78     AvailableActionColumns available_action_columns;
79     FunctionKeyColumns function_key_columns;
80
81     Gtk::ScrolledWindow function_key_scroller;
82     Gtk::TreeView function_key_editor;
83     Glib::RefPtr<Gtk::ListStore> function_key_model;
84     Glib::RefPtr<Gtk::TreeStore> available_action_model;
85
86     void rebuild_function_key_editor ();
87     void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase);
88     Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr<Gtk::TreeStore> model, Gtk::TreeModelColumnBase);
89 };
90