resources.
- Added wxMessageQueue::Clear().
- Added wxConfig::Read(float *) overload (Terry Farnham).
+- Always use decimal point (and not the current locale separator) in wxConfig.
Unix:
/**
Writes the double value to the config file and returns @true on
success.
+
+ Notice that if floating point numbers are saved as strings (as is the
+ case with the configuration files used by wxFileConfig), this function
+ uses the C locale for writing out the number, i.e. it will always use a
+ period as the decimal separator, irrespectively of the current locale.
+ This behaviour is new since wxWidgets 2.9.1 as the current locale was
+ used before, but the change should be transparent because both C and
+ current locales are tried when reading the numbers back.
*/
bool Write(const wxString& key, double value);
/**
wxString str;
if ( Read(key, &str) )
{
- return str.ToDouble(val);
+ if ( str.ToCDouble(val) )
+ return true;
+
+ // Previous versions of wxFileConfig wrote the numbers out using the
+ // current locale and not the C one as now, so attempt to parse the
+ // string as a number in the current locale too, for compatibility.
+ if ( str.ToDouble(val) )
+ return true;
}
return false;
bool wxConfigBase::DoWriteDouble(const wxString& key, double val)
{
- return DoWriteString(key, wxString::Format(wxT("%g"), val));
+ // Notice that we always write out the numbers in C locale and not the
+ // current one. This makes the config files portable between machines using
+ // different locales.
+ return DoWriteString(key, wxString::FromCDouble(val));
}
bool wxConfigBase::DoWriteBool(const wxString& key, bool value)