Nikolay Sivov : comctl32/listview: Improve grid drawing on LVS_EX_GRIDLINES style.
Alexandre Julliard
julliard at winehq.org
Thu Jun 4 07:59:33 CDT 2009
Module: wine
Branch: master
Commit: 39398aedc7ce83deb5d975bc80beee659884a351
URL: http://source.winehq.org/git/wine.git/?a=commit;h=39398aedc7ce83deb5d975bc80beee659884a351
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu Jun 4 02:43:06 2009 +0400
comctl32/listview: Improve grid drawing on LVS_EX_GRIDLINES style.
---
dlls/comctl32/listview.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 63500f2..b50bf2b 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4166,10 +4166,11 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
{
INT rgntype;
INT y, itemheight;
+ INT col, index;
HPEN hPen, hOldPen;
RECT rcClip, rcItem = {0};
POINT Origin;
- RANGE colRange;
+ RANGES colRanges;
ITERATOR j;
BOOL rmost = FALSE;
@@ -4182,21 +4183,23 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, 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++)
- {
- 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--)
+ for(col = 0; col < DPA_GetPtrCount(infoPtr->hdpaColumns); col++)
{
- 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);
}
+
/* is right most vertical line visible? */
if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
{
- LISTVIEW_GetHeaderRect(infoPtr, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, &rcItem);
+ index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
+ LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
rmost = (rcItem.right + Origin.x < rcClip.right);
}
@@ -4205,11 +4208,11 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
hOldPen = SelectObject ( hdc, hPen );
/* draw the vertical lines for the columns */
- iterator_rangeitems(&j, colRange);
+ iterator_rangesitems(&j, colRanges);
while(iterator_next(&j))
{
LISTVIEW_GetHeaderRect(infoPtr, j.nItem, &rcItem);
- if (rcItem.left == 0) continue; /* skip first column */
+ if (rcItem.left == 0) continue; /* skip leftmost column */
rcItem.left += Origin.x;
rcItem.right += Origin.x;
rcItem.top = infoPtr->rcList.top;
@@ -4222,8 +4225,14 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
/* draw rightmost grid line if visible */
if (rmost)
{
- MoveToEx (hdc, rcItem.right, rcItem.top, NULL);
- LineTo (hdc, rcItem.right, rcItem.bottom);
+ index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX,
+ DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
+ LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
+
+ rcItem.right += Origin.x;
+
+ MoveToEx (hdc, rcItem.right, infoPtr->rcList.top, NULL);
+ LineTo (hdc, rcItem.right, infoPtr->rcList.bottom);
}
/* draw the horizontial lines for the rows */
More information about the wine-cvs
mailing list