mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Reverted a change in number text formatting.
Fixed some message wording.
This commit is contained in:
parent
3c4fa8859c
commit
c9f7965599
2 changed files with 29 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue