- bool trace = tb->get_active();
-
- if (port->input()) {
- if (port->input()->tracing() != trace) {
- port->input()->trace (trace, &cerr, string (port->name()) + string (" input: "));
- }
- }
-}
-
-void
-OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
-{
- bool trace = tb->get_active();
-
- if (port->output()) {
- if (port->output()->tracing() != trace) {
- port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
- }
- }
-}
-
-void
-OptionEditor::save ()
-{
- /* XXX a bit odd that we save the entire session state here */
-
- ui.save_state ("");
-}
-
-gint
-OptionEditor::wm_close (GdkEventAny *ev)
-{
- save ();
- hide ();
- return TRUE;
-}
-
-void
-OptionEditor::raid_path_changed ()
-{
- if (session) {
- Config->set_raid_path (session_raid_entry.get_text());
- }
-}
-
-void
-OptionEditor::click_browse_clicked ()
-{
- SoundFileChooser sfdb (*this, _("Choose Click"), session);
-
- sfdb.show_all ();
- sfdb.present ();
-
- int result = sfdb.run ();
-
- if (result == Gtk::RESPONSE_OK) {
- click_chosen(sfdb.get_filename());
- }
-}
-
-void
-OptionEditor::click_chosen (const string & path)
-{
- click_path_entry.set_text (path);
- click_sound_changed ();
-}
-
-void
-OptionEditor::click_emphasis_browse_clicked ()
-{
- SoundFileChooser sfdb (*this, _("Choose Click Emphasis"), session);
-
- sfdb.show_all ();
- sfdb.present ();
-
- int result = sfdb.run ();
-
- if (result == Gtk::RESPONSE_OK) {
- click_emphasis_chosen (sfdb.get_filename());
- }
-}
-
-void
-OptionEditor::click_emphasis_chosen (const string & path)
-{
- click_emphasis_path_entry.set_text (path);
- click_emphasis_sound_changed ();
-}
-
-void
-OptionEditor::click_sound_changed ()
-{
- if (session) {
- string path = click_path_entry.get_text();
-
- if (path == Config->get_click_sound()) {
- return;
- }
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- Config->set_click_sound ("");
- } else {
- Config->set_click_sound (path);
- }
- }
-}
-
-void
-OptionEditor::click_emphasis_sound_changed ()
-{
- if (session) {
- string path = click_emphasis_path_entry.get_text();
-
- if (path == Config->get_click_emphasis_sound()) {
- return;
- }
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- Config->set_click_emphasis_sound ("");
- } else {
- Config->set_click_emphasis_sound (path);
- }
- }
-}
-
-void
-OptionEditor::clear_click_editor ()
-{
- if (click_io_selector) {
- click_packer.remove (*click_io_selector);
- click_packer.remove (*click_gpm);
- delete click_io_selector;
- delete click_gpm;
- click_io_selector = 0;
- click_gpm = 0;
- }
-}
-
-void
-OptionEditor::setup_click_editor ()
-{
- Label* label;
- HBox* hpacker = manage (new HBox);
-
- click_path_entry.set_sensitive (true);
- click_emphasis_path_entry.set_sensitive (true);
-
- click_path_entry.set_name ("OptionsEntry");
- click_emphasis_path_entry.set_name ("OptionsEntry");
-
- click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
- click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
-
- click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
- click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
-
- click_browse_button.set_name ("EditorGTKButton");
- click_emphasis_browse_button.set_name ("EditorGTKButton");
- click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
- click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
-
- click_packer.set_border_width (12);
- click_packer.set_spacing (5);
-
- click_io_selector = new IOSelector (*session, session->click_io(), false);
- click_gpm = new GainMeter (session->click_io(), *session);
-
- click_table.set_col_spacings (10);
-
- label = manage(new Label(_("Click audio file")));
- label->set_name ("OptionsLabel");
- click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
- click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
- click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
-
- label = manage(new Label(_("Click emphasis audiofile")));
- label->set_name ("OptionsLabel");
- click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
- click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
- click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
-
- hpacker->set_spacing (10);
- hpacker->pack_start (*click_io_selector, false, false);
- hpacker->pack_start (*click_gpm, false, false);
-
- click_packer.pack_start (click_table, false, false);
- click_packer.pack_start (*hpacker, false, false);
-
- click_packer.show_all ();
-}
-
-void
-OptionEditor::clear_auditioner_editor ()
-{
- if (auditioner_io_selector) {
- audition_hpacker.remove (*auditioner_io_selector);
- audition_hpacker.remove (*auditioner_gpm);
- delete auditioner_io_selector;
- delete auditioner_gpm;
- auditioner_io_selector = 0;
- auditioner_gpm = 0;
- }
-}
-
-void
-OptionEditor::setup_auditioner_editor ()
-{
- audition_packer.set_border_width (12);
- audition_packer.set_spacing (5);
- audition_hpacker.set_spacing (10);
-
- audition_label.set_name ("OptionEditorAuditionerLabel");
- audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
- "for listening to specific regions outside the context\n"
- "of the overall mix. It can be connected just like any\n"
- "other mixer strip."));
-
- audition_packer.pack_start (audition_label, false, false, 10);
- audition_packer.pack_start (audition_hpacker, false, false);
-}
-
-void
-OptionEditor::connect_audition_editor ()
-{
- auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
- auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
-
- audition_hpacker.pack_start (*auditioner_io_selector, false, false);
- audition_hpacker.pack_start (*auditioner_gpm, false, false);
-
- auditioner_io_selector->show_all ();
- auditioner_gpm->show_all ();
-}
-
-bool
-OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
-{
- (this->*pmf)();
- return false;
-}
-
-static const struct {
- const char *name;
- guint modifier;
-} modifiers[] = {
-
-#ifdef GTKOSX
-
- /* Command = Meta
- Option/Alt = Mod1
- */
-
- { "Shift", GDK_SHIFT_MASK },
- { "Command", GDK_META_MASK },
- { "Control", GDK_CONTROL_MASK },
- { "Option", GDK_MOD1_MASK },
- { "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK },
- { "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK },
- { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK },
- { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
-
-#else
- { "Shift", GDK_SHIFT_MASK },
- { "Control", GDK_CONTROL_MASK },
- { "Alt (Mod1)", GDK_MOD1_MASK },
- { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
- { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
- { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
- { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
- { "Mod2", GDK_MOD2_MASK },
- { "Mod3", GDK_MOD3_MASK },
- { "Mod4", GDK_MOD4_MASK },
- { "Mod5", GDK_MOD5_MASK },
-#endif
- { 0, 0 }
-};
-
-void
-OptionEditor::setup_keyboard_options ()
-{
- vector<string> dumb;
- Label* label;
-
- keyboard_mouse_table.set_border_width (12);
- keyboard_mouse_table.set_row_spacings (5);
- keyboard_mouse_table.set_col_spacings (5);
-
- /* internationalize and prepare for use with combos */
-
- for (int i = 0; modifiers[i].name; ++i) {
- dumb.push_back (_(modifiers[i].name));
- }
-
- set_popdown_strings (edit_modifier_combo, dumb);
- edit_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
-
- for (int x = 0; modifiers[x].name; ++x) {
- if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
- edit_modifier_combo.set_active_text (_(modifiers[x].name));
- break;
- }
- }
-
- label = manage (new Label (_("Edit using")));
- label->set_name ("OptionsLabel");
- label->set_alignment (1.0, 0.5);
-
- keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
- keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-
- label = manage (new Label (_("+ button")));
- label->set_name ("OptionsLabel");
-
- keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
- keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
-
- edit_button_spin.set_name ("OptionsEntry");
- edit_button_adjustment.set_value (Keyboard::edit_button());
- edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
-
- set_popdown_strings (delete_modifier_combo, dumb);
- delete_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
-
- for (int x = 0; modifiers[x].name; ++x) {
- if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
- delete_modifier_combo.set_active_text (_(modifiers[x].name));
- break;
- }
- }
-
- label = manage (new Label (_("Delete using")));
- label->set_name ("OptionsLabel");
- label->set_alignment (1.0, 0.5);
-
- keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
- keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-
- label = manage (new Label (_("+ button")));
- label->set_name ("OptionsLabel");
-
- keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
- keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-
- delete_button_spin.set_name ("OptionsEntry");
- delete_button_adjustment.set_value (Keyboard::delete_button());
- delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
-
- set_popdown_strings (snap_modifier_combo, dumb);
- snap_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
-
- for (int x = 0; modifiers[x].name; ++x) {
- if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
- snap_modifier_combo.set_active_text (_(modifiers[x].name));
- break;
- }
- }
-
- label = manage (new Label (_("Ignore snap using")));
- label->set_name ("OptionsLabel");
- label->set_alignment (1.0, 0.5);
-
- keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
- keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
-
- vector<string> strs;
-
- for (std::map<std::string,std::string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
- strs.push_back (bf->first);
- }
-
- set_popdown_strings (keyboard_layout_selector, strs);
- keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
- keyboard_layout_selector.signal_changed().connect (mem_fun (*this, &OptionEditor::bindings_changed));
-
- label = manage (new Label (_("Keyboard layout")));
- label->set_name ("OptionsLabel");
- label->set_alignment (1.0, 0.5);