Consistent use of abort() /* NOTREACHED */
[ardour.git] / libs / surfaces / push2 / gui.h
1 /*
2  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #ifndef __ardour_push2_gui_h__
20 #define __ardour_push2_gui_h__
21
22 #include <vector>
23 #include <string>
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/button.h>
27 #include <gtkmm/combobox.h>
28 #include <gtkmm/image.h>
29 #include <gtkmm/table.h>
30 #include <gtkmm/treestore.h>
31 #include <gtkmm/spinbutton.h>
32 #include <gtkmm/notebook.h>
33
34 namespace Gtk {
35         class CellRendererCombo;
36         class ListStore;
37 }
38
39 #include "ardour/mode.h"
40
41 #include "push2.h"
42
43 namespace ArdourSurface {
44
45 class P2GUI : public Gtk::VBox
46 {
47 public:
48         P2GUI (Push2&);
49         ~P2GUI ();
50
51 private:
52         Push2& p2;
53         PBD::ScopedConnectionList p2_connections;
54         Gtk::HBox hpacker;
55         Gtk::Table table;
56         Gtk::Table action_table;
57         Gtk::ComboBox input_combo;
58         Gtk::ComboBox output_combo;
59         Gtk::Image    image;
60
61         void update_port_combos ();
62         PBD::ScopedConnection connection_change_connection;
63         void connection_handler ();
64         PBD::ScopedConnection port_reg_connection;
65
66         struct MidiPortColumns : public Gtk::TreeModel::ColumnRecord {
67                 MidiPortColumns() {
68                         add (short_name);
69                         add (full_name);
70                 }
71                 Gtk::TreeModelColumn<std::string> short_name;
72                 Gtk::TreeModelColumn<std::string> full_name;
73         };
74
75         MidiPortColumns midi_port_columns;
76         bool ignore_active_change;
77
78         Glib::RefPtr<Gtk::ListStore> build_midi_port_list (std::vector<std::string> const & ports, bool for_input);
79         void active_port_changed (Gtk::ComboBox*,bool for_input);
80
81         struct ActionColumns : public Gtk::TreeModel::ColumnRecord {
82                 ActionColumns() {
83                         add (name);
84                         add (path);
85                 }
86                 Gtk::TreeModelColumn<std::string> name;
87                 Gtk::TreeModelColumn<std::string> path;
88         };
89
90         ActionColumns action_columns;
91         Glib::RefPtr<Gtk::TreeStore> available_action_model;
92         std::map<std::string,std::string> action_map; // map from action names to paths
93
94         struct PressureModeColumns : public Gtk::TreeModel::ColumnRecord {
95                 PressureModeColumns() {
96                         add (mode);
97                         add (name);
98                 }
99                 Gtk::TreeModelColumn<Push2::PressureMode>  mode;
100                 Gtk::TreeModelColumn<std::string> name;
101         };
102         PressureModeColumns pressure_mode_columns;
103         Glib::RefPtr<Gtk::ListStore> build_pressure_mode_columns ();
104         Gtk::ComboBox pressure_mode_selector;
105         Gtk::Label pressure_mode_label;
106
107         void reprogram_pressure_mode ();
108 };
109
110 }
111
112 #endif /* __ardour_push2_gui_h__ */