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"
35 #include "library_ui.h"
38 #include "option_editor.h"
42 using namespace ARDOUR;
44 using namespace Editing;
45 using namespace Gtkmm2ext;
47 static const gchar *psync_strings[] = {
51 N_("never used but stops crashes"),
55 static const gchar *lmode_strings[] = {
56 N_("Later regions are higher"),
57 N_("Most recently added/moved/trimmed regions are higher"),
58 N_("Most recently added regions are higher"),
62 static const gchar *xfl_strings[] = {
63 N_("Span entire region overlap"),
64 N_("Short fades at the start of the overlap"),
68 static vector<string> positional_sync_strings;
69 static vector<string> layer_mode_strings;
70 static vector<string> xfade_model_strings;
72 OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
73 : ArdourDialog ("option editor"),
82 auto_xfade_button (_("Automatically create crossfades")),
83 xfade_active_button (_("New full-overlap crossfades are unmuted")),
84 layer_mode_label (_("Region layering mode")),
85 xfade_model_label (_("Crossfade model")),
86 short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
87 short_xfade_slider (short_xfade_adjustment),
90 solo_latched_button (_("Latched solo")),
91 solo_via_bus_button (_("Solo via bus")),
95 show_waveforms_button (_("Show waveforms")),
96 show_waveforms_recording_button (_("Show waveforms while recording")),
97 mixer_strip_width_button (_("Narrow mixer strips")),
98 show_measures_button (_("Show measure lines")),
99 follow_playhead_button (_("Follow playhead")),
103 send_mtc_button (_("Send MTC")),
104 send_mmc_button (_("Send MMC")),
105 jack_time_master_button (_("JACK time master")),
106 smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
107 smpte_offset_negative_button (_("SMPTE offset is negative")),
111 midi_feedback_button (_("Send MIDI parameter feedback")),
112 midi_control_button (_("MIDI parameter control")),
113 mmc_control_button (_("MMC control")),
118 click_browse_button (_("Browse")),
119 click_emphasis_browse_button (_("Browse")),
123 keyboard_mouse_table (3, 4),
124 delete_button_adjustment (3, 1, 5),
125 delete_button_spin (delete_button_adjustment),
126 edit_button_adjustment (3, 1, 5),
127 edit_button_spin (edit_button_adjustment),
131 auto_connect_inputs_button (_("Auto-connect new track inputs to hardware")),
132 auto_connect_output_physical_button (_("Auto-connect new track outputs to hardware")),
133 auto_connect_output_master_button (_("Auto-connect new track outputs to master bus")),
134 auto_connect_output_manual_button (_("Manually connect new track outputs")),
135 hw_monitor_button(_("Use Hardware Monitoring")),
136 sw_monitor_button(_("Use Software Monitoring")),
137 plugins_stop_button (_("Stop plugins with transport")),
138 plugins_on_rec_button (_("Run plugins while recording")),
139 verify_remove_last_capture_button (_("Verify remove last capture")),
140 stop_rec_on_xrun_button (_("Stop recording on xrun")),
141 stop_at_end_button (_("Stop transport at end of session")),
142 debug_keyboard_button (_("Debug keyboard events")),
143 speed_quieten_button (_("-12dB gain reduction for ffwd/rew"))
146 using namespace Notebook_Helpers;
148 click_io_selector = 0;
149 auditioner_io_selector = 0;
151 set_default_size (300, 300);
152 set_title (_("ardour: options editor"));
153 set_wmclass (_("ardour_option_editor"), "Ardour");
155 set_name ("OptionsWindow");
156 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
158 layer_mode_label.set_name ("OptionsLabel");
159 xfade_model_label.set_name ("OptionsLabel");
161 VBox *vbox = manage(new VBox);
163 set_border_width (3);
165 vbox->set_spacing (4);
166 vbox->pack_start(notebook);
168 delete_event.connect (mem_fun(*this, &OptionEditor::wm_close));
170 notebook.set_show_tabs (true);
171 notebook.set_show_border (true);
172 notebook.set_name ("OptionsNotebook");
174 setup_sync_options();
175 setup_path_options();
176 setup_fade_options ();
177 setup_solo_options ();
178 setup_display_options ();
179 setup_misc_options ();
180 setup_keyboard_options ();
181 setup_auditioner_editor ();
183 notebook.pages().push_back (TabElem (misc_packer, _("Misc")));
184 notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
185 notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
186 notebook.pages().push_back (TabElem (display_packer, _("Display")));
187 notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
188 notebook.pages().push_back (TabElem (click_packer, _("Click")));
189 notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
190 notebook.pages().push_back (TabElem (fade_packer, _("Layers & Fades")));
191 notebook.pages().push_back (TabElem (solo_packer, _("Solo")));
193 if (!MIDI::Manager::instance()->get_midi_ports().empty()) {
194 setup_midi_options ();
195 notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
202 OptionEditor::set_session (Session *s)
204 clear_click_editor ();
205 clear_auditioner_editor ();
207 click_path_entry.set_text ("");
208 click_emphasis_path_entry.set_text ("");
209 session_raid_entry.set_text ("");
211 send_mtc_button.set_sensitive (false);
212 send_mmc_button.set_sensitive (false);
213 midi_feedback_button.set_sensitive (false);
214 midi_control_button.set_sensitive (false);
215 mmc_control_button.set_sensitive (false);
216 click_path_entry.set_sensitive (false);
217 click_emphasis_path_entry.set_sensitive (false);
218 session_raid_entry.set_sensitive (false);
219 plugins_on_rec_button.set_sensitive (false);
220 verify_remove_last_capture_button.set_sensitive (false);
221 slave_type_combo.set_sensitive (false);
222 solo_latched_button.set_sensitive (false);
223 solo_via_bus_button.set_sensitive (false);
224 smpte_fps_combo.set_sensitive (false);
225 meter_hold_combo.set_sensitive (false);
226 meter_falloff_combo.set_sensitive (false);
227 auto_connect_inputs_button.set_sensitive (false);
228 auto_connect_output_physical_button.set_sensitive (false);
229 auto_connect_output_master_button.set_sensitive (false);
230 auto_connect_output_manual_button.set_sensitive (false);
231 layer_mode_combo.set_sensitive (false);
232 short_xfade_slider.set_sensitive (false);
233 smpte_offset_negative_button.set_sensitive (false);
235 smpte_offset_clock.set_session (s);
237 if ((session = s) == 0) {
241 send_mtc_button.set_sensitive (true);
242 send_mmc_button.set_sensitive (true);
243 midi_feedback_button.set_sensitive (true);
244 midi_control_button.set_sensitive (true);
245 mmc_control_button.set_sensitive (true);
246 click_path_entry.set_sensitive (true);
247 click_emphasis_path_entry.set_sensitive (true);
248 session_raid_entry.set_sensitive (true);
249 plugins_on_rec_button.set_sensitive (true);
250 verify_remove_last_capture_button.set_sensitive (true);
251 slave_type_combo.set_sensitive (true);
252 solo_latched_button.set_sensitive (true);
253 solo_via_bus_button.set_sensitive (true);
254 smpte_fps_combo.set_sensitive (true);
255 meter_hold_combo.set_sensitive (true);
256 meter_falloff_combo.set_sensitive (true);
257 auto_connect_inputs_button.set_sensitive (true);
258 auto_connect_output_physical_button.set_sensitive (true);
259 auto_connect_output_master_button.set_sensitive (true);
260 auto_connect_output_manual_button.set_sensitive (true);
261 layer_mode_combo.set_sensitive (true);
262 short_xfade_slider.set_sensitive (true);
263 smpte_offset_negative_button.set_sensitive (true);
265 if (!s->smpte_drop_frames) {
267 if (s->smpte_frames_per_second == 24.0)
268 smpte_fps_combo.get_entry ()->set_text (_("24 FPS"));
269 else if (s->smpte_frames_per_second == 25.0)
270 smpte_fps_combo.get_entry ()->set_text (_("25 FPS"));
271 else if (s->smpte_frames_per_second == 30.0)
272 smpte_fps_combo.get_entry ()->set_text (_("30 FPS"));
274 smpte_fps_combo.get_entry ()->set_text (_("???"));
277 if (floor(s->smpte_frames_per_second) == 29.0)
278 smpte_fps_combo.get_entry ()->set_text (_("30 FPS drop"));
280 smpte_fps_combo.get_entry ()->set_text (_("???"));
283 smpte_offset_clock.set_session (s);
284 smpte_offset_clock.set (s->smpte_offset (), true);
286 smpte_offset_negative_button.set_active (session->smpte_offset_negative());
287 send_mtc_button.set_active (session->get_send_mtc());
291 send_mmc_button.set_active (session->get_send_mmc());
292 midi_control_button.set_active (session->get_midi_control());
293 midi_feedback_button.set_active (session->get_midi_feedback());
294 mmc_control_button.set_active (session->get_mmc_control());
296 /* set up port assignments */
298 map<MIDI::Port*,vector<RadioButton*> >::iterator res;
300 if (session->mtc_port()) {
301 if ((res = port_toggle_buttons.find (session->mtc_port())) != port_toggle_buttons.end()) {
302 (*res).second[MtcIndex]->set_active (true);
306 if (session->mmc_port ()) {
307 if ((res = port_toggle_buttons.find (session->mmc_port())) != port_toggle_buttons.end()) {
308 (*res).second[MmcIndex]->set_active (true);
312 if (session->midi_port()) {
313 if ((res = port_toggle_buttons.find (session->midi_port())) != port_toggle_buttons.end()) {
314 (*res).second[MidiIndex]->set_active (true);
318 auto_connect_inputs_button.set_active (session->get_input_auto_connect());
320 Session::AutoConnectOption oac = session->get_output_auto_connect();
321 if (oac & Session::AutoConnectPhysical) {
322 auto_connect_output_physical_button.set_active (true);
323 } else if (oac & Session::AutoConnectMaster) {
324 auto_connect_output_master_button.set_active (true);
326 auto_connect_output_manual_button.set_active (true);
329 setup_click_editor ();
330 connect_audition_editor ();
332 plugins_on_rec_button.set_active (session->get_recording_plugins ());
333 verify_remove_last_capture_button.set_active (Config->get_verify_remove_last_capture());
335 layer_mode_combo.get_entry()->set_text (layer_mode_strings[session->get_layer_model()]);
336 xfade_model_combo.get_entry()->set_text (xfade_model_strings[session->get_xfade_model()]);
338 short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
340 xfade_active_button.set_active (session->get_crossfades_active());
341 solo_latched_button.set_active (session->solo_latched());
342 solo_via_bus_button.set_active (session->solo_model() == Session::SoloBus);
344 add_session_paths ();
347 dumb.push_back (positional_sync_strings[Session::None]);
348 dumb.push_back (positional_sync_strings[Session::JACK]);
349 if (session->mtc_port()) {
350 dumb.push_back (positional_sync_strings[Session::MTC]);
352 set_popdown_strings (slave_type_combo, dumb);
355 if (session->meter_falloff() == 0.0f) {
356 meter_falloff_combo.get_entry ()->set_text (_("Off"));
357 } else if (session->meter_falloff() <= 0.3f) {
358 meter_falloff_combo.get_entry ()->set_text (_("Slowest"));
359 } else if (session->meter_falloff() <= 0.4f) {
360 meter_falloff_combo.get_entry ()->set_text (_("Slow"));
361 } else if (session->meter_falloff() <= 0.8f) {
362 meter_falloff_combo.get_entry ()->set_text (_("Medium"));
363 } else if (session->meter_falloff() <= 1.4f) {
364 meter_falloff_combo.get_entry ()->set_text (_("Fast"));
365 } else if (session->meter_falloff() <= 2.0f) {
366 meter_falloff_combo.get_entry ()->set_text (_("Faster"));
368 meter_falloff_combo.get_entry ()->set_text (_("Fastest"));
371 switch ((int) floor (session->meter_hold())) {
373 meter_hold_combo.get_entry ()->set_text (_("Off"));
376 meter_hold_combo.get_entry ()->set_text (_("Short"));
379 meter_hold_combo.get_entry ()->set_text (_("Medium"));
382 meter_hold_combo.get_entry ()->set_text (_("Long"));
386 session_control_changed (Session::SlaveType);
387 session_control_changed (Session::AlignChoice);
388 session->ControlChanged.connect (mem_fun(*this, &OptionEditor::queue_session_control_changed));
391 OptionEditor::~OptionEditor ()
395 static const gchar *native_format_strings[] = {
396 N_("Broadcast WAVE/floating point"),
397 N_("WAVE/floating point"),
402 OptionEditor::setup_path_options()
406 path_table.set_homogeneous (true);
407 path_table.set_border_width (12);
408 path_table.set_row_spacings (5);
410 session_raid_entry.set_name ("OptionsEntry");
412 session_raid_entry.activate.connect (mem_fun(*this, &OptionEditor::raid_path_changed));
414 session_raid_entry.signal_focus_in_event()().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
415 session_raid_entry.signal_focus_out_event()().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::raid_path_changed));
417 label = manage(new Label(_("session RAID path")));
418 label->set_name ("OptionsLabel");
419 path_table.attach (*label, 0, 1, 0, 1, 0, 0);
420 path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
422 label = manage(new Label(_("Native Format")));
423 label->set_name ("OptionsLabel");
424 path_table.attach (*label, 0, 1, 1, 2, 0, 0);
425 path_table.attach (native_format_combo, 1, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
427 vector<string> nfstrings = internationalize (native_format_strings);
429 set_popdown_strings (native_format_combo, nfstrings);
430 native_format_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::native_format_chosen));
432 fixup_combo_size (native_format_combo, nfstrings);
434 if (Config->get_native_format_is_bwf()) {
435 native_format_combo.get_entry()->set_text (native_format_strings[0]);
437 native_format_combo.get_entry()->set_text (native_format_strings[1]);
440 path_table.show_all();
444 OptionEditor::add_session_paths ()
446 click_path_entry.set_sensitive (true);
447 click_emphasis_path_entry.set_sensitive (true);
448 session_raid_entry.set_sensitive (true);
450 if (session->click_sound.length() == 0) {
451 click_path_entry.set_text (_("internal"));
453 click_path_entry.set_text (session->click_sound);
456 if (session->click_emphasis_sound.length() == 0) {
457 click_emphasis_path_entry.set_text (_("internal"));
459 click_emphasis_path_entry.set_text (session->click_emphasis_sound);
462 session_raid_entry.set_text(session->raid_path());
466 OptionEditor::setup_fade_options ()
471 auto_xfade_button.set_name ("OptionEditorToggleButton");
472 xfade_active_button.set_name ("OptionEditorToggleButton");
474 hbox = manage (new HBox);
475 hbox->set_border_width (12);
476 hbox->pack_start (auto_xfade_button, false, false);
477 fade_packer.pack_start (*hbox, false, false);
479 hbox = manage (new HBox);
480 hbox->set_border_width (12);
481 hbox->pack_start (xfade_active_button, false, false);
482 fade_packer.pack_start (*hbox, false, false);
484 layer_mode_strings = internationalize (lmode_strings);
486 dumb.push_back (lmode_strings[Session::LaterHigher]);
487 dumb.push_back (lmode_strings[Session::MoveAddHigher]);
488 dumb.push_back (lmode_strings[Session::AddHigher]);
489 set_popdown_strings (layer_mode_combo, dumb);
491 layer_mode_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::layer_mode_chosen));
493 fixup_combo_size (layer_mode_combo, layer_mode_strings);
495 hbox = manage (new HBox);
496 hbox->set_border_width (5);
497 hbox->set_spacing (10);
498 hbox->pack_start (layer_mode_label, false, false);
499 hbox->pack_start (layer_mode_combo, false, false);
500 fade_packer.pack_start (*hbox, false, false);
502 xfade_model_strings = internationalize (xfl_strings);
505 dumb.push_back (xfade_model_strings[FullCrossfade]);
506 dumb.push_back (xfade_model_strings[ShortCrossfade]);
507 set_popdown_strings (xfade_model_combo, dumb);
509 xfade_model_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::xfade_model_chosen));
511 fixup_combo_size (xfade_model_combo, xfade_model_strings);
513 hbox = manage (new HBox);
514 hbox->set_border_width (5);
515 hbox->set_spacing (10);
516 hbox->pack_start (xfade_model_label, false, false);
517 hbox->pack_start (xfade_model_combo, false, false);
518 fade_packer.pack_start (*hbox, false, false);
520 auto_xfade_button.set_active (Config->get_auto_xfade());
521 /* xfade and layer mode active requires session */
523 auto_xfade_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_xfade_clicked));
524 xfade_active_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::xfade_active_clicked));
526 Label* short_xfade_label = manage (new Label (_("Short crossfade length (msecs)")));
527 short_xfade_label->set_name ("OptionsLabel");
529 hbox = manage (new HBox);
530 hbox->set_border_width (5);
531 hbox->set_spacing (10);
532 hbox->pack_start (*short_xfade_label, false, false);
533 hbox->pack_start (short_xfade_slider, true, true);
534 fade_packer.pack_start (*hbox, false, false);
536 short_xfade_adjustment.value_changed.connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
538 fade_packer.show_all ();
542 OptionEditor::short_xfade_adjustment_changed ()
545 float val = short_xfade_adjustment.get_value();
547 /* val is in msecs */
549 Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
554 OptionEditor::layer_mode_chosen (GdkEventAny* ev)
560 string which = layer_mode_combo.get_entry()->get_text ();
562 if (which == layer_mode_strings[Session::LaterHigher]) {
563 session->set_layer_model (Session::LaterHigher);
564 } else if (which == layer_mode_strings[Session::MoveAddHigher]) {
565 session->set_layer_model (Session::MoveAddHigher);
566 } else if (which == layer_mode_strings[Session::AddHigher]) {
567 session->set_layer_model (Session::AddHigher);
573 OptionEditor::xfade_model_chosen (GdkEventAny* ev)
579 string which = xfade_model_combo.get_entry()->get_text ();
581 if (which == xfade_model_strings[FullCrossfade]) {
582 session->set_xfade_model (FullCrossfade);
583 } else if (which == xfade_model_strings[ShortCrossfade]) {
584 session->set_xfade_model (ShortCrossfade);
590 OptionEditor::auto_xfade_clicked ()
592 Config->set_auto_xfade (auto_xfade_button.get_active());
596 OptionEditor::xfade_active_clicked ()
599 session->set_crossfades_active (xfade_active_button.get_active());
604 OptionEditor::setup_solo_options ()
608 solo_via_bus_button.set_name ("OptionEditorToggleButton");
609 solo_latched_button.set_name ("OptionEditorToggleButton");
611 hbox = manage (new HBox);
612 hbox->set_border_width (12);
613 hbox->pack_start (solo_via_bus_button, false, false);
614 solo_packer.pack_start (*hbox, false, false);
616 hbox = manage (new HBox);
617 hbox->set_border_width (12);
618 hbox->pack_start (solo_latched_button, false, false);
619 solo_packer.pack_start (*hbox, false, false);
621 solo_via_bus_button.signal_clicked().connect
622 (mem_fun(*this, &OptionEditor::solo_via_bus_clicked));
623 solo_latched_button.signal_clicked().connect
624 (mem_fun(*this, &OptionEditor::solo_latched_clicked));
626 solo_packer.show_all ();
630 OptionEditor::solo_via_bus_clicked ()
636 if (solo_via_bus_button.get_active()) {
637 session->set_solo_model (Session::SoloBus);
639 session->set_solo_model (Session::InverseMute);
644 OptionEditor::solo_latched_clicked ()
650 bool x = solo_latched_button.get_active();
652 if (x != session->solo_latched()) {
653 session->set_solo_latched (x);
658 OptionEditor::setup_display_options ()
663 display_packer.set_border_width (12);
664 display_packer.set_spacing (5);
666 show_waveforms_button.set_name ("OptionEditorToggleButton");
667 show_waveforms_recording_button.set_name ("OptionEditorToggleButton");
668 show_measures_button.set_name ("OptionEditorToggleButton");
669 follow_playhead_button.set_name ("OptionEditorToggleButton");
670 mixer_strip_width_button.set_name ("OptionEditorToggleButton");
672 mixer_strip_width_button.set_active (mixer.get_strip_width() == Narrow);
674 hbox = manage (new HBox);
675 hbox->set_border_width (8);
676 hbox->pack_start (show_waveforms_button, false, false);
677 display_packer.pack_start (*hbox, false, false);
679 hbox = manage (new HBox);
680 hbox->set_border_width (8);
681 hbox->pack_start (show_waveforms_recording_button, false, false);
682 display_packer.pack_start (*hbox, false, false);
684 hbox = manage (new HBox);
685 hbox->set_border_width (8);
686 hbox->pack_start (show_measures_button, false, false);
687 display_packer.pack_start (*hbox, false, false);
689 hbox = manage (new HBox);
690 hbox->set_border_width (8);
691 hbox->pack_start (mixer_strip_width_button, false, false);
692 display_packer.pack_start (*hbox, false, false);
694 hbox = manage (new HBox);
695 hbox->set_border_width (8);
696 hbox->pack_start (follow_playhead_button, false, false);
697 display_packer.pack_start (*hbox, false, false);
699 Label *meter_hold_label = manage (new Label (_("Meter Peak Hold")));
700 meter_hold_label->set_name ("OptionsLabel");
702 dumb.push_back (_("Off"));
703 dumb.push_back (_("Short"));
704 dumb.push_back (_("Medium"));
705 dumb.push_back (_("Long"));
706 set_popdown_strings (meter_hold_combo, dumb);
707 meter_hold_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::meter_hold_chosen));
708 hbox = manage (new HBox);
709 hbox->set_border_width (8);
710 hbox->set_spacing (8);
711 hbox->pack_start (*meter_hold_label, false, false);
712 hbox->pack_start (meter_hold_combo, false, false);
713 display_packer.pack_start (*hbox, false, false);
715 Label *meter_falloff_label = manage (new Label (_("Meter Falloff")));
716 meter_falloff_label->set_name ("OptionsLabel");
718 dumb.push_back (_("Off"));
719 dumb.push_back (_("Slowest"));
720 dumb.push_back (_("Slow"));
721 dumb.push_back (_("Medium"));
722 dumb.push_back (_("Fast"));
723 dumb.push_back (_("Faster"));
724 dumb.push_back (_("Fastest"));
725 set_popdown_strings (meter_falloff_combo, dumb);
726 meter_falloff_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::meter_falloff_chosen));
727 hbox = manage (new HBox);
728 hbox->set_border_width (8);
729 hbox->set_spacing (8);
730 hbox->pack_start (*meter_falloff_label, false, false);
731 hbox->pack_start (meter_falloff_combo, false, false);
732 display_packer.pack_start (*hbox, false, false);
735 show_waveforms_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_clicked));
736 show_waveforms_recording_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_waveforms_recording_clicked));
737 show_measures_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::show_measures_clicked));
738 mixer_strip_width_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::strip_width_clicked));
739 follow_playhead_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::follow_playhead_clicked));
741 editor.DisplayControlChanged.connect (mem_fun(*this, &OptionEditor::display_control_changed));
743 show_measures_button.set_active (editor.show_measures());
744 show_waveforms_button.set_active (editor.show_waveforms());
745 show_waveforms_recording_button.set_active (editor.show_waveforms_recording());
746 follow_playhead_button.set_active (editor.follow_playhead());
750 OptionEditor::meter_hold_chosen (GdkEventAny* ev)
753 string str = meter_hold_combo.get_entry()->get_text();
755 if (str == _("Off")) {
756 session->set_meter_hold (0);
757 } else if (str == _("Short")) {
758 session->set_meter_hold (40);
759 } else if (str == _("Medium")) {
760 session->set_meter_hold (100);
761 } else if (str == _("Long")) {
762 session->set_meter_hold (200);
770 OptionEditor::meter_falloff_chosen (GdkEventAny* ev)
773 string str = meter_falloff_combo.get_entry()->get_text();
775 if (str == _("Off")) {
776 session->set_meter_falloff (0.0f);
777 } else if (str == _("Slowest")) {
778 session->set_meter_falloff (0.266f); // 6.6 dB/sec falloff at update rate of 40 ms
779 } else if (str == _("Slow")) {
780 session->set_meter_falloff (0.342f); // 8.6 dB/sec falloff at update rate of 40 ms
781 } else if (str == _("Medium")) {
782 session->set_meter_falloff (0.7f);
783 } else if (str == _("Fast")) {
784 session->set_meter_falloff (1.1f);
785 } else if (str == _("Faster")) {
786 session->set_meter_falloff (1.5f);
787 } else if (str == _("Fastest")) {
788 session->set_meter_falloff (2.5f);
796 OptionEditor::display_control_changed (Editing::DisplayControl dc)
798 ToggleButton* button = 0;
803 val = editor.show_measures ();
804 button = &show_measures_button;
807 val = editor.show_waveforms ();
808 button = &show_waveforms_button;
810 case ShowWaveformsRecording:
811 val = editor.show_waveforms_recording ();
812 button = &show_waveforms_recording_button;
815 val = editor.follow_playhead ();
816 button = &follow_playhead_button;
820 if (button->get_active() != val) {
821 button->set_active (val);
826 OptionEditor::setup_sync_options ()
828 Label *slave_type_label = manage (new Label (_("Positional Sync")));
832 slave_type_label->set_name("OptionsLabel");
833 positional_sync_strings = internationalize (psync_strings);
835 slave_type_combo.set_use_arrows_always (true);
836 slave_type_combo.set_value_in_list (true, false);
837 slave_type_combo.get_entry()->set_editable (false);
838 slave_type_combo.get_entry()->set_name ("OptionsEntry");
839 slave_type_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::slave_type_chosen));
842 dumb.push_back (X_("24 FPS"));
843 dumb.push_back (X_("25 FPS"));
844 dumb.push_back (X_("30 FPS drop"));
845 dumb.push_back (X_("30 FPS non-drop"));
847 set_popdown_strings (smpte_fps_combo, dumb);
848 smpte_fps_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
850 smpte_offset_clock.set_mode (AudioClock::SMPTE);
851 smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
853 send_mtc_button.set_name ("OptionEditorToggleButton");
854 jack_time_master_button.set_name ("OptionEditorToggleButton");
855 smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
857 send_mtc_button.unset_flags (Gtk::CAN_FOCUS);
858 jack_time_master_button.unset_flags (Gtk::CAN_FOCUS);
859 smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
861 hbox = manage (new HBox);
862 hbox->set_border_width (5);
863 hbox->set_spacing (10);
864 hbox->pack_start (*slave_type_label, false, false);
865 hbox->pack_start (slave_type_combo, false, false);
867 sync_packer.pack_start (*hbox, false, false);
869 hbox = manage (new HBox);
870 hbox->set_border_width (5);
871 hbox->pack_start (send_mtc_button, false, false);
872 sync_packer.pack_start (*hbox, false, false);
874 hbox = manage (new HBox);
875 hbox->set_border_width (5);
876 hbox->pack_start (jack_time_master_button, false, false);
877 sync_packer.pack_start (*hbox, false, false);
879 Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
880 Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
881 smpte_fps_label->set_name("OptionsLabel");
882 smpte_offset_label->set_name("OptionsLabel");
884 hbox = manage (new HBox);
885 hbox->set_border_width (5);
886 hbox->set_spacing (10);
887 hbox->pack_start (*smpte_fps_label, false, false);
888 hbox->pack_start (smpte_fps_combo, false, false);
890 sync_packer.pack_start (*hbox, false, false);
892 hbox = manage (new HBox);
893 hbox->set_border_width (5);
894 hbox->set_spacing (10);
895 hbox->pack_start (*smpte_offset_label, false, false);
896 hbox->pack_start (smpte_offset_clock, false, false);
897 hbox->pack_start (smpte_offset_negative_button, false, false);
899 sync_packer.pack_start (*hbox, false, false);
901 jack_time_master_button.set_active (Config->get_jack_time_master());
903 send_mtc_button.signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::send_mtc_toggled), &send_mtc_button));
904 jack_time_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::jack_time_master_clicked));
905 smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
909 OptionEditor::smpte_offset_negative_clicked ()
912 session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
917 OptionEditor::smpte_fps_chosen (GdkEventAny* ev)
920 string str = smpte_fps_combo.get_entry()->get_text();
922 if (str == X_("24 FPS")) {
923 session->set_smpte_type (24.0, false);
924 } else if (str == X_("25 FPS")) {
925 session->set_smpte_type (25.0, false);
926 } else if (str == X_("30 FPS drop")) {
927 session->set_smpte_type (29.97, true);
928 } else if (str == X_("30 FPS non-drop")) {
929 session->set_smpte_type (30.0, false);
937 OptionEditor::smpte_offset_chosen()
940 jack_nframes_t frames = smpte_offset_clock.current_duration();
941 session->set_smpte_offset (frames);
947 OptionEditor::setup_midi_options ()
950 MIDI::Manager::PortMap::const_iterator i;
951 const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
955 RadioButton* first_mtc_button = 0;
956 RadioButton* first_mmc_button = 0;
957 RadioButton* first_midi_button = 0;
959 Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
961 table->set_row_spacings (6);
962 table->set_col_spacings (10);
964 table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
965 table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
966 table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
967 table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
968 table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
969 table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
970 table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
972 table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
973 table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
974 table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
976 for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
978 pair<MIDI::Port*,vector<RadioButton*> > newpair;
980 newpair.first = i->second;
982 table->attach (*(manage (new Label (i->first))), 0, 1, n+2, n+3, 0, 0);
983 tb = manage (new ToggleButton (_("online")));
984 tb->set_name ("OptionEditorToggleButton");
986 /* remember, we have to handle the i18n case where the relative
987 lengths of the strings in language N is different than in english.
990 if (strlen (_("offline")) > strlen (_("online"))) {
991 set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
993 set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
996 tb->set_active (!(*i).second->input()->offline());
997 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
998 (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
999 table->attach (*tb, 1, 2, n+2, n+3, 0, 0);
1001 tb = manage (new ToggleButton ());
1002 tb->set_name ("OptionEditorToggleButton");
1003 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
1004 tb->set_size_request (10, 10);
1005 table->attach (*tb, 2, 3, n+2, n+3, 0, 0);
1007 tb = manage (new ToggleButton ());
1008 tb->set_name ("OptionEditorToggleButton");
1009 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
1010 tb->set_size_request (10, 10);
1011 table->attach (*tb, 3, 4, n+2, n+3, 0, 0);
1013 rb = manage (new RadioButton ());
1014 newpair.second.push_back (rb);
1015 rb->set_name ("OptionEditorToggleButton");
1017 first_mtc_button = rb;
1019 rb->set_group (first_mtc_button->group());
1021 table->attach (*rb, 4, 5, n+2, n+3, 0, 0);
1022 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb));
1024 if (Config->get_mtc_port_name() == i->first) {
1025 rb->set_active (true);
1028 rb = manage (new RadioButton ());
1029 newpair.second.push_back (rb);
1030 rb->set_name ("OptionEditorToggleButton");
1032 first_mmc_button = rb;
1034 rb->set_group (first_mmc_button->group());
1036 table->attach (*rb, 6, 7, n+2, n+3, 0, 0);
1037 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb));
1039 if (Config->get_mmc_port_name() == i->first) {
1040 rb->set_active (true);
1043 rb = manage (new RadioButton ());
1044 newpair.second.push_back (rb);
1045 rb->set_name ("OptionEditorToggleButton");
1047 first_midi_button = rb;
1049 rb->set_group (first_midi_button->group());
1051 table->attach (*rb, 8, 9, n+2, n+3, 0, 0);
1052 rb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb));
1054 if (Config->get_midi_port_name() == i->first) {
1055 rb->set_active (true);
1058 port_toggle_buttons.insert (newpair);
1063 hbox = manage (new HBox);
1064 hbox->set_border_width (6);
1065 hbox->pack_start (*table, true, false);
1066 midi_packer.pack_start (*hbox, false, false);
1068 VBox* mmcbuttonbox = manage (new VBox);
1070 mmc_control_button.set_name ("OptionEditorToggleButton");
1072 hbox = manage (new HBox);
1073 hbox->set_border_width (6);
1074 hbox->pack_start (mmc_control_button, false, false, 36);
1075 mmcbuttonbox->pack_start (*hbox, false, false);
1077 midi_control_button.set_name ("OptionEditorToggleButton");
1079 hbox = manage (new HBox);
1080 hbox->set_border_width (6);
1081 hbox->pack_start (midi_control_button, false, false, 36);
1082 mmcbuttonbox->pack_start (*hbox, false, false);
1084 send_mmc_button.set_name ("OptionEditorToggleButton");
1086 hbox = manage (new HBox);
1087 hbox->set_border_width (6);
1088 hbox->pack_start (send_mmc_button, false, false, 36);
1089 mmcbuttonbox->pack_start (*hbox, false, false);
1091 midi_feedback_button.set_name ("OptionEditorToggleButton");
1093 hbox = manage (new HBox);
1094 hbox->set_border_width (6);
1095 hbox->pack_start (midi_feedback_button, false, false, 36);
1096 mmcbuttonbox->pack_start (*hbox, false, false);
1098 midi_packer.pack_start (*mmcbuttonbox, false, false);
1100 mmc_control_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::mmc_control_toggled), &mmc_control_button));
1101 midi_control_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::midi_control_toggled), &midi_control_button));
1102 send_mmc_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::send_mmc_toggled), &send_mmc_button));
1103 midi_feedback_button.toggled.connect (bind (mem_fun(*this, &OptionEditor::midi_feedback_toggled), &midi_feedback_button));
1107 OptionEditor::mtc_port_chosen (GdkEventButton* ev, MIDI::Port *port, Gtk::RadioButton* rb)
1110 if (!rb->get_active()) {
1112 session->set_mtc_port (port->name());
1113 Config->set_mtc_port_name (port->name());
1115 session->set_mtc_port ("");
1118 /* update sync options to reflect MTC port availability */
1120 vector<string> dumb;
1121 dumb.push_back (positional_sync_strings[Session::None]);
1122 dumb.push_back (positional_sync_strings[Session::JACK]);
1124 if (session->mtc_port()) {
1125 dumb.push_back (positional_sync_strings[Session::MTC]);
1127 set_popdown_strings (slave_type_combo, dumb);
1129 rb->set_active (true);
1133 return stop_signal (*rb, "button_press_event");
1137 OptionEditor::mmc_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
1140 if (!rb->get_active()) {
1142 session->set_mmc_port (port->name());
1143 Config->set_mtc_port_name (port->name());
1145 session->set_mmc_port ("");
1147 rb->set_active (true);
1150 return stop_signal (*rb, "button_press_event");
1154 OptionEditor::midi_port_chosen (GdkEventButton* ev, MIDI::Port* port, Gtk::RadioButton* rb)
1157 if (!rb->get_active()) {
1159 session->set_midi_port (port->name());
1160 Config->set_midi_port_name (port->name());
1162 session->set_midi_port ("");
1164 rb->set_active (true);
1167 return stop_signal (*rb, "button_press_event");
1171 OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
1173 bool wanted = tb->get_active(); /* it hasn't changed at this point */
1175 if (wanted != port->input()->offline()) {
1176 port->input()->set_offline (wanted);
1178 return stop_signal (*tb, "button_press_event");
1182 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
1184 if (port->input()->offline()) {
1185 static_cast<Label*>(tb->get_child())->set_text (_("offline"));
1186 tb->set_active (false);
1188 static_cast<Label*>(tb->get_child())->set_text (_("online"));
1189 tb->set_active (true);
1194 OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
1196 /* XXX not very good MVC style here */
1198 port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
1199 tb->set_active (!tb->get_active());
1200 return stop_signal (*tb, "button_press_event");
1204 OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
1206 /* XXX not very good MVC style here */
1208 port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
1209 tb->set_active (!tb->get_active());
1210 return stop_signal (*tb, "button_press_event");
1214 OptionEditor::send_mtc_toggled (GdkEventButton *ev, CheckButton *button)
1217 session->set_send_mtc (!button->get_active());
1219 return stop_signal (*button, "button_press_event");
1223 OptionEditor::send_mmc_toggled (CheckButton *button)
1226 session->set_send_mmc (button->get_active());
1231 OptionEditor::mmc_control_toggled (CheckButton *button)
1234 session->set_mmc_control (button->get_active());
1239 OptionEditor::midi_control_toggled (CheckButton *button)
1242 session->set_midi_control (button->get_active());
1247 OptionEditor::midi_feedback_toggled (CheckButton *button)
1250 session->set_midi_feedback (button->get_active());
1255 OptionEditor::save ()
1257 /* XXX a bit odd that we save the entire session state here */
1263 OptionEditor::wm_close (GdkEventAny *ev)
1271 OptionEditor::jack_time_master_clicked ()
1273 bool yn = jack_time_master_button.get_active();
1275 Config->set_jack_time_master (yn);
1278 session->engine().reset_timebase ();
1283 OptionEditor::raid_path_changed ()
1286 session->set_raid_path (session_raid_entry.get_text());
1291 OptionEditor::click_browse_clicked ()
1293 SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
1294 sigc::connection c = sfdb.Action.connect (mem_fun(*this, &OptionEditor::click_chosen));
1296 sfdb.run (_("Use as click"), false, true);
1301 OptionEditor::click_chosen (vector<string> paths, bool ignore)
1305 if (!paths.empty()) {
1306 path = paths.front();
1311 click_path_entry.set_text (path);
1312 click_sound_changed ();
1316 OptionEditor::click_emphasis_browse_clicked ()
1318 SoundFileSelector& sfdb (ARDOUR_UI::instance()->get_sfdb_window());
1319 sigc::connection c = sfdb.Action.connect (mem_fun(*this, &OptionEditor::click_emphasis_chosen));
1321 sfdb.run (_("Use as click emphasis"), false, true);
1327 OptionEditor::click_emphasis_chosen (vector<string> paths, bool ignore)
1331 if (!paths.empty()) {
1332 path = paths.front();
1337 click_emphasis_path_entry.set_text (path);
1338 click_emphasis_sound_changed ();
1342 OptionEditor::click_sound_changed ()
1345 string path = click_path_entry.get_text();
1347 if (path == session->click_sound) {
1351 if (path.length() == 0) {
1353 session->set_click_sound ("");
1357 strip_whitespace_edges (path);
1359 if (path == _("internal")) {
1360 session->set_click_sound ("");
1362 session->set_click_sound (path);
1369 OptionEditor::click_emphasis_sound_changed ()
1372 string path = click_emphasis_path_entry.get_text();
1374 if (path == session->click_emphasis_sound) {
1378 if (path.length() == 0) {
1380 session->set_click_emphasis_sound ("");
1384 strip_whitespace_edges (path);
1386 if (path == _("internal")) {
1387 session->set_click_emphasis_sound ("");
1389 session->set_click_emphasis_sound (path);
1396 OptionEditor::show_waveforms_clicked ()
1398 editor.set_show_waveforms (show_waveforms_button.get_active());
1402 OptionEditor::show_waveforms_recording_clicked ()
1404 editor.set_show_waveforms_recording (show_waveforms_recording_button.get_active());
1408 OptionEditor::show_measures_clicked ()
1410 editor.set_show_measures (show_measures_button.get_active());
1414 OptionEditor::follow_playhead_clicked ()
1416 editor.set_follow_playhead (follow_playhead_button.get_active());
1420 OptionEditor::strip_width_clicked ()
1422 mixer.set_strip_width (mixer_strip_width_button.get_active() ? Narrow : Wide);
1427 OptionEditor::just_close_win()
1430 ARDOUR_UI::instance()->allow_focus(false);
1434 OptionEditor::queue_session_control_changed (Session::ControlType t)
1436 ui.call_slot (bind (mem_fun(*this, &OptionEditor::session_control_changed), t));
1440 OptionEditor::session_control_changed (Session::ControlType t)
1443 case Session::SlaveType:
1444 switch (session->slave_source()) {
1446 slave_type_combo.get_entry()->set_text (positional_sync_strings[Session::None]);
1449 slave_type_combo.get_entry()->set_text (positional_sync_strings[Session::MTC]);
1452 slave_type_combo.get_entry()->set_text (positional_sync_strings[Session::JACK]);
1455 slave_type_combo.get_entry()->set_text (_("--unknown--"));
1461 case Session::SendMTC:
1462 map_some_session_state (send_mtc_button, &Session::get_send_mtc);
1465 case Session::SendMMC:
1466 map_some_session_state (send_mmc_button, &Session::get_send_mmc);
1469 case Session::MMCControl:
1470 map_some_session_state (mmc_control_button, &Session::get_mmc_control);
1473 case Session::MidiFeedback:
1474 map_some_session_state (midi_feedback_button, &Session::get_midi_feedback);
1477 case Session::MidiControl:
1478 map_some_session_state (midi_control_button, &Session::get_midi_control);
1487 OptionEditor::native_format_chosen (GdkEventAny *ignored)
1495 bool use_bwf = (native_format_combo.get_entry()->get_text() == native_format_strings[0]);
1497 if (use_bwf != Config->get_native_format_is_bwf()) {
1498 Config->set_native_format_is_bwf (use_bwf);
1499 session->reset_native_file_format ();
1506 OptionEditor::slave_type_chosen (GdkEventAny *ignored)
1514 which = slave_type_combo.get_entry()->get_text();
1516 if (which == positional_sync_strings[Session::None]) {
1517 session->request_slave_source (Session::None);
1518 } else if (which == positional_sync_strings[Session::MTC]) {
1519 session->request_slave_source (Session::MTC);
1520 } else if (which == positional_sync_strings[Session::JACK]) {
1521 session->request_slave_source (Session::JACK);
1527 OptionEditor::clear_click_editor ()
1529 if (click_io_selector) {
1530 click_packer.remove (*click_io_selector);
1531 click_packer.remove (*click_gpm);
1532 delete click_io_selector;
1534 click_io_selector = 0;
1540 OptionEditor::setup_click_editor ()
1543 HBox* hpacker = manage (new HBox);
1545 click_path_entry.set_sensitive (true);
1546 click_emphasis_path_entry.set_sensitive (true);
1548 click_path_entry.set_name ("OptionsEntry");
1549 click_emphasis_path_entry.set_name ("OptionsEntry");
1551 click_path_entry.activate.connect (mem_fun(*this, &OptionEditor::click_sound_changed));
1552 click_emphasis_path_entry.activate.connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
1554 click_path_entry.signal_focus_in_event()().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
1555 click_path_entry.signal_focus_out_event()().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
1556 click_emphasis_path_entry.signal_focus_in_event()().connect (mem_fun (Keyboard::the_keyboard(), &Keyboard::focus_in_handler));
1557 click_emphasis_path_entry.signal_focus_out_event()().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
1559 click_browse_button.set_name ("EditorGTKButton");
1560 click_emphasis_browse_button.set_name ("EditorGTKButton");
1561 click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
1562 click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
1564 click_packer.set_border_width (12);
1565 click_packer.set_spacing (5);
1567 click_io_selector = new IOSelector (*session, session->click_io(), false);
1568 click_gpm = new GainMeter (session->click_io(), *session);
1570 click_table.set_col_spacings (10);
1572 label = manage(new Label(_("Click audio file")));
1573 label->set_name ("OptionsLabel");
1574 click_table.attach (*label, 0, 1, 0, 1, 0, 0);
1575 click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
1576 click_table.attach (click_browse_button, 2, 3, 0, 1, 0, 0);
1578 label = manage(new Label(_("Click emphasis audiofile")));
1579 label->set_name ("OptionsLabel");
1580 click_table.attach (*label, 0, 1, 1, 2, 0, 0);
1581 click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
1582 click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, 0, 0);
1584 hpacker->set_spacing (10);
1585 hpacker->pack_start (*click_io_selector, false, false);
1586 hpacker->pack_start (*click_gpm, false, false);
1588 click_packer.pack_start (click_table, false, false);
1589 click_packer.pack_start (*hpacker, false, false);
1591 click_packer.show_all ();
1595 OptionEditor::clear_auditioner_editor ()
1597 if (auditioner_io_selector) {
1598 audition_hpacker.remove (*auditioner_io_selector);
1599 audition_hpacker.remove (*auditioner_gpm);
1600 delete auditioner_io_selector;
1601 delete auditioner_gpm;
1602 auditioner_io_selector = 0;
1608 OptionEditor::setup_auditioner_editor ()
1610 audition_packer.set_border_width (12);
1611 audition_packer.set_spacing (5);
1612 audition_hpacker.set_spacing (10);
1614 audition_label.set_name ("OptionEditorAuditionerLabel");
1615 audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
1616 "for listening to specific regions outside the context\n"
1617 "of the overall mix. It can be connected just like any\n"
1618 "other mixer strip."));
1620 audition_packer.pack_start (audition_label, false, false, 10);
1621 audition_packer.pack_start (audition_hpacker, false, false);
1625 OptionEditor::connect_audition_editor ()
1627 auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
1628 auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
1630 audition_hpacker.pack_start (*auditioner_io_selector, false, false);
1631 audition_hpacker.pack_start (*auditioner_gpm, false, false);
1633 auditioner_io_selector->show_all ();
1634 auditioner_gpm->show_all ();
1638 OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
1641 return Keyboard::the_keyboard().focus_out_handler (ev);
1645 OptionEditor::setup_misc_options()
1647 Gtk::Table* table = manage (new Table (4, 2));
1648 table->set_homogeneous (true);
1650 misc_packer.set_border_width (8);
1651 misc_packer.set_spacing (3);
1652 misc_packer.pack_start (*table, true, true);
1654 table->attach (hw_monitor_button, 0, 1, 0, 1, Gtk::FILL, 0, 8, 0);
1655 table->attach (sw_monitor_button, 0, 1, 1, 2, Gtk::FILL, 0, 8, 0);
1656 table->attach (plugins_stop_button, 0, 1, 2, 3, Gtk::FILL, 0, 8, 0);
1657 table->attach (plugins_on_rec_button, 0, 1, 3, 4, Gtk::FILL, 0, 8, 0);
1658 table->attach (verify_remove_last_capture_button, 0, 1, 4, 5, Gtk::FILL, 0, 8, 0);
1660 table->attach (stop_rec_on_xrun_button, 1, 2, 0, 1, Gtk::FILL, 0, 8, 0);
1661 table->attach (stop_at_end_button, 1, 2, 1, 2, Gtk::FILL, 0, 8, 0);
1662 table->attach (debug_keyboard_button, 1, 2, 2, 3, Gtk::FILL, 0, 8, 0);
1663 table->attach (speed_quieten_button, 1, 2, 3, 4, Gtk::FILL, 0, 8, 0);
1665 Gtk::VBox* connect_box = manage (new VBox);
1666 connect_box->set_spacing (3);
1667 connect_box->set_border_width (8);
1669 auto_connect_output_manual_button.set_group (auto_connect_output_master_button.get_group());
1670 auto_connect_output_physical_button.set_group (auto_connect_output_master_button.get_group());
1672 Gtk::HBox* useless_box = manage (new HBox);
1673 useless_box->pack_start (auto_connect_inputs_button, false, false);
1674 connect_box->pack_start (*useless_box, false, false);
1675 connect_box->pack_start (auto_connect_output_master_button, false, false);
1676 connect_box->pack_start (auto_connect_output_physical_button, false, false);
1677 connect_box->pack_start (auto_connect_output_manual_button, false);
1679 misc_packer.pack_start (*connect_box, false, false);
1681 hw_monitor_button.set_name ("OptionEditorToggleButton");
1682 sw_monitor_button.set_name ("OptionEditorToggleButton");
1683 plugins_stop_button.set_name ("OptionEditorToggleButton");
1684 plugins_on_rec_button.set_name ("OptionEditorToggleButton");
1685 verify_remove_last_capture_button.set_name ("OptionEditorToggleButton");
1686 auto_connect_inputs_button.set_name ("OptionEditorToggleButton");
1687 auto_connect_output_physical_button.set_name ("OptionEditorToggleButton");
1688 auto_connect_output_master_button.set_name ("OptionEditorToggleButton");
1689 auto_connect_output_manual_button.set_name ("OptionEditorToggleButton");
1690 stop_rec_on_xrun_button.set_name ("OptionEditorToggleButton");
1691 stop_at_end_button.set_name ("OptionEditorToggleButton");
1692 debug_keyboard_button.set_name ("OptionEditorToggleButton");
1693 speed_quieten_button.set_name ("OptionEditorToggleButton");
1695 hw_monitor_button.set_active (Config->get_use_hardware_monitoring());
1696 sw_monitor_button.set_active (!Config->get_no_sw_monitoring());
1697 plugins_stop_button.set_active (Config->get_plugins_stop_with_transport());
1698 stop_rec_on_xrun_button.set_active (Config->get_stop_recording_on_xrun());
1699 stop_at_end_button.set_active (Config->get_stop_at_session_end());
1700 debug_keyboard_button.set_active (false);
1701 speed_quieten_button.set_active (Config->get_quieten_at_speed() != 1.0f);
1703 hw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::hw_monitor_clicked));
1704 sw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::sw_monitor_clicked));
1705 plugins_stop_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_stop_with_transport_clicked));
1706 plugins_on_rec_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_on_while_recording_clicked));
1707 verify_remove_last_capture_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::verify_remove_last_capture_clicked));
1708 auto_connect_inputs_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_inputs_clicked));
1709 auto_connect_output_physical_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_physical_clicked));
1710 auto_connect_output_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_master_clicked));
1711 auto_connect_output_manual_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_manual_clicked));
1712 stop_rec_on_xrun_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_rec_on_xrun_clicked));
1713 stop_at_end_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_at_end_clicked));
1714 debug_keyboard_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::debug_keyboard_clicked));
1715 speed_quieten_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::speed_quieten_clicked));
1719 OptionEditor::speed_quieten_clicked ()
1721 if (speed_quieten_button.get_active()) {
1722 Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
1724 Config->set_quieten_at_speed (1.0); /* no change */
1729 OptionEditor::debug_keyboard_clicked ()
1731 extern bool debug_keyboard;
1732 debug_keyboard = debug_keyboard_button.get_active ();
1736 OptionEditor::auto_connect_inputs_clicked ()
1739 session->set_input_auto_connect (auto_connect_inputs_button.get_active());
1744 OptionEditor::auto_connect_output_master_clicked ()
1747 if (auto_connect_output_master_button.get_active()) {
1748 session->set_output_auto_connect (Session::AutoConnectMaster);
1754 OptionEditor::auto_connect_output_physical_clicked ()
1757 if (auto_connect_output_physical_button.get_active()) {
1758 session->set_output_auto_connect (Session::AutoConnectPhysical);
1764 OptionEditor::auto_connect_output_manual_clicked ()
1767 if (auto_connect_output_manual_button.get_active()) {
1768 session->set_output_auto_connect (Session::AutoConnectOption (0));
1774 OptionEditor::hw_monitor_clicked ()
1776 Config->set_use_hardware_monitoring (hw_monitor_button.get_active());
1780 OptionEditor::sw_monitor_clicked ()
1782 Config->set_no_sw_monitoring (!sw_monitor_button.get_active());
1786 OptionEditor::plugins_stop_with_transport_clicked ()
1788 Config->set_plugins_stop_with_transport (plugins_stop_button.get_active());
1792 OptionEditor::plugins_on_while_recording_clicked ()
1795 session->set_recording_plugins (plugins_on_rec_button.get_active());
1800 OptionEditor::verify_remove_last_capture_clicked ()
1802 Config->set_verify_remove_last_capture(verify_remove_last_capture_button.get_active());
1806 OptionEditor::stop_rec_on_xrun_clicked ()
1808 Config->set_stop_recording_on_xrun (stop_rec_on_xrun_button.get_active());
1812 OptionEditor::stop_at_end_clicked ()
1814 Config->set_stop_at_session_end (stop_at_end_button.get_active());
1817 static const struct {
1821 { "Shift", GDK_SHIFT_MASK },
1822 { "Control", GDK_CONTROL_MASK },
1823 { "Alt (Mod1)", GDK_MOD1_MASK },
1824 { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
1825 { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
1826 { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
1827 { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
1828 { "Mod2", GDK_MOD2_MASK },
1829 { "Mod3", GDK_MOD3_MASK },
1830 { "Mod4", GDK_MOD4_MASK },
1831 { "Mod5", GDK_MOD5_MASK },
1836 OptionEditor::setup_keyboard_options ()
1838 vector<string> dumb;
1841 keyboard_mouse_table.set_border_width (12);
1842 keyboard_mouse_table.set_row_spacings (5);
1843 keyboard_mouse_table.set_col_spacings (5);
1845 /* internationalize and prepare for use with combos */
1847 for (int i = 0; modifiers[i].name; ++i) {
1848 dumb.push_back (_(modifiers[i].name));
1851 set_popdown_strings (edit_modifier_combo, dumb);
1852 edit_modifier_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
1854 for (int x = 0; modifiers[x].name; ++x) {
1855 if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
1856 edit_modifier_combo.get_entry()->set_text (_(modifiers[x].name));
1861 label = manage (new Label (_("Edit using")));
1862 label->set_name ("OptionsLabel");
1863 label->set_alignment (1.0, 0.5);
1865 keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
1866 keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
1868 label = manage (new Label (_("+ button")));
1869 label->set_name ("OptionsLabel");
1871 keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
1872 keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, 0);
1874 edit_button_spin.set_name ("OptionsEntry");
1875 edit_button_adjustment.set_value (Keyboard::edit_button());
1876 edit_button_adjustment.value_changed.connect (mem_fun(*this, &OptionEditor::edit_button_changed));
1878 set_popdown_strings (delete_modifier_combo, dumb);
1879 delete_modifier_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
1881 for (int x = 0; modifiers[x].name; ++x) {
1882 if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
1883 delete_modifier_combo.get_entry()->set_text (_(modifiers[x].name));
1888 label = manage (new Label (_("Delete using")));
1889 label->set_name ("OptionsLabel");
1890 label->set_alignment (1.0, 0.5);
1892 keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
1893 keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
1895 label = manage (new Label (_("+ button")));
1896 label->set_name ("OptionsLabel");
1898 keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
1899 keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, 0);
1901 delete_button_spin.set_name ("OptionsEntry");
1902 delete_button_adjustment.set_value (Keyboard::delete_button());
1903 delete_button_adjustment.value_changed.connect (mem_fun(*this, &OptionEditor::delete_button_changed));
1905 set_popdown_strings (snap_modifier_combo, dumb);
1906 snap_modifier_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
1908 for (int x = 0; modifiers[x].name; ++x) {
1909 if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
1910 snap_modifier_combo.get_entry()->set_text (_(modifiers[x].name));
1915 label = manage (new Label (_("Ignore snap using")));
1916 label->set_name ("OptionsLabel");
1917 label->set_alignment (1.0, 0.5);
1919 keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, 0);
1920 keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, 0);
1924 OptionEditor::edit_modifier_chosen (GdkEventAny *ev)
1928 txt = edit_modifier_combo.get_entry()->get_text();
1930 for (int i = 0; modifiers[i].name; ++i) {
1931 if (txt == _(modifiers[i].name)) {
1932 Keyboard::set_edit_modifier (modifiers[i].modifier);
1940 OptionEditor::delete_modifier_chosen (GdkEventAny *ev)
1944 txt = delete_modifier_combo.get_entry()->get_text();
1946 for (int i = 0; modifiers[i].name; ++i) {
1947 if (txt == _(modifiers[i].name)) {
1948 Keyboard::set_delete_modifier (modifiers[i].modifier);
1956 OptionEditor::snap_modifier_chosen (GdkEventAny *ev)
1960 txt = snap_modifier_combo.get_entry()->get_text();
1962 for (int i = 0; modifiers[i].name; ++i) {
1963 if (txt == _(modifiers[i].name)) {
1964 Keyboard::set_snap_modifier (modifiers[i].modifier);
1972 OptionEditor::delete_button_changed ()
1974 Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
1978 OptionEditor::edit_button_changed ()
1980 Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
1984 OptionEditor::fixup_combo_size (Gtk::Combo& combo, vector<string>& strings)
1986 /* find the widest string */
1988 string::size_type maxlen = 0;
1991 for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
1992 string::size_type l;
1994 if ((l = (*i).length()) > maxlen) {
2000 /* try to include ascenders and descenders */
2002 if (maxstring.length() > 2) {
2007 const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
2009 set_size_request_to_display_given_text (*combo.get_entry(), maxstring.c_str(), 10 + FUDGE, 10);
2013 OptionEditor::map_some_session_state (CheckButton& button, bool (Session::*get)() const)
2016 button.set_active ((session->*get)());