merged with 1697 revision of trunk (which is post-rc1 but pre-rc2
[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 Gtk::Dialog
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
70         /* paths */
71
72         Gtk::Table      path_table;
73         Gtk::Entry      session_raid_entry;
74
75         void setup_path_options();
76         void add_session_paths ();
77         void remove_session_paths ();
78         void raid_path_changed ();
79
80         /* fades */
81
82         Gtk::VBox        fade_packer;
83         Gtk::Adjustment  short_xfade_adjustment;
84         Gtk::HScale      short_xfade_slider;
85         Gtk::Adjustment  destructo_xfade_adjustment;
86         Gtk::HScale      destructo_xfade_slider;
87
88         void setup_fade_options();
89         void short_xfade_adjustment_changed ();
90         void destructo_xfade_adjustment_changed ();
91
92         /* Sync */
93
94         Gtk::VBox sync_packer;
95
96         Gtk::ComboBoxText slave_type_combo;
97         AudioClock smpte_offset_clock;
98         Gtk::CheckButton smpte_offset_negative_button;
99
100         void setup_sync_options ();
101
102         void smpte_offset_chosen ();
103         void smpte_offset_negative_clicked ();
104
105         /* MIDI */
106
107         Gtk::VBox  midi_packer;
108
109         Gtk::RadioButton::Group mtc_button_group;
110         Gtk::RadioButton::Group mmc_button_group;
111         Gtk::RadioButton::Group midi_button_group;
112
113         Gtk::Adjustment mmc_device_id_adjustment;
114         Gtk::SpinButton mmc_device_id_spinner;
115
116         void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
117         void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
118         void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
119         
120         void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
121         void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
122         void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*);
123
124         void mmc_device_id_adjusted ();
125
126         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
127
128         void setup_midi_options();
129
130         enum PortIndex {
131                 MtcIndex = 0,
132                 MmcIndex = 1,
133                 MidiIndex = 2
134         };
135
136         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
137
138         /* Click */
139
140         IOSelector*   click_io_selector;
141         GainMeter* click_gpm;
142         PannerUI*     click_panner;
143         Gtk::VBox     click_packer;
144         Gtk::Table    click_table;
145         Gtk::Entry    click_path_entry;
146         Gtk::Entry    click_emphasis_path_entry;
147         Gtk::Button   click_browse_button;
148         Gtk::Button   click_emphasis_browse_button;
149
150         void setup_click_editor ();
151         void clear_click_editor ();
152
153         void click_chosen (const string & paths);
154         void click_emphasis_chosen (const string & paths);
155
156         void click_browse_clicked ();
157         void click_emphasis_browse_clicked ();
158         
159         void click_sound_changed ();
160         void click_emphasis_sound_changed ();
161
162         /* Auditioner */
163
164         Gtk::VBox     audition_packer;
165         Gtk::HBox     audition_hpacker;
166         Gtk::Label    audition_label;
167         IOSelector*   auditioner_io_selector;
168         GainMeter* auditioner_gpm;
169         PannerUI* auditioner_panner;
170
171         void setup_auditioner_editor ();
172         void clear_auditioner_editor ();
173         void connect_audition_editor ();
174
175         /* keyboard/mouse */
176
177         Gtk::Table keyboard_mouse_table;
178         Gtk::ComboBoxText edit_modifier_combo;
179         Gtk::ComboBoxText delete_modifier_combo;
180         Gtk::ComboBoxText snap_modifier_combo;
181         Gtk::Adjustment delete_button_adjustment;
182         Gtk::SpinButton delete_button_spin;
183         Gtk::Adjustment edit_button_adjustment;
184         Gtk::SpinButton edit_button_spin;
185
186         void setup_keyboard_options ();
187         void delete_modifier_chosen ();
188         void edit_modifier_chosen ();
189         void snap_modifier_chosen ();
190         void edit_button_changed ();
191         void delete_button_changed ();
192
193         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
194 };
195
196 #endif /* __gtk_ardour_option_editor_h__ */
197
198