Remove the uses of wxNumberFormatter

We currently require mismatched locales for non-English since we don't
distinguish between locale-independent things like the config file and
UI things, which wxNumberFormatter barfs on.

Originally committed to SVN as r6930.
This commit is contained in:
Thomas Goyne 2012-07-06 02:14:46 +00:00
parent 8244271508
commit 4e53ab3eab
2 changed files with 9 additions and 8 deletions

View File

@ -152,7 +152,6 @@
#include <wx/msgdlg.h>
#include <wx/mstream.h>
#include <wx/notebook.h>
#include <wx/numformatter.h>
#include <wx/panel.h>
#include <wx/power.h>
#include <wx/protocol/http.h>

View File

@ -27,8 +27,6 @@
#ifndef AGI_PRE
#include <limits>
#include <wx/numformatter.h>
#endif
Vector2D::Vector2D()
@ -91,9 +89,13 @@ wxString Vector2D::DStr(char sep) const {
return wxString::Format("%d%c%d", (int)x, sep, (int)y);
}
wxString Vector2D::Str(char sep) const {
return
wxNumberFormatter::ToString(x, 3, wxNumberFormatter::Style_NoTrailingZeroes) +
sep +
wxNumberFormatter::ToString(y, 3, wxNumberFormatter::Style_NoTrailingZeroes);
static wxString float_to_string(float val) {
wxString s = wxString::Format("%.3f", val);
size_t pos = s.find_last_not_of("0");
if (pos != s.find(".")) ++pos;
return s.Left(pos);
}
wxString Vector2D::Str(char sep) const {
return float_to_string(x) + sep + float_to_string(y);
}