mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Reverted a change in number text formatting.
Fixed some message wording.
This commit is contained in:
@@ -15,7 +15,31 @@ namespace Slic3r { namespace GUI {
|
||||
|
||||
wxString double_to_string(double const value, const int max_precision /*= 4*/)
|
||||
{
|
||||
return wxNumberFormatter::ToString(value, max_precision, wxNumberFormatter::Style_NoTrailingZeroes);
|
||||
// Style_NoTrailingZeroes does not work on OSX. It also does not work correctly with some locales on Windows.
|
||||
// return wxNumberFormatter::ToString(value, max_precision, wxNumberFormatter::Style_NoTrailingZeroes);
|
||||
|
||||
wxString s = wxNumberFormatter::ToString(value, max_precision, wxNumberFormatter::Style_None);
|
||||
|
||||
// The following code comes from wxNumberFormatter::RemoveTrailingZeroes(wxString& s)
|
||||
// with the exception that here one sets the decimal separator explicitely to dot.
|
||||
// If number is in scientific format, trailing zeroes belong to the exponent and cannot be removed.
|
||||
if (s.find_first_of("eE") == wxString::npos) {
|
||||
const size_t posDecSep = s.find(".");
|
||||
// No decimal point => removing trailing zeroes irrelevant for integer number.
|
||||
if (posDecSep != wxString::npos) {
|
||||
// Find the last character to keep.
|
||||
size_t posLastNonZero = s.find_last_not_of("0");
|
||||
// If it's the decimal separator itself, don't keep it neither.
|
||||
if (posLastNonZero == posDecSep)
|
||||
-- posLastNonZero;
|
||||
s.erase(posLastNonZero + 1);
|
||||
// Remove sign from orphaned zero.
|
||||
if (s.compare("-0") == 0)
|
||||
s = "0";
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void Field::PostInitialize()
|
||||
|
||||
Reference in New Issue
Block a user