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/msgdlg.h>
#include <wx/mstream.h> #include <wx/mstream.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/numformatter.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/power.h> #include <wx/power.h>
#include <wx/protocol/http.h> #include <wx/protocol/http.h>

View file

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