Listview report mode tweaks

Duane Clark dclark at akamail.com
Thu Dec 19 18:48:03 CST 2002


Some padding tweaks, mainly for report mode, to try to make the Listview 
layout match WinNT exactly. This eliminates several visible artifacts 
that I have been seeing.

I also altered LISTVIEW_GetSubItemRect so that it reports correct 
values, as compared against WinNT on ControlSpy. LISTVIEW_GetItemRect 
looks good.

There are many possible combinations, and I have certainly missed some. 
Let me know of additional cases that anyone finds, and I will try to 
resolve them.

Changelog:
	Report mode padding tweaks.
	Fixes to LISTVIEW_GetSubItemRect.

-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.333
diff -u -r1.333 listview.c
--- dlls/comctl32/listview.c	10 Dec 2002 19:07:27 -0000	1.333
+++ dlls/comctl32/listview.c	20 Dec 2002 00:25:16 -0000
@@ -329,10 +329,10 @@
 #define LISTVIEW_SCROLL_ICON_LINE_SIZE 37
 
 /* Padding betwen image and label */
-#define IMAGE_PADDING  2
+#define IMAGE_PADDING  0
 
 /* Padding behind the label */
-#define TRAILING_PADDING  5
+#define TRAILING_PADDING  10
 
 /* Border for the icon caption */
 #define CAPTION_BORDER  2
@@ -1684,7 +1684,7 @@
     }
     else /* LVS_REPORT */
     {
-	lpptPosition->x = REPORT_MARGINX;
+	lpptPosition->x = 0;
 	lpptPosition->y = nItem * infoPtr->nItemHeight;
     }
 }
@@ -1788,9 +1788,9 @@
 	    State.left = Box.left;
 	    if (uView == LVS_REPORT) 
 	    {
-		State.left += REPORT_MARGINX;
 		if (lpLVItem->iSubItem == 0)
 		{
+		    State.left += REPORT_MARGINX;
 		    assert(lpLVItem->mask & LVIF_INDENT);
 		    State.left += infoPtr->iconSize.cx * lpLVItem->iIndent;
 		}
@@ -1853,7 +1853,6 @@
 	if (uView == LVS_REPORT)
 	{
 	    if (lpLVItem->iSubItem == 0) Label = lpColumnInfo->rcHeader;
-	    Label.right -= REPORT_MARGINX;
 	}
 
 	if (lpLVItem->iSubItem || ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && uView == LVS_REPORT))
@@ -3556,7 +3555,12 @@
 	default:            uFormat |= DT_LEFT;
 	}
     }
-    if (!(uFormat & (DT_RIGHT | DT_CENTER))) rcLabel.left += 2;
+    if (!(uFormat & (DT_RIGHT | DT_CENTER)))
+    {
+        if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon)) rcLabel.left += 2;
+        else rcLabel.left += 5;
+    }
+    else if (uFormat & DT_RIGHT) rcLabel.right -= 5;
     DrawTextW(hdc, lvItem.pszText, -1, &rcLabel, uFormat);
 
 postpaint:
@@ -5206,7 +5210,8 @@
 {
     POINT Position, Origin;
     LVITEMW lvItem;
-    
+    WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
+        
     if (!lprc || (infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return FALSE;
     
     TRACE("(nItem=%d, nSubItem=%d)\n", nItem, lprc->top);
@@ -5226,6 +5231,13 @@
         break;
 
     case LVIR_LABEL:
+        lvItem.mask |= LVIF_TEXT;
+        lvItem.pszText = szDispText;
+        lvItem.cchTextMax = DISP_TEXT_SIZE;
+        if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
+        LISTVIEW_GetItemMetrics(infoPtr, &lvItem, NULL, NULL, NULL, lprc);
+        break;
+
     case LVIR_BOUNDS:
 	LISTVIEW_GetItemMetrics(infoPtr, &lvItem, lprc, NULL, NULL, NULL);
         break;
@@ -5235,7 +5247,7 @@
 	return FALSE;
     }
 
-    OffsetRect(lprc, Position.x + Origin.x, Position.y + Origin.y);
+    OffsetRect(lprc, Position.x, Position.y);
     return TRUE;
 }
 
@@ -6307,7 +6319,7 @@
 		SIZE size;
 
 		if (GetTextExtentPoint32W(hdc, hdi.pszText, lstrlenW(hdi.pszText), &size))
-		    cx = size.cx;
+		    cx = size.cx + 11;
 		/* FIXME: Take into account the header image, if one is present */
 		SelectObject(hdc, old_font);
 		ReleaseDC(infoPtr->hwndSelf, hdc);


More information about the wine-patches mailing list