s/stringcr_t/const string &/
[ardour.git] / gtk2_ardour / option_editor.h
1 /*
2     Copyright (C) 2001 Paul Davis 
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
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #ifndef __gtk_ardour_option_editor_h__
22 #define __gtk_ardour_option_editor_h__
23
24 #include <gtkmm/notebook.h>
25 #include <gtkmm/checkbutton.h>
26 #include <gtkmm/table.h>
27 #include <gtkmm/entry.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/adjustment.h>
31 #include <gtkmm/scale.h>
32 #include <gtkmm/spinbutton.h>
33 #include <gtkmm/radiobutton.h>
34 #include <gtkmm/comboboxtext.h>
35
36 #include <ardour/session.h>
37
38 #include "ardour_dialog.h"
39 #include "editing.h"
40 #include "audio_clock.h"
41
42 class ARDOUR_UI;
43 class PublicEditor;
44 class Mixer_UI;
45 class IOSelector;
46 class GainMeter;
47 class PannerUI;
48
49 class OptionEditor : public Gtk::Dialog
50 {
51   public:
52         OptionEditor (ARDOUR_UI&, PublicEditor&, Mixer_UI&);
53         ~OptionEditor ();
54
55         void set_session (ARDOUR::Session *);
56         void save ();
57
58   private:
59         ARDOUR::Session *session;
60         ARDOUR_UI& ui;
61         PublicEditor& editor;
62         Mixer_UI& mixer;
63
64         Gtk::Notebook notebook;
65
66         /* Generic */
67
68         void session_control_changed (ARDOUR::Session::ControlType);
69         void queue_session_control_changed (ARDOUR::Session::ControlType);
70         void map_some_session_state (Gtk::CheckButton& button, bool (ARDOUR::Session::*get)() const);
71         gint wm_close (GdkEventAny *);
72         void just_close_win();
73         bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
74
75         /* paths */
76
77         Gtk::Table              path_table;
78
79         Gtk::Entry              session_raid_entry;
80
81         Gtk::ComboBoxText       native_format_combo;
82
83         Glib::RefPtr<Gtk::ListStore> sfdb_paths;
84         Gtk::TreeView sfdb_path_view;
85
86         struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord
87         {
88           public:
89             Gtk::TreeModelColumn<std::string> paths;
90
91                 SoundFilePathColumns() { add (paths); }
92         };
93         SoundFilePathColumns sfdb_path_columns;
94
95         void setup_path_options();
96         void add_session_paths ();
97         void remove_session_paths ();
98         void native_format_chosen ();
99         void raid_path_changed ();
100
101         /* fades */
102
103         // Gtk::Table           fade_table;
104
105         Gtk::VBox        fade_packer;
106         Gtk::CheckButton auto_xfade_button;
107         Gtk::CheckButton xfade_active_button;
108         Gtk::Label       layer_mode_label;
109         Gtk::ComboBoxText layer_mode_combo;
110         Gtk::Label       xfade_model_label;
111         Gtk::ComboBoxText xfade_model_combo;
112         Gtk::Adjustment  short_xfade_adjustment;
113         Gtk::HScale      short_xfade_slider;
114
115         void auto_xfade_clicked ();
116         void xfade_active_clicked ();
117         void layer_mode_chosen ();
118         void xfade_model_chosen ();
119         void setup_fade_options();
120         void short_xfade_adjustment_changed ();
121
122         /* solo */
123
124         Gtk::VBox        solo_packer;
125         Gtk::CheckButton solo_latched_button;
126         Gtk::CheckButton solo_via_bus_button;
127
128         void solo_latched_clicked();
129         void solo_via_bus_clicked ();
130         
131         void setup_solo_options();
132
133         /* display */
134
135         Gtk::VBox        display_packer;
136         Gtk::CheckButton show_waveforms_button;
137         Gtk::CheckButton show_waveforms_recording_button;
138         Gtk::CheckButton mixer_strip_width_button;
139         Gtk::CheckButton show_measures_button;
140         Gtk::CheckButton follow_playhead_button;
141         Gtk::ComboBoxText meter_hold_combo;
142         Gtk::ComboBoxText meter_falloff_combo;
143
144         void setup_display_options();
145         void show_waveforms_clicked ();
146         void show_waveforms_recording_clicked ();
147         void show_measures_clicked ();
148         void strip_width_clicked ();
149         void follow_playhead_clicked ();
150         void meter_hold_chosen ();
151         void meter_falloff_chosen ();
152         
153         void display_control_changed (Editing::DisplayControl);
154
155         /* Sync */
156
157         Gtk::VBox sync_packer;
158
159         Gtk::CheckButton send_mtc_button;
160         Gtk::CheckButton send_mmc_button;
161         Gtk::CheckButton jack_time_master_button;
162         Gtk::ComboBoxText slave_type_combo;
163         Gtk::ComboBoxText smpte_fps_combo;
164         AudioClock smpte_offset_clock;
165         Gtk::CheckButton smpte_offset_negative_button;
166
167         void setup_sync_options ();
168         gint send_mtc_toggled (GdkEventButton*, Gtk::CheckButton*);
169
170         void slave_type_chosen ();
171         void jack_time_master_clicked ();
172         void jack_transport_master_clicked ();
173         void smpte_fps_chosen ();
174         void smpte_offset_chosen ();
175         void smpte_offset_negative_clicked ();
176
177         /* MIDI */
178
179         Gtk::VBox  midi_packer;
180         Gtk::CheckButton midi_feedback_button;
181         Gtk::CheckButton midi_control_button;
182         Gtk::CheckButton mmc_control_button;
183
184         Gtk::RadioButton::Group mtc_button_group;
185         Gtk::RadioButton::Group mmc_button_group;
186         Gtk::RadioButton::Group midi_button_group;
187
188         void send_mmc_toggled (Gtk::CheckButton*);
189         void mmc_control_toggled (Gtk::CheckButton*);
190         void midi_control_toggled (Gtk::CheckButton*);
191         void midi_feedback_toggled (Gtk::CheckButton*);
192
193         gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
194         gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
195         gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
196         
197         gint mmc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
198         gint mtc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
199         gint midi_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
200
201         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
202
203         void setup_midi_options();
204
205         enum PortIndex {
206                 MtcIndex = 0,
207                 MmcIndex = 1,
208                 MidiIndex = 2
209         };
210
211         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
212
213         /* Click */
214
215         IOSelector*   click_io_selector;
216         GainMeter* click_gpm;
217         PannerUI*     click_panner;
218         Gtk::VBox     click_packer;
219         Gtk::Table    click_table;
220         Gtk::Entry    click_path_entry;
221         Gtk::Entry    click_emphasis_path_entry;
222         Gtk::Button   click_browse_button;
223         Gtk::Button   click_emphasis_browse_button;
224
225         void setup_click_editor ();
226         void clear_click_editor ();
227
228         void click_chosen (const string & paths);
229         void click_emphasis_chosen (const string & paths);
230
231         void click_browse_clicked ();
232         void click_emphasis_browse_clicked ();
233         
234         void click_sound_changed ();
235         void click_emphasis_sound_changed ();
236
237         /* Auditioner */
238
239         Gtk::VBox     audition_packer;
240         Gtk::HBox     audition_hpacker;
241         Gtk::Label    audition_label;
242         IOSelector*   auditioner_io_selector;
243         GainMeter* auditioner_gpm;
244         PannerUI* auditioner_panner;
245
246         void setup_auditioner_editor ();
247         void clear_auditioner_editor ();
248         void connect_audition_editor ();
249
250         /* keyboard/mouse */
251
252         Gtk::Table keyboard_mouse_table;
253         Gtk::ComboBoxText edit_modifier_combo;
254         Gtk::ComboBoxText delete_modifier_combo;
255         Gtk::ComboBoxText snap_modifier_combo;
256         Gtk::Adjustment delete_button_adjustment;
257         Gtk::SpinButton delete_button_spin;
258         Gtk::Adjustment edit_button_adjustment;
259         Gtk::SpinButton edit_button_spin;
260
261         void setup_keyboard_options ();
262         void delete_modifier_chosen ();
263         void edit_modifier_chosen ();
264         void snap_modifier_chosen ();
265         void edit_button_changed ();
266         void delete_button_changed ();
267
268         /* Miscellany */
269
270         Gtk::VBox misc_packer;
271
272         Gtk::CheckButton auto_connect_inputs_button;
273
274         Gtk::RadioButton auto_connect_output_physical_button;
275         Gtk::RadioButton auto_connect_output_master_button;
276         Gtk::RadioButton auto_connect_output_manual_button;
277         Gtk::RadioButton::Group auto_connect_output_button_group;
278
279         Gtk::CheckButton hw_monitor_button;
280         Gtk::CheckButton sw_monitor_button;
281         Gtk::CheckButton plugins_stop_button;
282         Gtk::CheckButton plugins_on_rec_button;
283         Gtk::CheckButton verify_remove_last_capture_button;
284         Gtk::CheckButton stop_rec_on_xrun_button;
285         Gtk::CheckButton stop_at_end_button;
286         Gtk::CheckButton debug_keyboard_button;
287         Gtk::CheckButton speed_quieten_button;
288
289         void setup_misc_options ();
290         void plugins_stop_with_transport_clicked ();
291         void verify_remove_last_capture_clicked ();
292         void plugins_on_while_recording_clicked ();
293         void auto_connect_inputs_clicked ();
294         void auto_connect_output_physical_clicked ();
295         void auto_connect_output_master_clicked ();
296         void auto_connect_output_manual_clicked ();
297         void hw_monitor_clicked ();
298         void sw_monitor_clicked ();
299         void stop_rec_on_xrun_clicked ();
300         void stop_at_end_clicked ();
301         void debug_keyboard_clicked ();
302         void speed_quieten_clicked ();
303
304         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
305 };
306
307 #endif /* __gtk_ardour_option_editor_h__ */
308
309