Deprecate wxPropertyGrid::DoubleToString().
Simply use wxNumberFormatter instead, this reduces code duplication and avoids bugs due to formatting inconsistencies in DoubleToString(). Closes #15625. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1568,6 +1568,7 @@ public:
|
|||||||
wxRect& rect,
|
wxRect& rect,
|
||||||
int flags );
|
int flags );
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_3_0
|
||||||
/** Standardized double-to-string conversion.
|
/** Standardized double-to-string conversion.
|
||||||
*/
|
*/
|
||||||
static const wxString& DoubleToString( wxString& target,
|
static const wxString& DoubleToString( wxString& target,
|
||||||
@@ -1575,6 +1576,7 @@ public:
|
|||||||
int precision,
|
int precision,
|
||||||
bool removeZeroes,
|
bool removeZeroes,
|
||||||
wxString* precTemplate = NULL );
|
wxString* precTemplate = NULL );
|
||||||
|
#endif // WXWIN_COMPATIBILITY_3_0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call this from wxPGProperty::OnEvent() to cause property value to be
|
Call this from wxPGProperty::OnEvent() to cause property value to be
|
||||||
|
@@ -62,6 +62,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/odcombo.h"
|
#include "wx/odcombo.h"
|
||||||
|
#include "wx/numformatter.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -361,7 +362,7 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
|
|||||||
// Min/Max check
|
// Min/Max check
|
||||||
wxFloatProperty::DoValidation(property, v_d, NULL, mode);
|
wxFloatProperty::DoValidation(property, v_d, NULL, mode);
|
||||||
|
|
||||||
wxPropertyGrid::DoubleToString(s, v_d, 6, true, NULL);
|
s = wxNumberFormatter::ToString(v_d, -1, wxNumberFormatter::Style_None);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -52,6 +52,7 @@
|
|||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
|
||||||
#include "wx/propgrid/propgrid.h"
|
#include "wx/propgrid/propgrid.h"
|
||||||
|
#include "wx/numformatter.h"
|
||||||
|
|
||||||
#define wxPG_CUSTOM_IMAGE_WIDTH 20 // for wxColourProperty etc.
|
#define wxPG_CUSTOM_IMAGE_WIDTH 20 // for wxColourProperty etc.
|
||||||
|
|
||||||
@@ -667,6 +668,7 @@ wxFloatProperty::wxFloatProperty( const wxString& label,
|
|||||||
|
|
||||||
wxFloatProperty::~wxFloatProperty() { }
|
wxFloatProperty::~wxFloatProperty() { }
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_3_0
|
||||||
// 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.
|
||||||
const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
||||||
@@ -738,6 +740,7 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target,
|
|||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
#endif // WXWIN_COMPATIBILITY_3_0
|
||||||
|
|
||||||
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
||||||
int argFlags ) const
|
int argFlags ) const
|
||||||
@@ -745,11 +748,9 @@ wxString wxFloatProperty::ValueToString( wxVariant& value,
|
|||||||
wxString text;
|
wxString text;
|
||||||
if ( !value.IsNull() )
|
if ( !value.IsNull() )
|
||||||
{
|
{
|
||||||
wxPropertyGrid::DoubleToString(text,
|
text = wxNumberFormatter::ToString(value.GetDouble(), m_precision,
|
||||||
value,
|
argFlags & wxPG_FULL_VALUE ? wxNumberFormatter::Style_None
|
||||||
m_precision,
|
: wxNumberFormatter::Style_NoTrailingZeroes);
|
||||||
!(argFlags & wxPG_FULL_VALUE),
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user