use running_from_source_tree()
[ardour.git] / gtk2_ardour / normalize_dialog.cc
index bed3a0275dc28f03e519a5006a16175a93816cc0..308328538cac2cf18ed654efe4258109c0f47bf4 100644 (file)
@@ -23,6 +23,7 @@
 #include <gtkmm/stock.h>
 #include <gtkmm/progressbar.h>
 #include "normalize_dialog.h"
+#include "i18n.h"
 
 using namespace Gtk;
 
@@ -34,7 +35,7 @@ NormalizeDialog::NormalizeDialog (bool more_than_one)
        , _normalize_individually (0)
 {
        get_vbox()->set_spacing (12);
-       
+
        HBox* hbox = manage (new HBox);
        hbox->set_spacing (6);
        hbox->set_border_width (6);
@@ -43,6 +44,7 @@ NormalizeDialog::NormalizeDialog (bool more_than_one)
        _spin->set_range (-112, 0);
        _spin->set_increments (0.1, 1);
        _spin->set_value (_last_normalization_value);
+       _spin->set_activates_default ();
        hbox->pack_start (*_spin, false, false);
        hbox->pack_start (*manage (new Label (_("dbFS"))), false, false);
        get_vbox()->pack_start (*hbox);
@@ -66,9 +68,10 @@ NormalizeDialog::NormalizeDialog (bool more_than_one)
        get_vbox()->pack_start (*_progress_bar);
 
        show_all ();
-       
+
        add_button (Stock::CANCEL, RESPONSE_CANCEL);
        add_button (_("Normalize"), RESPONSE_ACCEPT);
+       set_default_response (RESPONSE_ACCEPT);
 
        signal_response().connect (sigc::mem_fun (*this, &NormalizeDialog::button_clicked));
 }
@@ -92,6 +95,10 @@ NormalizeDialog::target () const
 void
 NormalizeDialog::update_progress_gui (float p)
 {
+       /* Normalization is run inside the GUI thread, so we can directly
+        * update the progress bar when notified about progress.
+        */
+
        _progress_bar->set_fraction (p);
 }
 
@@ -100,7 +107,9 @@ NormalizeDialog::run ()
 {
        int const r = ArdourDialog::run ();
        _last_normalization_value = target ();
-       _last_normalize_individually = _normalize_individually->get_active ();
+       if (_normalize_individually) {
+               _last_normalize_individually = _normalize_individually->get_active ();
+       }
        return r;
 }