]> git.saurik.com Git - wxWidgets.git/commitdiff
wxPropertyGrid member m_visPropArray removed, now always recreated from scratch in...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 13 Sep 2008 20:14:20 +0000 (20:14 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 13 Sep 2008 20:14:20 +0000 (20:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/propgrid.h
src/propgrid/propgrid.cpp

index c9bf181175d958d1617670a1d605b3710b615e3c..4d03285a16c4bdcb94cbd01813976f0e724ff17f 100644 (file)
@@ -1632,9 +1632,6 @@ protected:
     // background colour for empty space below the grid
     wxColour            m_colEmptySpace;
 
-    // temp property array used in DoDrawItems
-    wxArrayPtrVoid      m_visPropArray;
-
     // NB: These *cannot* be moved to globals.
 
     // Array of background colour brushes.
index 0df955818d6c8a710841feef33a8b0bc9d33c25f..956de165fbdcb0d7c2b427e5ad5607266301e195 100644 (file)
@@ -1060,7 +1060,6 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing )
        GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont);
 
     m_lineHeight = m_fontHeight+(2*m_spacingy)+1;
-    m_visPropArray.SetCount((m_height/m_lineHeight)+10);
 
     // button spacing
     m_buttonSpacingY = (m_lineHeight - m_iconHeight) / 2;
@@ -2089,7 +2088,11 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
     wxPropertyGridConstIterator it( state, wxPG_ITERATE_VISIBLE, firstItem );
     int endScanBottomY = lastItemBottomY + lh;
     int y = firstItemTopY;
-    unsigned int arrInd = 0;
+
+    //
+    // Pregenerate list of visible properties.
+    wxArrayPGProperty visPropArray;
+    visPropArray.reserve((m_height/m_lineHeight)+6);
 
     for ( ; !it.AtEnd(); it.Next() )
     {
@@ -2097,8 +2100,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
 
         if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
         {
-            m_visPropArray[arrInd] = (wxPGProperty*)p;
-            arrInd++;
+            visPropArray.push_back((wxPGProperty*)p);
 
             if ( y > endScanBottomY )
                 break;
@@ -2107,17 +2109,19 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
         }
     }
 
-    m_visPropArray[arrInd] = NULL;
+    visPropArray.push_back(NULL);
+
+    wxPGProperty* nextP = visPropArray[0];
 
     int gridWidth = state->m_width;
 
     y = firstItemTopY;
-    for ( arrInd=0;
-          m_visPropArray[arrInd] != NULL && y <= lastItemBottomY;
+    for ( unsigned int arrInd=1;
+          nextP && y <= lastItemBottomY;
           arrInd++ )
     {
-        wxPGProperty* p =(wxPGProperty*) m_visPropArray[arrInd];
-        wxPGProperty* nextP = (wxPGProperty*) m_visPropArray[arrInd+1];
+        wxPGProperty* p = nextP;
+        nextP = visPropArray[arrInd];
 
         int rowHeight = m_fontHeight+(m_spacingy*2)+1;
         int textMarginHere = x;
@@ -4140,8 +4144,6 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
     m_width = width;
     m_height = height;
 
-    m_visPropArray.SetCount((height/m_lineHeight)+10);
-
 #if wxPG_DOUBLE_BUFFER
     if ( !(GetExtraStyle() & wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
     {