X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/026767c6aee4c61b904fe68b79af186258fd6005..fb1e6455778e1696e6498431df40335d4731240f:/src/propgrid/props.cpp diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index f8d0857e7c..e399674bd5 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -186,8 +186,10 @@ wxNumericPropertyValidator:: { arr.Add(wxS("+")); arr.Add(wxS("-")); - arr.Add(wxS(".")); arr.Add(wxS("e")); + + // Use locale-specific decimal point + arr.Add(wxString::Format("%g", 1.1)[1]); } SetIncludes(arr); @@ -666,11 +668,11 @@ wxFloatProperty::~wxFloatProperty() { } // This helper method provides standard way for floating point-using // properties to convert values to string. -void wxPropertyGrid::DoubleToString(wxString& target, - double value, - int precision, - bool removeZeroes, - wxString* precTemplate) +const wxString& wxPropertyGrid::DoubleToString(wxString& target, + double value, + int precision, + bool removeZeroes, + wxString* precTemplate) { if ( precision >= 0 ) { @@ -713,6 +715,27 @@ void wxPropertyGrid::DoubleToString(wxString& target, if ( new_len != target.length() ) target.resize(new_len); } + + // Remove sign from zero + if ( target.length() >= 2 && target[0] == wxS('-') ) + { + bool isZero = true; + wxString::const_iterator i = target.begin() + 1; + + for ( ; i != target.end(); i++ ) + { + if ( *i != wxS('0') && *i != wxS('.') && *i != wxS(',') ) + { + isZero = false; + break; + } + } + + if ( isZero ) + target.erase(target.begin()); + } + + return target; } wxString wxFloatProperty::ValueToString( wxVariant& value,