Make range selection context menu work again.
[ardour.git] / gtk2_ardour / option_editor.cc
index 988aa92e451cae82a43df671a586ebfcef9bb0db..935197a0ca98572fa38dff2bbe985e7620c8e500 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2001-2006 Paul Davis 
+    Copyright (C) 2001-2006 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
+#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
+#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
 
 #include <pbd/whitespace.h>
 
@@ -26,6 +28,7 @@
 #include <ardour/auditioner.h>
 #include <ardour/sndfilesource.h>
 #include <ardour/crossfade.h>
+#include <ardour/profile.h>
 #include <midi++/manager.h>
 #include <midi++/factory.h>
 #include <gtkmm2ext/stop_signal.h>
@@ -44,6 +47,7 @@
 #include "option_editor.h"
 #include "midi_port_dialog.h"
 #include "gui_thread.h"
+#include "utils.h"
 
 #include "i18n.h"
 
@@ -86,12 +90,14 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
 
          /* MIDI */
 
-         midi_port_table (4, 11),
+         midi_port_table (4, 12),
          mmc_receive_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
          mmc_receive_device_id_spinner (mmc_receive_device_id_adjustment),
          mmc_send_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
          mmc_send_device_id_spinner (mmc_send_device_id_adjustment),
          add_midi_port_button (_("Add new MIDI port")),
+         initial_program_change_adjustment (0.0, -1.0, (double) 0x7f, 1.0, 16.0),
+         initial_program_change_spinner (initial_program_change_adjustment),
 
          /* Click */
 
@@ -106,14 +112,15 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
          delete_button_spin (delete_button_adjustment),
          edit_button_adjustment (3, 1, 5),
          edit_button_spin (edit_button_adjustment)
-         
+
 {
        using namespace Notebook_Helpers;
 
+       first_click_setup = true;
        click_io_selector = 0;
        auditioner_io_selector = 0;
        session = 0;
-       
+
        WindowTitle title(Glib::get_application_name());
        title += _("Preferences");
        set_title(title.get_string());
@@ -123,7 +130,7 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
 
        set_name ("Preferences");
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
-       
+
        VBox *vbox = get_vbox();
        set_border_width (3);
 
@@ -142,9 +149,11 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
        setup_keyboard_options ();
        setup_auditioner_editor ();
 
-       notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
-       notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
-       notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
+       if (!Profile->get_sae()) {
+               notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
+               notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
+               notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
+       }
        notebook.pages().push_back (TabElem (click_packer, _("Click")));
        notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
        notebook.pages().push_back (TabElem (misc_packer, _("Misc")));
@@ -220,7 +229,7 @@ OptionEditor::setup_path_options()
 
        session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
 
-       label = manage(new Label(_("session RAID path")));
+       label = manage (new Label (_("Session RAID path")));
        label->set_name ("OptionsLabel");
        path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
        path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
@@ -250,14 +259,42 @@ OptionEditor::add_session_paths ()
        session_raid_entry.set_text(session->raid_path());
 }
 
