ChangeLog Eliminate most of the flicker when resizing columns More debug tracing. --- dlls/comctl32/listview.c.X6 Thu Oct 24 02:31:16 2002 +++ dlls/comctl32/listview.c Thu Oct 24 11:15:31 2002 @@ -248,7 +248,8 @@ HCURSOR hHotCursor; HFONT hDefaultFont; HFONT hFont; - INT ntmHeight; /* From GetTextMetrics from above font */ + INT ntmHeight; /* Some cached metrics of the font used */ + INT ntmAveCharWidth; /* by the listview to draw items */ BOOL bRedraw; /* Turns on/off repaints & invalidations */ BOOL bFirstPaint; /* Flags if the control has never painted before */ BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */ @@ -1244,7 +1245,7 @@ { RECT rcCol; - if(!infoPtr->bRedraw) return; + if(!is_redrawing(infoPtr)) return; LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol); rcCol.top = infoPtr->rcList.top; rcCol.bottom = infoPtr->rcList.bottom; @@ -2045,6 +2046,8 @@ if (uView != LVS_ICON && uView != LVS_SMALLICON) return FALSE; + TRACE("nAlignCode=%d\n", nAlignCode); + if (nAlignCode == LVA_DEFAULT) { if (infoPtr->dwStyle & LVS_ALIGNLEFT) nAlignCode = LVA_ALIGNLEFT; @@ -2192,7 +2195,9 @@ static INT LISTVIEW_CalculateItemWidth(LISTVIEW_INFO *infoPtr) { UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; - INT nItemWidth; + INT nItemWidth = 0; + + TRACE("uView=%d\n", uView); if (uView == LVS_ICON) nItemWidth = infoPtr->iconSpacing.cx; @@ -2205,13 +2210,12 @@ LISTVIEW_GetHeaderRect(infoPtr, infoPtr->hdpaColumns->nItemCount - 1, &rcHeader); nItemWidth = rcHeader.right; } - else nItemWidth = 0; } else /* LVS_SMALLICON, or LVS_LIST */ { INT i; - for (nItemWidth = i = 0; i < infoPtr->nItemCount; i++) + for (i = 0; i < infoPtr->nItemCount; i++) nItemWidth = max(LISTVIEW_GetLabelWidth(infoPtr, i), nItemWidth); if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx + IMAGE_PADDING; @@ -2238,6 +2242,8 @@ UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; INT nItemHeight; + TRACE("uView=%d\n", uView); + if (uView == LVS_ICON) nItemHeight = infoPtr->iconSpacing.cy; else @@ -2288,7 +2294,10 @@ TEXTMETRICW tm; if (GetTextMetricsW(hdc, &tm)) + { infoPtr->ntmHeight = tm.tmHeight; + infoPtr->ntmAveCharWidth = tm.tmAveCharWidth; + } SelectObject(hdc, hOldFont); ReleaseDC(infoPtr->hwndSelf, hdc); @@ -6447,6 +6456,8 @@ INT oldHeight = infoPtr->nItemHeight; HIMAGELIST himlOld = 0; + TRACE("(nType=%d, himl=%p\n", nType, himl); + switch (nType) { case LVSIL_NORMAL: @@ -7637,9 +7648,18 @@ dx = cxy - (lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left); if (dx != 0) { + RECT rcCol = lpColumnInfo->rcHeader; + lpColumnInfo->rcHeader.right += dx; LISTVIEW_ScrollColumns(infoPtr, lpnmh->iItem + 1, dx); - if (uView == LVS_REPORT) LISTVIEW_InvalidateColumn(infoPtr, lpnmh->iItem); + if (uView == LVS_REPORT && is_redrawing(infoPtr)) + { + rcCol.right = min (rcCol.right, lpColumnInfo->rcHeader.right); + rcCol.left = max (rcCol.left, rcCol.right - 3 * infoPtr->ntmAveCharWidth); + rcCol.top = infoPtr->rcList.top; + rcCol.bottom = infoPtr->rcList.bottom; + LISTVIEW_InvalidateRect(infoPtr, &rcCol); + } } } break; -- Dimi.