PBD::strip_whitespace_edges() returns the empty string if the passed string is
[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
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
101         void setup_sync_options ();
102
103         void smpte_offset_chosen ();
104         void smpte_offset_negative_clicked ();
105
106         /* MIDI */
107
108         Gtk::VBox  midi_packer;
109
110         Gtk::RadioButton::Group mtc_button_group;
111         Gtk::RadioButton::Group mmc_button_group;
112         Gtk::RadioButton::Group midi_button_group;
113
114         void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
115         void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
116         void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
117         
118         void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
119         void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
120         void midi_port_chosen (MIDI::Port*,Gtk::RadioButton*);
121
122         void map_port_online (MIDI::Port*, Gtk::ToggleButton*);
123
124         void setup_midi_options();
125
126         enum PortIndex {
127                 MtcIndex = 0,
128                 MmcIndex = 1,
129                 MidiIndex = 2
130         };
131
132         std::map<MIDI::Port*,std::vector<Gtk::RadioButton*> > port_toggle_buttons;
133
134         /* Click */
135
136         IOSelector*   click_io_selector;
137         GainMeter* click_gpm;
138         PannerUI*     click_panner;
139         Gtk::VBox     click_packer;
140         Gtk::Table    click_table;
141         Gtk::Entry    click_path_entry;
142         Gtk::Entry    click_emphasis_path_entry;
143         Gtk::Button   click_browse_button;
144         Gtk::Button   click_emphasis_browse_button;
145
146         void setup_click_editor ();
147         void clear_click_editor ();
148
149         void click_chosen (const string & paths);
150         void click_emphasis_chosen (const string & paths);
151
152         void click_browse_clicked ();
153         void click_emphasis_browse_clicked ();
154         
155         void click_sound_changed ();
156         void click_emphasis_sound_changed ();
157
158         /* Auditioner */
159
160         Gtk::VBox     audition_packer;
161         Gtk::HBox     audition_hpacker;
162         Gtk::Label    audition_label;
163         IOSelector*   auditioner_io_selector;
164         GainMeter* auditioner_gpm;
165         PannerUI* auditioner_panner;
166
167         void setup_auditioner_editor ();
168         void clear_auditioner_editor ();
169         void connect_audition_editor ();
170
171         /* keyboard/mouse */
172
173         Gtk::Table keyboard_mouse_table;
174         Gtk::ComboBoxText edit_modifier_combo;
175         Gtk::ComboBoxText delete_modifier_combo;
176         Gtk::ComboBoxText snap_modifier_combo;
177         Gtk::Adjustment delete_button_adjustment;
178         Gtk::SpinButton delete_button_spin;
179         Gtk::Adjustment edit_button_adjustment;
180         Gtk::SpinButton edit_button_spin;
181
182         void setup_keyboard_options ();
183         void delete_modifier_chosen ();
184         void edit_modifier_chosen ();
185         void snap_modifier_chosen ();
186         void edit_button_changed ();
187         void delete_button_changed ();
188
189         void fixup_combo_size (Gtk::ComboBoxText&, std::vector<std::string>& strings);
190 };
191
192 #endif /* __gtk_ardour_option_editor_h__ */
193
194