Listview W0

Dimitrie O. Paun dpaun at rogers.com
Mon Oct 21 15:42:15 CDT 2002


I guess we can start a new series, with a noop.

Alexandre, let me develop a bit this series, before commiting.

ChangeLog
  Rename LISTVIEW_ITEM to ITEM_INFO for consistency
  Rename LISTVIEW_SUBITEM to SUBITEM_INFO for same reason
  Fix type in comment spotted by Bobby Bingham.

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v
retrieving revision 1.281
diff -u -r1.281 listview.c
--- dlls/comctl32/listview.c	21 Oct 2002 19:46:46 -0000	1.281
+++ dlls/comctl32/listview.c	21 Oct 2002 20:37:53 -0000
@@ -40,7 +40,7 @@
  *   -- FIXMEs (search for them)
  *   
  * States
- *   -- LVIS_ACTIVATING (not currently supported my comctl32.dll version 6.0)
+ *   -- LVIS_ACTIVATING (not currently supported by comctl32.dll version 6.0)
  *   -- LVIS_CUT
  *   -- LVIS_DROPHILITED
  *   -- LVIS_OVERLAYMASK
@@ -152,19 +152,19 @@
   INT iImage;
 } ITEMHDR, *LPITEMHDR;
 
-typedef struct tagLISTVIEW_SUBITEM
+typedef struct tagSUBITEM_INFO
 {
   ITEMHDR hdr;
   INT iSubItem;
-} LISTVIEW_SUBITEM;
+} SUBITEM_INFO;
 
-typedef struct tagLISTVIEW_ITEM
+typedef struct tagITEM_INFO
 {
   ITEMHDR hdr;
   UINT state;
   LPARAM lParam;
   INT iIndent;
-} LISTVIEW_ITEM;
+} ITEM_INFO;
 
 typedef struct tagRANGE
 {
@@ -2105,15 +2105,15 @@
  *   SUCCESS : subitem pointer
  *   FAILURE : NULL
  */
-static LISTVIEW_SUBITEM* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
+static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
 {
-    LISTVIEW_SUBITEM *lpSubItem;
+    SUBITEM_INFO *lpSubItem;
     INT i;
 
     /* we should binary search here if need be */
     for (i = 1; i < hdpaSubItems->nItemCount; i++)
     {
-	lpSubItem = (LISTVIEW_SUBITEM *)DPA_GetPtr(hdpaSubItems, i);
+	lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i);
 	if (lpSubItem->iSubItem == nSubItem)
 	    return lpSubItem;
     }
@@ -2993,7 +2993,7 @@
  */
 static BOOL set_main_item(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isNew, BOOL isW, BOOL *bChanged)
 {
-    LISTVIEW_ITEM *lpItem;
+    ITEM_INFO *lpItem;
     NMLISTVIEW nmlv;
     UINT uChanged = 0;
     LVITEMW item;
@@ -3014,7 +3014,7 @@
     else
     {
 	HDPA hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
-	lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
+	lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0);
 	assert (lpItem);
     }
 
@@ -3129,7 +3129,7 @@
 static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW, BOOL *bChanged)
 {
     HDPA hdpaSubItems;
-    LISTVIEW_SUBITEM *lpSubItem;
+    SUBITEM_INFO *lpSubItem;
 
     /* we do not support subitems for virtual listviews */
     if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
@@ -3148,15 +3148,15 @@
     lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem);
     if (!lpSubItem)
     {
-	LISTVIEW_SUBITEM *tmpSubItem;
+	SUBITEM_INFO *tmpSubItem;
 	INT i;
 
-	lpSubItem = (LISTVIEW_SUBITEM *)COMCTL32_Alloc(sizeof(LISTVIEW_SUBITEM));
+	lpSubItem = (SUBITEM_INFO *)COMCTL32_Alloc(sizeof(SUBITEM_INFO));
 	if (!lpSubItem) return FALSE;
 	/* we could binary search here, if need be...*/
   	for (i = 1; i < hdpaSubItems->nItemCount; i++)
   	{
-	    tmpSubItem = (LISTVIEW_SUBITEM *)DPA_GetPtr(hdpaSubItems, i);
+	    tmpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i);
 	    if (tmpSubItem->iSubItem > lpLVItem->iSubItem) break;
   	}
 	if (DPA_InsertPtr(hdpaSubItems, i, lpSubItem) == -1)
