Ardour  9.0-pre0-380-gbbdb6b0e63
osc_gui.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Len Ovens <len@ovenwerks.net>
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 #ifndef osc_gui_h
19 #define osc_gui_h
20 
21 #include <gtkmm/comboboxtext.h>
22 #include <gtkmm/label.h>
23 #include <gtkmm/notebook.h>
24 #include <gtkmm/spinbutton.h>
25 
26 #include "osc.h"
27 
28 #include "pbd/i18n.h"
29 
30 // preset stuff
31 static const char* const preset_dir_name = "osc";
32 static const char* const preset_suffix = ".preset";
33 static const char * const preset_env_variable_name = "ARDOUR_OSC_PATH";
34 
35 namespace ArdourSurface {
36 
37 class OSC_GUI : public Gtk::Notebook
38 {
39 public:
42 
43 
44 private:
45  // settings page
54  std::vector<std::string> preset_options;
55  std::map<std::string,std::string> preset_files;
57  void get_session ();
59  uint32_t sesn_portmode;
60  std::string sesn_port;
61  uint32_t sesn_bank;
62  uint32_t sesn_send;
63  uint32_t sesn_plugin;
64  uint32_t sesn_strips;
65  uint32_t sesn_feedback;
66  uint32_t sesn_gainmode;
67  void save_user ();
69  void load_preset (std::string preset);
70 
71  void debug_changed ();
74  void clear_device ();
75  void factory_reset ();
76  void reshow_values ();
77  void port_changed ();
79  void bank_changed ();
82  void strips_changed ();
84  void preset_changed ();
85  // Strip types calculator
86  uint32_t def_strip;
100  int stvalue;
101  // feedback calculator
102  uint32_t def_feedback;
122  int fbvalue;
123  void set_bitsets ();
124 
125 
126 
127  OSC& cp;
128 };
129 
130 
131 void*
132 OSC::get_gui () const
133 {
134  if (!gui) {
135  const_cast<OSC*>(this)->build_gui ();
136  }
137  static_cast<Gtk::Notebook*>(gui)->show_all();
138  return gui;
139 }
140 
141 void
143 {
144  if (gui) {
145  Gtk::Widget *w = static_cast<Gtk::Notebook*>(gui)->get_parent();
146  if (w) {
147  w->hide();
148  delete w;
149  }
150  }
151  delete (OSC_GUI*) gui;
152  gui = 0;
153 }
154 
155 void
157 {
158  gui = (void*) new OSC_GUI (*this);
159 }
160 
161 } // end namespace
162 
163 #endif // osc_gui_h
Gtk::CheckButton signal_present
Definition: osc_gui.h:114
uint32_t sesn_plugin
Definition: osc_gui.h:63
Gtk::CheckButton selected_tracks
Definition: osc_gui.h:97
Gtk::CheckButton select_fb
Definition: osc_gui.h:118
Gtk::ComboBoxText debug_combo
Definition: osc_gui.h:46
Gtk::CheckButton hp_min_sec
Definition: osc_gui.h:116
Gtk::CheckButton master_type
Definition: osc_gui.h:95
Gtk::CheckButton usegroups
Definition: osc_gui.h:99
Gtk::CheckButton heart_beat
Definition: osc_gui.h:108
Gtk::CheckButton scene_status
Definition: osc_gui.h:121
Gtk::CheckButton meter_float
Definition: osc_gui.h:112
uint32_t def_feedback
Definition: osc_gui.h:102
Gtk::CheckButton smpte
Definition: osc_gui.h:111
Gtk::SpinButton plugin_page_entry
Definition: osc_gui.h:51
Gtk::CheckButton foldback_busses
Definition: osc_gui.h:92
Gtk::CheckButton monitor_type
Definition: osc_gui.h:96
uint32_t sesn_bank
Definition: osc_gui.h:61
Gtk::CheckButton hidden_tracks
Definition: osc_gui.h:98
Gtk::Label current_strip_types
Definition: osc_gui.h:88
Gtk::CheckButton midi_tracks
Definition: osc_gui.h:90
Gtk::ComboBoxText gainmode_combo
Definition: osc_gui.h:52
std::vector< std::string > preset_options
Definition: osc_gui.h:54
Gtk::CheckButton hp_gui
Definition: osc_gui.h:117
uint32_t sesn_send
Definition: osc_gui.h:62
Gtk::CheckButton strip_buttons_button
Definition: osc_gui.h:105
Gtk::SpinButton send_page_entry
Definition: osc_gui.h:50
Gtk::CheckButton audio_tracks
Definition: osc_gui.h:89
uint32_t sesn_portmode
Definition: osc_gui.h:59
Gtk::CheckButton bar_and_beat
Definition: osc_gui.h:110
std::map< std::string, std::string > preset_files
Definition: osc_gui.h:55
Gtk::CheckButton ssid_as_path
Definition: osc_gui.h:107
uint32_t sesn_feedback
Definition: osc_gui.h:65
Gtk::CheckButton use_osc10
Definition: osc_gui.h:119
Gtk::CheckButton master_fb
Definition: osc_gui.h:109
Gtk::SpinButton bank_entry
Definition: osc_gui.h:49
Gtk::CheckButton strip_control_button
Definition: osc_gui.h:106
Gtk::CheckButton midi_buses
Definition: osc_gui.h:93
Gtk::Label current_feedback
Definition: osc_gui.h:104
uint32_t def_strip
Definition: osc_gui.h:86
uint32_t sesn_gainmode
Definition: osc_gui.h:66
Gtk::ComboBoxText portmode_combo
Definition: osc_gui.h:47
Gtk::ComboBoxText preset_combo
Definition: osc_gui.h:53
uint32_t sesn_strips
Definition: osc_gui.h:64
Gtk::CheckButton meter_led
Definition: osc_gui.h:113
void load_preset(std::string preset)
Gtk::CheckButton control_masters
Definition: osc_gui.h:94
Gtk::CheckButton hp_samples
Definition: osc_gui.h:115
Gtk::SpinButton port_entry
Definition: osc_gui.h:48
Gtk::CheckButton audio_buses
Definition: osc_gui.h:91
bool port_focus_out(GdkEventFocus *)
Gtk::CheckButton trigger_status
Definition: osc_gui.h:120
std::string sesn_port
Definition: osc_gui.h:60
void build_gui()
Definition: osc_gui.h:156
void tear_down_gui()
Definition: osc_gui.h:142
void * get_gui() const
Definition: osc_gui.h:132
void * gui
Definition: osc.h:772
static const char *const preset_env_variable_name
Definition: osc_gui.h:33
static const char *const preset_dir_name
Definition: osc_gui.h:31
static const char *const preset_suffix
Definition: osc_gui.h:32