Reverted a change in number text formatting.

Fixed some message wording.
This commit is contained in:
bubnikv 2019-05-10 11:44:21 +02:00
parent 3c4fa8859c
commit c9f7965599
2 changed files with 29 additions and 5 deletions

View file

@ -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()

View file

@ -716,12 +716,12 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
std::string text;
bool red_colored = false;
switch (m_warnings.back()) {
case ObjectOutside : text = L("Detected object outside print volume"); break;
case ToolpathOutside : text = L("Detected toolpath outside print volume"); break;
case ObjectOutside : text = L("An object outside the print area was detected"); break;
case ToolpathOutside : text = L("A toolpath outside the print area was detected"); break;
case SomethingNotShown : text = L("Some objects are not visible when editing supports"); break;
case ObjectClashed: {
text = L("Detected object outside print volume\n"
"Resolve a clash to continue slicing/export process correctly");
text = L("An object outside the print area was detected\n"
"Resolve the current problem to continue slicing");
red_colored = true;
break;
}