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