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/destructive_filesource.h>
28 #include <ardour/crossfade.h>
29 #include <midi++/manager.h>
30 #include <gtkmm2ext/stop_signal.h>
31 #include <gtkmm2ext/utils.h>
33 #include "public_editor.h"
35 #include "ardour_ui.h"
36 #include "io_selector.h"
37 #include "gain_meter.h"
41 #include "option_editor.h"
45 using namespace ARDOUR;
48 using namespace Editing;
49 using namespace Gtkmm2ext;
52 static vector<string> positional_sync_strings;
54 OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
55 : Dialog ("option editor"),
63 sfdb_paths(ListStore::create(sfdb_path_columns)),
64 sfdb_path_view(sfdb_paths),
68 short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
69 short_xfade_slider (short_xfade_adjustment),
70 destructo_xfade_adjustment (1.0, 1.0, 500.0, 1.0, 100.0),
71 destructo_xfade_slider (destructo_xfade_adjustment),
75 smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
76 smpte_offset_negative_button (_("SMPTE offset is negative")),
83 click_browse_button (_("Browse")),
84 click_emphasis_browse_button (_("Browse")),
88 keyboard_mouse_table (3, 4),
89 delete_button_adjustment (3, 1, 5),
90 delete_button_spin (delete_button_adjustment),
91 edit_button_adjustment (3, 1, 5),
92 edit_button_spin (edit_button_adjustment)
95 using namespace Notebook_Helpers;
97 click_io_selector = 0;
98 auditioner_io_selector = 0;
101 set_default_size (300, 300);
102 set_title (_("ardour: options editor"));
103 set_wmclass (_("ardour_option_editor"), "Ardour");
105 set_name ("OptionsWindow");
106 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
108 VBox *vbox = get_vbox();
109 set_border_width (3);
111 vbox->set_spacing (4);
112 vbox->pack_start(notebook);
114 signal_delete_event().connect (mem_fun(*this, &OptionEditor::wm_close));
116 notebook.set_show_tabs (true);
117 notebook.set_show_border (true);
118 notebook.set_name ("OptionsNotebook");
120 setup_sync_options();
121 setup_path_options();
122 setup_fade_options ();
123 setup_keyboard_options ();
124 setup_auditioner_editor ();
126 notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
127 notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
128 notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
129 notebook.pages().push_back (TabElem (click_packer, _("Click")));
130 notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
131 notebook.pages().push_back (TabElem (fade_packer, _("Layers & Fades")));
133 if (!MIDI::Manager::instance()->get_midi_ports().empty()) {
134 setup_midi_options ();
135 notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
143 OptionEditor::set_session (Session *s)
145 clear_click_editor ();
146 clear_auditioner_editor ();
148 click_path_entry.set_text ("");
149 click_emphasis_path_entry.set_text ("");
150 session_raid_entry.set_text ("");
152 click_path_entry.set_sensitive (false);
153 click_emphasis_path_entry.set_sensitive (false);
154 session_raid_entry.set_sensitive (false);
156 smpte_fps_combo.set_sensitive (false);
157 short_xfade_slider.set_sensitive (false);
158 smpte_offset_negative_button.set_sensitive (false);
160 smpte_offset_clock.set_session (s);
162 if ((session = s) == 0) {
167 click_path_entry.set_sensitive (true);
168 click_emphasis_path_entry.set_sensitive (true);
169 session_raid_entry.set_sensitive (true);
170 smpte_fps_combo.set_sensitive (true);
171 short_xfade_slider.set_sensitive (true);
172 smpte_offset_negative_button.set_sensitive (true);
174 if (!s->smpte_drop_frames) {
176 if (s->smpte_frames_per_second == 24.0)
177 smpte_fps_combo.set_active_text (_("24 FPS"));
178 else if (s->smpte_frames_per_second == 25.0)
179 smpte_fps_combo.set_active_text (_("25 FPS"));
180 else if (s->smpte_frames_per_second == 30.0)
181 smpte_fps_combo.set_active_text (_("30 FPS"));
183 smpte_fps_combo.set_active_text (_("???"));
186 if (floor(s->smpte_frames_per_second) == 29.0)
187 smpte_fps_combo.set_active_text (_("30 FPS drop"));
189 smpte_fps_combo.set_active_text (_("???"));
192 smpte_offset_clock.set_session (s);
193 smpte_offset_clock.set (s->smpte_offset (), true);
195 smpte_offset_negative_button.set_active (session->smpte_offset_negative());
197 /* set up port assignments */
199 std::map<MIDI::Port*,vector<RadioButton*> >::iterator res;
201 if (session->mtc_port()) {
202 if ((res = port_toggle_buttons.find (session->mtc_port())) != port_toggle_buttons.end()) {
203 (*res).second[MtcIndex]->set_active (true);
207 if (session->mmc_port ()) {
208 if ((res = port_toggle_buttons.find (session->mmc_port())) != port_toggle_buttons.end()) {
209 (*res).second[MmcIndex]->set_active (true);
213 if (session->midi_port()) {
214 if ((res = port_toggle_buttons.find (session->midi_port())) != port_toggle_buttons.end()) {
215 (*res).second[MidiIndex]->set_active (true);
219 setup_click_editor ();
220 connect_audition_editor ();
222 short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
224 add_session_paths ();
227 OptionEditor::~OptionEditor ()
232 OptionEditor::setup_path_options()
236 path_table.set_homogeneous (false);
237 path_table.set_border_width (12);
238 path_table.set_row_spacings (5);
240 session_raid_entry.set_name ("OptionsEntry");
242 session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
244 label = manage(new Label(_("session RAID path")));
245 label->set_name ("OptionsLabel");
246 path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
247 path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
249 label = manage(new Label(_("Soundfile Search Paths")));
250 label->set_name("OptionsLabel");
251 path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL);
252 path_table.attach(sfdb_path_view, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
254 sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths);
255 sfdb_path_view.set_size_request(-1, 100);
256 sfdb_path_view.set_headers_visible (false);
258 path_table.show_all();
262 OptionEditor::add_session_paths ()
264 click_path_entry.set_sensitive (true);
265 click_emphasis_path_entry.set_sensitive (true);
266 session_raid_entry.set_sensitive (true);
268 if (session->click_sound.length() == 0) {
269 click_path_entry.set_text (_("internal"));
271 click_path_entry.set_text (session->click_sound);
274 if (session->click_emphasis_sound.length() == 0) {
275 click_emphasis_path_entry.set_text (_("internal"));
277 click_emphasis_path_entry.set_text (session->click_emphasis_sound);
280 session_raid_entry.set_text(session->raid_path());
284 OptionEditor::setup_fade_options ()
288 Label* label = manage (new Label (_("Short crossfade length (msecs)")));
289 label->set_name ("OptionsLabel");
291 hbox = manage (new HBox);
292 hbox->set_border_width (5);
293 hbox->set_spacing (10);
294 hbox->pack_start (*label, false, false);
295 hbox->pack_start (short_xfade_slider, true, true);
296 fade_packer.pack_start (*hbox, false, false);
298 short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
300 label = manage (new Label (_("Destructive crossfade length (msecs)")));
301 label->set_name ("OptionsLabel");
303 hbox = manage (new HBox);
304 hbox->set_border_width (5);
305 hbox->set_spacing (10);
306 hbox->pack_start (*label, false, false);
307 hbox->pack_start (destructo_xfade_slider, true, true);
308 fade_packer.pack_start (*hbox, false, false);
310 destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
312 short_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
313 destructo_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
315 destructo_xfade_adjustment.set_value (Config->get_destructive_xfade_msecs());
317 fade_packer.show_all ();
321 OptionEditor::short_xfade_adjustment_changed ()
324 float val = short_xfade_adjustment.get_value();
326 /* val is in msecs */
328 Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
333 OptionEditor::destructo_xfade_adjustment_changed ()
335 float val = destructo_xfade_adjustment.get_value();
337 /* val is in msecs */
339 Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
342 DestructiveFileSource::setup_standard_crossfades (session->frame_rate());
347 OptionEditor::setup_sync_options ()
353 dumb.push_back (X_("24 FPS"));
354 dumb.push_back (X_("25 FPS"));
355 dumb.push_back (X_("30 FPS drop"));
356 dumb.push_back (X_("30 FPS non-drop"));
358 set_popdown_strings (smpte_fps_combo, dumb);
359 smpte_fps_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
361 smpte_offset_clock.set_mode (AudioClock::SMPTE);
362 smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
364 smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
366 smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
368 Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
369 Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
370 smpte_fps_label->set_name("OptionsLabel");
371 smpte_offset_label->set_name("OptionsLabel");
373 hbox = manage (new HBox);
374 hbox->set_border_width (5);
375 hbox->set_spacing (10);
376 hbox->pack_start (*smpte_fps_label, false, false);
377 hbox->pack_start (smpte_fps_combo, false, false);
379 sync_packer.pack_start (*hbox, false, false);
381 hbox = manage (new HBox);
382 hbox->set_border_width (5);
383 hbox->set_spacing (10);
384 hbox->pack_start (*smpte_offset_label, false, false);
385 hbox->pack_start (smpte_offset_clock, false, false);
386 hbox->pack_start (smpte_offset_negative_button, false, false);
388 sync_packer.pack_start (*hbox, false, false);
390 smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
394 OptionEditor::smpte_offset_negative_clicked ()
397 session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
402 OptionEditor::smpte_fps_chosen ()
405 string str = smpte_fps_combo.get_active_text();
407 if (str == X_("24 FPS")) {
408 session->set_smpte_type (24.0, false);
409 } else if (str == X_("25 FPS")) {
410 session->set_smpte_type (25.0, false);
411 } else if (str == X_("30 FPS drop")) {
412 session->set_smpte_type (29.97, true);
413 } else if (str == X_("30 FPS non-drop")) {
414 session->set_smpte_type (30.0, false);
420 OptionEditor::smpte_offset_chosen()
423 jack_nframes_t frames = smpte_offset_clock.current_duration();
424 session->set_smpte_offset (frames);
430 OptionEditor::setup_midi_options ()
433 MIDI::Manager::PortMap::const_iterator i;
434 const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
439 Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
441 table->set_row_spacings (6);
442 table->set_col_spacings (10);
444 table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
445 table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
446 table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
447 table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
448 table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
449 table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
450 table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
452 table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
453 table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
454 table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
456 for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
458 pair<MIDI::Port*,vector<RadioButton*> > newpair;
460 newpair.first = i->second;
462 table->attach (*(manage (new Label (i->first))), 0, 1, n+2, n+3,FILL|EXPAND, FILL );
463 tb = manage (new ToggleButton (_("online")));
464 tb->set_name ("OptionEditorToggleButton");
466 /* remember, we have to handle the i18n case where the relative
467 lengths of the strings in language N is different than in english.
470 if (strlen (_("offline")) > strlen (_("online"))) {
471 set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
473 set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
476 tb->set_active (!(*i).second->input()->offline());
477 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
478 (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
479 table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
481 tb = manage (new ToggleButton ());
482 tb->set_name ("OptionEditorToggleButton");
483 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
484 tb->set_size_request (10, 10);
485 table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
487 tb = manage (new ToggleButton ());
488 tb->set_name ("OptionEditorToggleButton");
489 tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
490 tb->set_size_request (10, 10);
491 table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
493 rb = manage (new RadioButton ());
494 newpair.second.push_back (rb);
495 rb->set_name ("OptionEditorToggleButton");
497 mtc_button_group = rb->get_group();
499 rb->set_group (mtc_button_group);
502 table->attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL);
503 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb));
505 if (Config->get_mtc_port_name() == i->first) {
506 rb->set_active (true);
509 rb = manage (new RadioButton ());
510 newpair.second.push_back (rb);
511 rb->set_name ("OptionEditorToggleButton");
513 mmc_button_group = rb->get_group();
515 rb->set_group (mmc_button_group);
517 table->attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
518 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb));
520 if (Config->get_mmc_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 midi_button_group = rb->get_group();
530 rb->set_group (midi_button_group);
532 table->attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
533 rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb));
535 if (Config->get_midi_port_name() == i->first) {
536 rb->set_active (true);
539 port_toggle_buttons.insert (newpair);
544 hbox = manage (new HBox);
545 hbox->set_border_width (6);
546 hbox->pack_start (*table, true, false);
547 midi_packer.pack_start (*hbox, false, false);
551 OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb)
554 if (rb->get_active()) {
555 cerr << "Activating MTC port " << port->name() << endl;
557 session->set_mtc_port (port->name());
558 Config->set_mtc_port_name (port->name());
560 session->set_mtc_port ("");
562 rb->set_active (true);
568 OptionEditor::mmc_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
571 if (rb->get_active()) {
572 cerr << "Activating MMC port " << port->name() << endl;
574 session->set_mmc_port (port->name());
575 Config->set_mtc_port_name (port->name());
577 session->set_mmc_port ("");
579 rb->set_active (true);
585 OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
588 if (rb->get_active()) {
589 cerr << "Activating MIDI port " << port->name() << endl;
591 session->set_midi_port (port->name());
592 Config->set_midi_port_name (port->name());
594 session->set_midi_port ("");
596 rb->set_active (true);
602 OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
604 bool wanted = tb->get_active(); /* it hasn't changed at this point */
606 if (wanted != port->input()->offline()) {
607 port->input()->set_offline (wanted);
609 return stop_signal (*tb, "button_press_event");
613 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
615 if (port->input()->offline()) {
616 tb->set_label (_("offline"));
617 tb->set_active (false);
619 tb->set_label (_("online"));
620 tb->set_active (true);
625 OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
627 /* XXX not very good MVC style here */
629 port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
630 tb->set_active (!tb->get_active());
631 return stop_signal (*tb, "button_press_event");
635 OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
637 /* XXX not very good MVC style here */
639 port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
640 tb->set_active (!tb->get_active());
641 return stop_signal (*tb, "button_press_event");
645 OptionEditor::save ()
647 /* XXX a bit odd that we save the entire session state here */
653 OptionEditor::wm_close (GdkEventAny *ev)
661 OptionEditor::raid_path_changed ()
664 session->set_raid_path (session_raid_entry.get_text());
669 OptionEditor::click_browse_clicked ()
671 SoundFileChooser sfdb (_("Choose Click"), session);
673 int result = sfdb.run ();
675 if (result == Gtk::RESPONSE_OK) {
676 click_chosen(sfdb.get_filename());
681 OptionEditor::click_chosen (const string & path)
683 click_path_entry.set_text (path);
684 click_sound_changed ();
688 OptionEditor::click_emphasis_browse_clicked ()
690 SoundFileChooser sfdb (_("Choose Click Emphasis"), session);
692 int result = sfdb.run ();
694 if (result == Gtk::RESPONSE_OK) {
695 click_emphasis_chosen (sfdb.get_filename());
700 OptionEditor::click_emphasis_chosen (const string & path)
702 click_emphasis_path_entry.set_text (path);
703 click_emphasis_sound_changed ();
707 OptionEditor::click_sound_changed ()
710 string path = click_path_entry.get_text();
712 if (path == session->click_sound) {
716 if (path.length() == 0) {
718 session->set_click_sound ("");
722 strip_whitespace_edges (path);
724 if (path == _("internal")) {
725 session->set_click_sound ("");
727 session->set_click_sound (path);
734 OptionEditor::click_emphasis_sound_changed ()
737 string path = click_emphasis_path_entry.get_text();
739 if (path == session->click_emphasis_sound) {
743 if (path.length() == 0) {
745 session->set_click_emphasis_sound ("");
749 strip_whitespace_edges (path);
751 if (path == _("internal")) {
752 session->set_click_emphasis_sound ("");
754 session->set_click_emphasis_sound (path);
761 OptionEditor::clear_click_editor ()
763 if (click_io_selector) {
764 click_packer.remove (*click_io_selector);
765 click_packer.remove (*click_gpm);
766 delete click_io_selector;
768 click_io_selector = 0;
774 OptionEditor::setup_click_editor ()
777 HBox* hpacker = manage (new HBox);
779 click_path_entry.set_sensitive (true);
780 click_emphasis_path_entry.set_sensitive (true);
782 click_path_entry.set_name ("OptionsEntry");
783 click_emphasis_path_entry.set_name ("OptionsEntry");
785 click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
786 click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
788 click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
789 click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
791 click_browse_button.set_name ("EditorGTKButton");
792 click_emphasis_browse_button.set_name ("EditorGTKButton");
793 click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
794 click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
796 click_packer.set_border_width (12);
797 click_packer.set_spacing (5);
799 click_io_selector = new IOSelector (*session, session->click_io(), false);
800 click_gpm = new GainMeter (session->click_io(), *session);
802 click_table.set_col_spacings (10);
804 label = manage(new Label(_("Click audio file")));
805 label->set_name ("OptionsLabel");
806 click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
807 click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
808 click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
810 label = manage(new Label(_("Click emphasis audiofile")));
811 label->set_name ("OptionsLabel");
812 click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
813 click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
814 click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
816 hpacker->set_spacing (10);
817 hpacker->pack_start (*click_io_selector, false, false);
818 hpacker->pack_start (*click_gpm, false, false);
820 click_packer.pack_start (click_table, false, false);
821 click_packer.pack_start (*hpacker, false, false);
823 click_packer.show_all ();
827 OptionEditor::clear_auditioner_editor ()
829 if (auditioner_io_selector) {
830 audition_hpacker.remove (*auditioner_io_selector);
831 audition_hpacker.remove (*auditioner_gpm);
832 delete auditioner_io_selector;
833 delete auditioner_gpm;
834 auditioner_io_selector = 0;
840 OptionEditor::setup_auditioner_editor ()
842 audition_packer.set_border_width (12);
843 audition_packer.set_spacing (5);
844 audition_hpacker.set_spacing (10);
846 audition_label.set_name ("OptionEditorAuditionerLabel");
847 audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
848 "for listening to specific regions outside the context\n"
849 "of the overall mix. It can be connected just like any\n"
850 "other mixer strip."));
852 audition_packer.pack_start (audition_label, false, false, 10);
853 audition_packer.pack_start (audition_hpacker, false, false);
857 OptionEditor::connect_audition_editor ()
859 auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
860 auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
862 audition_hpacker.pack_start (*auditioner_io_selector, false, false);
863 audition_hpacker.pack_start (*auditioner_gpm, false, false);
865 auditioner_io_selector->show_all ();
866 auditioner_gpm->show_all ();
870 OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
876 static const struct {
880 { "Shift", GDK_SHIFT_MASK },
881 { "Control", GDK_CONTROL_MASK },
882 { "Alt (Mod1)", GDK_MOD1_MASK },
883 { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
884 { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
885 { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
886 { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
887 { "Mod2", GDK_MOD2_MASK },
888 { "Mod3", GDK_MOD3_MASK },
889 { "Mod4", GDK_MOD4_MASK },
890 { "Mod5", GDK_MOD5_MASK },
895 OptionEditor::setup_keyboard_options ()
900 keyboard_mouse_table.set_border_width (12);
901 keyboard_mouse_table.set_row_spacings (5);
902 keyboard_mouse_table.set_col_spacings (5);
904 /* internationalize and prepare for use with combos */
906 for (int i = 0; modifiers[i].name; ++i) {
907 dumb.push_back (_(modifiers[i].name));
910 set_popdown_strings (edit_modifier_combo, dumb);
911 edit_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
913 for (int x = 0; modifiers[x].name; ++x) {
914 if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
915 edit_modifier_combo.set_active_text (_(modifiers[x].name));
920 label = manage (new Label (_("Edit using")));
921 label->set_name ("OptionsLabel");
922 label->set_alignment (1.0, 0.5);
924 keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
925 keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
927 label = manage (new Label (_("+ button")));
928 label->set_name ("OptionsLabel");
930 keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
931 keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
933 edit_button_spin.set_name ("OptionsEntry");
934 edit_button_adjustment.set_value (Keyboard::edit_button());
935 edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
937 set_popdown_strings (delete_modifier_combo, dumb);
938 delete_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
940 for (int x = 0; modifiers[x].name; ++x) {
941 if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
942 delete_modifier_combo.set_active_text (_(modifiers[x].name));
947 label = manage (new Label (_("Delete using")));
948 label->set_name ("OptionsLabel");
949 label->set_alignment (1.0, 0.5);
951 keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
952 keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
954 label = manage (new Label (_("+ button")));
955 label->set_name ("OptionsLabel");
957 keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
958 keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
960 delete_button_spin.set_name ("OptionsEntry");
961 delete_button_adjustment.set_value (Keyboard::delete_button());
962 delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
964 set_popdown_strings (snap_modifier_combo, dumb);
965 snap_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
967 for (int x = 0; modifiers[x].name; ++x) {
968 if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
969 snap_modifier_combo.set_active_text (_(modifiers[x].name));
974 label = manage (new Label (_("Ignore snap using")));
975 label->set_name ("OptionsLabel");
976 label->set_alignment (1.0, 0.5);
978 keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
979 keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
983 OptionEditor::edit_modifier_chosen ()
987 txt = edit_modifier_combo.get_active_text();
989 for (int i = 0; modifiers[i].name; ++i) {
990 if (txt == _(modifiers[i].name)) {
991 Keyboard::set_edit_modifier (modifiers[i].modifier);
998 OptionEditor::delete_modifier_chosen ()
1002 txt = delete_modifier_combo.get_active_text();
1004 for (int i = 0; modifiers[i].name; ++i) {
1005 if (txt == _(modifiers[i].name)) {
1006 Keyboard::set_delete_modifier (modifiers[i].modifier);
1013 OptionEditor::snap_modifier_chosen ()
1017 txt = snap_modifier_combo.get_active_text();
1019 for (int i = 0; modifiers[i].name; ++i) {
1020 if (txt == _(modifiers[i].name)) {
1021 Keyboard::set_snap_modifier (modifiers[i].modifier);
1028 OptionEditor::delete_button_changed ()
1030 Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
1034 OptionEditor::edit_button_changed ()
1036 Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
1040 OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& strings)
1042 /* find the widest string */
1044 string::size_type maxlen = 0;
1047 for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
1048 string::size_type l;
1050 if ((l = (*i).length()) > maxlen) {
1056 /* try to include ascenders and descenders */
1058 if (maxstring.length() > 2) {
1063 const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
1065 set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);