+static void
+font_scale_changed (Gtk::Adjustment* adj)
+{
+       Config->set_font_scale((long)floor (adj->get_value() * 1024));
+       reset_dpi();
+}
+
 void
 OptionEditor::setup_misc_options ()
 {
        Gtk::HBox* hbox;
-       
-       Label* label = manage (new Label (_("Short crossfade length (msecs)")));
+       Label* label;
+
+#ifndef GTKOSX
+       /* font scaling does nothing with GDK/Quartz */
+
+       Gtk::Adjustment* dpi_adj = new Gtk::Adjustment ((double)Config->get_font_scale() / 1024, 50, 250, 1, 10);
+       Gtk::HScale * dpi_range = new Gtk::HScale (*dpi_adj);
+
+       label = manage (new Label (_("Font scaling")));
        label->set_name ("OptionsLabel");
-       
+
+       dpi_range->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
+       dpi_adj->signal_value_changed().connect (bind (sigc::ptr_fun (font_scale_changed), dpi_adj));
+
+       hbox = manage (new HBox);
+       hbox->set_border_width (5);
+       hbox->set_spacing (10);
+       hbox->pack_start (*label, false, false);
+       hbox->pack_start (*dpi_range, true, true);
+       misc_packer.pack_start (*hbox, false, false);
+#endif
+
+       label = manage (new Label (_("Short crossfade length (msecs)")));
+       label->set_name ("OptionsLabel");
+
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
@@ -269,14 +306,14 @@ OptionEditor::setup_misc_options ()
 
        label = manage (new Label (_("Destructive crossfade length (msecs)")));
        label->set_name ("OptionsLabel");
-       
+
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
        hbox->pack_start (*label, false, false);
        hbox->pack_start (destructo_xfade_slider, true, true);
        misc_packer.pack_start (*hbox, false, false);
-       
+
 
        destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
 
@@ -316,7 +353,7 @@ OptionEditor::setup_misc_options ()
        hbox->pack_start (*label, false, false);
        hbox->pack_start (saved_history_depth_spinner, false, false);
        misc_packer.pack_start (*hbox, false, false);
-       
+
        short_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
        destructo_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
 
@@ -329,7 +366,7 @@ void
 OptionEditor::limit_history_toggled ()
 {
        bool x = limit_history_button.get_active();
-       
+
        if (!x) {
                Config->set_history_depth (0);
                history_depth_spinner.set_sensitive (false);
@@ -370,9 +407,9 @@ OptionEditor::short_xfade_adjustment_changed ()
 {
        if (session) {
                float val = short_xfade_adjustment.get_value();
-               
+
                /* val is in msecs */
-               
+
                Crossfade::set_short_xfade_length ((nframes_t) floor (session->frame_rate() * (val / 1000.0)));
        }
 }
@@ -384,12 +421,12 @@ OptionEditor::destructo_xfade_adjustment_changed ()
 
        /* val is in msecs */
 
-       
+
        Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
 
        if (session) {
                SndFileSource::setup_standard_crossfades (session->frame_rate());
-       } 
+       }
 }
 
 void
@@ -400,14 +437,14 @@ OptionEditor::setup_sync_options ()
 
        smpte_offset_clock.set_mode (AudioClock::SMPTE);
        smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
-       
+
        smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
 
        smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
 
        Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
        smpte_offset_label->set_name("OptionsLabel");
-       
+
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
@@ -473,32 +510,49 @@ OptionEditor::setup_midi_options ()
        hbox->pack_start (midi_port_table, true, false);
 
        midi_packer.pack_start (*hbox, false, false);
-       add_midi_port_button.set_label ("Add MIDI port");
+       add_midi_port_button.set_label ("Add MIDI Port");
        midi_packer.pack_start (add_midi_port_button, false, false);
 
        hbox = manage (new HBox);
        hbox->set_border_width (6);
        hbox->set_spacing (6);
-       label = (manage (new Label (_("Inbound MMC Device ID")))); 
+       label = (manage (new Label (_("Inbound MMC Device ID"))));
        hbox->pack_start (mmc_receive_device_id_spinner, false, false);
        hbox->pack_start (*label, false, false);
-       midi_packer.pack_start (*hbox, false, false); 
+       midi_packer.pack_start (*hbox, false, false);
 
        mmc_receive_device_id_spinner.set_value(Config->get_mmc_receive_device_id ());
 
        hbox = manage (new HBox);
        hbox->set_border_width (6);
        hbox->set_spacing (6);
-       label = (manage (new Label (_("Outbound MMC Device ID")))); 
+       label = (manage (new Label (_("Outbound MMC Device ID"))));
        hbox->pack_start (mmc_send_device_id_spinner, false, false);
        hbox->pack_start (*label, false, false);
        midi_packer.pack_start (*hbox, false, false);
 
        mmc_send_device_id_spinner.set_value(Config->get_mmc_send_device_id ());
 
+       hbox = manage (new HBox);
+       hbox->set_border_width (6);
+       hbox->set_spacing (6);
+       label = (manage (new Label (_("Startup program change")))); 
+       hbox->pack_start (initial_program_change_spinner, false, false);
+       hbox->pack_start (*label, false, false);
+       midi_packer.pack_start (*hbox, false, false);
+       
+       initial_program_change_spinner.set_value (Config->get_initial_program_change());
+       initial_program_change_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::initial_program_change_adjusted));
+
        add_midi_port_button.signal_clicked().connect (mem_fun (*this, &OptionEditor::add_midi_port));
 }
 
