2 Copyright (C) 2001 Paul Davis
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.
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.
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.
21 #include <ardour/session.h>
22 #include <ardour/audioengine.h>
23 #include <ardour/configuration.h>
24 #include <ardour/auditioner.h>
25 #include <ardour/crossfade.h>
26 #include <midi++/manager.h>
27 #include <gtkmm2ext/stop_signal.h>
28 #include <gtkmm2ext/utils.h>
30 #include "public_editor.h"
32 #include "ardour_ui.h"
33 #include "io_selector.h"
34 #include "gain_meter.h"
38 #include "option_editor.h"
42 using namespace ARDOUR;
44 using namespace Editing;
45 using namespace Gtkmm2ext;
48 static const gchar *psync_strings[] = {
52 N_("never used but stops crashes"),
56 static const gchar *lmode_strings[] = {
57 N_("Later regions are higher"),
58 N_("Most recently added/moved/trimmed regions are higher"),
59 N_("Most recently added regions are higher"),
63 static const gchar *xfl_strings[] = {
64 N_("Span entire region overlap"),
65 N_("Short fades at the start of the overlap"),
69 static vector<string> positional_sync_strings;
70 static vector<string> layer_mode_strings;
71 static vector<string> xfade_model_strings;
73 OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
74 : ArdourDialog ("option editor"),
83 auto_xfade_button (_("Automatically create crossfades")),
84 xfade_active_button (_("New full-overlap crossfades are unmuted")),
85 layer_mode_label (_("Region layering mode")),
86 xfade_model_label (_("Crossfade model")),
87 short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
88 short_xfade_slider (short_xfade_adjustment),
91 solo_latched_button (_("Latched solo")),
92 solo_via_bus_button (_("Solo via bus")),
96 show_waveforms_button (_("Show waveforms")),
97 show_waveforms_recording_button (_("Show waveforms while recording")),
98 mixer_strip_width_button (_("Narrow mixer strips")),
99 show_measures_button (_("Show measure lines")),
100 follow_playhead_button (_("Follow playhead")),
104 send_mtc_button (_("Send MTC")),
105 send_mmc_button (_("Send MMC")),
106 jack_time_master_button (_("JACK time master")),
107 smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
108 smpte_offset_negative_button (_("SMPTE offset is negative")),
112 midi_feedback_button (_("Send MIDI parameter feedback")),
113 midi_control_button (_("MIDI parameter control")),
114 mmc_control_button (_("MMC control")),
119 click_browse_button (_("Browse")),
120 click_emphasis_browse_button (_("Browse")),
124 keyboard_mouse_table (3, 4),
125 delete_button_adjustment (3, 1, 5),
126 delete_button_spin (delete_button_adjustment),
127 edit_button_adjustment (3, 1, 5),
128 edit_button_spin (edit_button_adjustment),
132 auto_connect_inputs_button (_("Auto-connect new track inputs to hardware")),
133 auto_connect_output_physical_button (_("Auto-connect new track outputs to hardware")),
134 auto_connect_output_master_button (_("Auto-connect new track outputs to master bus")),
135 auto_connect_output_manual_button (_("Manually connect new track outputs")),
136 hw_monitor_button(_("Use Hardware Monitoring")),
137 sw_monitor_button(_("Use Software Monitoring")),
138 plugins_stop_button (_("Stop plugins with transport")),
139 plugins_on_rec_button (_("Run plugins while recording")),
140 verify_remove_last_capture_button (_("Verify remove last capture")),
141 stop_rec_on_xrun_button (_("Stop recording on xrun")),
142 stop_at_end_button (_("Stop transport at end of session")),
143 debug_keyboard_button (_("Debug keyboard events")),
144 speed_quieten_button (_("-12dB gain reduction for ffwd/rew"))
147 using namespace Notebook_Helpers;
149 click_io_selector = 0;
150 auditioner_io_selector = 0;
152 set_default_size (300, 300);
153 set_title (_("ardour: options editor"));
154 set_wmclass (_("ardour_option_editor"), "Ardour");
156 set_name ("OptionsWindow");
157 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
159 layer_mode_label.set_name ("OptionsLabel");
160 xfade_model_label.set_name ("OptionsLabel");
162 VBox *vbox = manage(new VBox);
164 set_border_width (3);
166 vbox->set_spacing (4);
167 vbox->pack_start(notebook);
169 signal_delete_event().connect (mem_fun(*this, &OptionEditor::wm_close));
171 notebook.set_show_tabs (true);
172 notebook.set_show_border (true);
173 notebook.set_name ("OptionsNotebook");
175 setup_sync_options();
176 setup_path_options();
177 setup_fade_options ();
178 setup_solo_options ();
179 setup_display_options ();
180 setup_misc_options ();
181 setup_keyboard_options ();
182 setup_auditioner_editor ();
184 notebook.pages().push_back (TabElem (misc_packer, _("Misc")));
185 notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
186 notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
187 notebook.pages().push_back (TabElem (display_packer, _("Display")));
188 notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
189 notebook.pages().push_back (TabElem (click_packer, _("Click")));
190 notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
191 notebook.pages().push_back (TabElem (fade_packer, _("Layers & Fades")));
192 notebook.pages().push_back (TabElem (solo_packer, _("Solo")));
194 if (!MIDI::Manager::instance()->get_midi_ports().empty()) {
195 setup_midi_options ();
196 notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
203 OptionEditor::set_session (Session *s)
205 clear_click_editor ();
206 clear_auditioner_editor ();
208 click_path_entry.set_text ("");
209 click_emphasis_path_entry.set_text ("");
210 session_raid_entry.set_text ("");
212 send_mtc_button.set_sensitive (false);
213 send_mmc_button.set_sensitive (false);
214 midi_feedback_button.set_sensitive (false);
215 midi_control_button.set_sensitive (false);
216 mmc_control_button.set_sensitive (false);
217 click_path_entry.set_sensitive (false);
218 click_emphasis_path_entry.set_sensitive (false);
219 session_raid_entry.set_sensitive (false);
220 plugins_on_rec_button.set_sensitive (false);
221 verify_remove_last_capture_button.set_sensitive (false);
222 slave_type_combo.set_sensitive (false);
223 solo_latched_button.set_sensitive (false);
224 solo_via_bus_button.set_sensitive (false);
225 smpte_fps_combo.set_sensitive (false);
226 meter_hold_combo.set_sensitive (false);
227 meter_falloff_combo.set_sensitive (false);
228 auto_connect_inputs_button.set_sensitive (false);
229 auto_connect_output_physical_button.set_sensitive (false);
230 auto_connect_output_master_button.set_sensitive (false);
231 auto_connect_output_manual_button.set_sensitive (false);
232 layer_mode_combo.set_sensitive (false);
233 short_xfade_slider.set_sensitive (false);
234 smpte_offset_negative_button.set_sensitive (false);
236 smpte_offset_clock.set_session (s);
238 if ((session = s) == 0) {
242 send_mtc_button.set_sensitive (true);
243 send_mmc_button.set_sensitive (true);
244 midi_feedback_button.set_sensitive (true);
245 midi_control_button.set_sensitive (true);
246 mmc_control_button.set_sensitive (true);
247 click_path_entry.set_sensitive (true);
248 click_emphasis_path_entry.set_sensitive (true);
249 session_raid_entry.set_sensitive (true);
250 plugins_on_rec_button.set_sensitive (true);
251 verify_remove_last_capture_button.set_sensitive (true);
252 slave_type_combo.set_sensitive (true);
253 solo_latched_button.set_sensitive (true);
254 solo_via_bus_button.set_sensitive (true);
255 smpte_fps_combo.set_sensitive (true);
256 meter_hold_combo.set_sensitive (true);
257 meter_falloff_combo.set_sensitive (true);
258 auto_connect_inputs_button.set_sensitive (true);
259 auto_connect_output_physical_button.set_sensitive (true);
260 auto_connect_output_master_button.set_sensitive (true);
261 auto_connect_output_manual_button.set_sensitive (true);
262 layer_mode_combo.set_sensitive (true);
263 short_xfade_slider.set_sensitive (true);
264 smpte_offset_negative_button.set_sensitive (true);
266 if (!s->smpte_drop_frames) {
268 if (s->smpte_frames_per_second == 24.0)
269 smpte_fps_combo.set_active_text (_("24 FPS"));
270 else if (s->smpte_frames_per_second == 25.0)
271 smpte_fps_combo.set_active_text (_("25 FPS"));
272 else if (s->smpte_frames_per_second == 30.0)
273 smpte_fps_combo.set_active_text (_("30 FPS"));
275 smpte_fps_combo.set_active_text (_("???"));
278 if (floor(s->smpte_frames_per_second) == 29.0)
279 smpte_fps_combo.set_active_text (_("30 FPS drop"));
281 smpte_fps_combo.set_active_text (_("???"));
284 smpte_offset_clock.set_session (s);
285 smpte_offset_clock.set (s->smpte_offset (), true);
287 smpte_offset_negative_button.set_active (session->smpte_offset_negative());
288 send_mtc_button.set_active (session->get_send_mtc());
292 send_mmc_button.set_active (session->get_send_mmc());
293 midi_control_button.set_active (session->get_midi_control());
294 midi_feedback_button.set_active (session->get_midi_feedback());
295 mmc_control_button.set_active (session->get_mmc_control());
297 /* set up port assignments */
299 std::map<MIDI::Port*,vector<RadioButton*> >::iterator res;
301 if (session->mtc_port()) {
302 if ((res = port_toggle_buttons.find (session->mtc_port())) != port_toggle_buttons.end()) {
303 (*res).second[MtcIndex]->set_active (true);
307 if (session->mmc_port ()) {
308 if ((res = port_toggle_buttons.find (session->mmc_port())) != port_toggle_buttons.end()) {
309 (*res).second[MmcIndex]->set_active (true);
313 if (session->midi_port()) {
314 if ((res = port_toggle_buttons.find (session->midi_port())) != port_toggle_buttons.end()) {
315 (*res).second[MidiIndex]->set_active (true);
319 auto_connect_inputs_button.set_active (session->get_input_auto_connect());
321 Session::AutoConnectOption oac = session->get_output_auto_connect();
322 if (oac & Session::AutoConnectPhysical) {
323 auto_connect_output_physical_button.set_active (true);
324 } else if (oac & Session::AutoConnectMaster) {
325 auto_connect_output_master_button.set_active (true);
327 auto_connect_output_manual_button.set_active (true);
330 setup_click_editor ();
331 connect_audition_editor ();
333 plugins_on_rec_button.set_active (session->get_recording_plugins ());
334 verify_remove_last_capture_button.set_active (Config->get_verify_remove_last_capture());
336 layer_mode_combo.set_active_text (layer_mode_strings[session->get_layer_model()]);
337 xfade_model_combo.set_active_text (xfade_model_strings[session->get_xfade_model()]);
339 short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
341 xfade_active_button.set_active (session->get_crossfades_active());
342 solo_latched_button.set_active (session->solo_latched());
343 solo_via_bus_button.set_active (session->solo_model() == Session::SoloBus);
345 add_session_paths ();
348 dumb.push_back (positional_sync_strings[Session::None]);
349 dumb.push_back (positional_sync_strings[Session::JACK]);
350 if (session->mtc_port()) {
351 dumb.push_back (positional_sync_strings[Session::MTC]);
353 set_popdown_strings (slave_type_combo, dumb);
356 if (session->meter_falloff() == 0.0f) {
357 meter_falloff_combo.set_active_text (_("Off"));
358 } else if (session->meter_falloff() <= 0.3f) {
359 meter_falloff_combo.set_active_text (_("Slowest"));
360 } else if (session->meter_falloff() <= 0.4f) {
361 meter_falloff_combo.set_active_text (_("Slow"));
362 } else if (session->meter_falloff() <= 0.8f) {
363 meter_falloff_combo.set_active_text (_("Medium"));
364 } else if (session->meter_falloff() <= 1.4f) {
365 meter_falloff_combo.set_active_text (_("Fast"));
366 } else if (session->meter_falloff() <= 2.0f) {
367 meter_falloff_combo.set_active_text (_("Faster"));
369 meter_falloff_combo.set_active_text (_("Fastest"));
372 switch ((int) floor (session->meter_hold())) {
374 meter_hold_combo.set_active_text (_("Off"));
377 meter_hold_combo.set_active_text (_("Short"));
380 meter_hold_combo.set_active_text (_("Medium"));
383 meter_hold_combo.set_active_text (_("Long"));
387 session_control_changed (Session::SlaveType);
388 session_control_changed (Session::AlignChoice);
389 session->ControlChanged.connect (mem_fun(*this, &OptionEditor::queue_session_control_changed));
392 OptionEditor::~OptionEditor ()
396 static const gchar *native_format_strings[] = {
397 N_("Broadcast WAVE/floating point"),
398 N_("WAVE/floating point"),
403 OptionEditor::setup_path_options()
407 path_table.set_homogeneous (true);
408 path_table.set_border_width (12);
409 path_table.set_row_spacings (5);
411 session_raid_entry.set_name ("OptionsEntry");
413 session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
415 session_raid_entry.signal_focus_in_event().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
416 session_raid_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::raid_path_changed));
418 label = manage(new Label(_("session RAID path")));
419 label->set_name ("OptionsLabel");
420 path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
421 path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
423 label = manage(new Label(_("Native Format")));
424 label->set_name ("OptionsLabel");
425 path_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
426 path_table.attach (native_format_combo, 1, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
428 vector<string> nfstrings = internationalize (native_format_strings);
430 set_popdown_strings (native_format_combo, nfstrings);
431 native_format_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::native_format_chosen));
433 fixup_combo_size (native_format_combo, nfstrings);
435 if (Config->get_native_format_is_bwf()) {
436 native_format_combo.set_active_text (native_format_strings[0]);
438 native_format_combo.set_active_text (native_format_strings[1]);
441 path_table.show_all();
445 OptionEditor::add_session_paths ()
447 click_path_entry.set_sensitive (true);
448 click_emphasis_path_entry.set_sensitive (true);
449 session_raid_entry.set_sensitive (true);
451 if (session->click_sound.length() == 0) {
452 click_path_entry.set_text (_("internal"));
454 click_path_entry.set_text (session->click_sound);
457 if (session->click_emphasis_sound.length() == 0) {
458 click_emphasis_path_entry.set_text (_("internal"));
460 click_emphasis_path_entry.set_text (session->click_emphasis_sound);
463 session_raid_entry.set_text(session->raid_path());
467 OptionEditor::setup_fade_options ()
472 auto_xfade_button.set_name ("OptionEditorToggleButton");
473 xfade_active_button.set_name ("OptionEditorToggleButton");
475 hbox = manage (new HBox);
476 hbox->set_border_width (12);
477 hbox->pack_start (auto_xfade_button, false, false);
478 fade_packer.pack_start (*hbox, false, false);
480 hbox = manage (new HBox);
481 hbox->set_border_width (12);
482 hbox->pack_start (xfade_active_button, false, false);
483 fade_packer.pack_start (*hbox, false, false);
485 layer_mode_strings = internationalize (lmode_strings);
487 dumb.push_back (lmode_strings[Session::LaterHigher]);
488 dumb.push_back (lmode_strings[Session::MoveAddHigher]);
489 dumb.push_back (lmode_strings[Session::AddHigher]);
490 set_popdown_strings (layer_mode_combo, dumb);
492 layer_mode_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::layer_mode_chosen));
494 fixup_combo_size (layer_mode_combo, layer_mode_strings);
496 hbox = manage (new HBox);
497 hbox->set_border_width (5);
498 hbox->set_spacing (10);
499 hbox->pack_start (layer_mode_label, false, false);
500 hbox->pack_start (layer_mode_combo, false, false);
501 fade_packer.pack_start (*hbox, false, false);
503 xfade_model_strings = internationalize (xfl_strings);
506 dumb.push_back (xfade_model_strings[FullCrossfade]);
507 dumb.push_back (xfade_model_strings[ShortCrossfade]);
508 set_popdown_strings (xfade_model_combo, dumb);
510 xfade_model_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::xfade_model_chosen));
512 fixup_combo_size (xfade_model_combo, xfade_model_strings);
514 hbox = manage (new HBox);
515 hbox->set_border_width (5);
516 hbox->set_spacing (10);
517 hbox->pack_start (xfade_model_label, false, false);
518 hbox->pack_start (xfade_model_combo, false, false);
519 fade_packer.pack_start (*hbox, false, false);
521 auto_xfade_button.set_active (Config->get_auto_xfade());
522 /* xfade and layer mode active requires session */
524 auto_xfade_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_xfade_clicked));
525 xfade_active_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::xfade_active_clicked));
527 Label* short_xfade_label = manage (new Label (_("Short crossfade length (msecs)")));
528 short_xfade_label->set_name ("OptionsLabel");
530 hbox = manage (new HBox);
531 hbox->set_border_width (5);
532 hbox->set_spacing (10);
533 hbox->pack_start (*short_xfade_label, false, false);
534 hbox->pack_start (short_xfade_slider, true, true);
535 fade_packer.pack_start (*hbox, false, false);
537 short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
539 fade_packer.show_all ();
543 OptionEditor::short_xfade_adjustment_changed ()
546 float val = short_xfade_adjustment.get_value();
548 /* val is in msecs */
550 Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
555 OptionEditor::layer_mode_chosen (GdkEventAny* ev)
561 string which = layer_mode_combo.get_active_text ();
563 if (which == layer_mode_strings[Session::LaterHigher]) {
564 session->set_layer_model (Session::LaterHigher);
565 } else if (which == layer_mode_strings[Session::MoveAddHigher]) {
566 session->set_layer_model (Session::MoveAddHigher);
567 } else if (which == layer_mode_strings[Session::AddHigher]) {
568 session->set_layer_model (Session::AddHigher);
574 OptionEditor::xfade_model_chosen (GdkEventAny* ev)
580 string which = xfade_model_combo.get_active_text ();
582 if (which == xfade_model_strings[FullCrossfade]) {
583 session->set_xfade_model (FullCrossfade);
584 } else if (which == xfade_model_strings[ShortCrossfade]) {
585 session->set_xfade_model (ShortCrossfade);
591 OptionEditor::auto_xfade_clicked ()
593 Config->set_auto_xfade (auto_xfade_button.get_active());
597 OptionEditor::xfade_active_clicked ()
600 session->set_crossfades_active (xfade_active_button.get_active());
605 OptionEditor::setup_solo_options ()
609 solo_via_bus_button.set_name ("OptionEditorToggleButton");
610 solo_latched_button.set_name ("OptionEditorToggleButton");
612 hbox = manage (new HBox);
613 hbox->set_border_width (12);
614 hbox->pack_start (solo_via_bus_button, false, false);
615 solo_packer.pack_start (*hbox, false, false);
617 hbox = manage (new HBox);
618 hbox->set_border_width (12);
619 hbox->pack_start (solo_latched_button, false, false);
620 solo_packer.pack_start (*hbox, false, false);
622 solo_via_bus_button.signal_clicked().connect
623 (mem_fun(*this, &OptionEditor::solo_via_bus_clicked));
624 solo_latched_button.signal_clicked().connect
625 (mem_fun(*this, &OptionEditor::solo_latched_clicked));
627 solo_packer.show_all ();
631 OptionEditor::solo_via_bus_clicked ()
637 if (solo_via_bus_button.get_active()) {
638 session->set_solo_model (Session::SoloBus);
640 session->set_solo_model (Session::InverseMute);
645 OptionEditor::solo_latched_clicked ()
651 bool x = solo_latched_button.get_active();
653 if (x != session->solo_latched()) {
654 session->set_solo_latched (x);
659 OptionEditor::setup_display_options ()
664 display_packer.set_border_width (12);
665 display_packer.set_spacing (5);
667 show_waveforms_button.set_name ("OptionEditorToggleButton");
668 show_waveforms_recording_button.set_name ("OptionEditorToggleButton");
669 show_measures_button.set_name ("OptionEditorToggleButton");
670 follow_playhead_button.set_name ("OptionEditorToggleButton");
671 mixer_strip_width_button.set_name ("OptionEditorToggleButton");
673 mixer_strip_width_button.set_active (mixer.get_strip_width() == Narrow);
675 hbox = manage (new HBox);
676 hbox->set_border_width (8);
677 hbox->pack_start (show_waveforms_button, false, false);
678 display_packer.pack_start (*hbox, false, false);
680 hbox = manage (new HBox);
681 hbox->set_border_width (8);
682 hbox->pack_start (show_waveforms_recording_button, false, false);
683 display_packer.pack_start (*hbox, false, false);
685 hbox = manage (new HBox);
686 hbox->set_border_width (8);
687 hbox->pack_start (show_measures_button, false, false);
688 display_packer.pack_start (*hbox, false, false);
690 hbox = manage (new HBox);
691 hbox->set_border_width (8);
692 hbox->pack_start (mixer_strip_width_button, false, false);
693 display_packer.pack_start (*hbox, false, false);
695 hbox = manage (new HBox);
696 hbox->set_border_width (8);
697 hbox->pack_start (follow_playhead_button, false, false);
698 display_packer.pack_start (*hbox, false, false);
700 Label *meter_hold_label = manage (new Label (_("Meter Peak Hold")));
701 meter_hold_label->set_name ("OptionsLabel");
703 dumb.push_back (_("Off"));
704 dumb.push_back (_("Short"));
705 dumb.push_back (_("Medium"));
706 dumb.push_back (_("Long"));
707 set_popdown_strings (meter_hold_combo, dumb);
708 meter_hold_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::meter_hold_chosen));
709 hbox = manage (new HBox);
710 hbox->set_border_width (8);
711 hbox->set_spacing (8);
712 hbox->pack_start (*meter_hold_label, false, false);
713 hbox->pack_start (meter_hold_combo, false, false);
714 display_packer.pack_start (*hbox, false, false);
716 Label *meter_falloff_label = manage (new Label (_("Meter Falloff")));
717 meter_falloff_label->set_name ("OptionsLabel");
719 dumb.push_back (_("Off"));
720 dumb.push_back (_("Slowest"));
721 dumb.push_back (_("Slow"));
722 dumb.push_back (_("Medium"));
723 dumb.push_back (_("Fast"));
724 dumb.push_back (_("Faster"));
725 dumb.push_back (_("Fastest"));
726 set_popdown_strings (meter_falloff_combo, dumb);
727 meter_falloff_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::meter_falloff_chosen));
728 hbox = manage (new HBox);
729 hbox->set_border_width (8);
730 hbox->set_spacing (8);
731 hbox->pack_start (*meter_falloff_label, false, false);
732 hbox->pack_start (meter_falloff_combo, false, false);
733 display_packer.pack_start (*hbox, false, false);
736 show_waveforms_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_clicked));
737 show_waveforms_recording_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_recording_clicked));
738 show_measures_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_measures_clicked));
739 mixer_strip_width_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::strip_width_clicked));
740 follow_playhead_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::follow_playhead_clicked));
742 editor.DisplayControlChanged.connect (mem_fun(*this, &OptionEditor::display_control_changed));
744 show_measures_button.set_active (editor.show_measures());
745 show_waveforms_button.set_active (editor.show_waveforms());
746 show_waveforms_recording_button.set_active (editor.show_waveforms_recording());
747 follow_playhead_button.set_active (editor.follow_playhead());
751 OptionEditor::meter_hold_chosen (GdkEventAny* ev)
754 string str = meter_hold_combo.get_active_text();
756 if (str == _("Off")) {
757 session->set_meter_hold (0);
758 } else if (str == _("Short")) {
759 session->set_meter_hold (40);
760 } else if (str == _("Medium")) {
761 session->set_meter_hold (100);
762 } else if (str == _("Long")) {
763 session->set_meter_hold (200);
771 OptionEditor::meter_falloff_chosen (GdkEventAny* ev)
774 string str = meter_falloff_combo.get_active_text();
776 if (str == _("Off")) {
777 session->set_meter_falloff (0.0f);
778 } else if (str == _("Slowest")) {
779 session->set_meter_falloff (0.266f); // 6.6 dB/sec falloff at update rate of 40 ms
780 } else if (str == _("Slow")) {
781 session->set_meter_falloff (0.342f); // 8.6 dB/sec falloff at update rate of 40 ms
782 } else if (str == _("Medium")) {
783 session->set_meter_falloff (0.7f);
784 } else if (str == _("Fast")) {
785 session->set_meter_falloff (1.1f);
786 } else if (str == _("Faster")) {
787 session->set_meter_falloff (1.5f);
788 } else if (str == _("Fastest")) {
789 session->set_meter_falloff (2.5f);
797 OptionEditor::display_control_changed (Editing::DisplayControl dc)
799 ToggleButton* button = 0;
804 val = editor.show_measures ();
805 button = &show_measures_button;
808 val = editor.show_waveforms ();
809 button = &show_waveforms_button;
811 case ShowWaveformsRecording:
812 val = editor.show_waveforms_recording ();
813 button = &show_waveforms_recording_button;
816 val = editor.follow_playhead ();
817 button = &follow_playhead_button;
821 if (button->get_active() != val) {
822 button->set_active (val);
827 OptionEditor::setup_sync_options ()
829 Label *slave_type_label = manage (new Label (_("Positional Sync")));
833 slave_type_label->set_name("OptionsLabel");
834 positional_sync_strings = internationalize (psync_strings);
836 slave_type_combo.set_name ("OptionsEntry");
837 slave_type_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::slave_type_chosen));
840 dumb.push_back (X_("24 FPS"));
841 dumb.push_back (X_("25 FPS"));
842 dumb.push_back (X_("30 FPS drop"));
843 dumb.push_back (X_("30 FPS non-drop"));
845 set_popdown_strings (smpte_fps_combo, dumb);
846 smpte_fps_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
848 smpte_offset_clock.set_mode (AudioClock::SMPTE);
849 smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
851 send_mtc_button.set_name ("OptionEditorToggleButton");
852 jack_time_master_button.set_name ("OptionEditorToggleButton");
853 smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
855 send_mtc_button.unset_flags (Gtk::CAN_FOCUS);
856 jack_time_master_button.unset_flags (Gtk::CAN_FOCUS);
857 smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
859 hbox = manage (new HBox);
860 hbox->set_border_width (5);
861 hbox->set_spacing (10);
862 hbox->pack_start (*slave_type_label, false, false);
863 hbox->pack_start (slave_type_combo, false, false);
865 sync_packer.pack_start (*hbox, false, false);
867 hbox = manage (new HBox);
868 hbox->set_border_width (5);
869 hbox->pack_start (send_mtc_button, false, false);
870 sync_packer.pack_start (*hbox, false, false);
872 hbox = manage (new HBox);
873 hbox->set_border_width (5);
874 hbox->pack_start (jack_time_master_button, false, false);
875 sync_packer.pack_start (*hbox, false, false);
877 Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
878 Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
879 smpte_fps_label->set_name("OptionsLabel");
880 smpte_offset_label->set_name("OptionsLabel");
882 hbox = manage (new HBox);
883 hbox->set_border_width (5);
884 hbox->set_spacing (10);
885 hbox->pack_start (*smpte_fps_label, false, false);
886 hbox->pack_start (smpte_fps_combo, false, false);
888 sync_packer.pack_start (*hbox, false, false);
890 hbox = manage (new HBox);
891 hbox->set_border_width (5);
892 hbox->set_spacing (10);
893 hbox->pack_start (*smpte_offset_label, false, false);
894 hbox->pack_start (smpte_offset_clock, false, false);
895 hbox->pack_start (smpte_offset_negative_button, false, false);
897 sync_packer.pack_start (*hbox, false, false);
899 jack_time_master_button.set_active (Config->get_jack_time_master());
901 send_mtc_button.signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::send_mtc_toggled), &send_mtc_button));
902 jack_time_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::jack_time_master_clicked));
903 smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
907 OptionEditor::smpte_offset_negative_clicked ()
910 session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
915 OptionEditor::smpte_fps_chosen (GdkEventAny* ev)
918 string str = smpte_fps_combo.get_active_text();
920 if (str == X_("24 FPS")) {
921 session->set_smpte_type (24.0, false);
922 } else if (str == X_("25 FPS")) {
923 session->set_smpte_type (25.0, false);
924 } else if (str == X_("30 FPS drop")) {
925 session->set_smpte_type (29.97, true);
926 } else if (str == X_("30 FPS non-drop")) {
927 session->set_smpte_type (30.0, false);
935 OptionEditor::smpte_offset_chosen()
938 jack_nframes_t frames = smpte_offset_clock.current_duration();
939 session->set_smpte_offset (frames);
945 OptionEditor::setup_midi_options ()
948 MIDI::Manager::PortMap::const_iterator i;
949 const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
954 Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
956 table->set_row_spacings (6);
957 table->set_col_spacings (10);
959 table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
960 table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
961 table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
962 table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
963 table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
964 table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
965 table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
967 table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
968 table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
969 table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
971 for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
973 pair<MIDI::Port*,vector<RadioButton*> > newpair;
975 newpair.first = i->second;
977 table->attach (*(manage (new Label (i->first))), 0, 1, n+2, n+3,FILL|EXPAND, FILL );
978 tb = manage (new ToggleButton (_("online")));
979 tb->set_name ("OptionEditorToggleButton");
981 /* remember, we have to handle the i18n case where the relative
982 lengths of the strings in language N is different than in english.
985 if (strlen (_("offline")) > strlen (_("online"))) {
986 set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
988 set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
991 tb->set_active (!(*i).second->input()->offline());
992 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
993 (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
994 table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
996 tb = manage (new ToggleButton ());
997 tb->set_name ("OptionEditorToggleButton");
998 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
999 tb->set_size_request (10, 10);
1000 table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
1002 tb = manage (new ToggleButton ());
1003 tb->set_name ("OptionEditorToggleButton");
1004 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
1005 tb->set_size_request (10, 10);
1006 table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
1008 rb = manage (new RadioButton ());
1009 newpair.second.push_back (rb);
1010 rb->set_name ("OptionEditorToggleButton");
1012 mtc_button_group = rb->get_group();
1014 rb->set_group (mtc_button_group);
1016 table->attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL);
1017 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb));
1019 if (Config->get_mtc_port_name() == i->first) {
1020 rb->set_active (true);
1023 rb = manage (new RadioButton ());
1024 newpair.second.push_back (rb);
1025 rb->set_name ("OptionEditorToggleButton");
1027 mmc_button_group = rb->get_group();
1029 rb->set_group (mmc_button_group);
1031 table->attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
1032 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb));
1034 if (Config->get_mmc_port_name() == i->first) {
1035 rb->set_active (true);
1038 rb = manage (new RadioButton ());
1039 newpair.second.push_back (rb);
1040 rb->set_name ("OptionEditorToggleButton");
1042 midi_button_group = rb->get_group();
1044 rb->set_group (midi_button_group);
1046 table->attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
1047 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb));
1049 if (Config->get_midi_port_name() == i->first) {
1050 rb->set_active (true);
1053 port_toggle_buttons.insert (newpair);
1058 hbox = manage (new HBox);
1059 hbox->set_border_width (6);
1060 hbox->pack_start (*table, true, false);
1061 midi_packer.pack_start (*hbox, false, false);
1063 VBox* mmcbuttonbox = manage (new VBox);
1065 mmc_control_button.set_name ("OptionEditorToggleButton");
1067 hbox = manage (new HBox);
1068 hbox->set_border_width (6);
1069 hbox->pack_start (mmc_control_button, false, false, 36);
1070 mmcbuttonbox->pack_start (*hbox, false, false);
1072 midi_control_button.set_name ("OptionEditorToggleButton");
1074 hbox = manage (new HBox);
1075 hbox->set_border_width (6);
1076 hbox->pack_start (midi_control_button, false, false, 36);
1077 mmcbuttonbox->pack_start (*hbox, false, false);
1079 send_mmc_button.set_name ("OptionEditorToggleButton");
1081 hbox = manage (new HBox);
1082 hbox->set_border_width (6);
1083 hbox->pack_start (send_mmc_button, false, false, 36);
1084 mmcbuttonbox->pack_start (*hbox, false, false);
1086 midi_feedback_button.set_name ("OptionEditorToggleButton");
1088 hbox = manage (new HBox);
1089 hbox->set_border_width (6);
1090 hbox->pack_start (midi_feedback_button, false, false, 36);
1091 mmcbuttonbox->pack_start (*hbox, false, false);
1093 midi_packer.pack_start (*mmcbuttonbox, false, false);
1095 mmc_control_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_control_toggled), &mmc_control_button));
1096 midi_control_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_control_toggled), &midi_control_button));
1097 send_mmc_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::send_mmc_toggled), &send_mmc_button));
1098 midi_feedback_button.signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_feedback_toggled), &midi_feedback_button));
1102 OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioButton* rb)
1105 if (!rb->get_active()) {
1107 session->set_mtc_port (port->name());
1108 Config->set_mtc_port_name (port->name());
1110 session->set_mtc_port ("");
1113 /* update sync options to reflect MTC port availability */
1115 vector<string> dumb;
1116 dumb.push_back (positional_sync_strings[Session::None]);
1117 dumb.push_back (positional_sync_strings[Session::JACK]);
1119 if (session->mtc_port()) {
1120 dumb.push_back (positional_sync_strings[Session::MTC]);
1122 set_popdown_strings (slave_type_combo, dumb);
1124 rb->set_active (true);
1128 return stop_signal (*rb, "button_press_event");
1132 OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
1135 if (!rb->get_active()) {
1137 session->set_mmc_port (port->name());
1138 Config->set_mtc_port_name (port->name());
1140 session->set_mmc_port ("");
1142 rb->set_active (true);
1145 return stop_signal (*rb, "button_press_event");
1149 OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
1152 if (!rb->get_active()) {
1154 session->set_midi_port (port->name());
1155 Config->set_midi_port_name (port->name());
1157 session->set_midi_port ("");
1159 rb->set_active (true);
1162 return stop_signal (*rb, "button_press_event");
1166 OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
1168 bool wanted = tb->get_active(); /* it hasn't changed at this point */
1170 if (wanted != port->input()->offline()) {
1171 port->input()->set_offline (wanted);
1173 return stop_signal (*tb, "button_press_event");
1177 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
1179 if (port->input()->offline()) {
1180 static_cast<Label*>(tb->get_child())->set_text (_("offline"));
1181 tb->set_active (false);
1183 static_cast<Label*>(tb->get_child())->set_text (_("online"));
1184 tb->set_active (true);
1189 OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
1191 /* XXX not very good MVC style here */
1193 port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
1194 tb->set_active (!tb->get_active());
1195 return stop_signal (*tb, "button_press_event");
1199 OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
1201 /* XXX not very good MVC style here */
1203 port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
1204 tb->set_active (!tb->get_active());
1205 return stop_signal (*tb, "button_press_event");
1209 OptionEditor::send_mtc_toggled (GdkEventButton *ev, CheckButton *button)
1212 session->set_send_mtc (!button->get_active());
1214 return stop_signal (*button, "button_press_event");
1218 OptionEditor::send_mmc_toggled (CheckButton *button)
1221 session->set_send_mmc (button->get_active());
1226 OptionEditor::mmc_control_toggled (CheckButton *button)
1229 session->set_mmc_control (button->get_active());
1234 OptionEditor::midi_control_toggled (CheckButton *button)
1237 session->set_midi_control (button->get_active());
1242 OptionEditor::midi_feedback_toggled (CheckButton *button)
1245 session->set_midi_feedback (button->get_active());
1250 OptionEditor::save ()
1252 /* XXX a bit odd that we save the entire session state here */
1258 OptionEditor::wm_close (GdkEventAny *ev)
1266 OptionEditor::jack_time_master_clicked ()
1268 bool yn = jack_time_master_button.get_active();
1270 Config->set_jack_time_master (yn);
1273 session->engine().reset_timebase ();
1278 OptionEditor::raid_path_changed ()
1281 session->set_raid_path (session_raid_entry.get_text());
1286 OptionEditor::click_browse_clicked ()
1288 SoundFileChooser sfdb (_("Choose Click"));
1290 int result = sfdb.run ();
1292 if (result == Gtk::RESPONSE_OK) {
1293 click_chosen(sfdb.get_filename());
1298 OptionEditor::click_chosen (string path)
1300 click_path_entry.set_text (path);
1301 click_sound_changed ();
1305 OptionEditor::click_emphasis_browse_clicked ()
1307 SoundFileChooser sfdb (_("Choose Click Emphasis"));
1309 int result = sfdb.run ();
1311 if (result == Gtk::RESPONSE_OK) {
1312 click_emphasis_chosen (sfdb.get_filename());
1317 OptionEditor::click_emphasis_chosen (std::string path)
1319 click_emphasis_path_entry.set_text (path);
1320 click_emphasis_sound_changed ();
1324 OptionEditor::click_sound_changed ()
1327 string path = click_path_entry.get_text();
1329 if (path == session->click_sound) {
1333 if (path.length() == 0) {
1335 session->set_click_sound ("");
1339 strip_whitespace_edges (path);
1341 if (path == _("internal")) {
1342 session->set_click_sound ("");
1344 session->set_click_sound (path);
1351 OptionEditor::click_emphasis_sound_changed ()
1354 string path = click_emphasis_path_entry.get_text();
1356 if (path == session->click_emphasis_sound) {
1360 if (path.length() == 0) {
1362 session->set_click_emphasis_sound ("");
1366 strip_whitespace_edges (path);
1368 if (path == _("internal")) {
1369 session->set_click_emphasis_sound ("");
1371 session->set_click_emphasis_sound (path);
1378 OptionEditor::show_waveforms_clicked ()
1380 editor.set_show_waveforms (show_waveforms_button.get_active());
1384 OptionEditor::show_waveforms_recording_clicked ()
1386 editor.set_show_waveforms_recording (show_waveforms_recording_button.get_active());
1390 OptionEditor::show_measures_clicked ()
1392 editor.set_show_measures (show_measures_button.get_active());
1396 OptionEditor::follow_playhead_clicked ()
1398 editor.set_follow_playhead (follow_playhead_button.get_active());
1402 OptionEditor::strip_width_clicked ()
1404 mixer.set_strip_width (mixer_strip_width_button.get_active() ? Narrow : Wide);
1409 OptionEditor::just_close_win()
1412 ARDOUR_UI::instance()->allow_focus(false);
1416 OptionEditor::queue_session_control_changed (Session::ControlType t)
1418 ui.call_slot (bind (mem_fun(*this, &OptionEditor::session_control_changed), t));
1422 OptionEditor::session_control_changed (Session::ControlType t)
1425 case Session::SlaveType:
1426 switch (session->slave_source()) {
1428 slave_type_combo.set_active_text (positional_sync_strings[Session::None]);
1431 slave_type_combo.set_active_text (positional_sync_strings[Session::MTC]);
1434 slave_type_combo.set_active_text (positional_sync_strings[Session::JACK]);
1437 slave_type_combo.set_active_text (_("--unknown--"));
1443 case Session::SendMTC:
1444 map_some_session_state (send_mtc_button, &Session::get_send_mtc);
1447 case Session::SendMMC:
1448 map_some_session_state (send_mmc_button, &Session::get_send_mmc);
1451 case Session::MMCControl:
1452 map_some_session_state (mmc_control_button, &Session::get_mmc_control);
1455 case Session::MidiFeedback:
1456 map_some_session_state (midi_feedback_button, &Session::get_midi_feedback);
1459 case Session::MidiControl:
1460 map_some_session_state (midi_control_button, &Session::get_midi_control);
1469 OptionEditor::native_format_chosen (GdkEventAny *ignored)
1477 bool use_bwf = (native_format_combo.get_active_text() == native_format_strings[0]);
1479 if (use_bwf != Config->get_native_format_is_bwf()) {
1480 Config->set_native_format_is_bwf (use_bwf);
1481 session->reset_native_file_format ();
1488 OptionEditor::slave_type_chosen (GdkEventAny *ignored)
1496 which = slave_type_combo.get_active_text();
1498 if (which == positional_sync_strings[Session::None]) {
1499 session->request_slave_source (Session::None);
1500 } else if (which == positional_sync_strings[Session::MTC]) {
1501 session->request_slave_source (Session::MTC);
1502 } else if (which == positional_sync_strings[Session::JACK]) {
1503 session->request_slave_source (Session::JACK);
1509 OptionEditor::clear_click_editor ()
1511 if (click_io_selector) {
1512 click_packer.remove (*click_io_selector);
1513 click_packer.remove (*click_gpm);
1514 delete click_io_selector;
1516 click_io_selector = 0;
1522 OptionEditor::setup_click_editor ()
1525 HBox* hpacker = manage (new HBox);
1527 click_path_entry.set_sensitive (true);
1528 click_emphasis_path_entry.set_sensitive (true);
1530 click_path_entry.set_name ("OptionsEntry");
1531 click_emphasis_path_entry.set_name ("OptionsEntry");
1533 click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
1534 click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
1536 click_path_entry.signal_focus_in_event().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
1537 click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
1538 click_emphasis_path_entry.signal_focus_in_event().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
1539 click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
1541 click_browse_button.set_name ("EditorGTKButton");
1542 click_emphasis_browse_button.set_name ("EditorGTKButton");
1543 click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
1544 click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
1546 click_packer.set_border_width (12);
1547 click_packer.set_spacing (5);
1549 click_io_selector = new IOSelector (*session, session->click_io(), false);
1550 click_gpm = new GainMeter (session->click_io(), *session);
1552 click_table.set_col_spacings (10);
1554 label = manage(new Label(_("Click audio file")));
1555 label->set_name ("OptionsLabel");
1556 click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
1557 click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
1558 click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
1560 label = manage(new Label(_("Click emphasis audiofile")));
1561 label->set_name ("OptionsLabel");
1562 click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
1563 click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
1564 click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
1566 hpacker->set_spacing (10);
1567 hpacker->pack_start (*click_io_selector, false, false);
1568 hpacker->pack_start (*click_gpm, false, false);
1570 click_packer.pack_start (click_table, false, false);
1571 click_packer.pack_start (*hpacker, false, false);
1573 click_packer.show_all ();
1577 OptionEditor::clear_auditioner_editor ()
1579 if (auditioner_io_selector) {
1580 audition_hpacker.remove (*auditioner_io_selector);
1581 audition_hpacker.remove (*auditioner_gpm);
1582 delete auditioner_io_selector;
1583 delete auditioner_gpm;
1584 auditioner_io_selector = 0;
1590 OptionEditor::setup_auditioner_editor ()
1592 audition_packer.set_border_width (12);
1593 audition_packer.set_spacing (5);
1594 audition_hpacker.set_spacing (10);
1596 audition_label.set_name ("OptionEditorAuditionerLabel");
1597 audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
1598 "for listening to specific regions outside the context\n"
1599 "of the overall mix. It can be connected just like any\n"
1600 "other mixer strip."));
1602 audition_packer.pack_start (audition_label, false, false, 10);
1603 audition_packer.pack_start (audition_hpacker, false, false);
1607 OptionEditor::connect_audition_editor ()
1609 auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
1610 auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
1612 audition_hpacker.pack_start (*auditioner_io_selector, false, false);
1613 audition_hpacker.pack_start (*auditioner_gpm, false, false);
1615 auditioner_io_selector->show_all ();
1616 auditioner_gpm->show_all ();
1620 OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
1623 return Keyboard::the_keyboard().focus_out_handler (ev);
1627 OptionEditor::setup_misc_options()
1629 Gtk::Table* table = manage (new Table (4, 2));
1630 table->set_homogeneous (true);
1632 misc_packer.set_border_width (8);
1633 misc_packer.set_spacing (3);
1634 misc_packer.pack_start (*table, true, true);
1636 table->attach (hw_monitor_button, 0, 1, 0, 1, Gtk::FILL, FILL, 8, 0);
1637 table->attach (sw_monitor_button, 0, 1, 1, 2, Gtk::FILL, FILL, 8, 0);
1638 table->attach (plugins_stop_button, 0, 1, 2, 3, Gtk::FILL, FILL, 8, 0);
1639 table->attach (plugins_on_rec_button, 0, 1, 3, 4, Gtk::FILL, FILL, 8, 0);
1640 table->attach (verify_remove_last_capture_button, 0, 1, 4, 5, Gtk::FILL, FILL, 8, 0);
1642 table->attach (stop_rec_on_xrun_button, 1, 2, 0, 1, Gtk::FILL, FILL, 8, 0);
1643 table->attach (stop_at_end_button, 1, 2, 1, 2, Gtk::FILL, FILL, 8, 0);
1644 table->attach (debug_keyboard_button, 1, 2, 2, 3, Gtk::FILL, FILL, 8, 0);
1645 table->attach (speed_quieten_button, 1, 2, 3, 4, Gtk::FILL, FILL, 8, 0);
1647 Gtk::VBox* connect_box = manage (new VBox);
1648 connect_box->set_spacing (3);
1649 connect_box->set_border_width (8);
1651 auto_connect_output_button_group = auto_connect_output_master_button.get_group();
1652 auto_connect_output_manual_button.set_group (auto_connect_output_button_group);
1653 auto_connect_output_physical_button.set_group (auto_connect_output_button_group);
1655 Gtk::HBox* useless_box = manage (new HBox);
1656 useless_box->pack_start (auto_connect_inputs_button, false, false);
1657 connect_box->pack_start (*useless_box, false, false);
1658 connect_box->pack_start (auto_connect_output_master_button, false, false);
1659 connect_box->pack_start (auto_connect_output_physical_button, false, false);
1660 connect_box->pack_start (auto_connect_output_manual_button, false, false);
1662 misc_packer.pack_start (*connect_box, false, false);
1664 hw_monitor_button.set_name ("OptionEditorToggleButton");
1665 sw_monitor_button.set_name ("OptionEditorToggleButton");
1666 plugins_stop_button.set_name ("OptionEditorToggleButton");
1667 plugins_on_rec_button.set_name ("OptionEditorToggleButton");
1668 verify_remove_last_capture_button.set_name ("OptionEditorToggleButton");
1669 auto_connect_inputs_button.set_name ("OptionEditorToggleButton");
1670 auto_connect_output_physical_button.set_name ("OptionEditorToggleButton");
1671 auto_connect_output_master_button.set_name ("OptionEditorToggleButton");
1672 auto_connect_output_manual_button.set_name ("OptionEditorToggleButton");
1673 stop_rec_on_xrun_button.set_name ("OptionEditorToggleButton");
1674 stop_at_end_button.set_name ("OptionEditorToggleButton");
1675 debug_keyboard_button.set_name ("OptionEditorToggleButton");
1676 speed_quieten_button.set_name ("OptionEditorToggleButton");
1678 hw_monitor_button.set_active (Config->get_use_hardware_monitoring());
1679 sw_monitor_button.set_active (!Config->get_no_sw_monitoring());
1680 plugins_stop_button.set_active (Config->get_plugins_stop_with_transport());
1681 stop_rec_on_xrun_button.set_active (Config->get_stop_recording_on_xrun());
1682 stop_at_end_button.set_active (Config->get_stop_at_session_end());
1683 debug_keyboard_button.set_active (false);
1684 speed_quieten_button.set_active (Config->get_quieten_at_speed() != 1.0f);
1686 hw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::hw_monitor_clicked));
1687 sw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::sw_monitor_clicked));
1688 plugins_stop_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_stop_with_transport_clicked));
1689 plugins_on_rec_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_on_while_recording_clicked));
1690 verify_remove_last_capture_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::verify_remove_last_capture_clicked));
1691 auto_connect_inputs_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_inputs_clicked));
1692 auto_connect_output_physical_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_physical_clicked));
1693 auto_connect_output_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_master_clicked));
1694 auto_connect_output_manual_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_manual_clicked));
1695 stop_rec_on_xrun_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_rec_on_xrun_clicked));
1696 stop_at_end_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_at_end_clicked));
1697 debug_keyboard_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::debug_keyboard_clicked));
1698 speed_quieten_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::speed_quieten_clicked));
1702 OptionEditor::speed_quieten_clicked ()
1704 if (speed_quieten_button.get_active()) {
1705 Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
1707 Config->set_quieten_at_speed (1.0); /* no change */
1712 OptionEditor::debug_keyboard_clicked ()
1714 extern bool debug_keyboard;
1715 debug_keyboard = debug_keyboard_button.get_active ();
1719 OptionEditor::auto_connect_inputs_clicked ()
1722 session->set_input_auto_connect (auto_connect_inputs_button.get_active());
1727 OptionEditor::auto_connect_output_master_clicked ()
1730 if (auto_connect_output_master_button.get_active()) {
1731 session->set_output_auto_connect (Session::AutoConnectMaster);
1737 OptionEditor::auto_connect_output_physical_clicked ()
1740 if (auto_connect_output_physical_button.get_active()) {
1741 session->set_output_auto_connect (Session::AutoConnectPhysical);
1747 OptionEditor::auto_connect_output_manual_clicked ()
1750 if (auto_connect_output_manual_button.get_active()) {
1751 session->set_output_auto_connect (Session::AutoConnectOption (0));
1757 OptionEditor::hw_monitor_clicked ()
1759 Config->set_use_hardware_monitoring (hw_monitor_button.get_active());
1763 OptionEditor::sw_monitor_clicked ()
1765 Config->set_no_sw_monitoring (!sw_monitor_button.get_active());
1769 OptionEditor::plugins_stop_with_transport_clicked ()
1771 Config->set_plugins_stop_with_transport (plugins_stop_button.get_active());
1775 OptionEditor::plugins_on_while_recording_clicked ()
1778 session->set_recording_plugins (plugins_on_rec_button.get_active());
1783 OptionEditor::verify_remove_last_capture_clicked ()
1785 Config->set_verify_remove_last_capture(verify_remove_last_capture_button.get_active());
1789 OptionEditor::stop_rec_on_xrun_clicked ()
1791 Config->set_stop_recording_on_xrun (stop_rec_on_xrun_button.get_active());
1795 OptionEditor::stop_at_end_clicked ()
1797 Config->set_stop_at_session_end (stop_at_end_button.get_active());
1800 static const struct {
1804 { "Shift", GDK_SHIFT_MASK },
1805 { "Control", GDK_CONTROL_MASK },
1806 { "Alt (Mod1)", GDK_MOD1_MASK },
1807 { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
1808 { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
1809 { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
1810 { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
1811 { "Mod2", GDK_MOD2_MASK },
1812 { "Mod3", GDK_MOD3_MASK },
1813 { "Mod4", GDK_MOD4_MASK },
1814 { "Mod5", GDK_MOD5_MASK },
1819 OptionEditor::setup_keyboard_options ()
1821 vector<string> dumb;
1824 keyboard_mouse_table.set_border_width (12);
1825 keyboard_mouse_table.set_row_spacings (5);
1826 keyboard_mouse_table.set_col_spacings (5);
1828 /* internationalize and prepare for use with combos */
1830 for (int i = 0; modifiers[i].name; ++i) {
1831 dumb.push_back (_(modifiers[i].name));
1834 set_popdown_strings (edit_modifier_combo, dumb);
1835 edit_modifier_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
1837 for (int x = 0; modifiers[x].name; ++x) {
1838 if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
1839 edit_modifier_combo.set_active_text (_(modifiers[x].name));
1844 label = manage (new Label (_("Edit using")));
1845 label->set_name ("OptionsLabel");
1846 label->set_alignment (1.0, 0.5);
1848 keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
1849 keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
1851 label = manage (new Label (_("+ button")));
1852 label->set_name ("OptionsLabel");
1854 keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
1855 keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
1857 edit_button_spin.set_name ("OptionsEntry");
1858 edit_button_adjustment.set_value (Keyboard::edit_button());
1859 edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
1861 set_popdown_strings (delete_modifier_combo, dumb);
1862 delete_modifier_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
1864 for (int x = 0; modifiers[x].name; ++x) {
1865 if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
1866 delete_modifier_combo.set_active_text (_(modifiers[x].name));
1871 label = manage (new Label (_("Delete using")));
1872 label->set_name ("OptionsLabel");
1873 label->set_alignment (1.0, 0.5);
1875 keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
1876 keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
1878 label = manage (new Label (_("+ button")));
1879 label->set_name ("OptionsLabel");
1881 keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
1882 keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
1884 delete_button_spin.set_name ("OptionsEntry");
1885 delete_button_adjustment.set_value (Keyboard::delete_button());
1886 delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
1888 set_popdown_strings (snap_modifier_combo, dumb);
1889 snap_modifier_combo.signal_unmap_event().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
1891 for (int x = 0; modifiers[x].name; ++x) {
1892 if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
1893 snap_modifier_combo.set_active_text (_(modifiers[x].name));
1898 label = manage (new Label (_("Ignore snap using")));
1899 label->set_name ("OptionsLabel");
1900 label->set_alignment (1.0, 0.5);
1902 keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
1903 keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
1907 OptionEditor::edit_modifier_chosen (GdkEventAny *ev)
1911 txt = edit_modifier_combo.get_active_text();
1913 for (int i = 0; modifiers[i].name; ++i) {
1914 if (txt == _(modifiers[i].name)) {
1915 Keyboard::set_edit_modifier (modifiers[i].modifier);
1923 OptionEditor::delete_modifier_chosen (GdkEventAny *ev)
1927 txt = delete_modifier_combo.get_active_text();
1929 for (int i = 0; modifiers[i].name; ++i) {
1930 if (txt == _(modifiers[i].name)) {
1931 Keyboard::set_delete_modifier (modifiers[i].modifier);
1939 OptionEditor::snap_modifier_chosen (GdkEventAny *ev)
1943 txt = snap_modifier_combo.get_active_text();
1945 for (int i = 0; modifiers[i].name; ++i) {
1946 if (txt == _(modifiers[i].name)) {
1947 Keyboard::set_snap_modifier (modifiers[i].modifier);
1955 OptionEditor::delete_button_changed ()
1957 Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
1961 OptionEditor::edit_button_changed ()
1963 Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
1967 OptionEditor::fixup_combo_size (Gtk::Combo& combo, vector<string>& strings)
1969 /* find the widest string */
1971 string::size_type maxlen = 0;
1974 for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
1975 string::size_type l;
1977 if ((l = (*i).length()) > maxlen) {
1983 /* try to include ascenders and descenders */
1985 if (maxstring.length() > 2) {
1990 const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
1992 set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);
1996 OptionEditor::map_some_session_state (CheckButton& button, bool (Session::*get)() const)
1999 button.set_active ((session->*get)());