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_GetOrigin(infoPtr, &Origin);
|
||||||
|
nFrom = min(nOldCount, nItems);
|
||||||
|
nTo = max(nOldCount, nItems);
|
||||||
|
|
||||||
|
if (uView == LVS_REPORT)
|
||||||
|
{
|
||||||
|
rcErase.left = 0;
|
||||||
|
rcErase.top = nFrom * infoPtr->nItemHeight;
|
||||||
|
rcErase.right = infoPtr->nItemWidth;
|
||||||
|
rcErase.bottom = nTo * infoPtr->nItemHeight;
|
||||||
|
OffsetRect(&rcErase, Origin.x, Origin.y);
|
||||||
|
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
|
||||||
|
LISTVIEW_InvalidateRect(infoPtr, &rcErase);
|
||||||
|
}
|
||||||
|
else /* LVS_LIST */
|
||||||
|
{
|
||||||
|
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
|
||||||
|
|
||||||
LISTVIEW_UpdateSize(infoPtr);
|
rcErase.left = (nFrom / nPerCol) * infoPtr->nItemWidth;
|
||||||
LISTVIEW_UpdateScroll(infoPtr);
|
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);
|
||||||
|
|
||||||
if (min(precount,infoPtr->nItemCount) < topvisible)
|
rcErase.left = (nFrom / nPerCol + 1) * infoPtr->nItemWidth;
|
||||||
LISTVIEW_InvalidateList(infoPtr); /* FIXME: optimize */
|
rcErase.top = 0;
|
||||||
}
|
rcErase.right = (nTo / nPerCol + 1) * infoPtr->nItemWidth;
|
||||||
else
|
rcErase.bottom = nPerCol * infoPtr->nItemHeight;
|
||||||
{
|
OffsetRect(&rcErase, Origin.x, Origin.y);
|
||||||
/* According to MSDN for non-LVS_OWNERDATA this is just
|
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
|
||||||
* a performance issue. The control allocates its internal
|
LISTVIEW_InvalidateRect(infoPtr, &rcErase);
|
||||||
* 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
|
}
|
||||||
*/
|
else
|
||||||
WARN("for non-ownerdata performance option not implemented.\n");
|
{
|
||||||
}
|
/* 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
Loading…
Reference in New Issue