/*
- Copyright (C) 2012-2015 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
using boost::shared_ptr;
using boost::thread;
using boost::optional;
+using boost::lexical_cast;
+using boost::bad_lexical_cast;
using dcp::Size;
/** Path to our executable, required by the stacktrace stuff and filled
{
return "pcm_" + asset->id() + ".mxf";
}
+
+float
+relaxed_string_to_float (string s)
+{
+ try {
+ boost::algorithm::replace_all (s, ",", ".");
+ return lexical_cast<float> (s);
+ } catch (bad_lexical_cast) {
+ boost::algorithm::replace_all (s, ".", ",");
+ return lexical_cast<float> (s);
+ }
+}
extern std::map<std::string, std::string> split_get_request (std::string url);
extern std::string video_asset_filename (boost::shared_ptr<dcp::PictureAsset> asset);
extern std::string audio_asset_filename (boost::shared_ptr<dcp::SoundAsset> asset);
+extern float relaxed_string_to_float (std::string);
#endif
/*
- 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, 1, true)
return 0;
}
- return lexical_cast<float> (wx_to_std (_wanted->GetValue ()));
+ return relaxed_string_to_float (wx_to_std (_wanted->GetValue ()));
}
float
return 0;
}
- return lexical_cast<float> (wx_to_std (_actual->GetValue ()));
+ return relaxed_string_to_float (wx_to_std (_actual->GetValue ()));
}