+void
+OptionEditor::initial_program_change_adjusted ()
+{
+       Config->set_initial_program_change (((int32_t) floor (initial_program_change_adjustment.get_value())) & 0x7f);
+}
+
 void
 OptionEditor::redisplay_midi_ports ()
 {
@@ -517,52 +571,60 @@ OptionEditor::redisplay_midi_ports ()
 
        midi_port_table_widgets.clear ();
 
-       midi_port_table.resize (ports.size() + 4, 11);
+       midi_port_table.resize (ports.size() + 4, 12);
 
        Gtk::Label* label;
 
-       label = (manage (new Label (_("Port")))); 
+       label = (manage (new Label (_("Port"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 0, 1, 0, 1);
-       label = (manage (new Label (_("Offline")))); 
+       label = (manage (new Label (_("Offline"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 1, 2, 0, 1);
-       label = (manage (new Label (_("Trace\nInput")))); 
+       label = (manage (new Label (_("Trace\ninput"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 2, 3, 0, 1);
-       label = (manage (new Label (_("Trace\nOutput")))); 
+       label = (manage (new Label (_("Trace\noutput"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 3, 4, 0, 1);
-       label = (manage (new Label (_("MTC")))); 
+       label = (manage (new Label (_("MTC"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 4, 5, 0, 1);
-       label = (manage (new Label (_("MMC")))); 
+       label = (manage (new Label (_("MIDI\nclock"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 6, 7, 0, 1);
-       label = (manage (new Label (_("MIDI Parameter\nControl")))); 
+       label = (manage (new Label (_("MMC"))));
        label->show ();
        midi_port_table_widgets.push_back (label);
        midi_port_table.attach (*label, 8, 9, 0, 1);
+       label = (manage (new Label (_("MIDI parameter\ncontrol"))));
+       label->show ();
+       midi_port_table_widgets.push_back (label);
+       midi_port_table.attach (*label, 10, 11, 0, 1);
 
-       Gtk::HSeparator* hsep = (manage (new HSeparator())); 
+       Gtk::HSeparator* hsep = (manage (new HSeparator()));
        hsep->show ();
        midi_port_table_widgets.push_back (hsep);
-       midi_port_table.attach (*hsep, 0, 9, 1, 2);
-       Gtk::VSeparator* vsep = (manage (new VSeparator())); 
+       midi_port_table.attach (*hsep, 0, 11, 1, 2);
+       Gtk::VSeparator* vsep = (manage (new VSeparator()));
        vsep->show ();
        midi_port_table_widgets.push_back (vsep);
        midi_port_table.attach (*vsep, 5, 6, 0, 8);
-       vsep = (manage (new VSeparator())); 
+       vsep = (manage (new VSeparator()));
        vsep->show ();
        midi_port_table_widgets.push_back (vsep);
        midi_port_table.attach (*vsep, 7, 8, 0, 8);
-       
+       vsep = (manage (new VSeparator()));
+       vsep->show ();
+       midi_port_table_widgets.push_back (vsep);
+       midi_port_table.attach (*vsep, 9, 10, 0, 8);
+
        for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
 
                ToggleButton* tb;
@@ -570,20 +632,20 @@ OptionEditor::redisplay_midi_ports ()
                Button* bb;
 
                /* the remove button. create early so we can pass it to various callbacks */
-               
+
                bb = manage (new Button (Stock::REMOVE));
                bb->set_name ("OptionEditorToggleButton");
                bb->show ();
                midi_port_table_widgets.push_back (bb);
-               midi_port_table.attach (*bb, 9, 10, n+2, n+3, FILL|EXPAND, FILL);
+               midi_port_table.attach (*bb, 11, 12, n+2, n+3, FILL|EXPAND, FILL);
                bb->signal_clicked().connect (bind (mem_fun(*this, &OptionEditor::remove_midi_port), i->second));
                bb->set_sensitive (port_removable (i->second));
 
-               label = (manage (new Label (i->first))); 
+               label = (manage (new Label (i->first)));
                label->show ();
                midi_port_table_widgets.push_back (label);
                midi_port_table.attach (*label, 0, 1, n+2, n+3,FILL|EXPAND, FILL );
-               
+
                tb = manage (new ToggleButton (_("online")));
                tb->set_name ("OptionEditorToggleButton");
 
@@ -606,6 +668,7 @@ OptionEditor::redisplay_midi_ports ()
                midi_port_table_widgets.push_back (tb);
                midi_port_table.attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
 
+               // Trace MIDI Input
                tb = manage (new ToggleButton ());
                tb->set_name ("OptionEditorToggleButton");
                tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
@@ -614,6 +677,7 @@ OptionEditor::redisplay_midi_ports ()
                midi_port_table_widgets.push_back (tb);
                midi_port_table.attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
 
+               // Trace MIDI Output
                tb = manage (new ToggleButton ());
                tb->set_name ("OptionEditorToggleButton");
                tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
@@ -622,13 +686,13 @@ OptionEditor::redisplay_midi_ports ()
                midi_port_table_widgets.push_back (tb);
                midi_port_table.attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
 
+               // MTC Radio Button
                rb = manage (new RadioButton ());
                rb->set_name ("OptionEditorToggleButton");
                if (n == 0) {
                        mtc_button_group = rb->get_group();
                } else {
                        rb->set_group (mtc_button_group);
-
                }
                rb->show ();
                midi_port_table_widgets.push_back (rb);
@@ -638,7 +702,24 @@ OptionEditor::redisplay_midi_ports ()
                if (session && i->second == session->mtc_port()) {
                        rb->set_active (true);
                }
-               
+
+               // MIDI Clock Radio Button
+               rb = manage (new RadioButton ());
+               rb->set_name ("OptionEditorToggleButton");
+               if (n == 0) {
+                       midi_clock_button_group = rb->get_group();
+               } else {
+                       rb->set_group (midi_clock_button_group);
+               }
+               rb->show ();
+               midi_port_table_widgets.push_back (rb);
+               midi_port_table.attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
+               rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_clock_port_chosen), (*i).second, rb, bb));
+
+               if (session && i->second == session->midi_clock_port()) {
+                       rb->set_active (true);
+               }
+
                rb = manage (new RadioButton ());
                rb->set_name ("OptionEditorToggleButton");
                if (n == 0) {
@@ -648,7 +729,7 @@ OptionEditor::redisplay_midi_ports ()
                }
                rb->show ();
                midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
+               midi_port_table.attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
                rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb, bb));
 
                if (session && i->second == session->mmc_port()) {
@@ -664,7 +745,7 @@ OptionEditor::redisplay_midi_ports ()
                }
                rb->show ();
                midi_port_table_widgets.push_back (rb);
-               midi_port_table.attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
+               midi_port_table.attach (*rb, 10, 11, n+2, n+3, FILL|EXPAND, FILL);
                rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb, bb));
 
                if (session && i->second == session->midi_port()) {
@@ -743,7 +824,7 @@ OptionEditor::port_removable (MIDI::Port *port)
 }
 
 void
-OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb) 
+OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
 {
        if (session) {
                if (rb->get_active()) {
@@ -784,6 +865,20 @@ OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb, Gtk::But
        }
 }
 
+void
+OptionEditor::midi_clock_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
+{
+       if (session) {
+               if (rb->get_active()) {
+                       session->set_midi_clock_port (port->name());
+                       Config->set_midi_clock_port_name (port->name());
+               } else {
+                       session->set_midi_clock_port ("");
+               }
+               bb->set_sensitive (port_removable (port));
+       }
+}
+
 void
 OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
 {
@@ -792,7 +887,7 @@ OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
        if (port->input()) {
                if (wanted != port->input()->offline()) {
                        port->input()->set_offline (wanted);
-               } 
+               }
        }
 }
 
@@ -800,7 +895,7 @@ void
 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
 {
        bool bstate = tb->get_active ();
-       
+
        if (port->input()) {
                if (bstate != port->input()->offline()) {
                        if (port->input()->offline()) {
@@ -880,12 +975,12 @@ 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());
        }
@@ -915,7 +1010,7 @@ OptionEditor::click_emphasis_browse_clicked ()
 
 void
 OptionEditor::click_emphasis_chosen (const string & path)
-{      
+{
        click_emphasis_path_entry.set_text (path);
        click_emphasis_sound_changed ();
 }
@@ -964,8 +1059,8 @@ void
 OptionEditor::clear_click_editor ()
 {
        if (click_io_selector) {
-               click_packer.remove (*click_io_selector);
-               click_packer.remove (*click_gpm);
+               click_hpacker.remove (*click_io_selector);
+               click_hpacker.remove (*click_gpm);
                delete click_io_selector;
                delete click_gpm;
                click_io_selector = 0;
@@ -977,51 +1072,60 @@ 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);
+       if (first_click_setup) {
+               
+               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_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_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_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_table.set_col_spacings (10);
+               
+               label = manage(new Label(_("Click audio file:")));
+               label->set_name ("OptionsLabel");
+               label->set_alignment (0, 0.5);
+               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");
+               label->set_alignment (0, 0.5);
+               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);
 
-       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.pack_start (click_table, false, false);
+               click_packer.pack_start (click_hpacker, false, false);
 
-       click_packer.set_border_width (12);
-       click_packer.set_spacing (5);
+               click_hpacker.set_spacing (10);
 
-       click_io_selector = new IOSelector (*session, session->click_io(), false);
-       click_gpm = new GainMeter (session->click_io(), *session);
+               first_click_setup = false;
+       }
 
-       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);
+       click_path_entry.set_sensitive (true);
+       click_emphasis_path_entry.set_sensitive (true);
 
-       hpacker->set_spacing (10);
-       hpacker->pack_start (*click_io_selector, false, false);
-       hpacker->pack_start (*click_gpm, false, false);
+       click_io_selector = new IOSelector (*session, session->click_io(), true);
+       click_gpm = new GainMeter (*session);
+       click_gpm->set_io (session->click_io());
 
-       click_packer.pack_start (click_table, false, false);
-       click_packer.pack_start (*hpacker, false, false);
+       click_hpacker.pack_start (*click_io_selector, true, true);
+       click_hpacker.pack_start (*click_gpm, false, false);
 
        click_packer.show_all ();
 }
@@ -1051,7 +1155,7 @@ OptionEditor::setup_auditioner_editor ()
                                   "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);
 }
@@ -1059,10 +1163,11 @@ OptionEditor::setup_auditioner_editor ()
 void
 OptionEditor::connect_audition_editor ()
 {
-       auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
-       auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
+       auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), true);
+       auditioner_gpm = new GainMeter (*session);
+       auditioner_gpm->set_io (session->the_auditioner());
 
-       audition_hpacker.pack_start (*auditioner_io_selector, false, false);
+       audition_hpacker.pack_start (*auditioner_io_selector, true, true);
        audition_hpacker.pack_start (*auditioner_gpm, false, false);
 
        auditioner_io_selector->show_all ();
@@ -1070,7 +1175,7 @@ OptionEditor::connect_audition_editor ()
 }
 
 bool
-OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)()) 
+OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
 {
        (this->*pmf)();
        return false;
@@ -1081,7 +1186,7 @@ static const struct {
     guint   modifier;
 } modifiers[] = {
 
-#ifdef GTKOSX 
+#ifdef GTKOSX
 
        /* Command = Meta
           Option/Alt = Mod1
@@ -1138,16 +1243,16 @@ OptionEditor::setup_keyboard_options ()
                }
        }
 
-       label = manage (new Label (_("Edit using")));
+       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);
 
@@ -1165,10 +1270,10 @@ OptionEditor::setup_keyboard_options ()
                }
        }
 
-       label = manage (new Label (_("Delete using")));
+       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);
 
@@ -1184,7 +1289,7 @@ OptionEditor::setup_keyboard_options ()
 
        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));
@@ -1192,24 +1297,24 @@ OptionEditor::setup_keyboard_options ()
                }
        }
 
-       label = manage (new Label (_("Ignore snap using")));
+       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 = manage (new Label (_("Keyboard layout:")));
        label->set_name ("OptionsLabel");
        label->set_alignment (1.0, 0.5);
 
@@ -1221,7 +1326,7 @@ void
 OptionEditor::bindings_changed ()
 {
        string txt;
-       
+
        txt = keyboard_layout_selector.get_active_text();
 
        for (std::map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
@@ -1237,7 +1342,7 @@ void
 OptionEditor::edit_modifier_chosen ()
 {
        string txt;
-       
+
        txt = edit_modifier_combo.get_active_text();
 
        for (int i = 0; modifiers[i].name; ++i) {
@@ -1252,7 +1357,7 @@ void
 OptionEditor::delete_modifier_chosen ()
 {
        string txt;
-       
+
        txt = delete_modifier_combo.get_active_text();
 
        for (int i = 0; modifiers[i].name; ++i) {
@@ -1267,7 +1372,7 @@ void
 OptionEditor::snap_modifier_chosen ()
 {
        string txt;
-       
+
        txt = snap_modifier_combo.get_active_text();
 
        for (int i = 0; modifiers[i].name; ++i) {
@@ -1325,12 +1430,12 @@ OptionEditor::parameter_changed (const char* parameter_name)
        ENSURE_GUI_THREAD (bind (mem_fun (*this, &OptionEditor::parameter_changed), parameter_name));
 
 #define PARAM_IS(x) (!strcmp (parameter_name, (x)))
-       
+
        if (PARAM_IS ("timecode-source-is-synced")) {
                synced_timecode_button.set_active (Config->get_timecode_source_is_synced());
        } else if (PARAM_IS ("history-depth")) {
                int32_t depth = Config->get_history_depth();
-               
+
                history_depth.set_value (depth);
                history_depth_spinner.set_sensitive (depth != 0);
                limit_history_button.set_active (depth != 0);
@@ -1345,5 +1450,7 @@ OptionEditor::parameter_changed (const char* parameter_name)
 
                save_history_button.set_active (x);
                saved_history_depth_spinner.set_sensitive (x);
+       } else if (PARAM_IS ("font-scale")) {
+               reset_dpi();
        }
 }