Merge.
[dcpomatic.git] / src / wx / gain_calculator_dialog.cc
index 9b6c7b00478ca495f461c92414e16b1174ad45bd..7f4b774c0eac82516a00d05d8d34215b9b42f9e2 100644 (file)
 using namespace boost;
 
 GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
-       : wxDialog (parent, wxID_ANY, _("Gain Calculator"))
+       : wxDialog (parent, wxID_ANY, wxString (_("Gain Calculator")))
 {
        wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
        table->AddGrowableCol (1, 1);
 
-       add_label_to_sizer (table, this, "I want to play this back at fader");
+       add_label_to_sizer (table, this, _("I want to play this back at fader"));
        _wanted = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
        table->Add (_wanted, 1, wxEXPAND);
 
-       add_label_to_sizer (table, this, "But I have to use fader");
+       add_label_to_sizer (table, this, _("But I have to use fader"));
        _actual = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
        table->Add (_actual, 1, wxEXPAND);
 
        wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 1, wxEXPAND);
+       overall_sizer->Add (table, 1, wxEXPAND | wxALL, 6);
 
        wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
        if (buttons) {
@@ -52,11 +52,19 @@ GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
 float
 GainCalculatorDialog::wanted_fader () const
 {
+       if (_wanted->GetValue().IsEmpty()) {
+               return 0;
+       }
+       
        return lexical_cast<float> (wx_to_std (_wanted->GetValue ()));
 }
 
 float
 GainCalculatorDialog::actual_fader () const
 {
+       if (_actual->GetValue().IsEmpty()) {
+               return 0;
+       }
+
        return lexical_cast<float> (wx_to_std (_actual->GetValue ()));
 }