[2/3] comctl32/listview: Improve item visibility calculation for report view

Nikolay Sivov bunglehead at gmail.com
Wed Jun 3 18:02:35 CDT 2009


This (and next too) are another tiptoe steps to allow column reordering.
It removes assumption that column index always equals to its order.

Changelog:
    - Improve item visibility calculation for report view

>From e435102420f99b67134466cf037f5a3b33c6f532 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu, 4 Jun 2009 01:43:28 +0400
Subject: Improve item visibility calculation for report view

---
 dlls/comctl32/listview.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index b83c697..63500f2 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4096,7 +4096,8 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc,
     INT rgntype;
     RECT rcClip, rcItem;
     POINT Origin, Position;
-    RANGE colRange;
+    RANGES colRanges;
+    INT col, index;
     ITERATOR j;
 
     TRACE("()\n");
@@ -4107,19 +4108,19 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc,
     
     /* Get scroll info once before loop */
     LISTVIEW_GetOrigin(infoPtr, &Origin);
-    
+
+    colRanges = ranges_create(DPA_GetPtrCount(infoPtr->hdpaColumns));
+
     /* narrow down the columns we need to paint */
-    for(colRange.lower = 0; colRange.lower < DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.lower++)
+    for(col = 0; col < DPA_GetPtrCount(infoPtr->hdpaColumns); col++)
     {
-	LISTVIEW_GetHeaderRect(infoPtr, colRange.lower, &rcItem);
-	if (rcItem.right + Origin.x >= rcClip.left) break;
-    }
-    for(colRange.upper = DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.upper > 0; colRange.upper--)
-    {
-	LISTVIEW_GetHeaderRect(infoPtr, colRange.upper - 1, &rcItem);
-	if (rcItem.left + Origin.x < rcClip.right) break;
+	index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, col, 0);
+
+	LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
+	if ((rcItem.right + Origin.x >= rcClip.left) && (rcItem.left + Origin.x < rcClip.right))
+	    ranges_additem(colRanges, index);
     }
-    iterator_rangeitems(&j, colRange);
+    iterator_rangesitems(&j, colRanges);
 
     /* in full row select, we _have_ to draw the main item */
     if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
-- 
1.5.6.5







More information about the wine-patches mailing list