From a253cdb4137b802bceca03b3ee278a654215c11a Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 5 Jul 2015 21:14:50 +0200 Subject: [PATCH] Refactor wxPropertyGrid::OnComboItemPaint Make the code more readable by reducing scope of some local variables, by simplifying their initialization, etc. --- src/propgrid/editors.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 695c2cd7bb..6aec8a0555 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -731,20 +731,18 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, wxString text; const wxPGChoices& choices = p->GetChoices(); - const wxPGCommonValue* comVal = NULL; - int comVals = p->GetDisplayedCommonValueCount(); int comValIndex = -1; - int choiceCount = 0; - if ( choices.IsOk() ) - choiceCount = choices.GetCount(); + const int choiceCount = choices.IsOk()? choices.GetCount(): 0; - if ( item >= choiceCount && comVals > 0 ) + if ( item >= choiceCount && p->GetDisplayedCommonValueCount() > 0 ) { comValIndex = item - choiceCount; - comVal = GetCommonValue(comValIndex); if ( !p->IsValueUnspecified() ) - text = comVal->GetLabel(); + { + const wxPGCommonValue* cv = GetCommonValue(comValIndex); + text = cv->GetLabel(); + } } else {