NO-OP: whitespac
[ardour.git] / libs / surfaces / cc121 / gui.h
1 /*
2     Copyright (C) 2015 Paul Davis
3     Copyright (C) 2016 W.P. van Paassen
4
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.
9
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.
14
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.
18
19 */
20
21 #ifndef __ardour_cc121_gui_h__
22 #define __ardour_cc121_gui_h__
23
24 #include <vector>
25 #include <string>
26
27 #include <gtkmm/box.h>
28 #include <gtkmm/combobox.h>
29 #include <gtkmm/image.h>
30 #include <gtkmm/table.h>
31 #include <gtkmm/treestore.h>
32
33 namespace Gtk {
34         class CellRendererCombo;
35         class ListStore;
36 }
37
38 #include "cc121.h"
39
40 namespace ArdourSurface {
41
42 class CC121GUI : public Gtk::VBox
43 {
44 public:
45         CC121GUI (CC121&);
46         ~CC121GUI ();
47
48 private:
49         CC121& fp;
50         Gtk::HBox hpacker;
51         Gtk::Table table;
52         Gtk::Table action_table;
53         Gtk::ComboBox input_combo;
54         Gtk::ComboBox output_combo;
55         Gtk::Image    image;
56
57         Gtk::ComboBox foot_combo;
58         Gtk::ComboBox function1_combo;
59         Gtk::ComboBox function2_combo;
60         Gtk::ComboBox function3_combo;
61         Gtk::ComboBox function4_combo;
62         Gtk::ComboBox value_combo;
63         Gtk::ComboBox lock_combo;
64         Gtk::ComboBox eq1_combo;
65         Gtk::ComboBox eq2_combo;
66         Gtk::ComboBox eq3_combo;
67         Gtk::ComboBox eq4_combo;
68         Gtk::ComboBox eqtype_combo;
69         Gtk::ComboBox allbypass_combo;
70
71         void update_port_combos ();
72         PBD::ScopedConnection connection_change_connection;
73         void connection_handler ();
74
75         struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
76                 MidiPortColumns() {
77                         add (short_name);
78                         add (full_name);
79                 }
80                 Gtk::TreeModelColumn<std::string> short_name;
81                 Gtk::TreeModelColumn<std::string> full_name;
82         };
83
84         MidiPortColumns midi_port_columns;
85         bool ignore_active_change;
86
87         Glib::RefPtr<Gtk::ListStore> build_midi_port_list (std::vector<std::string> const & ports, bool for_input);
88         void active_port_changed (Gtk::ComboBox*,bool for_input);
89
90         struct ActionColumns : public Gtk::TreeModel::ColumnRecord {
91                 ActionColumns() {
92                         add (name);
93                         add (path);
94                 }
95                 Gtk::TreeModelColumn<std::string> name;
96                 Gtk::TreeModelColumn<std::string> path;
97         };
98
99         ActionColumns action_columns;
100         Glib::RefPtr<Gtk::TreeStore> available_action_model;
101         std::map<std::string,std::string> action_map; // map from action names to paths
102
103         void build_action_combo (Gtk::ComboBox& cb, std::vector<std::pair<std::string,std::string> > const & actions, CC121::ButtonID, CC121::ButtonState);
104         void build_user_action_combo (Gtk::ComboBox&, CC121::ButtonState, CC121::ButtonID);
105         void build_foot_action_combo (Gtk::ComboBox&, CC121::ButtonState);
106
107         void build_available_action_menu ();
108         void action_changed (Gtk::ComboBox*, CC121::ButtonID, CC121::ButtonState);
109
110         bool find_action_in_model (const Gtk::TreeModel::iterator& iter, std::string const & action_path, Gtk::TreeModel::iterator* found);
111
112 };
113
114 }
115
116 #endif /* __ardour_cc121_gui_h__ */