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 <pbd/whitespace.h>
23 #include <ardour/session.h>
24 #include <ardour/audioengine.h>
25 #include <ardour/configuration.h>
26 #include <ardour/auditioner.h>
27 #include <ardour/crossfade.h>
28 #include <midi++/manager.h>
29 #include <gtkmm2ext/stop_signal.h>
30 #include <gtkmm2ext/utils.h>
32 #include "public_editor.h"
34 #include "ardour_ui.h"
35 #include "io_selector.h"
36 #include "gain_meter.h"
40 #include "option_editor.h"
44 using namespace ARDOUR;
46 using namespace Editing;
47 using namespace Gtkmm2ext;
50 static vector<string> positional_sync_strings;
52 OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
53 : Dialog ("option editor"),
61 sfdb_paths(ListStore::create(sfdb_path_columns)),
62 sfdb_path_view(sfdb_paths),
66 short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
67 short_xfade_slider (short_xfade_adjustment),
68 destructo_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
69 destructo_xfade_slider (destructo_xfade_adjustment),
73 smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
74 smpte_offset_negative_button (_("SMPTE offset is negative")),
81 click_browse_button (_("Browse")),
82 click_emphasis_browse_button (_("Browse")),
86 keyboard_mouse_table (3, 4),
87 delete_button_adjustment (3, 1, 5),
88 delete_button_spin (delete_button_adjustment),
89 edit_button_adjustment (3, 1, 5),
90 edit_button_spin (edit_button_adjustment)
93 using namespace Notebook_Helpers;
95 click_io_selector = 0;
96 auditioner_io_selector = 0;
98 set_default_size (300, 300);
99 set_title (_("ardour: options editor"));
100 set_wmclass (_("ardour_option_editor"), "Ardour");
102 set_name ("OptionsWindow");
103 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
105 VBox *vbox = get_vbox();
106 set_border_width (3);
108 vbox->set_spacing (4);
109 vbox->pack_start(notebook);
111 signal_delete_event().connect (mem_fun(*this, &OptionEditor::wm_close));
113 notebook.set_show_tabs (true);
114 notebook.set_show_border (true);
115 notebook.set_name ("OptionsNotebook");
117 setup_sync_options();
118 setup_path_options();
119 setup_fade_options ();
120 setup_keyboard_options ();
121 setup_auditioner_editor ();
123 notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
124 notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
125 notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
126 notebook.pages().push_back (TabElem (click_packer, _("Click")));
127 notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
128 notebook.pages().push_back (TabElem (fade_packer, _("Layers & Fades")));
130 if (!MIDI::Manager::instance()->get_midi_ports().empty()) {
131 setup_midi_options ();
132 notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
140 OptionEditor::set_session (Session *s)
142 clear_click_editor ();
143 clear_auditioner_editor ();
145 click_path_entry.set_text ("");
146 click_emphasis_path_entry.set_text ("");
147 session_raid_entry.set_text ("");
149 click_path_entry.set_sensitive (false);
150 click_emphasis_path_entry.set_sensitive (false);
151 session_raid_entry.set_sensitive (false);
153 smpte_fps_combo.set_sensitive (false);
154 short_xfade_slider.set_sensitive (false);
155 smpte_offset_negative_button.set_sensitive (false);
157 smpte_offset_clock.set_session (s);
159 if ((session = s) == 0) {
164 click_path_entry.set_sensitive (true);
165 click_emphasis_path_entry.set_sensitive (true);
166 session_raid_entry.set_sensitive (true);
167 smpte_fps_combo.set_sensitive (true);
168 short_xfade_slider.set_sensitive (true);
169 smpte_offset_negative_button.set_sensitive (true);
171 if (!s->smpte_drop_frames) {
173 if (s->smpte_frames_per_second == 24.0)
174 smpte_fps_combo.set_active_text (_("24 FPS"));
175 else if (s->smpte_frames_per_second == 25.0)
176 smpte_fps_combo.set_active_text (_("25 FPS"));
177 else if (s->smpte_frames_per_second == 30.0)
178 smpte_fps_combo.set_active_text (_("30 FPS"));
180 smpte_fps_combo.set_active_text (_("???"));
183 if (floor(s->smpte_frames_per_second) == 29.0)
184 smpte_fps_combo.set_active_text (_("30 FPS drop"));
186 smpte_fps_combo.set_active_text (_("???"));
189 smpte_offset_clock.set_session (s);
190 smpte_offset_clock.set (s->smpte_offset (), true);
192 smpte_offset_negative_button.set_active (session->smpte_offset_negative());
194 /* set up port assignments */
196 std::map<MIDI::Port*,vector<RadioButton*> >::iterator res;
198 if (session->mtc_port()) {
199 if ((res = port_toggle_buttons.find (session->mtc_port())) != port_toggle_buttons.end()) {
200 (*res).second[MtcIndex]->set_active (true);
204 if (session->mmc_port ()) {
205 if ((res = port_toggle_buttons.find (session->mmc_port())) != port_toggle_buttons.end()) {
206 (*res).second[MmcIndex]->set_active (true);
210 if (session->midi_port()) {
211 if ((res = port_toggle_buttons.find (session->midi_port())) != port_toggle_buttons.end()) {
212 (*res).second[MidiIndex]->set_active (true);
216 setup_click_editor ();
217 connect_audition_editor ();
219 short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
221 add_session_paths ();
224 OptionEditor::~OptionEditor ()
228 static const gchar *native_format_strings[] = {
229 N_("Broadcast WAVE/floating point"),
230 N_("WAVE/floating point"),
235 OptionEditor::setup_path_options()
239 path_table.set_homogeneous (false);
240 path_table.set_border_width (12);
241 path_table.set_row_spacings (5);
243 session_raid_entry.set_name ("OptionsEntry");
245 session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
247 label = manage(new Label(_("session RAID path")));
248 label->set_name ("OptionsLabel");
249 path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
250 path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
252 label = manage(new Label(_("Native Format")));
253 label->set_name ("OptionsLabel");
254 path_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
255 path_table.attach (native_format_combo, 1, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
257 label = manage(new Label(_("Soundfile Search Paths")));
258 label->set_name("OptionsLabel");
259 path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL);
260 path_table.attach(sfdb_path_view, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
262 sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths);
263 sfdb_path_view.set_size_request(-1, 100);
265 vector<string> nfstrings = internationalize (native_format_strings);
267 set_popdown_strings (native_format_combo, nfstrings);
268 native_format_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::native_format_chosen));
270 fixup_combo_size (native_format_combo, nfstrings);
272 if (Config->get_native_format_is_bwf()) {
273 native_format_combo.set_active_text (native_format_strings[0]);
275 native_format_combo.set_active_text (native_format_strings[1]);
278 path_table.show_all();
282 OptionEditor::add_session_paths ()
284 click_path_entry.set_sensitive (true);
285 click_emphasis_path_entry.set_sensitive (true);
286 session_raid_entry.set_sensitive (true);
288 if (session->click_sound.length() == 0) {
289 click_path_entry.set_text (_("internal"));
291 click_path_entry.set_text (session->click_sound);
294 if (session->click_emphasis_sound.length() == 0) {
295 click_emphasis_path_entry.set_text (_("internal"));
297 click_emphasis_path_entry.set_text (session->click_emphasis_sound);
300 session_raid_entry.set_text(session->raid_path());
304 OptionEditor::setup_fade_options ()
308 Label* label = manage (new Label (_("Short crossfade length (msecs)")));
309 label->set_name ("OptionsLabel");
311 hbox = manage (new HBox);
312 hbox->set_border_width (5);
313 hbox->set_spacing (10);
314 hbox->pack_start (*label, false, false);
315 hbox->pack_start (short_xfade_slider, true, true);
316 fade_packer.pack_start (*hbox, false, false);
318 short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
320 label = manage (new Label (_("Destructive crossfade length (msecs)")));
321 label->set_name ("OptionsLabel");
323 hbox = manage (new HBox);
324 hbox->set_border_width (5);
325 hbox->set_spacing (10);
326 hbox->pack_start (*label, false, false);
327 hbox->pack_start (destructo_xfade_slider, true, true);
328 fade_packer.pack_start (*hbox, false, false);
330 destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
332 fade_packer.show_all ();
336 OptionEditor::short_xfade_adjustment_changed ()
339 float val = short_xfade_adjustment.get_value();
341 /* val is in msecs */
343 Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
348 OptionEditor::destructo_xfade_adjustment_changed ()
350 float val = destructo_xfade_adjustment.get_value();
352 /* val is in msecs */
355 Config->set_destructive_xfade_msecs ((uint32_t) floor (val), session->frame_rate());
357 Config->set_destructive_xfade_msecs ((uint32_t) floor (val), 0);
362 OptionEditor::setup_sync_options ()
368 dumb.push_back (X_("24 FPS"));
369 dumb.push_back (X_("25 FPS"));
370 dumb.push_back (X_("30 FPS drop"));
371 dumb.push_back (X_("30 FPS non-drop"));
373 set_popdown_strings (smpte_fps_combo, dumb);
374 smpte_fps_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
376 smpte_offset_clock.set_mode (AudioClock::SMPTE);
377 smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
379 smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
381 smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
383 Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
384 Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
385 smpte_fps_label->set_name("OptionsLabel");
386 smpte_offset_label->set_name("OptionsLabel");
388 hbox = manage (new HBox);
389 hbox->set_border_width (5);
390 hbox->set_spacing (10);
391 hbox->pack_start (*smpte_fps_label, false, false);
392 hbox->pack_start (smpte_fps_combo, false, false);
394 sync_packer.pack_start (*hbox, false, false);
396 hbox = manage (new HBox);
397 hbox->set_border_width (5);
398 hbox->set_spacing (10);
399 hbox->pack_start (*smpte_offset_label, false, false);
400 hbox->pack_start (smpte_offset_clock, false, false);
401 hbox->pack_start (smpte_offset_negative_button, false, false);
403 sync_packer.pack_start (*hbox, false, false);
405 smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
409 OptionEditor::smpte_offset_negative_clicked ()
412 session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
417 OptionEditor::smpte_fps_chosen ()
420 string str = smpte_fps_combo.get_active_text();
422 if (str == X_("24 FPS")) {
423 session->set_smpte_type (24.0, false);
424 } else if (str == X_("25 FPS")) {
425 session->set_smpte_type (25.0, false);
426 } else if (str == X_("30 FPS drop")) {
427 session->set_smpte_type (29.97, true);
428 } else if (str == X_("30 FPS non-drop")) {
429 session->set_smpte_type (30.0, false);
435 OptionEditor::smpte_offset_chosen()
438 jack_nframes_t frames = smpte_offset_clock.current_duration();
439 session->set_smpte_offset (frames);
445 OptionEditor::setup_midi_options ()
448 MIDI::Manager::PortMap::const_iterator i;
449 const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
454 Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
456 table->set_row_spacings (6);
457 table->set_col_spacings (10);
459 table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
460 table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
461 table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
462 table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
463 table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
464 table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
465 table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
467 table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
468 table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
469 table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
471 for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
473 pair<MIDI::Port*,vector<RadioButton*> > newpair;
475 newpair.first = i->second;
477 table->attach (*(manage (new Label (i->first))), 0, 1, n+2, n+3,FILL|EXPAND, FILL );
478 tb = manage (new ToggleButton (_("online")));
479 tb->set_name ("OptionEditorToggleButton");
481 /* remember, we have to handle the i18n case where the relative
482 lengths of the strings in language N is different than in english.
485 if (strlen (_("offline")) > strlen (_("online"))) {
486 set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
488 set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
491 tb->set_active (!(*i).second->input()->offline());
492 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
493 (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
494 table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
496 tb = manage (new ToggleButton ());
497 tb->set_name ("OptionEditorToggleButton");
498 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
499 tb->set_size_request (10, 10);
500 table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
502 tb = manage (new ToggleButton ());
503 tb->set_name ("OptionEditorToggleButton");
504 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
505 tb->set_size_request (10, 10);
506 table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
508 rb = manage (new RadioButton ());
509 newpair.second.push_back (rb);
510 rb->set_name ("OptionEditorToggleButton");
512 mtc_button_group = rb->get_group();
514 rb->set_group (mtc_button_group);
517 table->attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL);
518 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb));
520 if (Config->get_mtc_port_name() == i->first) {
521 rb->set_active (true);
524 rb = manage (new RadioButton ());
525 newpair.second.push_back (rb);
526 rb->set_name ("OptionEditorToggleButton");
528 mmc_button_group = rb->get_group();
530 rb->set_group (mmc_button_group);
532 table->attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
533 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb));
535 if (Config->get_mmc_port_name() == i->first) {
536 rb->set_active (true);
539 rb = manage (new RadioButton ());
540 newpair.second.push_back (rb);
541 rb->set_name ("OptionEditorToggleButton");
543 midi_button_group = rb->get_group();
545 rb->set_group (midi_button_group);
547 table->attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
548 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb));
550 if (Config->get_midi_port_name() == i->first) {
551 rb->set_active (true);
554 port_toggle_buttons.insert (newpair);
559 hbox = manage (new HBox);
560 hbox->set_border_width (6);
561 hbox->pack_start (*table, true, false);
562 midi_packer.pack_start (*hbox, false, false);
566 OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb)
569 if (rb->get_active()) {
570 cerr << "Activating MTC port " << port->name() << endl;
572 session->set_mtc_port (port->name());
573 Config->set_mtc_port_name (port->name());
575 session->set_mtc_port ("");
577 rb->set_active (true);
583 OptionEditor::mmc_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
586 if (rb->get_active()) {
587 cerr << "Activating MMC port " << port->name() << endl;
589 session->set_mmc_port (port->name());
590 Config->set_mtc_port_name (port->name());
592 session->set_mmc_port ("");
594 rb->set_active (true);
600 OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
603 if (rb->get_active()) {
604 cerr << "Activating MIDI port " << port->name() << endl;
606 session->set_midi_port (port->name());
607 Config->set_midi_port_name (port->name());
609 session->set_midi_port ("");
611 rb->set_active (true);
617 OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
619 bool wanted = tb->get_active(); /* it hasn't changed at this point */
621 if (wanted != port->input()->offline()) {
622 port->input()->set_offline (wanted);
624 return stop_signal (*tb, "button_press_event");
628 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
630 if (port->input()->offline()) {
631 static_cast<Label*>(tb->get_child())->set_text (_("offline"));
632 tb->set_active (false);
634 static_cast<Label*>(tb->get_child())->set_text (_("online"));
635 tb->set_active (true);
640 OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
642 /* XXX not very good MVC style here */
644 port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
645 tb->set_active (!tb->get_active());
646 return stop_signal (*tb, "button_press_event");
650 OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
652 /* XXX not very good MVC style here */
654 port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
655 tb->set_active (!tb->get_active());
656 return stop_signal (*tb, "button_press_event");
660 OptionEditor::save ()
662 /* XXX a bit odd that we save the entire session state here */
668 OptionEditor::wm_close (GdkEventAny *ev)
676 OptionEditor::raid_path_changed ()
679 session->set_raid_path (session_raid_entry.get_text());
684 OptionEditor::click_browse_clicked ()
686 SoundFileChooser sfdb (_("Choose Click"));
688 int result = sfdb.run ();
690 if (result == Gtk::RESPONSE_OK) {
691 click_chosen(sfdb.get_filename());
696 OptionEditor::click_chosen (const string & path)
698 click_path_entry.set_text (path);
699 click_sound_changed ();
703 OptionEditor::click_emphasis_browse_clicked ()
705 SoundFileChooser sfdb (_("Choose Click Emphasis"));
707 int result = sfdb.run ();
709 if (result == Gtk::RESPONSE_OK) {
710 click_emphasis_chosen (sfdb.get_filename());
715 OptionEditor::click_emphasis_chosen (const string & path)
717 click_emphasis_path_entry.set_text (path);
718 click_emphasis_sound_changed ();
722 OptionEditor::click_sound_changed ()
725 string path = click_path_entry.get_text();
727 if (path == session->click_sound) {
731 if (path.length() == 0) {
733 session->set_click_sound ("");
737 strip_whitespace_edges (path);
739 if (path == _("internal")) {
740 session->set_click_sound ("");
742 session->set_click_sound (path);
749 OptionEditor::click_emphasis_sound_changed ()
752 string path = click_emphasis_path_entry.get_text();
754 if (path == session->click_emphasis_sound) {
758 if (path.length() == 0) {
760 session->set_click_emphasis_sound ("");
764 strip_whitespace_edges (path);
766 if (path == _("internal")) {
767 session->set_click_emphasis_sound ("");
769 session->set_click_emphasis_sound (path);
776 OptionEditor::native_format_chosen ()
784 bool use_bwf = (native_format_combo.get_active_text() == native_format_strings[0]);
786 if (use_bwf != Config->get_native_format_is_bwf()) {
787 Config->set_native_format_is_bwf (use_bwf);
788 session->reset_native_file_format ();
793 OptionEditor::clear_click_editor ()
795 if (click_io_selector) {
796 click_packer.remove (*click_io_selector);
797 click_packer.remove (*click_gpm);
798 delete click_io_selector;
800 click_io_selector = 0;
806 OptionEditor::setup_click_editor ()
809 HBox* hpacker = manage (new HBox);
811 click_path_entry.set_sensitive (true);
812 click_emphasis_path_entry.set_sensitive (true);
814 click_path_entry.set_name ("OptionsEntry");
815 click_emphasis_path_entry.set_name ("OptionsEntry");
817 click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
818 click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
820 click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
821 click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
823 click_browse_button.set_name ("EditorGTKButton");
824 click_emphasis_browse_button.set_name ("EditorGTKButton");
825 click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
826 click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
828 click_packer.set_border_width (12);
829 click_packer.set_spacing (5);
831 click_io_selector = new IOSelector (*session, session->click_io(), false);
832 click_gpm = new GainMeter (session->click_io(), *session);
834 click_table.set_col_spacings (10);
836 label = manage(new Label(_("Click audio file")));
837 label->set_name ("OptionsLabel");
838 click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
839 click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
840 click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
842 label = manage(new Label(_("Click emphasis audiofile")));
843 label->set_name ("OptionsLabel");
844 click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
845 click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
846 click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
848 hpacker->set_spacing (10);
849 hpacker->pack_start (*click_io_selector, false, false);
850 hpacker->pack_start (*click_gpm, false, false);
852 click_packer.pack_start (click_table, false, false);
853 click_packer.pack_start (*hpacker, false, false);
855 click_packer.show_all ();
859 OptionEditor::clear_auditioner_editor ()
861 if (auditioner_io_selector) {
862 audition_hpacker.remove (*auditioner_io_selector);
863 audition_hpacker.remove (*auditioner_gpm);
864 delete auditioner_io_selector;
865 delete auditioner_gpm;
866 auditioner_io_selector = 0;
872 OptionEditor::setup_auditioner_editor ()
874 audition_packer.set_border_width (12);
875 audition_packer.set_spacing (5);
876 audition_hpacker.set_spacing (10);
878 audition_label.set_name ("OptionEditorAuditionerLabel");
879 audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
880 "for listening to specific regions outside the context\n"
881 "of the overall mix. It can be connected just like any\n"
882 "other mixer strip."));
884 audition_packer.pack_start (audition_label, false, false, 10);
885 audition_packer.pack_start (audition_hpacker, false, false);
889 OptionEditor::connect_audition_editor ()
891 auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
892 auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
894 audition_hpacker.pack_start (*auditioner_io_selector, false, false);
895 audition_hpacker.pack_start (*auditioner_gpm, false, false);
897 auditioner_io_selector->show_all ();
898 auditioner_gpm->show_all ();
902 OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
908 static const struct {
912 { "Shift", GDK_SHIFT_MASK },
913 { "Control", GDK_CONTROL_MASK },
914 { "Alt (Mod1)", GDK_MOD1_MASK },
915 { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
916 { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
917 { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
918 { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
919 { "Mod2", GDK_MOD2_MASK },
920 { "Mod3", GDK_MOD3_MASK },
921 { "Mod4", GDK_MOD4_MASK },
922 { "Mod5", GDK_MOD5_MASK },
927 OptionEditor::setup_keyboard_options ()
932 keyboard_mouse_table.set_border_width (12);
933 keyboard_mouse_table.set_row_spacings (5);
934 keyboard_mouse_table.set_col_spacings (5);
936 /* internationalize and prepare for use with combos */
938 for (int i = 0; modifiers[i].name; ++i) {
939 dumb.push_back (_(modifiers[i].name));
942 set_popdown_strings (edit_modifier_combo, dumb);
943 edit_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
945 for (int x = 0; modifiers[x].name; ++x) {
946 if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
947 edit_modifier_combo.set_active_text (_(modifiers[x].name));
952 label = manage (new Label (_("Edit using")));
953 label->set_name ("OptionsLabel");
954 label->set_alignment (1.0, 0.5);
956 keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
957 keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
959 label = manage (new Label (_("+ button")));
960 label->set_name ("OptionsLabel");
962 keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
963 keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
965 edit_button_spin.set_name ("OptionsEntry");
966 edit_button_adjustment.set_value (Keyboard::edit_button());
967 edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
969 set_popdown_strings (delete_modifier_combo, dumb);
970 delete_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
972 for (int x = 0; modifiers[x].name; ++x) {
973 if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
974 delete_modifier_combo.set_active_text (_(modifiers[x].name));
979 label = manage (new Label (_("Delete using")));
980 label->set_name ("OptionsLabel");
981 label->set_alignment (1.0, 0.5);
983 keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
984 keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
986 label = manage (new Label (_("+ button")));
987 label->set_name ("OptionsLabel");
989 keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
990 keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
992 delete_button_spin.set_name ("OptionsEntry");
993 delete_button_adjustment.set_value (Keyboard::delete_button());
994 delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
996 set_popdown_strings (snap_modifier_combo, dumb);
997 snap_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
999 for (int x = 0; modifiers[x].name; ++x) {
1000 if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
1001 snap_modifier_combo.set_active_text (_(modifiers[x].name));
1006 label = manage (new Label (_("Ignore snap using")));
1007 label->set_name ("OptionsLabel");
1008 label->set_alignment (1.0, 0.5);
1010 keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
1011 keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
1015 OptionEditor::edit_modifier_chosen ()
1019 txt = edit_modifier_combo.get_active_text();
1021 for (int i = 0; modifiers[i].name; ++i) {
1022 if (txt == _(modifiers[i].name)) {
1023 Keyboard::set_edit_modifier (modifiers[i].modifier);
1030 OptionEditor::delete_modifier_chosen ()
1034 txt = delete_modifier_combo.get_active_text();
1036 for (int i = 0; modifiers[i].name; ++i) {
1037 if (txt == _(modifiers[i].name)) {
1038 Keyboard::set_delete_modifier (modifiers[i].modifier);
1045 OptionEditor::snap_modifier_chosen ()
1049 txt = snap_modifier_combo.get_active_text();
1051 for (int i = 0; modifiers[i].name; ++i) {
1052 if (txt == _(modifiers[i].name)) {
1053 Keyboard::set_snap_modifier (modifiers[i].modifier);
1060 OptionEditor::delete_button_changed ()
1062 Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
1066 OptionEditor::edit_button_changed ()
1068 Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
1072 OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& strings)
1074 /* find the widest string */
1076 string::size_type maxlen = 0;
1079 for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
1080 string::size_type l;
1082 if ((l = (*i).length()) > maxlen) {
1088 /* try to include ascenders and descenders */
1090 if (maxstring.length() > 2) {
1095 const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
1097 set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);