ChangeLog Fix potential bug in RemoveAllItems Fix report-mode ONWERDRAW bug (with help from Alexandre Julliard) Fix multiple selection bug (in report and list mode) Remove code duplication for removing selections. Index: dlls/comctl32/listview.c =================================================================== RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v retrieving revision 1.174 diff -u -r1.174 listview.c --- dlls/comctl32/listview.c 5 Oct 2002 18:05:27 -0000 1.174 +++ dlls/comctl32/listview.c 6 Oct 2002 07:17:17 -0000 @@ -126,6 +126,7 @@ INT nItemWidth; HDPA hdpaSelectionRanges; INT nSelectionMark; + BOOL bRemovingAllSelections; INT nHotItem; SHORT notifyFormat; RECT rcList; /* This rectangle is really the window @@ -2069,11 +2070,10 @@ static LRESULT LISTVIEW_RemoveAllSelections(LISTVIEW_INFO *infoPtr) { RANGE *sel; - static BOOL removing_all_selections = FALSE; - if (removing_all_selections) return TRUE; + if (infoPtr->bRemovingAllSelections) return TRUE; - removing_all_selections = TRUE; + infoPtr->bRemovingAllSelections = TRUE; TRACE("()\n"); @@ -2084,7 +2084,7 @@ } while (infoPtr->hdpaSelectionRanges->nItemCount > 0); - removing_all_selections = FALSE; + infoPtr->bRemovingAllSelections = FALSE; return TRUE; } @@ -2287,7 +2287,7 @@ nFirst = min(infoPtr->nSelectionMark, nItem); nLast = max(infoPtr->nSelectionMark, nItem); } - for (i = nFirst; i < nLast; i++) + for (i = nFirst; i <= nLast; i++) LISTVIEW_SetItemState(infoPtr, i, &item); } else @@ -3377,9 +3377,6 @@ dis.CtlID = uID; dis.itemID = nItem; dis.itemAction = ODA_DRAWENTIRE; - if (item.state & LVIS_SELECTED) dis.itemAction |= ODA_SELECT; - if (item.state & LVIS_FOCUSED) dis.itemAction |= ODA_FOCUS; - /*dis.itemState = ODS_DEFAULT; */ if (item.state & LVIS_SELECTED) dis.itemState |= ODS_SELECTED; if (item.state & LVIS_FOCUSED) dis.itemState |= ODS_FOCUS; dis.hwndItem = infoPtr->hwndSelf; @@ -6725,19 +6722,7 @@ : "", (dwFlags & LVSICF_NOSCROLL) ? "LVSICF_NOSCROLL" : ""); - /* - * Internally remove all the selections. - * FIXME: why not RemoveAllSelections - */ - do - { - RANGE *selection; - selection = DPA_GetPtr(infoPtr->hdpaSelectionRanges,0); - if (selection) - LISTVIEW_RemoveSelectionRange(infoPtr,selection->lower, - selection->upper); - } - while (infoPtr->hdpaSelectionRanges->nItemCount>0); + LISTVIEW_RemoveAllSelections(infoPtr); precount = infoPtr->hdpaItems->nItemCount; topvisible = LISTVIEW_GetTopIndex(infoPtr) +