if ( GetChildCount() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
{
// Value stored in m_value is non-editable, non-full value
- if ( (argFlags & wxPG_FULL_VALUE) || (argFlags & wxPG_EDITABLE_VALUE) )
+ if ( (argFlags & wxPG_FULL_VALUE) ||
+ (argFlags & wxPG_EDITABLE_VALUE) ||
+ !s.length() )
{
// Calling this under incorrect conditions will fail
wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT,
{
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);
wxTextCtrl* tc = static_cast<wxTextCtrl*>(wnd);
wxString text = tc->GetValue();
- if ( !text.length() )
+ if ( text.empty() )
return false;
return true;
wxString s;
long value32;
- if ( text.length() == 0 )
+ if ( text.empty() )
{
variant.MakeNull();
return true;
wxString variantType = variant.GetType();
bool isPrevLong = variantType == wxPG_VARIANT_TYPE_LONG;
- if ( text.length() == 0 )
+ if ( text.empty() )
{
variant.MakeNull();
return true;
// 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 )
{
if (!precTemplate)
precTemplate = &text1;
- if ( !precTemplate->length() )
+ if ( precTemplate->empty() )
{
*precTemplate = wxS("%.");
*precTemplate << wxString::Format( wxS("%i"), precision );
target.Printf( wxS("%f"), value );
}
- if ( removeZeroes && precision != 0 && target.length() )
+ if ( removeZeroes && precision != 0 && !target.empty() )
{
// Remove excess zeroes (do not remove this code just yet,
// since sprintf can't do the same consistently across platforms).
for ( ; i != target.end(); i++ )
{
- if ( *i != wxS('0') && *i != wxS('.') )
+ if ( *i != wxS('0') && *i != wxS('.') && *i != wxS(',') )
{
isZero = false;
break;
if ( isZero )
target.erase(target.begin());
}
+
+ return target;
}
wxString wxFloatProperty::ValueToString( wxVariant& value,
wxString s;
double value;
- if ( text.length() == 0 )
+ if ( text.empty() )
{
variant.MakeNull();
return true;
text.CmpNoCase(m_label) == 0 )
boolValue = true;
- if ( text.length() == 0 )
+ if ( text.empty() )
{
variant.MakeNull();
return true;
// semicolons are no longer valid delimeters
WX_PG_TOKENIZER1_BEGIN(text,wxS(','))
- if ( token.length() )
+ if ( !token.empty() )
{
// Determine which one it is
long bit = IdToBit( token );
path = filename.GetPath();
indFilter = fileProp->m_indFilter;
- if ( !path.length() && fileProp->m_basePath.length() )
+ if ( path.empty() && !fileProp->m_basePath.empty() )
path = fileProp->m_basePath;
}
else
}
// Find index for extension.
- if ( m_indFilter < 0 && fnstr.length() )
+ if ( m_indFilter < 0 && !fnstr.empty() )
{
wxString ext = filename.GetExt();
int curind = 0;
pos = len;
wxString found_ext = m_wildcard.substr(ext_begin, pos-ext_begin);
- if ( found_ext.length() > 0 )
+ if ( !found_ext.empty() )
{
if ( found_ext[0] == wxS('*') )
{
return wxEmptyString;
wxString fullName = filename.GetFullName();
- if ( !fullName.length() )
+ if ( fullName.empty() )
return wxEmptyString;
if ( argFlags & wxPG_FULL_VALUE )
}
else if ( m_flags & wxPG_PROP_SHOW_FULL_FILENAME )
{
- if ( m_basePath.Length() )
+ if ( !m_basePath.empty() )
{
wxFileName fn2(filename);
fn2.MakeRelativeTo(m_basePath);
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
// Message
- if ( message.length() )
+ if ( !message.empty() )
topsizer->Add( new wxStaticText(this,-1,message),
0, wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL|wxALL, spacing );
if ( flags & Escape )
{
str.Replace( wxS("\\"), wxS("\\\\"), true );
- if ( pdr.length() )
+ if ( !pdr.empty() )
str.Replace( preas, pdr, true );
}