REBAR: fix IE (make sure to take account of hidden bands during layout)

Mike McCormack mike at codeweavers.com
Sat Mar 13 01:35:01 CST 2004


This fixes some IE regressions I caused with my previous patch.

Mike

ChangeLog:
* make sure to take account of hidden bands during layout
-------------- next part --------------
Index: dlls/comctl32/rebar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/rebar.c,v
retrieving revision 1.87
diff -u -r1.87 rebar.c
--- dlls/comctl32/rebar.c	12 Mar 2004 20:23:39 -0000	1.87
+++ dlls/comctl32/rebar.c	13 Mar 2004 06:47:23 -0000
@@ -1395,6 +1395,24 @@
 }
 
 
+static inline INT REBAR_NextVisibleBand( REBAR_INFO *infoPtr, INT n )
+{
+    for( n = n+1; n < infoPtr->uNumBands; n++ ) {
+        if( !HIDDENBAND( &infoPtr->bands[n] ) )
+            return n;
+    }
+    return -1;
+}
+
+static inline INT REBAR_PrevVisibleBand( REBAR_INFO *infoPtr, INT n )
+{
+    for( n = n-1; n >= 0; n-- ) {
+        if( !HIDDENBAND( &infoPtr->bands[n] ) )
+            return n;
+    }
+    return -1;
+}
+
 static VOID
 REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
      /* Function: This routine is resposible for laying out all */
@@ -1753,10 +1771,6 @@
     /* ******* End Phase 2 - split rows till adjustment height full ******* */
 
 
-    /* ******* End Phase 2a - create array of start and end    ******* */
-    /*                          indexes by row                         */
-
-
     /* ******* Start Phase 2b - adjust all bands for height full ******* */
     /* assumes that the following variables contain:                 */
     /*   y/x     current height/width of all rows                    */
@@ -1764,27 +1778,28 @@
 
     if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) &&
 	infoPtr->uNumBands) {
-	INT diff, i;
+	INT diff, i, n;
 	UINT j;
 
 	diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
 
         /* iterate backwards thru the rows */
-        for (i = infoPtr->uNumBands-1; i>0; i--) {
+        for (i = infoPtr->uNumBands-1; i>=0; i--) {
 	    lpBand = &infoPtr->bands[i];
+	    if(HIDDENBAND(lpBand)) continue;
 
 	    /* if row has more than 1 band, ignore it */
 
             /* row is same as previous */
-            if( lpBand->iRow == infoPtr->bands[i-1].iRow ) 
+            n = REBAR_PrevVisibleBand( infoPtr, i );
+            if( (n>=0) && ( lpBand->iRow == infoPtr->bands[n].iRow )  )
                 continue;
 
             /* row is same as next */
-            if( (i != (infoPtr->uNumBands-1)) && 
-                (lpBand->iRow == infoPtr->bands[i+1].iRow ) )
+            n = REBAR_NextVisibleBand( infoPtr, i );
+            if( (n>=0) && (lpBand->iRow == infoPtr->bands[n].iRow ) )
                 continue;
 
-	    if(HIDDENBAND(lpBand)) continue;
 	    if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
 	    if (((INT)lpBand->cyMaxChild < 1) ||
 		((INT)lpBand->cyIntegral < 1)) {
@@ -1825,7 +1840,7 @@
     /* ******* Start Phase 3 - adjust all bands for width full ******* */
 
     if (infoPtr->uNumBands) {
-        int startband;
+        int startband, n;
 
 	/* If RBS_BANDBORDERS set then indicate to draw bottom separator */
 	/* on all bands in all rows but last row.                        */
@@ -1839,8 +1854,8 @@
                     continue;
 
                 /* not righthand bands */
-                if( (i!=(infoPtr->uNumBands - 1) ) &&
-                    (lpBand->iRow != infoPtr->bands[i+1].iRow ) )
+                n = REBAR_NextVisibleBand( infoPtr, i );
+                if( ( n>=0 ) && (lpBand->iRow == infoPtr->bands[n].iRow ) )
 		    lpBand->fDraw |= DRAW_RIGHTSEP;
 
                 /* not the last row */
@@ -1852,27 +1867,24 @@
 	/* Distribute the extra space on the horizontal and adjust  */
 	/* all bands in row to same height.                         */
 	mcy = 0;
-        row = 1;
         startband = 0;
         for (i=0; i<infoPtr->uNumBands; i++) {
 
             lpBand = &infoPtr->bands[i];
-            if (HIDDENBAND(lpBand)) continue;
-            if (mcy < ircBw(lpBand))
+            if ( (mcy < ircBw(lpBand)) && !HIDDENBAND(lpBand) )
                 mcy = ircBw(lpBand);
 
             if( (i==(infoPtr->uNumBands-1)) ||
                 (infoPtr->bands[i+1].iRow != lpBand->iRow ) )
             {
 	        TRACE("P3 processing row %d, starting band %d, ending band %d\n",
-		      row, startband, i);
+		      lpBand->iRow, startband, i);
 
 	        REBAR_AdjustBands (infoPtr, startband, i,
 			       (infoPtr->dwStyle & CCS_VERT) ?
 			       clientcy : clientcx, mcy);
                 startband = i+1;
                 mcy = 0;
-                row ++;
             }
 	}
 


More information about the wine-patches mailing list