02237103a2bd98542ae95cadf71ada7f600283d5
[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 ArdourDialog
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         gint 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         void setup_path_options();
84         void add_session_paths ();
85         void remove_session_paths ();
86         gint native_format_chosen (GdkEventAny *);
87         void raid_path_changed ();
88
89         /* fades */
90
91         // Gtk::Table           fade_table;
92
93         Gtk::VBox        fade_packer;
94         Gtk::CheckButton auto_xfade_button;
95         Gtk::CheckButton xfade_active_button;
96         Gtk::Label       layer_mode_label;
97         Gtk::ComboBoxText layer_mode_combo;
98         Gtk::Label       xfade_model_label;
99         Gtk::ComboBoxText xfade_model_combo;
100         Gtk::Adjustment  short_xfade_adjustment;
101         Gtk::HScale      short_xfade_slider;
102
103         void auto_xfade_clicked ();
104         void xfade_active_clicked ();
105         gint layer_mode_chosen (GdkEventAny*);
106         gint xfade_model_chosen (GdkEventAny*);
107         void setup_fade_options();
108         void short_xfade_adjustment_changed ();
109
110         /* solo */
111
112         Gtk::VBox        solo_packer;
113         Gtk::CheckButton solo_latched_button;
114         Gtk::CheckButton solo_via_bus_button;
115
116         void solo_latched_clicked();
117         void solo_via_bus_clicked ();
118         
119         void setup_solo_options();
120
121         /* display */
122
123         Gtk::VBox        display_packer;
124         Gtk::CheckButton show_waveforms_button;
125         Gtk::CheckButton show_waveforms_recording_button;
126         Gtk::CheckButton mixer_strip_width_button;
127         Gtk::CheckButton show_measures_button;
128         Gtk::CheckButton follow_playhead_button;
129         Gtk::ComboBoxText meter_hold_combo;
130         Gtk::ComboBoxText meter_falloff_combo;
131
132         void setup_display_options();
133         void show_waveforms_clicked ();
134         void show_waveforms_recording_clicked ();
135         void show_measures_clicked ();
136         void strip_width_clicked ();
137         void follow_playhead_clicked ();
138         gint meter_hold_chosen (GdkEventAny *);
139         gint meter_falloff_chosen (GdkEventAny *);
140         
141         void display_control_changed (Editing::DisplayControl);
142
143         /* Sync */
144
145         Gtk::VBox sync_packer;
146
147         Gtk::CheckButton send_mtc_button;
148         Gtk::CheckButton send_mmc_button;
149         Gtk::CheckButton jack_time_master_button;
150         Gtk::ComboBoxText slave_type_combo;
151         Gtk::ComboBoxText smpte_fps_combo;
152         AudioClock smpte_offset_clock;
153         Gtk::CheckButton smpte_offset_negative_button;
154
155         void setup_sync_options ();
156         gint send_mtc_toggled (GdkEventButton*, Gtk::CheckButton*);
157
158         gint slave_type_chosen (GdkEventAny*);
159         void jack_time_master_clicked ();
160         void jack_transport_master_clicked ();
161         gint smpte_fps_chosen (GdkEventAny*);
162         void smpte_offset_chosen ();
163         void smpte_offset_negative_clicked ();
164
165         /* MIDI */
166
167         Gtk::VBox  midi_packer;
168         Gtk::CheckButton midi_feedback_button;
169         Gtk::CheckButton midi_control_button;
170         Gtk::CheckButton mmc_control_button;
171
172         void send_mmc_toggled (Gtk::CheckButton*);
173         void mmc_control_toggled (Gtk::CheckButton*);
174         void midi_control_toggled (Gtk::CheckButton*);
175         void midi_feedback_toggled (Gtk::CheckButton*);
176
177         gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
178         gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
179         gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
180         
181         gint mmc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
182         gint mtc_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
183         gint midi_port_chosen (GdkEventButton*,MIDI::Port*,Gtk::RadioButton*);
184
185         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
186
187         void setup_midi_options();
188
189         enum PortIndex {
190                 MtcIndex = 0,
191                 MmcIndex = 1,
192                 MidiIndex = 2
193         };
194
195         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
196
197         /* Click */
198
199         IOSelector*   click_io_selector;
200         GainMeter* click_gpm;
201         PannerUI*     click_panner;
202         Gtk::VBox     click_packer;
203         Gtk::Table    click_table;
204         Gtk::Entry    click_path_entry;
205         Gtk::Entry    click_emphasis_path_entry;
206         Gtk::Button   click_browse_button;
207         Gtk::Button   click_emphasis_browse_button;
208
209         void setup_click_editor ();
210         void clear_click_editor ();
211
212         void click_chosen (std::string paths);
213         void click_emphasis_chosen (std::string paths);
214
215         void click_browse_clicked ();
216         void click_emphasis_browse_clicked ();
217         
218         void click_sound_changed ();
219         void click_emphasis_sound_changed ();
220
221         /* Auditioner */
222
223         Gtk::VBox     audition_packer;
224         Gtk::HBox     audition_hpacker;
225         Gtk::Label    audition_label;
226         IOSelector*   auditioner_io_selector;
227         GainMeter* auditioner_gpm;
228         PannerUI* auditioner_panner;
229
230         void setup_auditioner_editor ();
231         void clear_auditioner_editor ();
232         void connect_audition_editor ();
233
234         /* keyboard/mouse */
235
236         Gtk::Table keyboard_mouse_table;
237         Gtk::ComboBoxText edit_modifier_combo;
238         Gtk::ComboBoxText delete_modifier_combo;
239         Gtk::ComboBoxText snap_modifier_combo;
240         Gtk::Adjustment delete_button_adjustment;
241         Gtk::SpinButton delete_button_spin;
242         Gtk::Adjustment edit_button_adjustment;
243         Gtk::SpinButton edit_button_spin;
244
245         void setup_keyboard_options ();
246         gint delete_modifier_chosen (GdkEventAny*);
247         gint edit_modifier_chosen (GdkEventAny*);
248         gint snap_modifier_chosen (GdkEventAny*);
249         void edit_button_changed ();
250         void delete_button_changed ();
251
252         /* Miscellany */
253
254         Gtk::VBox misc_packer;
255
256         Gtk::CheckButton auto_connect_inputs_button;
257
258         Gtk::RadioButton auto_connect_output_physical_button;
259         Gtk::RadioButton auto_connect_output_master_button;
260         Gtk::RadioButton auto_connect_output_manual_button;
261
262         Gtk::CheckButton hw_monitor_button;
263         Gtk::CheckButton sw_monitor_button;
264         Gtk::CheckButton plugins_stop_button;
265         Gtk::CheckButton plugins_on_rec_button;
266         Gtk::CheckButton verify_remove_last_capture_button;
267         Gtk::CheckButton stop_rec_on_xrun_button;
268         Gtk::CheckButton stop_at_end_button;
269         Gtk::CheckButton debug_keyboard_button;
270         Gtk::CheckButton speed_quieten_button;
271
272         void setup_misc_options ();
273         void plugins_stop_with_transport_clicked ();
274         void verify_remove_last_capture_clicked ();
275         void plugins_on_while_recording_clicked ();
276         void auto_connect_inputs_clicked ();
277         void auto_connect_output_physical_clicked ();
278         void auto_connect_output_master_clicked ();
279         void auto_connect_output_manual_clicked ();
280         void hw_monitor_clicked ();
281         void sw_monitor_clicked ();
282         void stop_rec_on_xrun_clicked ();
283         void stop_at_end_clicked ();
284         void debug_keyboard_clicked ();
285         void speed_quieten_clicked ();
286
287         void fixup_combo_size (Gtk::ComboBox&, std::vector<std::string>& strings);
288 };
289
290 #endif /* __gtk_ardour_option_editor_h__ */
291
292