Listview W4

Dimitrie O. Paun dpaun at rogers.com
Tue Oct 22 09:12:53 CDT 2002


ChangeLog
  Do not crash if callback text is not filled (behave like native)
  Render report mode from top to bottom (easier on the eye)
  Docs updates, type fixes, more traces.

--- dlls/comctl32/listview.c.W3	Mon Oct 21 22:57:34 2002
+++ dlls/comctl32/listview.c	Tue Oct 22 10:10:17 2002
@@ -54,6 +54,8 @@
  *
  * Speedups
  *   -- LISTVIEW_SetItemCount is too invalidation happy
+ *   -- in sorted mode, LISTVIEW_InsertItemT sorts the array,
+ *      instead of inserting in the right spot
  *   -- we should keep an ordered array of coordinates in iconic mode
  *      this would allow to frame items (iterator_frameditems),
  *      and find nearest item (LVFI_NEARESTXY) a lot more efficiently
@@ -3384,6 +3386,7 @@
 {
     UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
+    WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
     DWORD cditemmode = CDRF_DODEFAULT;
     RECT* lprcFocus, rcSelect, rcBox, rcState, rcIcon, rcLabel;
     NMLVCUSTOMDRAW nmlvcd;
@@ -3406,6 +3409,7 @@
     if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
     if (nSubItem > 0 && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) 
 	lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED);
+    if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = szCallback;
     TRACE("   lvItem=%s\n", debuglvitem_t(&lvItem, TRUE));
 
     /* now check if we need to update the focus rectangle */
@@ -3452,14 +3456,20 @@
     {
         UINT uStateImage = (lvItem.state & LVIS_STATEIMAGEMASK) >> 12;
         if (uStateImage)
+	{
+	     TRACE("uStateImage=%d\n", uStateImage);
 	     ImageList_Draw(infoPtr->himlState, uStateImage - 1, hdc, rcState.left, rcState.top, ILD_NORMAL);
+	}
     }
 
     /* small icons */
     himl = (uView == LVS_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
     if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon))
+    {
+	TRACE("iImage=%d\n", lvItem.iImage);
 	ImageList_Draw(himl, lvItem.iImage, hdc, rcIcon.left, rcIcon.top,
 			(lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL);
+    }
 
     /* Don't bother painting item being edited */
     if (infoPtr->hwndEdit && lprcFocus && nSubItem == 0) goto postpaint;
@@ -3551,7 +3561,7 @@
     }
 
     /* iterate through the invalidated rows */
-    while(iterator_prev(&i))
+    while(iterator_next(&i))
     {
 	item.iItem = i.nItem;
 	item.iSubItem = 0;
@@ -3625,10 +3635,10 @@
     iterator_visibleitems(&i, infoPtr, hdc);
     
     /* a last few bits before we start drawing */
-    TRACE("Colums=(%di - %d)\n", nFirstCol, nLastCol);
+    TRACE("Colums=(%d - %d)\n", nFirstCol, nLastCol);
 
     /* iterate through the invalidated rows */
-    while(iterator_prev(&i))
+    while(iterator_next(&i))
     {
 	/* iterate through the invalidated columns */
 	for (nCol = nFirstCol; nCol <= nLastCol; nCol++)




More information about the wine-patches mailing list