3881687d5cf8e2b229223a352d8aaefc7012ed30
[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 */
19
20 #ifndef __gtk_ardour_option_editor_h__
21 #define __gtk_ardour_option_editor_h__
22
23 #include <gtkmm/notebook.h>
24 #include <gtkmm/checkbutton.h>
25 #include <gtkmm/table.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/box.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/adjustment.h>
30 #include <gtkmm/scale.h>
31 #include <gtkmm/spinbutton.h>
32 #include <gtkmm/radiobutton.h>
33 #include <gtkmm/comboboxtext.h>
34
35 #include <ardour/session.h>
36
37 #include "ardour_dialog.h"
38 #include "editing.h"
39 #include "audio_clock.h"
40
41 class ARDOUR_UI;
42 class PublicEditor;
43 class Mixer_UI;
44 class IOSelector;
45 class GainMeter;
46 class PannerUI;
47
48 class OptionEditor : public ArdourDialog
49 {
50   public:
51         OptionEditor (ARDOUR_UI&, PublicEditor&, Mixer_UI&);
52         ~OptionEditor ();
53
54         void set_session (ARDOUR::Session *);
55         void save ();
56
57   private:
58         ARDOUR::Session *session;
59         ARDOUR_UI& ui;
60         PublicEditor& editor;
61         Mixer_UI& mixer;
62
63         Gtk::Notebook notebook;
64
65         /* Generic */
66
67         gint wm_close (GdkEventAny *);
68         bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
69         void parameter_changed (const char* name);
70
71         /* paths */
72
73         Gtk::Table      path_table;
74         Gtk::Entry      session_raid_entry;
75
76         void setup_path_options();
77         void add_session_paths ();
78         void remove_session_paths ();
79         void raid_path_changed ();
80
81         /* fades */
82
83         Gtk::VBox        fade_packer;
84         Gtk::Adjustment  short_xfade_adjustment;
85         Gtk::HScale      short_xfade_slider;
86         Gtk::Adjustment  destructo_xfade_adjustment;
87         Gtk::HScale      destructo_xfade_slider;
88
89         void setup_fade_options();
90         void short_xfade_adjustment_changed ();
91         void destructo_xfade_adjustment_changed ();
92
93         /* Sync */
94
95         Gtk::VBox sync_packer;
96
97         Gtk::ComboBoxText slave_type_combo;
98         AudioClock smpte_offset_clock;
99         Gtk::CheckButton smpte_offset_negative_button;
100         Gtk::CheckButton synced_timecode_button;
101
102         void setup_sync_options ();
103
104         void smpte_offset_chosen ();
105         void smpte_offset_negative_clicked ();
106         void synced_timecode_toggled ();
107
108         /* MIDI */
109
110         Gtk::VBox  midi_packer;
111
112         Gtk::RadioButton::Group mtc_button_group;
113         Gtk::RadioButton::Group mmc_button_group;
114         Gtk::RadioButton::Group midi_button_group;
115
116         Gtk::Table      midi_port_table;
117         std::vector<Gtk::Widget*> midi_port_table_widgets;
118         Gtk::Adjustment mmc_receive_device_id_adjustment;
119         Gtk::SpinButton mmc_receive_device_id_spinner;
120         Gtk::Adjustment mmc_send_device_id_adjustment;
121         Gtk::SpinButton mmc_send_device_id_spinner;
122         Gtk::Button     add_midi_port_button;
123
124         void add_midi_port ();
125         void remove_midi_port (MIDI::Port*);
126         void redisplay_midi_ports ();
127
128         void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
129         void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
130         void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
131         
132         void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
133         void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
134         void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*, Gtk::Button*);
135         bool port_removable (MIDI::Port*);
136
137         void mmc_receive_device_id_adjusted ();
138         void mmc_send_device_id_adjusted ();
139
140         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
141
142         void setup_midi_options();
143
144         enum PortIndex {
145                 MtcIndex = 0,
146                 MmcIndex = 1,
147                 MidiIndex = 2
148         };
149
150         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
151
152         /* Click */
153
154         IOSelector*   click_io_selector;
155         GainMeter* click_gpm;
156         PannerUI*     click_panner;
157         Gtk::VBox     click_packer;
158         Gtk::Table    click_table;
159         Gtk::Entry    click_path_entry;
160         Gtk::Entry    click_emphasis_path_entry;
161         Gtk::Button   click_browse_button;
162         Gtk::Button   click_emphasis_browse_button;
163
164         void setup_click_editor ();
165         void clear_click_editor ();
166
167         void click_chosen (const string & paths);
168         void click_emphasis_chosen (const string & paths);
169
170         void click_browse_clicked ();
171         void click_emphasis_browse_clicked ();
172         
173         void click_sound_changed ();
174         void click_emphasis_sound_changed ();
175
176         /* Auditioner */
177
178         Gtk::VBox     audition_packer;
179         Gtk::HBox     audition_hpacker;
180         Gtk::Label    audition_label;
181         IOSelector*   auditioner_io_selector;
182         GainMeter* auditioner_gpm;
183         PannerUI* auditioner_panner;
184
185         void setup_auditioner_editor ();
186         void clear_auditioner_editor ();
187         void connect_audition_editor ();
188
189         /* keyboard/mouse */
190
191         Gtk::Table keyboard_mouse_table;
192         Gtk::ComboBoxText edit_modifier_combo;
193         Gtk::ComboBoxText delete_modifier_combo;
194         Gtk::ComboBoxText snap_modifier_combo;
195         Gtk::Adjustment delete_button_adjustment;
196         Gtk::SpinButton delete_button_spin;
197         Gtk::Adjustment edit_button_adjustment;
198         Gtk::SpinButton edit_button_spin;
199
200         void setup_keyboard_options ();
201         void delete_modifier_chosen ();
202         void edit_modifier_chosen ();
203         void snap_modifier_chosen ();
204         void edit_button_changed ();
205         void delete_button_changed ();
206
207         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
208 };
209
210 #endif /* __gtk_ardour_option_editor_h__ */
211
212