OSC: Add master_send_enable for MB
[ardour.git] / libs / surfaces / osc / osc_gui.h
1 /*
2     Copyright (C) 2016 Robin Gareus <robin@gareus.org
3     Copyright (C) 2009-2012 Paul Davis
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 #ifndef osc_gui_h
21 #define osc_gui_h
22
23
24 #include "osc.h"
25
26 #include "pbd/i18n.h"
27
28 // preset stuff
29 static const char* const preset_dir_name = "osc";
30 static const char* const preset_suffix = ".preset";
31 static const char * const preset_env_variable_name = "ARDOUR_OSC_PATH";
32
33 namespace ArdourSurface {
34
35 class OSC_GUI : public Gtk::Notebook
36 {
37 public:
38         OSC_GUI (OSC&);
39         ~OSC_GUI ();
40
41
42 private:
43         // settings page
44         Gtk::ComboBoxText debug_combo;
45         Gtk::ComboBoxText portmode_combo;
46         Gtk::SpinButton port_entry;
47         Gtk::SpinButton bank_entry;
48         Gtk::SpinButton send_page_entry;
49         Gtk::SpinButton plugin_page_entry;
50         Gtk::ComboBoxText gainmode_combo;
51         Gtk::ComboBoxText preset_combo;
52         std::vector<std::string> preset_options;
53         std::map<std::string,std::string> preset_files;
54         bool preset_busy;
55         void get_session ();
56         void restore_sesn_values ();
57         uint32_t sesn_portmode;
58         std::string sesn_port;
59         uint32_t sesn_bank;
60         uint32_t sesn_send;
61         uint32_t sesn_plugin;
62         uint32_t sesn_strips;
63         uint32_t sesn_feedback;
64         uint32_t sesn_gainmode;
65         void save_user ();
66         void scan_preset_files ();
67         void load_preset (std::string preset);
68
69         void debug_changed ();
70         void portmode_changed ();
71         void gainmode_changed ();
72         void clear_device ();
73         void factory_reset ();
74         void reshow_values ();
75         void port_changed ();
76         void bank_changed ();
77         void send_page_changed ();
78         void plugin_page_changed ();
79         void strips_changed ();
80         void feedback_changed ();
81         void preset_changed ();
82         // Strip types calculator
83         uint32_t def_strip;
84         void calculate_strip_types ();
85         Gtk::Label current_strip_types;
86         Gtk::CheckButton audio_tracks;
87         Gtk::CheckButton midi_tracks;
88         Gtk::CheckButton audio_buses;
89         Gtk::CheckButton audio_auxes;
90         Gtk::CheckButton midi_buses;
91         Gtk::CheckButton control_masters;
92         Gtk::CheckButton master_type;
93         Gtk::CheckButton monitor_type;
94         Gtk::CheckButton selected_tracks;
95         Gtk::CheckButton hidden_tracks;
96         int stvalue;
97         // feedback calculator
98         uint32_t def_feedback;
99         void calculate_feedback ();
100         Gtk::Label current_feedback;
101         Gtk::CheckButton strip_buttons_button;
102         Gtk::CheckButton strip_control_button;
103         Gtk::CheckButton ssid_as_path;
104         Gtk::CheckButton heart_beat;
105         Gtk::CheckButton master_fb;
106         Gtk::CheckButton bar_and_beat;
107         Gtk::CheckButton smpte;
108         Gtk::CheckButton meter_float;
109         Gtk::CheckButton meter_led;
110         Gtk::CheckButton signal_present;
111         Gtk::CheckButton hp_samples;
112         Gtk::CheckButton hp_min_sec;
113         Gtk::CheckButton hp_gui;
114         Gtk::CheckButton select_fb;
115         Gtk::CheckButton use_osc10;
116         int fbvalue;
117         void set_bitsets ();
118
119
120
121         OSC& cp;
122 };
123
124
125 void*
126 OSC::get_gui () const
127 {
128         if (!gui) {
129                 const_cast<OSC*>(this)->build_gui ();
130         }
131         //static_cast<Gtk::VBox*>(gui)->show_all();
132         static_cast<Gtk::Notebook*>(gui)->show_all();
133         return gui;
134 }
135
136 void
137 OSC::tear_down_gui ()
138 {
139         if (gui) {
140                 Gtk::Widget *w = static_cast<Gtk::Notebook*>(gui)->get_parent();
141                 if (w) {
142                         w->hide();
143                         delete w;
144                 }
145         }
146         delete (OSC_GUI*) gui;
147         gui = 0;
148 }
149
150 void
151 OSC::build_gui ()
152 {
153         gui = (void*) new OSC_GUI (*this);
154 }
155
156 } // end namespace
157
158 #endif // osc_gui_h