Rewrite of the SetItemCount: bugs got squashed,
LVSICF_{NOSCROLL,NOINVALIDATEALL} implemented.
This commit is contained in:
parent
7710b3c8f3
commit
28a2f193a3
|
@ -53,7 +53,6 @@
|
||||||
* -- LISTVIEW_StyleChanged doesn't handle some changes too well
|
* -- LISTVIEW_StyleChanged doesn't handle some changes too well
|
||||||
*
|
*
|
||||||
* Speedups
|
* Speedups
|
||||||
* -- LISTVIEW_SetItemCount is too invalidation happy
|
|
||||||
* -- LISTVIEW_Size invalidates too much
|
* -- LISTVIEW_Size invalidates too much
|
||||||
* -- in sorted mode, LISTVIEW_InsertItemT sorts the array,
|
* -- in sorted mode, LISTVIEW_InsertItemT sorts the array,
|
||||||
* instead of inserting in the right spot
|
* instead of inserting in the right spot
|
||||||
|
@ -6521,46 +6520,79 @@ static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAG
|
||||||
*/
|
*/
|
||||||
static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFlags)
|
static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
TRACE("(nItems=%d, dwFlags=%lx)\n", nItems, dwFlags);
|
TRACE("(nItems=%d, dwFlags=%lx)\n", nItems, dwFlags);
|
||||||
|
|
||||||
if (infoPtr->dwStyle & LVS_OWNERDATA)
|
if (infoPtr->dwStyle & LVS_OWNERDATA)
|
||||||
{
|
{
|
||||||
int precount,topvisible;
|
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
|
||||||
|
INT nOldCount = infoPtr->nItemCount;
|
||||||
|
|
||||||
TRACE("LVS_OWNERDATA is set!\n");
|
LISTVIEW_DeselectAll(infoPtr);
|
||||||
if (dwFlags & (LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL))
|
infoPtr->nItemCount = nItems;
|
||||||
FIXME("flags %s %s not implemented\n",
|
LISTVIEW_UpdateScroll(infoPtr);
|
||||||
(dwFlags & LVSICF_NOINVALIDATEALL) ? "LVSICF_NOINVALIDATEALL"
|
|
||||||
: "",
|
|
||||||
(dwFlags & LVSICF_NOSCROLL) ? "LVSICF_NOSCROLL" : "");
|
|
||||||
|
|
||||||
LISTVIEW_DeselectAll(infoPtr);
|
/* the flags are valid only in ownerdata report and list modes */
|
||||||
|
if (uView == LVS_ICON || uView == LVS_SMALLICON) dwFlags = 0;
|
||||||
|
|
||||||
precount = infoPtr->nItemCount;
|
if (!(dwFlags & LVSICF_NOSCROLL))
|
||||||
topvisible = LISTVIEW_GetTopIndex(infoPtr) +
|
LISTVIEW_EnsureVisible(infoPtr, nItems - 1, FALSE);
|
||||||
LISTVIEW_GetCountPerColumn(infoPtr) + 1;
|
|
||||||
|
|
||||||
infoPtr->nItemCount = nItems;
|
if (!(dwFlags & LVSICF_NOINVALIDATEALL))
|
||||||
LISTVIEW_UpdateItemSize(infoPtr);
|
LISTVIEW_InvalidateList(infoPtr);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INT nFrom, nTo;
|
||||||
|
POINT Origin;
|
||||||
|
RECT rcErase;
|
||||||
|
|
||||||
LISTVIEW_UpdateSize(infoPtr);
|
LISTVIEW_GetOrigin(infoPtr, &Origin);
|
||||||
LISTVIEW_UpdateScroll(infoPtr);
|
nFrom = min(nOldCount, nItems);
|
||||||
|
nTo = max(nOldCount, nItems);
|
||||||
|
|
||||||
if (min(precount,infoPtr->nItemCount) < topvisible)
|
if (uView == LVS_REPORT)
|
||||||
LISTVIEW_InvalidateList(infoPtr); /* FIXME: optimize */
|
{
|
||||||
}
|
rcErase.left = 0;
|
||||||
else
|
rcErase.top = nFrom * infoPtr->nItemHeight;
|
||||||
{
|
rcErase.right = infoPtr->nItemWidth;
|
||||||
/* According to MSDN for non-LVS_OWNERDATA this is just
|
rcErase.bottom = nTo * infoPtr->nItemHeight;
|
||||||
* a performance issue. The control allocates its internal
|
OffsetRect(&rcErase, Origin.x, Origin.y);
|
||||||
* data structures for the number of items specified. It
|
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
|
||||||
* cuts down on the number of memory allocations. Therefore
|
LISTVIEW_InvalidateRect(infoPtr, &rcErase);
|
||||||
* we will just issue a WARN here
|
}
|
||||||
*/
|
else /* LVS_LIST */
|
||||||
WARN("for non-ownerdata performance option not implemented.\n");
|
{
|
||||||
}
|
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
|
||||||
|
|
||||||
return TRUE;
|
rcErase.left = (nFrom / nPerCol) * infoPtr->nItemWidth;
|
||||||
|
rcErase.top = (nFrom % nPerCol) * infoPtr->nItemHeight;
|
||||||
|
rcErase.right = rcErase.left + infoPtr->nItemWidth;
|
||||||
|
rcErase.bottom = nPerCol * infoPtr->nItemHeight;
|
||||||
|
OffsetRect(&rcErase, Origin.x, Origin.y);
|
||||||
|
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
|
||||||
|
LISTVIEW_InvalidateRect(infoPtr, &rcErase);
|
||||||
|
|
||||||
|
rcErase.left = (nFrom / nPerCol + 1) * infoPtr->nItemWidth;
|
||||||
|
rcErase.top = 0;
|
||||||
|
rcErase.right = (nTo / nPerCol + 1) * infoPtr->nItemWidth;
|
||||||
|
rcErase.bottom = nPerCol * infoPtr->nItemHeight;
|
||||||
|
OffsetRect(&rcErase, Origin.x, Origin.y);
|
||||||
|
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
|
||||||
|
LISTVIEW_InvalidateRect(infoPtr, &rcErase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* According to MSDN for non-LVS_OWNERDATA this is just
|
||||||
|
* a performance issue. The control allocates its internal
|
||||||
|
* data structures for the number of items specified. It
|
||||||
|
* cuts down on the number of memory allocations. Therefore
|
||||||
|
* we will just issue a WARN here
|
||||||
|
*/
|
||||||
|
WARN("for non-ownerdata performance option not implemented.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
Loading…
Reference in New Issue