summaryrefslogtreecommitdiff
path: root/libs/surfaces/osc/osc_gui.h
blob: e0c71b83d1fe427d947754b7ee7c06241fcb48cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
    Copyright (C) 2016 Robin Gareus <robin@gareus.org
    Copyright (C) 2009-2012 Paul Davis

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/
#ifndef osc_gui_h
#define osc_gui_h


#include "osc.h"

#include "pbd/i18n.h"

// preset stuff
static const char* const preset_dir_name = "osc";
static const char* const preset_suffix = ".preset";
static const char * const preset_env_variable_name = "ARDOUR_OSC_PATH";

namespace ArdourSurface {

class OSC_GUI : public Gtk::Notebook
{
public:
	OSC_GUI (OSC&);
	~OSC_GUI ();


private:
	// settings page
	Gtk::ComboBoxText debug_combo;
	Gtk::ComboBoxText portmode_combo;
	Gtk::SpinButton port_entry;
	Gtk::SpinButton bank_entry;
	Gtk::ComboBoxText gainmode_combo;
	Gtk::ComboBoxText preset_combo;
	std::vector<std::string> preset_options;
	std::map<std::string,std::string> preset_files;
	bool preset_busy;
	void get_session ();
	void restore_sesn_values ();
	uint32_t sesn_portmode;
	std::string sesn_port;
	uint32_t sesn_bank;
	uint32_t sesn_strips;
	uint32_t sesn_feedback;
	uint32_t sesn_gainmode;
	void save_user ();
	void scan_preset_files ();
	void load_preset (std::string preset);

	void debug_changed ();
	void portmode_changed ();
	void gainmode_changed ();
	void clear_device ();
	void factory_reset ();
	void reshow_values ();
	void port_changed ();
	void bank_changed ();
	void strips_changed ();
	void feedback_changed ();
	void preset_changed ();
	// Strip types calculator
	uint32_t def_strip;
	void calculate_strip_types ();
	void push_strip_types ();
	Gtk::Label current_strip_types;
	Gtk::CheckButton audio_tracks;
	Gtk::CheckButton midi_tracks;
	Gtk::CheckButton audio_buses;
	Gtk::CheckButton midi_buses;
	Gtk::CheckButton control_masters;
	Gtk::CheckButton master_type;
	Gtk::CheckButton monitor_type;
	Gtk::CheckButton selected_tracks;
	Gtk::CheckButton hidden_tracks;
	int stvalue;
	// feedback calculator
	uint32_t def_feedback;
	void calculate_feedback ();
	void push_feedback ();
	Gtk::Label current_feedback;
	Gtk::CheckButton strip_buttons_button;
	Gtk::CheckButton strip_control_button;
	Gtk::CheckButton ssid_as_path;
	Gtk::CheckButton heart_beat;
	Gtk::CheckButton master_fb;
	Gtk::CheckButton bar_and_beat;
	Gtk::CheckButton smpte;
	Gtk::CheckButton meter_float;
	Gtk::CheckButton meter_led;
	Gtk::CheckButton signal_present;
	Gtk::CheckButton hp_samples;
	Gtk::CheckButton hp_min_sec;
	Gtk::CheckButton hp_gui;
	Gtk::CheckButton select_fb;
	int fbvalue;
	void set_bitsets ();



	OSC& cp;
};


void*
OSC::get_gui () const
{
	if (!gui) {
		const_cast<OSC*>(this)->build_gui ();
	}
	//static_cast<Gtk::VBox*>(gui)->show_all();
	static_cast<Gtk::Notebook*>(gui)->show_all();
	return gui;
}

void
OSC::tear_down_gui ()
{
	if (gui) {
		Gtk::Widget *w = static_cast<Gtk::Notebook*>(gui)->get_parent();
		if (w) {
			w->hide();
			delete w;
		}
	}
	delete (OSC_GUI*) gui;
	gui = 0;
}

void
OSC::build_gui ()
{
	gui = (void*) new OSC_GUI (*this);
}

} // end namespace

#endif // osc_gui_h