add global region fade toggle; fixup (?) reload of MIDI config state (both ported...
[ardour.git] / gtk2_ardour / option_editor.h
1 #ifndef __gtk_ardour_option_editor_h__
2 #define __gtk_ardour_option_editor_h__
3
4 /*
5     Copyright (C) 2001 Paul Davis
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 */
22
23 #include <vector>
24
25 #include <gtkmm/notebook.h>
26 #include <gtkmm/checkbutton.h>
27 #include <gtkmm/table.h>
28 #include <gtkmm/entry.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/label.h>
31 #include <gtkmm/adjustment.h>
32 #include <gtkmm/scale.h>
33 #include <gtkmm/spinbutton.h>
34 #include <gtkmm/radiobutton.h>
35 #include <gtkmm/comboboxtext.h>
36
37 #include <ardour/session.h>
38
39 #include "ardour_dialog.h"
40 #include "editing.h"
41 #include "audio_clock.h"
42
43 class ARDOUR_UI;
44 class PublicEditor;
45 class Mixer_UI;
46 class IOSelector;
47 class GainMeter;
48 class PannerUI;
49
50 class OptionEditor : public ArdourDialog
51 {
52   public:
53         OptionEditor (ARDOUR_UI&, PublicEditor&, Mixer_UI&);
54         ~OptionEditor ();
55
56         void set_session (ARDOUR::Session *);
57         void save ();
58
59   private:
60         ARDOUR::Session *session;
61         ARDOUR_UI& ui;
62         PublicEditor& editor;
63         Mixer_UI& mixer;
64
65         Gtk::Notebook notebook;
66
67         /* Generic */
68
69         gint wm_close (GdkEventAny *);
70         bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
71         void parameter_changed (const char* name);
72
73         /* paths */
74
75         Gtk::Table      path_table;
76         Gtk::Entry      session_raid_entry;
77
78         void setup_path_options();
79         void add_session_paths ();
80         void remove_session_paths ();
81         void raid_path_changed ();
82
83         /* misc */
84
85         Gtk::VBox        misc_packer;
86
87         Gtk::Adjustment  short_xfade_adjustment;
88         Gtk::HScale      short_xfade_slider;
89         Gtk::Adjustment  destructo_xfade_adjustment;
90         Gtk::HScale      destructo_xfade_slider;
91
92         void setup_misc_options();
93
94         void short_xfade_adjustment_changed ();
95         void destructo_xfade_adjustment_changed ();
96
97         Gtk::Adjustment history_depth;
98         Gtk::Adjustment saved_history_depth;
99         Gtk::SpinButton     history_depth_spinner;
100         Gtk::SpinButton     saved_history_depth_spinner;
101         Gtk::CheckButton    limit_history_button;
102         Gtk::CheckButton    save_history_button;
103
104         void history_depth_changed();
105         void saved_history_depth_changed();
106         void save_history_toggled ();
107         void limit_history_toggled ();
108
109         /* Sync */
110
111         Gtk::VBox sync_packer;
112
113         Gtk::ComboBoxText slave_type_combo;
114         AudioClock smpte_offset_clock;
115         Gtk::CheckButton smpte_offset_negative_button;
116         Gtk::CheckButton synced_timecode_button;
117
118         void setup_sync_options ();
119
120         void smpte_offset_chosen ();
121         void smpte_offset_negative_clicked ();
122         void synced_timecode_toggled ();
123
124         /* MIDI */
125
126         Gtk::VBox  midi_packer;
127
128         Gtk::RadioButton::Group mtc_button_group;
129         Gtk::RadioButton::Group mmc_button_group;
130         Gtk::RadioButton::Group midi_button_group;
131         Gtk::RadioButton::Group midi_clock_button_group;
132
133         Gtk::Table      midi_port_table;
134         std::vector<Gtk::Widget*> midi_port_table_widgets;
135         Gtk::Adjustment mmc_receive_device_id_adjustment;
136         Gtk::SpinButton mmc_receive_device_id_spinner;
137         Gtk::Adjustment mmc_send_device_id_adjustment;
138         Gtk::SpinButton mmc_send_device_id_spinner;
139         Gtk::Button     add_midi_port_button;
140         Gtk::Adjustment initial_program_change_adjustment;
141         Gtk::SpinButton initial_program_change_spinner;
142
143         void add_midi_port ();
144         void remove_midi_port (MIDI::Port*);
145         void redisplay_midi_ports ();
146
147         void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
148         void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
149         void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
150
151         void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
152         void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
153         void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
154         void midi_clock_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
155         bool port_removable (MIDI::Port*);
156
157         void mmc_receive_device_id_adjusted ();
158         void mmc_send_device_id_adjusted ();
159
160         void initial_program_change_adjusted ();
161
162         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
163
164         void setup_midi_options();
165
166         enum PortIndex {
167                 MtcIndex = 0,
168                 MmcIndex = 1,
169                 MidiIndex = 2,
170                 MidiClockIndex = 3
171         };
172
173         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
174
175         /* Click */
176
177         IOSelector*   click_io_selector;
178         GainMeter* click_gpm;
179         PannerUI*     click_panner;
180         bool          first_click_setup;
181         Gtk::HBox     click_hpacker;
182         Gtk::VBox     click_packer;
183         Gtk::Table    click_table;
184         Gtk::Entry    click_path_entry;
185         Gtk::Entry    click_emphasis_path_entry;
186         Gtk::Button   click_browse_button;
187         Gtk::Button   click_emphasis_browse_button;
188
189         void setup_click_editor ();
190         void clear_click_editor ();
191
192         void click_chosen (const string & paths);
193         void click_emphasis_chosen (const string & paths);
194
195         void click_browse_clicked ();
196         void click_emphasis_browse_clicked ();
197
198         void click_sound_changed ();
199         void click_emphasis_sound_changed ();
200
201         /* Auditioner */
202
203         Gtk::VBox     audition_packer;
204         Gtk::HBox     audition_hpacker;
205         Gtk::Label    audition_label;
206         IOSelector*   auditioner_io_selector;
207         GainMeter* auditioner_gpm;
208         PannerUI* auditioner_panner;
209
210         void setup_auditioner_editor ();
211         void clear_auditioner_editor ();
212         void connect_audition_editor ();
213
214         /* keyboard/mouse */
215
216         Gtk::Table keyboard_mouse_table;
217         Gtk::ComboBoxText keyboard_layout_selector;
218         Gtk::ComboBoxText edit_modifier_combo;
219         Gtk::ComboBoxText delete_modifier_combo;
220         Gtk::ComboBoxText snap_modifier_combo;
221         Gtk::Adjustment delete_button_adjustment;
222         Gtk::SpinButton delete_button_spin;
223         Gtk::Adjustment edit_button_adjustment;
224         Gtk::SpinButton edit_button_spin;
225
226         std::map<std::string,std::string> bindings_files;
227
228         void setup_keyboard_options ();
229         void delete_modifier_chosen ();
230         void edit_modifier_chosen ();
231         void snap_modifier_chosen ();
232         void edit_button_changed ();
233         void delete_button_changed ();
234         void bindings_changed ();
235
236         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
237 };
238
239 #endif /* __gtk_ardour_option_editor_h__ */
240
241