]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/props.cpp
Don't name variables "id" in public headers.
[wxWidgets.git] / src / propgrid / props.cpp
index f8d0857e7c2a7590a25cf83e40cbf03f4dacb715..e399674bd500ee61015d33113200fb4577ddae91 100644 (file)
@@ -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,