On May 17, 2003 06:37 am, Robert Shearman wrote:
It is the second one. The 0th subitem always seems to stay in the 0th column and the other subitems are shifted. (Note that the column headings are shifted normally, ie. column 0 has a new column heading).
Interesting. This seems to mean that we can remove a lot of fancy code from there :) What about this patch:
Index: dlls/comctl32/listview.c =================================================================== RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v retrieving revision 1.351 diff -u -r1.351 listview.c --- dlls/comctl32/listview.c 13 May 2003 00:30:10 -0000 1.351 +++ dlls/comctl32/listview.c 19 May 2003 07:28:54 -0000 @@ -6242,25 +6242,10 @@ /* now we have to actually adjust the data */ if (!(infoPtr->dwStyle & LVS_OWNERDATA) && infoPtr->nItemCount > 0) { - SUBITEM_INFO *lpSubItem, *lpMainItem, **lpNewItems = 0; + SUBITEM_INFO *lpSubItem; HDPA hdpaSubItems; INT nItem, i; - /* preallocate memory, so we can fail gracefully */ - if (nNewColumn == 0) - { - 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(SUBITEM_INFO)))) break; - if (i != infoPtr->nItemCount) - { - for(; i >=0; i--) COMCTL32_Free(lpNewItems[i]); - COMCTL32_Free(lpNewItems); - goto fail; - } - } - for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); @@ -6270,21 +6255,7 @@ if (lpSubItem->iSubItem >= nNewColumn) lpSubItem->iSubItem++; } - - /* for inserting column 0, we have to special-case the main item */ - if (nNewColumn == 0) - { - lpMainItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); - lpSubItem = lpNewItems[nItem]; - lpSubItem->hdr = lpMainItem->hdr; - lpSubItem->iSubItem = 1; - ZeroMemory(&lpMainItem->hdr, sizeof(lpMainItem->hdr)); - lpMainItem->iSubItem = 0; - DPA_InsertPtr(hdpaSubItems, 1, lpSubItem); - } } - - COMCTL32_Free(lpNewItems); }
/* make space for the new column */
-----Original Message----- From: Dimitrie O. Paun [mailto:dpaun@rogers.com] Sent: 19 May 2003 08:31 To: Robert Shearman Cc: Wine Devel Subject: Re: Fix ListView Bugs
On May 17, 2003 06:37 am, Robert Shearman wrote:
It is the second one. The 0th subitem always seems to stay in the 0th column and the other subitems are shifted. (Note that the
column headings
are shifted normally, ie. column 0 has a new column heading).
Interesting. This seems to mean that we can remove a lot of fancy code from there :) What about this patch:
Yes, that patch works perfectly, although it doesn't seem to be against current CVS and wouldn't patch cleanly.
Rob