X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/91c818f82929ee2164ac5cfc77eaecddcea937a0..8a2e3f80f67b0716b3d1854418b187943dcff11a:/src/propgrid/property.cpp diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index addc80c0c2..1663eda6f9 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -639,12 +639,6 @@ int wxPGProperty::Index( const wxPGProperty* p ) const return wxNOT_FOUND; } -void wxPGProperty::UpdateControl( wxWindow* primary ) -{ - if ( primary ) - GetEditorClass()->UpdateControl(this, primary); -} - bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const { return true; @@ -978,6 +972,11 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int for ( ;; ) { + // How many units we iterate string forward at the end of loop? + // We need to keep track of this or risk going to negative + // with it-- operation. + unsigned int strPosIncrement = 1; + if ( tokenStart != 0xFFFFFF ) { // Token is running @@ -991,11 +990,12 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int { const wxPGProperty* child = Item(curChild); wxVariant variant(child->GetValue()); - variant.SetName(child->GetBaseName()); + wxString childName = child->GetBaseName(); #ifdef __WXDEBUG__ if ( debug_print ) - wxLogDebug(wxT("token = '%s', child = %s"),token.c_str(),child->GetLabel().c_str()); + wxLogDebug(wxT("token = '%s', child = %s"), + token.c_str(), childName.c_str()); #endif // Add only if editable or setting programmatically @@ -1004,8 +1004,18 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int { if ( len > 0 ) { - if ( child->StringToValue(variant, token, propagatedFlags|wxPG_COMPOSITE_FRAGMENT) ) + if ( child->StringToValue(variant, token, + propagatedFlags|wxPG_COMPOSITE_FRAGMENT) ) { + // We really need to set the variant's name + // *after* child->StringToValue() has been + // called, since variant's value may be set by + // assigning another variant into it, which + // then usually causes name to be copied (ie. + // usually cleared) as well. wxBoolProperty + // being case in point with its use of + // wxPGVariant_Bool macro as an optimization. + variant.SetName(childName); list.Append(variant); changed = true; @@ -1015,6 +1025,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int { // Empty, becomes unspecified variant.MakeNull(); + variant.SetName(childName); list.Append(variant); changed = true; } @@ -1071,23 +1082,23 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) || !child->HasFlag(wxPG_PROP_DISABLED|wxPG_PROP_READONLY) ) { - bool stvRes = child->StringToValue( variant, token, propagatedFlags ); + wxString childName = child->GetBaseName(); + + bool stvRes = child->StringToValue( variant, token, + propagatedFlags ); if ( stvRes || (variant != oldChildValue) ) { - if ( stvRes ) - changed = true; + variant.SetName(childName); + list.Append(variant); + + changed = true; } else { - // Failed, becomes unspecified - variant.MakeNull(); - changed = true; + // No changes... } } - variant.SetName(child->GetBaseName()); - list.Append(variant); - curChild++; if ( curChild >= iMax ) break; @@ -1101,10 +1112,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int tokenStart = pos; if ( a == delimeter ) - { - pos--; - --it; - } + strPosIncrement -= 1; } } } @@ -1112,7 +1120,8 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int if ( a == 0 ) break; - ++it; + it += strPosIncrement; + if ( it != text.end() ) { a = *it; @@ -1121,7 +1130,8 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int { a = 0; } - pos++; + + pos += strPosIncrement; } if ( changed ) @@ -1336,18 +1346,13 @@ void wxPGProperty::SetFlagRecursively( FlagType flag, bool set ) void wxPGProperty::RefreshEditor() { - if ( m_parent && GetParentState() ) - { - wxPropertyGrid* pg = GetParentState()->GetGrid(); - if ( pg->GetSelectedProperty() == this ) - { - wxWindow* editor = pg->GetEditorControl(); - if ( editor ) - GetEditorClass()->UpdateControl( this, editor ); - } - } -} + if ( !m_parent ) + return; + wxPropertyGrid* pg = GetGrid(); + if ( pg && pg->GetSelectedProperty() == this ) + pg->RefreshEditor(); +} wxVariant wxPGProperty::GetDefaultValue() const {