Allow UI to set up FFmpeg streams again.
[dcpomatic.git] / src / wx / gain_calculator_dialog.cc
index fcd54d4cfb76ccea0398c937db966c405acf78bc..22e6b447ab1bb96f69f0946986b0c0f4b3d8651f 100644 (file)
 using namespace boost;
 
 GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
-       : wxDialog (parent, wxID_ANY, wxString (_("Gain Calculator")))
+       : wxDialog (parent, wxID_ANY, _("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);
 
@@ -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 ()));
 }