diff options
Diffstat (limited to 'src/wx/gain_calculator_dialog.cc')
| -rw-r--r-- | src/wx/gain_calculator_dialog.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/wx/gain_calculator_dialog.cc b/src/wx/gain_calculator_dialog.cc index 9c8b87dac..62708fd22 100644 --- a/src/wx/gain_calculator_dialog.cc +++ b/src/wx/gain_calculator_dialog.cc @@ -20,11 +20,12 @@ #include "gain_calculator_dialog.h" #include "wx_util.h" -#include "lib/util.h" #include "lib/cinema_sound_processor.h" + using boost::optional; + GainCalculatorDialog::GainCalculatorDialog (wxWindow* parent) : TableDialog (parent, _("Gain Calculator"), 2, 1, true) { @@ -50,9 +51,19 @@ optional<float> GainCalculatorDialog::db_change () const { if (_wanted->GetValue().IsEmpty() || _actual->GetValue().IsEmpty()) { - return optional<float>(); + return {}; } + auto relaxed_string_to_float = [](std::string s) { + try { + boost::algorithm::replace_all(s, ",", "."); + return boost::lexical_cast<float>(s); + } catch (boost::bad_lexical_cast &) { + boost::algorithm::replace_all(s, ".", ","); + return boost::lexical_cast<float>(s); + } + }; + return CinemaSoundProcessor::from_index( _processor->GetSelection())->db_for_fader_change( relaxed_string_to_float(wx_to_std(_wanted->GetValue())), |
