Accept either , or . for a decimal separator in the gain calculator.
[dcpomatic.git] / src / wx / gain_calculator_dialog.cc
index d49dfae70841acca22765d9c824bb53d0af83ab7..418ec2e7719b3eefba026e3b65e3780583552c76 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 
     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
 
 */
 
-#include <boost/lexical_cast.hpp>
 #include "gain_calculator_dialog.h"
 #include "wx_util.h"
-
-using namespace boost;
+#include "lib/util.h"
 
 GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent)
-       : TableDialog (parent, _("Gain Calculator"), 2, true)
+       : TableDialog (parent, _("Gain Calculator"), 2, 1, true)
 {
        add (_("I want to play this back at fader"), true);
        _wanted = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC)));
@@ -41,8 +39,8 @@ GainCalculatorDialog::wanted_fader () const
        if (_wanted->GetValue().IsEmpty()) {
                return 0;
        }
-       
-       return lexical_cast<float> (wx_to_std (_wanted->GetValue ()));
+
+       return relaxed_string_to_float (wx_to_std (_wanted->GetValue ()));
 }
 
 float
@@ -52,5 +50,5 @@ GainCalculatorDialog::actual_fader () const
                return 0;
        }
 
-       return lexical_cast<float> (wx_to_std (_actual->GetValue ()));
+       return relaxed_string_to_float (wx_to_std (_actual->GetValue ()));
 }