Midi radiobuttons now work.
[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 Gtk::Dialog
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         gint wm_close (GdkEventAny *);
69         bool focus_out_event_handler (GdkEventFocus*, void (OptionEditor::*pmf)());
70
71         /* paths */
72
73         Gtk::Table              path_table;
74         Gtk::Entry              session_raid_entry;
75         Gtk::ComboBoxText       native_format_combo;
76
77         struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord {
78             public:
79                  SoundFilePathColumns() { add (paths); }
80                  Gtk::TreeModelColumn<std::string> paths;
81                             
82         };
83
84         SoundFilePathColumns sfdb_path_columns;
85         Glib::RefPtr<Gtk::ListStore> sfdb_paths;
86         Gtk::TreeView sfdb_path_view;
87
88         void setup_path_options();
89         void add_session_paths ();
90         void remove_session_paths ();
91         void native_format_chosen ();
92         void raid_path_changed ();
93
94         /* fades */
95
96         Gtk::VBox        fade_packer;
97         Gtk::CheckButton auto_xfade_button;
98         Gtk::CheckButton xfade_active_button;
99         Gtk::Label       layer_mode_label;
100         Gtk::ComboBoxText layer_mode_combo;
101         Gtk::Label       xfade_model_label;
102         Gtk::ComboBoxText xfade_model_combo;
103         Gtk::Adjustment  short_xfade_adjustment;
104         Gtk::HScale      short_xfade_slider;
105
106         void auto_xfade_clicked ();
107         void xfade_active_clicked ();
108         void layer_mode_chosen ();
109         void xfade_model_chosen ();
110         void setup_fade_options();
111         void short_xfade_adjustment_changed ();
112
113         /* Sync */
114
115         Gtk::VBox sync_packer;
116
117         Gtk::ComboBoxText slave_type_combo;
118         Gtk::ComboBoxText smpte_fps_combo;
119         AudioClock smpte_offset_clock;
120         Gtk::CheckButton smpte_offset_negative_button;
121
122         void setup_sync_options ();
123
124         void smpte_fps_chosen ();
125         void smpte_offset_chosen ();
126         void smpte_offset_negative_clicked ();
127
128         /* MIDI */
129
130         Gtk::VBox  midi_packer;
131
132         Gtk::RadioButton::Group mtc_button_group;
133         Gtk::RadioButton::Group mmc_button_group;
134         Gtk::RadioButton::Group midi_button_group;
135
136         gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
137         gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
138         gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
139         
140         void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
141         void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
142         void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*);
143
144         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
145
146         void setup_midi_options();
147
148         enum PortIndex {
149                 MtcIndex = 0,
150                 MmcIndex = 1,
151                 MidiIndex = 2
152         };
153
154         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
155
156         /* Click */
157
158         IOSelector*   click_io_selector;
159         GainMeter* click_gpm;
160         PannerUI*     click_panner;
161         Gtk::VBox     click_packer;
162         Gtk::Table    click_table;
163         Gtk::Entry    click_path_entry;
164         Gtk::Entry    click_emphasis_path_entry;
165         Gtk::Button   click_browse_button;
166         Gtk::Button   click_emphasis_browse_button;
167
168         void setup_click_editor ();
169         void clear_click_editor ();
170
171         void click_chosen (const string & paths);
172         void click_emphasis_chosen (const string & paths);
173
174         void click_browse_clicked ();
175         void click_emphasis_browse_clicked ();
176         
177         void click_sound_changed ();
178         void click_emphasis_sound_changed ();
179
180         /* Auditioner */
181
182         Gtk::VBox     audition_packer;
183         Gtk::HBox     audition_hpacker;
184         Gtk::Label    audition_label;
185         IOSelector*   auditioner_io_selector;
186         GainMeter* auditioner_gpm;
187         PannerUI* auditioner_panner;
188
189         void setup_auditioner_editor ();
190         void clear_auditioner_editor ();
191         void connect_audition_editor ();
192
193         /* keyboard/mouse */
194
195         Gtk::Table keyboard_mouse_table;
196         Gtk::ComboBoxText edit_modifier_combo;
197         Gtk::ComboBoxText delete_modifier_combo;
198         Gtk::ComboBoxText snap_modifier_combo;
199         Gtk::Adjustment delete_button_adjustment;
200         Gtk::SpinButton delete_button_spin;
201         Gtk::Adjustment edit_button_adjustment;
202         Gtk::SpinButton edit_button_spin;
203
204         void setup_keyboard_options ();
205         void delete_modifier_chosen ();
206         void edit_modifier_chosen ();
207         void snap_modifier_chosen ();
208         void edit_button_changed ();
209         void delete_button_changed ();
210
211         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
212 };
213
214 #endif /* __gtk_ardour_option_editor_h__ */
215
216