Fix ListView Bugs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes two bugs.
1. Regression. The colour used for the background of text that wasn't
selected wasn't being set properly any more, as it had been moved into
notify_prepaint. This patch moves it back to where it was before and the
text background appears correctly.
2. Don't clear the item header when column 0 is inserted - it would clear
anything already set in the header, such as information set by InsertItem

ChangeLog:
- Make selected text appear correctly now
- Don't clear header for subitem 0 when column 0 is inserted

Rob
Index: wine/dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.351
diff -u -r1.351 listview.c
--- wine/dlls/comctl32/listview.c	13 May 2003 00:30:10 -0000	1.351
+++ wine/dlls/comctl32/listview.c	16 May 2003 09:02:28 -0000
@@ -881,42 +881,9 @@
     return result;
 }
 
-static DWORD notify_prepaint (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)
+static inline DWORD notify_prepaint (LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd)
 {
-    BOOL isSelected = lpnmlvcd->nmcd.uItemState & CDIS_SELECTED;
-    DWORD cditemmode = notify_customdraw(infoPtr, CDDS_PREPAINT, lpnmlvcd);
-
-    if (cditemmode & CDRF_SKIPDEFAULT) return cditemmode;
-
-    /* apprently, for selected items, we have to override the returned values */
-    if (isSelected)
-    {
-	if (infoPtr->bFocus)
-	{
-	    lpnmlvcd->clrTextBk = comctl32_color.clrHighlight;
-	    lpnmlvcd->clrText   = comctl32_color.clrHighlightText;
-        }
-	else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
-	{
-	    lpnmlvcd->clrTextBk = comctl32_color.clr3dFace;
-	    lpnmlvcd->clrText   = comctl32_color.clrBtnText;
-	}
-    }
-
-    /* Set the text attributes */
-    if (lpnmlvcd->clrTextBk != CLR_NONE)
-    {
-	SetBkMode(hdc, OPAQUE);
-	if (lpnmlvcd->clrTextBk == CLR_DEFAULT)
-	    SetBkColor(hdc, infoPtr->clrTextBkDefault);
-	else
-	    SetBkColor(hdc,lpnmlvcd->clrTextBk);
-    }
-    else
-	SetBkMode(hdc, TRANSPARENT);
-    SetTextColor(hdc, lpnmlvcd->clrText);
-
-    return cditemmode;
+    return notify_customdraw(infoPtr, CDDS_PREPAINT, lpnmlvcd);
 }
 
 static inline DWORD notify_postpaint (LISTVIEW_INFO *infoPtr, NMLVCUSTOMDRAW *lpnmlvcd)
@@ -3570,6 +3537,23 @@
         cditemmode = notify_prepaint (infoPtr, hdc, &nmlvcd);
     if (cditemmode & CDRF_SKIPDEFAULT) goto postpaint;
 
+    if (cditemmode & CDRF_SKIPDEFAULT) return cditemmode;
+
+    /* apprently, for selected items, we have to override the returned values */
+    if (lvItem.state & LVIS_SELECTED)
+    {
+	if (infoPtr->bFocus)
+	{
+	    nmlvcd.clrTextBk = comctl32_color.clrHighlight;
+	    nmlvcd.clrText   = comctl32_color.clrHighlightText;
+        }
+	else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
+	{
+	    nmlvcd.clrTextBk = comctl32_color.clr3dFace;
+	    nmlvcd.clrText   = comctl32_color.clrBtnText;
+	}
+    }
+
     /* in full row select, subitems, will just use main item's colors */
     if (nSubItem && uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
 	nmlvcd.clrTextBk = CLR_NONE;
@@ -3597,6 +3581,19 @@
     /* Don't bother painting item being edited */
     if (infoPtr->hwndEdit && nItem == infoPtr->nEditLabelItem && nSubItem == 0) goto postpaint;
 
+    /* Set the text attributes */
+    if (nmlvcd.clrTextBk != CLR_NONE)
+    {
+	SetBkMode(hdc, OPAQUE);
+	if (nmlvcd.clrTextBk == CLR_DEFAULT)
+	    SetBkColor(hdc, infoPtr->clrTextBkDefault);
+	else
+	    SetBkColor(hdc,nmlvcd.clrTextBk);
+    }
+    else
+	SetBkMode(hdc, TRANSPARENT);
+    SetTextColor(hdc, nmlvcd.clrText);
+
     /* draw the selection background, if we're drawing the main item */
     if (nSubItem == 0)
     {
@@ -6278,7 +6275,6 @@
 		lpSubItem = lpNewItems[nItem];
 		lpSubItem->hdr = lpMainItem->hdr;
 		lpSubItem->iSubItem = 1;
-		ZeroMemory(&lpMainItem->hdr, sizeof(lpMainItem->hdr));
 		lpMainItem->iSubItem = 0;
 		DPA_InsertPtr(hdpaSubItems, 1, lpSubItem);
     	    }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux