Listview W10

Dimitrie O. Paun dpaun at rogers.com
Wed Oct 23 13:33:16 CDT 2002


ChangeLog
  Use InvalidateItem instead of explicit InvalidateRect
    it is cleaner, and faster when redraw is disabled.

--- dlls/comctl32/listview.c.W9	Wed Oct 23 14:23:27 2002
+++ dlls/comctl32/listview.c	Wed Oct 23 14:31:25 2002
@@ -1192,7 +1192,6 @@
     LISTVIEW_InvalidateRect(infoPtr, NULL);
 }
 
-	
 static inline void LISTVIEW_InvalidateColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
 {
     RECT rcCol;
@@ -2009,8 +2008,7 @@
  */
 static BOOL LISTVIEW_MoveIconTo(LISTVIEW_INFO *infoPtr, INT nItem, LPPOINT lppt, BOOL isNew)
 {
-    POINT Origin, old;
-    RECT rcItem;
+    POINT old;
     
     if (!isNew)
     { 
@@ -2018,6 +2016,7 @@
         old.y = (LONG)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
     
         if (lppt->x == old.x && lppt->y == old.y) return TRUE;
+	LISTVIEW_InvalidateItem(infoPtr, nItem);
     }
 
     /* Allocating a POINTER for every item is too resource intensive,
@@ -2025,21 +2024,7 @@
     if (!DPA_SetPtr(infoPtr->hdpaPosX, nItem, (void *)lppt->x)) return FALSE;
     if (!DPA_SetPtr(infoPtr->hdpaPosY, nItem, (void *)lppt->y)) return FALSE;
 
-    LISTVIEW_GetOrigin(infoPtr, &Origin);
-    if (!isNew)
-    {
-	rcItem.left = old.x + Origin.x;
-	rcItem.top = old.y + Origin.y;
-	rcItem.right = rcItem.left + infoPtr->nItemWidth;
-	rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
-	LISTVIEW_InvalidateRect(infoPtr, &rcItem);
-    }
-	
-    rcItem.left = lppt->x + Origin.x;
-    rcItem.top = lppt->y + Origin.y;
-    rcItem.right = rcItem.left + infoPtr->nItemWidth;
-    rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
-    LISTVIEW_InvalidateRect(infoPtr, &rcItem);
+    LISTVIEW_InvalidateItem(infoPtr, nItem);
 
     return TRUE;
 }
@@ -4124,7 +4109,6 @@
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     NMLISTVIEW nmlv;
     LVITEMW item;
-    RECT rcBox;
 
     TRACE("(nItem=%d)\n", nItem);
 
@@ -4134,16 +4118,16 @@
     item.state = 0;
     item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
     LISTVIEW_SetItemState(infoPtr, nItem, &item);
-
-    /* we need to do this here, because we'll be deleting stuff */  
-    if (uView == LVS_SMALLICON || uView == LVS_ICON)
-	LISTVIEW_GetItemBox(infoPtr, nItem, &rcBox);
 	    
     /* send LVN_DELETEITEM notification. */
     ZeroMemory(&nmlv, sizeof (NMLISTVIEW));
     nmlv.iItem = nItem;
     notify_listview(infoPtr, LVN_DELETEITEM, &nmlv);
 
+    /* we need to do this here, because we'll be deleting stuff */  
+    if (uView == LVS_SMALLICON || uView == LVS_ICON)
+	LISTVIEW_InvalidateItem(infoPtr, nItem);
+    
     if (!(infoPtr->dwStyle & LVS_OWNERDATA))
     {
         HDPA hdpaSubItems;
@@ -4164,7 +4148,6 @@
     {
 	DPA_DeletePtr(infoPtr->hdpaPosX, nItem);
 	DPA_DeletePtr(infoPtr->hdpaPosY, nItem);
-	LISTVIEW_InvalidateRect(infoPtr, &rcBox);
     }
 
     infoPtr->nItemCount--;

-- 
Dimi.




More information about the wine-patches mailing list