@@ -3956,7 +3956,7 @@
   
     if (!(infoPtr->dwStyle & LVS_OWNERDATA))
     {
-	LISTVIEW_SUBITEM *lpSubItem, *lpDelItem;
+	SUBITEM_INFO *lpSubItem, *lpDelItem;
 	HDPA hdpaSubItems;
 	INT nItem, nSubItem, i;
 	
@@ -3967,7 +3967,7 @@
 	    lpDelItem = 0;
 	    for (i = 1; i < hdpaSubItems->nItemCount; i++)
 	    {
-		lpSubItem = (LISTVIEW_SUBITEM *)DPA_GetPtr(hdpaSubItems, i);
+		lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i);
 		if (lpSubItem->iSubItem == nColumn)
 		{
 		    nSubItem = i;
@@ -4691,7 +4691,7 @@
 static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
 {
     NMLVDISPINFOW dispInfo;
-    LISTVIEW_ITEM *lpItem;
+    ITEM_INFO *lpItem;
     ITEMHDR* pItemHdr;
     HDPA hdpaSubItems;
 
@@ -4766,12 +4766,12 @@
 
     /* find the item and subitem structures before we proceed */
     hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
-    lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
+    lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0);
     assert (lpItem);
 
     if (lpLVItem->iSubItem)
     {
-	LISTVIEW_SUBITEM *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem);
+	SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem);
         if(!lpSubItem) return FALSE;
 	pItemHdr = &lpSubItem->hdr;
     }
