Have wxPropertyGrid::DoubleToString() to also take comma into account as a decimal separator. In addition, the function now returns target wxString (makes writing tests easier).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1547,11 +1547,11 @@ public:
|
|||||||
|
|
||||||
/** Standardized double-to-string conversion.
|
/** Standardized double-to-string conversion.
|
||||||
*/
|
*/
|
||||||
static void DoubleToString( wxString& target,
|
static const wxString& DoubleToString( wxString& target,
|
||||||
double value,
|
double value,
|
||||||
int precision,
|
int precision,
|
||||||
bool removeZeroes,
|
bool removeZeroes,
|
||||||
wxString* precTemplate );
|
wxString* precTemplate = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call this from wxPGProperty::OnEvent() to cause property value to be
|
Call this from wxPGProperty::OnEvent() to cause property value to be
|
||||||
|
@@ -666,7 +666,7 @@ wxFloatProperty::~wxFloatProperty() { }
|
|||||||
|
|
||||||
// This helper method provides standard way for floating point-using
|
// This helper method provides standard way for floating point-using
|
||||||
// properties to convert values to string.
|
// properties to convert values to string.
|
||||||
void wxPropertyGrid::DoubleToString(wxString& target,
|
const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
||||||
double value,
|
double value,
|
||||||
int precision,
|
int precision,
|
||||||
bool removeZeroes,
|
bool removeZeroes,
|
||||||
@@ -722,7 +722,7 @@ void wxPropertyGrid::DoubleToString(wxString& target,
|
|||||||
|
|
||||||
for ( ; i != target.end(); i++ )
|
for ( ; i != target.end(); i++ )
|
||||||
{
|
{
|
||||||
if ( *i != wxS('0') && *i != wxS('.') )
|
if ( *i != wxS('0') && *i != wxS('.') && *i != wxS(',') )
|
||||||
{
|
{
|
||||||
isZero = false;
|
isZero = false;
|
||||||
break;
|
break;
|
||||||
@@ -732,6 +732,8 @@ void wxPropertyGrid::DoubleToString(wxString& target,
|
|||||||
if ( isZero )
|
if ( isZero )
|
||||||
target.erase(target.begin());
|
target.erase(target.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
||||||
|
Reference in New Issue
Block a user