-
-gint
-OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
-{
- /* XXX not very good MVC style here */
-
- port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
- tb->set_active (!tb->get_active());
- return stop_signal (*tb, "button_press_event");
-}
-
-gint
-OptionEditor::send_mtc_toggled (GdkEventButton *ev, CheckButton *button)
-{
- if (session) {
- session->set_send_mtc (!button->get_active());
- }
- return stop_signal (*button, "button_press_event");
-}
-
-void
-OptionEditor::send_mmc_toggled (CheckButton *button)
-{
- if (session) {
- session->set_send_mmc (button->get_active());
- }
-}
-
-void
-OptionEditor::mmc_control_toggled (CheckButton *button)
-{
- if (session) {
- session->set_mmc_control (button->get_active());
- }
-}
-
-void
-OptionEditor::midi_control_toggled (CheckButton *button)
-{
- if (session) {
- session->set_midi_control (button->get_active());
- }
-}
-
-void
-OptionEditor::midi_feedback_toggled (CheckButton *button)
-{
- if (session) {
- session->set_midi_feedback (button->get_active());
- }
-}
-
-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 ();
- just_close_win();
- return TRUE;
-}
-
-void
-OptionEditor::jack_time_master_clicked ()
-{
- bool yn = jack_time_master_button.get_active();
-
- Config->set_jack_time_master (yn);
-
- if (session) {
- session->engine().reset_timebase ();
- }
-}
-
-void
-OptionEditor::raid_path_changed ()
-{
- if (session) {
- session->set_raid_path (session_raid_entry.get_text());
- }
-}
-
-void
-OptionEditor::click_browse_clicked ()
-{
- SoundFileChooser sfdb (_("Choose Click"));
-
- int result = sfdb.run ();
-
- if (result == Gtk::RESPONSE_OK) {
- click_chosen(sfdb.get_filename());
- }
-}
-
-void
-OptionEditor::click_chosen (string path)
-{
- click_path_entry.set_text (path);
- click_sound_changed ();
-}
-
-void
-OptionEditor::click_emphasis_browse_clicked ()
-{
- SoundFileChooser sfdb (_("Choose Click Emphasis"));
-
- int result = sfdb.run ();
-
- if (result == Gtk::RESPONSE_OK) {
- click_emphasis_chosen (sfdb.get_filename());
- }
-}
-
-void
-OptionEditor::click_emphasis_chosen (std::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 == session->click_sound) {
- return;
- }
-
- if (path.length() == 0) {
-
- session->set_click_sound ("");
-
- } else {
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- session->set_click_sound ("");
- } else {
- session->set_click_sound (path);
- }
- }
- }
-}
-
-void
-OptionEditor::click_emphasis_sound_changed ()
-{
- if (session) {
- string path = click_emphasis_path_entry.get_text();
-
- if (path == session->click_emphasis_sound) {
- return;
- }
-
- if (path.length() == 0) {
-
- session->set_click_emphasis_sound ("");
-
- } else {
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- session->set_click_emphasis_sound ("");
- } else {
- session->set_click_emphasis_sound (path);
- }
- }
- }
-}
-
-void
-OptionEditor::show_waveforms_clicked ()
-{
- editor.set_show_waveforms (show_waveforms_button.get_active());
-}
-
-void
-OptionEditor::show_waveforms_recording_clicked ()
-{
- editor.set_show_waveforms_recording (show_waveforms_recording_button.get_active());
-}
-
-void
-OptionEditor::show_measures_clicked ()
-{
- editor.set_show_measures (show_measures_button.get_active());
-}
-
-void
-OptionEditor::follow_playhead_clicked ()
-{
- editor.set_follow_playhead (follow_playhead_button.get_active());
-}
-
-void
-OptionEditor::strip_width_clicked ()
-{
- mixer.set_strip_width (mixer_strip_width_button.get_active() ? Narrow : Wide);
-}
-
-
-void
-OptionEditor::just_close_win()
-{
- hide_all();
-}
-
-void
-OptionEditor::queue_session_control_changed (Session::ControlType t)
-{
- ui.call_slot (bind (mem_fun(*this, &OptionEditor::session_control_changed), t));
-}
-
-void
-OptionEditor::session_control_changed (Session::ControlType t)
-{
- switch (t) {
- case Session::SlaveType:
- switch (session->slave_source()) {
- case Session::None:
- slave_type_combo.set_active_text (positional_sync_strings[Session::None]);
- break;
- case Session::MTC:
- slave_type_combo.set_active_text (positional_sync_strings[Session::MTC]);
- break;
- case Session::JACK:
- slave_type_combo.set_active_text (positional_sync_strings[Session::JACK]);
- break;
- default:
- slave_type_combo.set_active_text (_("--unknown--"));
- break;
- }
-
- break;
-
- case Session::SendMTC:
- map_some_session_state (send_mtc_button, &Session::get_send_mtc);
- break;
-
- case Session::SendMMC:
- map_some_session_state (send_mmc_button, &Session::get_send_mmc);
- break;
-
- case Session::MMCControl:
- map_some_session_state (mmc_control_button, &Session::get_mmc_control);
- break;
-
- case Session::MidiFeedback:
- map_some_session_state (midi_feedback_button, &Session::get_midi_feedback);
- break;
-
- case Session::MidiControl:
- map_some_session_state (midi_control_button, &Session::get_midi_control);
- break;
-
- default:
- break;
- }
-}
-
-void
-OptionEditor::native_format_chosen ()
-{
- string which;
-
- if (session == 0) {
- return;
- }
-
- bool use_bwf = (native_format_combo.get_active_text() == native_format_strings[0]);
-
- if (use_bwf != Config->get_native_format_is_bwf()) {
- Config->set_native_format_is_bwf (use_bwf);
- session->reset_native_file_format ();
- }
-}
-
-void
-OptionEditor::slave_type_chosen ()
-{
- string which;
-
- if (session == 0) {
- return;
- }
-
- which = slave_type_combo.get_active_text();
-
- if (which == positional_sync_strings[Session::None]) {
- session->request_slave_source (Session::None);
- } else if (which == positional_sync_strings[Session::MTC]) {
- session->request_slave_source (Session::MTC);
- } else if (which == positional_sync_strings[Session::JACK]) {
- session->request_slave_source (Session::JACK);
- }
-}
-
-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;
-}
-
-void
-OptionEditor::setup_misc_options()
-{
- Gtk::Table* table = manage (new Table (4, 2));
- table->set_homogeneous (true);
-
- misc_packer.set_border_width (8);
- misc_packer.set_spacing (3);
- misc_packer.pack_start (*table, true, true);
-
- table->attach (hw_monitor_button, 0, 1, 0, 1, Gtk::FILL, FILL, 8, 0);
- table->attach (sw_monitor_button, 0, 1, 1, 2, Gtk::FILL, FILL, 8, 0);
- table->attach (plugins_stop_button, 0, 1, 2, 3, Gtk::FILL, FILL, 8, 0);
- table->attach (plugins_on_rec_button, 0, 1, 3, 4, Gtk::FILL, FILL, 8, 0);
- table->attach (verify_remove_last_capture_button, 0, 1, 4, 5, Gtk::FILL, FILL, 8, 0);
-
- table->attach (stop_rec_on_xrun_button, 1, 2, 0, 1, Gtk::FILL, FILL, 8, 0);
- table->attach (stop_at_end_button, 1, 2, 1, 2, Gtk::FILL, FILL, 8, 0);
- table->attach (debug_keyboard_button, 1, 2, 2, 3, Gtk::FILL, FILL, 8, 0);
- table->attach (speed_quieten_button, 1, 2, 3, 4, Gtk::FILL, FILL, 8, 0);
-
- Gtk::VBox* connect_box = manage (new VBox);
- connect_box->set_spacing (3);
- connect_box->set_border_width (8);
-
- auto_connect_output_button_group = auto_connect_output_master_button.get_group();
- auto_connect_output_manual_button.set_group (auto_connect_output_button_group);
- auto_connect_output_physical_button.set_group (auto_connect_output_button_group);
-
- Gtk::HBox* useless_box = manage (new HBox);
- useless_box->pack_start (auto_connect_inputs_button, false, false);
- connect_box->pack_start (*useless_box, false, false);
- connect_box->pack_start (auto_connect_output_master_button, false, false);
- connect_box->pack_start (auto_connect_output_physical_button, false, false);
- connect_box->pack_start (auto_connect_output_manual_button, false, false);
-
- misc_packer.pack_start (*connect_box, false, false);
-
- hw_monitor_button.set_name ("OptionEditorToggleButton");
- sw_monitor_button.set_name ("OptionEditorToggleButton");
- plugins_stop_button.set_name ("OptionEditorToggleButton");
- plugins_on_rec_button.set_name ("OptionEditorToggleButton");
- verify_remove_last_capture_button.set_name ("OptionEditorToggleButton");
- auto_connect_inputs_button.set_name ("OptionEditorToggleButton");
- auto_connect_output_physical_button.set_name ("OptionEditorToggleButton");
- auto_connect_output_master_button.set_name ("OptionEditorToggleButton");
- auto_connect_output_manual_button.set_name ("OptionEditorToggleButton");
- stop_rec_on_xrun_button.set_name ("OptionEditorToggleButton");
- stop_at_end_button.set_name ("OptionEditorToggleButton");
- debug_keyboard_button.set_name ("OptionEditorToggleButton");
- speed_quieten_button.set_name ("OptionEditorToggleButton");
-
- hw_monitor_button.set_active (Config->get_use_hardware_monitoring());
- sw_monitor_button.set_active (!Config->get_no_sw_monitoring());
- plugins_stop_button.set_active (Config->get_plugins_stop_with_transport());
- stop_rec_on_xrun_button.set_active (Config->get_stop_recording_on_xrun());
- stop_at_end_button.set_active (Config->get_stop_at_session_end());
- debug_keyboard_button.set_active (false);
- speed_quieten_button.set_active (Config->get_quieten_at_speed() != 1.0f);
-
- hw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::hw_monitor_clicked));
- sw_monitor_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::sw_monitor_clicked));
- plugins_stop_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_stop_with_transport_clicked));
- plugins_on_rec_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::plugins_on_while_recording_clicked));
- verify_remove_last_capture_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::verify_remove_last_capture_clicked));
- auto_connect_inputs_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_inputs_clicked));
- auto_connect_output_physical_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_physical_clicked));
- auto_connect_output_master_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_master_clicked));
- auto_connect_output_manual_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_connect_output_manual_clicked));
- stop_rec_on_xrun_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_rec_on_xrun_clicked));
- stop_at_end_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::stop_at_end_clicked));
- debug_keyboard_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::debug_keyboard_clicked));
- speed_quieten_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::speed_quieten_clicked));
-}
-
-void
-OptionEditor::speed_quieten_clicked ()
-{
- if (speed_quieten_button.get_active()) {
- Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
- } else {
- Config->set_quieten_at_speed (1.0); /* no change */
- }
-}
-
-void
-OptionEditor::debug_keyboard_clicked ()
-{
- extern bool debug_keyboard;
- debug_keyboard = debug_keyboard_button.get_active ();
-}
-
-void
-OptionEditor::auto_connect_inputs_clicked ()
-{
- if (session) {
- session->set_input_auto_connect (auto_connect_inputs_button.get_active());
- }
-}
-
-void
-OptionEditor::auto_connect_output_master_clicked ()
-{
- if (session) {
- if (auto_connect_output_master_button.get_active()) {
- session->set_output_auto_connect (Session::AutoConnectMaster);
- }
- }
-}
-
-void
-OptionEditor::auto_connect_output_physical_clicked ()
-{
- if (session) {
- if (auto_connect_output_physical_button.get_active()) {
- session->set_output_auto_connect (Session::AutoConnectPhysical);
- }
- }
-}
-
-void
-OptionEditor::auto_connect_output_manual_clicked ()
-{
- if (session) {
- if (auto_connect_output_manual_button.get_active()) {
- session->set_output_auto_connect (Session::AutoConnectOption (0));
- }
- }
-}
-
-void
-OptionEditor::hw_monitor_clicked ()
-{
- Config->set_use_hardware_monitoring (hw_monitor_button.get_active());
-}
-
-void
-OptionEditor::sw_monitor_clicked ()
-{
- Config->set_no_sw_monitoring (!sw_monitor_button.get_active());
-}
-
-void
-OptionEditor::plugins_stop_with_transport_clicked ()
-{
- Config->set_plugins_stop_with_transport (plugins_stop_button.get_active());
-}
-
-void
-OptionEditor::plugins_on_while_recording_clicked ()
-{
- if (session) {
- session->set_recording_plugins (plugins_on_rec_button.get_active());
- }
-}
-
-void
-OptionEditor::verify_remove_last_capture_clicked ()
-{
- Config->set_verify_remove_last_capture(verify_remove_last_capture_button.get_active());
-}
-
-void
-OptionEditor::stop_rec_on_xrun_clicked ()
-{
- Config->set_stop_recording_on_xrun (stop_rec_on_xrun_button.get_active());
-}
-
-void
-OptionEditor::stop_at_end_clicked ()
-{
- Config->set_stop_at_session_end (stop_at_end_button.get_active());
-}
-
-static const struct {
- const char *name;
- guint modifier;
-} modifiers[] = {
- { "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 },
- { 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);
-}
-
-void
-OptionEditor::edit_modifier_chosen ()
-{
- string txt;
-
- txt = edit_modifier_combo.get_active_text();
-
- for (int i = 0; modifiers[i].name; ++i) {
- if (txt == _(modifiers[i].name)) {
- Keyboard::set_edit_modifier (modifiers[i].modifier);
- break;
- }
- }
-}
-
-void
-OptionEditor::delete_modifier_chosen ()
-{
- string txt;
-
- txt = delete_modifier_combo.get_active_text();
-
- for (int i = 0; modifiers[i].name; ++i) {
- if (txt == _(modifiers[i].name)) {
- Keyboard::set_delete_modifier (modifiers[i].modifier);
- break;
- }
- }
-}
-
-void
-OptionEditor::snap_modifier_chosen ()
-{
- string txt;
-
- txt = snap_modifier_combo.get_active_text();
-
- for (int i = 0; modifiers[i].name; ++i) {
- if (txt == _(modifiers[i].name)) {
- Keyboard::set_snap_modifier (modifiers[i].modifier);
- break;
- }
- }
-}
-
-void
-OptionEditor::delete_button_changed ()
-{
- Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
-}
-
-void
-OptionEditor::edit_button_changed ()
-{
- Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
-}
-
-void
-OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& strings)
-{
- /* find the widest string */
-
- string::size_type maxlen = 0;
- string maxstring;
-
- for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
- string::size_type l;
-
- if ((l = (*i).length()) > maxlen) {
- maxlen = l;
- maxstring = *i;
- }
- }
-
- /* try to include ascenders and descenders */
-
- if (maxstring.length() > 2) {
- maxstring[0] = 'g';
- maxstring[1] = 'l';
- }
-
- const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
-
- set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);
-}
-
-void
-OptionEditor::map_some_session_state (CheckButton& button, bool (Session::*get)() const)
-{
- if (session) {
- button.set_active ((session->*get)());
- }
-}
-