@@ -5629,8 +5629,8 @@
 */
 static INT WINAPI LISTVIEW_InsertCompare(  LPVOID first, LPVOID second,  LPARAM lParam)
 {
-    LISTVIEW_ITEM* lv_first = (LISTVIEW_ITEM*) DPA_GetPtr( (HDPA)first, 0 );
-    LISTVIEW_ITEM* lv_second = (LISTVIEW_ITEM*) DPA_GetPtr( (HDPA)second, 0 );
+    ITEM_INFO* lv_first = (ITEM_INFO*) DPA_GetPtr( (HDPA)first, 0 );
+    ITEM_INFO* lv_second = (ITEM_INFO*) DPA_GetPtr( (HDPA)second, 0 );
     INT cmpv = textcmpWT(lv_first->hdr.pszText, lv_second->hdr.pszText, TRUE); 
 
     /* if we're sorting descending, negate the return value */
@@ -5656,7 +5656,7 @@
     INT nItem;
     HDPA hdpaSubItems;
     NMLISTVIEW nmlv;
-    LISTVIEW_ITEM *lpItem;
+    ITEM_INFO *lpItem;
     BOOL is_sorted, has_changed;
     LVITEMW item;
 
@@ -5669,7 +5669,7 @@
 
     if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1;
 
-    if ( !(lpItem = (LISTVIEW_ITEM *)COMCTL32_Alloc(sizeof(LISTVIEW_ITEM))) )
+    if ( !(lpItem = (ITEM_INFO *)COMCTL32_Alloc(sizeof(ITEM_INFO))) )
 	return -1;
     
     /* insert item in listview control data structure */
@@ -5977,17 +5977,17 @@
     /* now we have to actually adjust the data */
     if (!(infoPtr->dwStyle & LVS_OWNERDATA) && infoPtr->nItemCount > 0)
     {
-	LISTVIEW_SUBITEM *lpSubItem, *lpMainItem, **lpNewItems = 0;
+	SUBITEM_INFO *lpSubItem, *lpMainItem, **lpNewItems = 0;
 	HDPA hdpaSubItems;
 	INT nItem, i;
 	
 	/* preallocate memory, so we can fail gracefully */
 	if (nNewColumn == 0)
 	{
-	    lpNewItems = COMCTL32_Alloc(sizeof(LISTVIEW_SUBITEM *) * infoPtr->nItemCount);
+	    lpNewItems = COMCTL32_Alloc(sizeof(SUBITEM_INFO *) * infoPtr->nItemCount);
 	    if (!lpNewItems) goto fail;
 	    for (i = 0; i < infoPtr->nItemCount; i++)
-		if (!(lpNewItems[i] = COMCTL32_Alloc(sizeof(LISTVIEW_SUBITEM)))) break;
+		if (!(lpNewItems[i] = COMCTL32_Alloc(sizeof(SUBITEM_INFO)))) break;
 	    if (i != infoPtr->nItemCount)
 	    {
 		for(; i >=0; i--) COMCTL32_Free(lpNewItems[i]);
@@ -6001,7 +6001,7 @@
 	    hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem);
 	    for (i = 1; i < hdpaSubItems->nItemCount; i++)
 	    {
-		lpSubItem = (LISTVIEW_SUBITEM *)DPA_GetPtr(hdpaSubItems, i);
+		lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i);
 		if (lpSubItem->iSubItem >= nNewColumn)
 		    lpSubItem->iSubItem++;
 	    }
@@ -6009,7 +6009,7 @@
 	    /* for inserting column 0, we have to special-case the main item */	
 	    if (nNewColumn == 0)
 	    {
-		lpMainItem = (LISTVIEW_SUBITEM *)DPA_GetPtr(hdpaSubItems, 0);
+		lpMainItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0);
 		lpSubItem = lpNewItems[nItem];
 		lpSubItem->hdr = lpMainItem->hdr;
 		lpSubItem->iSubItem = 1;
@@ -6701,8 +6701,8 @@
  * Callback internally used by LISTVIEW_SortItems()
  *
  * PARAMETER(S):
- * [I] first : pointer to first LISTVIEW_ITEM to compare
- * [I] second : pointer to second LISTVIEW_ITEM to compare
+ * [I] first : pointer to first ITEM_INFO to compare
+ * [I] second : pointer to second ITEM_INFO to compare
  * [I] lParam : HWND of control
  *
  * RETURN:
@@ -6713,8 +6713,8 @@
 static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM lParam)
 {
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW((HWND)lParam, 0);
-  LISTVIEW_ITEM* lv_first = (LISTVIEW_ITEM*) DPA_GetPtr( (HDPA)first, 0 );
-  LISTVIEW_ITEM* lv_second = (LISTVIEW_ITEM*) DPA_GetPtr( (HDPA)second, 0 );
+  ITEM_INFO* lv_first = (ITEM_INFO*) DPA_GetPtr( (HDPA)first, 0 );
+  ITEM_INFO* lv_second = (ITEM_INFO*) DPA_GetPtr( (HDPA)second, 0 );
 
   /* Forward the call to the client defined callback */
   return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort );
@@ -6737,7 +6737,7 @@
 {
     UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     HDPA hdpaSubItems;
-    LISTVIEW_ITEM *lpItem;
+    ITEM_INFO *lpItem;
     LPVOID selectionMarkItem;
     LVITEMW item;
     int i;
@@ -6754,7 +6754,7 @@
     if (infoPtr->nFocusedItem >= 0)
     {
 	hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nFocusedItem);
-	lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
+	lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0);
 	if (lpItem) lpItem->state |= LVIS_FOCUSED;
     }
     /* FIXME: go thorugh selected items and mark them so in lpItem->state */
@@ -6774,7 +6774,7 @@
     for (i=0; i < infoPtr->nItemCount; i++)
     {
 	hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, i);
-	lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
+	lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0);
 
 	if (lpItem->state & LVIS_SELECTED)
 	{




More information about the wine-patches mailing list