Here is my first few fixes for ListView. More to come. Vitaliy Margolen changelog: dlls/comctl32/listview.c changes for Icon and SmallIcon modes: - fix typo causing wrong scroll boundaries - reverse mouse wheel scroll directions - fix navigation with keyboard when auto arranged Index: listview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/listview.c,v retrieving revision 1.343 diff -u -r1.343 listview.c --- listview.c 7 Mar 2003 20:35:30 -0000 1.343 +++ listview.c 13 Mar 2003 06:41:07 -0000 @@ -2167,7 +2167,7 @@ for (i = 0; i < infoPtr->nItemCount; i++) { x = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, i); - y = (LONG)DPA_GetPtr(infoPtr->hdpaPosX, i); + y = (LONG)DPA_GetPtr(infoPtr->hdpaPosY, i); lprcView->right = max(lprcView->right, x); lprcView->bottom = max(lprcView->bottom, y); } @@ -5426,6 +5426,7 @@ UINT uMask = 0; LVFINDINFOW lvFindInfo; INT nCountPerColumn; + INT nCountPerRow; INT i; TRACE("nItem=%d, uFlags=%x, nItemCount=%d\n", nItem, uFlags, infoPtr->nItemCount); @@ -5466,6 +5467,18 @@ } else { + /* Special case for autoarrange - move 'til the top of a list */ + if (is_autoarrange(infoPtr)) + { + nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr); + while (nItem - nCountPerRow >= 0) + { + nItem -= nCountPerRow; + if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask) + return nItem; + } + return -1; + } lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_UP; ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); @@ -5489,6 +5502,18 @@ } else { + /* Special case for autoarrange - move 'til the bottom of a list */ + if (is_autoarrange(infoPtr)) + { + nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr); + while (nItem + nCountPerRow < infoPtr->nItemCount ) + { + nItem += nCountPerRow; + if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask) + return nItem; + } + return -1; + } lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_DOWN; ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); @@ -5513,6 +5538,18 @@ } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) { + /* Special case for autoarrange - move 'ti the beginning of a row */ + if (is_autoarrange(infoPtr)) + { + nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr); + while (nItem % nCountPerRow > 0) + { + nItem --; + if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask) + return nItem; + } + return -1; + } lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_LEFT; ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); @@ -5537,6 +5574,18 @@ } else if ((uView == LVS_SMALLICON) || (uView == LVS_ICON)) { + /* Special case for autoarrange - move 'til the end of a row */ + if (is_autoarrange(infoPtr)) + { + nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr); + while (nItem % nCountPerRow < nCountPerRow - 1 ) + { + nItem ++; + if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask) + return nItem; + } + return -1; + } lvFindInfo.flags = LVFI_NEARESTXY; lvFindInfo.vkDirection = VK_RIGHT; ListView_GetItemPosition(infoPtr->hwndSelf, nItem, &lvFindInfo.pt); @@ -7403,7 +7452,7 @@ * should be fixed in the future. */ LISTVIEW_VScroll(infoPtr, SB_INTERNAL, (gcWheelDelta < 0) ? - LISTVIEW_SCROLL_ICON_LINE_SIZE : -LISTVIEW_SCROLL_ICON_LINE_SIZE, 0); + -LISTVIEW_SCROLL_ICON_LINE_SIZE : LISTVIEW_SCROLL_ICON_LINE_SIZE, 0); break; case LVS_REPORT: