Narrow down the items we iterate over in LIST, and REPORT mode.
Fix a Client --> List coordinate transformations in FindItem. Fix bug in HitItem (in LIST and REPORT mode). Avoid the last bit of drawing in REPORT mode.
This commit is contained in:
parent
9d678ff740
commit
05b4a09357
|
@ -770,27 +770,47 @@ static inline BOOL iterator_empty(ITERATOR* i)
|
||||||
static BOOL iterator_frameditems(ITERATOR* i, LISTVIEW_INFO* infoPtr, const RECT* lprc)
|
static BOOL iterator_frameditems(ITERATOR* i, LISTVIEW_INFO* infoPtr, const RECT* lprc)
|
||||||
{
|
{
|
||||||
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
|
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
|
||||||
INT nPerCol, nPerRow;
|
INT lower, upper;
|
||||||
|
RECT frame = *lprc;
|
||||||
|
POINT Origin;
|
||||||
|
|
||||||
/* in case we fail, we want to return an empty iterator */
|
/* in case we fail, we want to return an empty iterator */
|
||||||
if (!iterator_empty(i)) return FALSE;
|
if (!iterator_empty(i)) return FALSE;
|
||||||
|
|
||||||
|
if (!LISTVIEW_GetOrigin(infoPtr, &Origin)) return FALSE;
|
||||||
|
|
||||||
|
OffsetRect(&frame, -Origin.x, -Origin.y);
|
||||||
|
|
||||||
if (uView == LVS_ICON || uView == LVS_SMALLICON)
|
if (uView == LVS_ICON || uView == LVS_SMALLICON)
|
||||||
{
|
{
|
||||||
|
/* FIXME: we got to do better then this */
|
||||||
i->range.lower = 0;
|
i->range.lower = 0;
|
||||||
i->range.upper = infoPtr->nItemCount - 1;
|
i->range.upper = infoPtr->nItemCount - 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else if (uView == LVS_REPORT)
|
||||||
|
{
|
||||||
|
if (frame.left >= infoPtr->nItemWidth) return TRUE;
|
||||||
|
if (frame.top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE;
|
||||||
|
|
||||||
i->range.lower = LISTVIEW_GetTopIndex(infoPtr);
|
lower = frame.top / infoPtr->nItemHeight;
|
||||||
|
upper = (frame.bottom - 1) / infoPtr->nItemHeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1);
|
||||||
|
if (frame.top >= infoPtr->nItemHeight * nPerCol) return TRUE;
|
||||||
|
lower = (frame.left / infoPtr->nItemWidth) * nPerCol + frame.top / infoPtr->nItemHeight;
|
||||||
|
upper = ((frame.right - 1) / infoPtr->nItemWidth) * nPerCol + (frame.bottom - 1) / infoPtr->nItemHeight;
|
||||||
|
}
|
||||||
|
|
||||||
nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1) + 1;
|
if (upper < 0 || lower >= infoPtr->nItemCount) return TRUE;
|
||||||
if (uView == LVS_REPORT)
|
lower = max(lower, 0);
|
||||||
nPerRow = 1;
|
upper = min(upper, infoPtr->nItemCount - 1);
|
||||||
else /* uView == LVS_LIST */
|
if (upper < lower) return TRUE;
|
||||||
nPerRow = max((infoPtr->rcList.right - infoPtr->rcList.left)/infoPtr->nItemWidth, 1);
|
i->range.lower = lower;
|
||||||
|
i->range.upper = upper;
|
||||||
|
|
||||||
i->range.upper = min(i->range.lower + nPerCol * nPerRow, infoPtr->nItemCount - 1);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3539,10 +3559,6 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD cdmode
|
||||||
isFocused = FALSE;
|
isFocused = FALSE;
|
||||||
for (j = nFirstCol; j <= nLastCol; j++)
|
for (j = nFirstCol; j <= nLastCol; j++)
|
||||||
{
|
{
|
||||||
if (cdmode & CDRF_NOTIFYITEMDRAW)
|
|
||||||
cditemmode = notify_customdrawitem (infoPtr, hdc, i.nItem, j, CDDS_ITEMPREPAINT);
|
|
||||||
if (cditemmode & CDRF_SKIPDEFAULT) continue;
|
|
||||||
|
|
||||||
rcItem = lpCols[j].rc;
|
rcItem = lpCols[j].rc;
|
||||||
rcItem.left += REPORT_MARGINX;
|
rcItem.left += REPORT_MARGINX;
|
||||||
rcItem.right = max(rcItem.left, rcItem.right - REPORT_MARGINX);
|
rcItem.right = max(rcItem.left, rcItem.right - REPORT_MARGINX);
|
||||||
|
@ -3552,6 +3568,12 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD cdmode
|
||||||
/* Offset the Scroll Bar Pos */
|
/* Offset the Scroll Bar Pos */
|
||||||
OffsetRect(&rcItem, ptOrig.x, ptOrig.y);
|
OffsetRect(&rcItem, ptOrig.x, ptOrig.y);
|
||||||
|
|
||||||
|
if (rgntype == COMPLEXREGION && !RectVisible(hdc, &rcItem)) continue;
|
||||||
|
|
||||||
|
if (cdmode & CDRF_NOTIFYITEMDRAW)
|
||||||
|
cditemmode = notify_customdrawitem (infoPtr, hdc, i.nItem, j, CDDS_ITEMPREPAINT);
|
||||||
|
if (cditemmode & CDRF_SKIPDEFAULT) continue;
|
||||||
|
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
isFocused = LISTVIEW_DrawItem(infoPtr, hdc, i.nItem, rcItem);
|
isFocused = LISTVIEW_DrawItem(infoPtr, hdc, i.nItem, rcItem);
|
||||||
else
|
else
|
||||||
|
@ -4415,8 +4437,8 @@ static LRESULT LISTVIEW_FindItemW(LISTVIEW_INFO *infoPtr, INT nStart,
|
||||||
|
|
||||||
FIXME("LVFI_NEARESTXY is slow.\n");
|
FIXME("LVFI_NEARESTXY is slow.\n");
|
||||||
if (!LISTVIEW_GetOrigin(infoPtr, &Origin)) return -1;
|
if (!LISTVIEW_GetOrigin(infoPtr, &Origin)) return -1;
|
||||||
Destination.x = lpFindInfo->pt.x + Origin.x;
|
Destination.x = lpFindInfo->pt.x - Origin.x;
|
||||||
Destination.y = lpFindInfo->pt.y + Origin.y;
|
Destination.y = lpFindInfo->pt.y - Origin.y;
|
||||||
switch(lpFindInfo->vkDirection)
|
switch(lpFindInfo->vkDirection)
|
||||||
{
|
{
|
||||||
case VK_DOWN: Destination.y += infoPtr->nItemHeight; break;
|
case VK_DOWN: Destination.y += infoPtr->nItemHeight; break;
|
||||||
|
@ -5622,15 +5644,16 @@ static LRESULT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BO
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
POINT Origin, Position;
|
POINT Origin, Position;
|
||||||
|
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
|
||||||
|
|
||||||
if (!LISTVIEW_GetOrigin(infoPtr, &Origin)) return -1;
|
if (!LISTVIEW_GetOrigin(infoPtr, &Origin)) return -1;
|
||||||
Position.x = lpht->pt.x - Origin.x;
|
Position.x = lpht->pt.x - Origin.x;
|
||||||
Position.y = lpht->pt.y - Origin.y;
|
Position.y = lpht->pt.y - Origin.y;
|
||||||
|
|
||||||
if (Position.x < LISTVIEW_GetCountPerRow(infoPtr) * infoPtr->nItemWidth &&
|
if (Position.y < nPerCol * infoPtr->nItemHeight)
|
||||||
Position.y < LISTVIEW_GetCountPerColumn(infoPtr) * infoPtr->nItemHeight)
|
|
||||||
{
|
{
|
||||||
lpht->iItem = (Position.x / infoPtr->nItemWidth) * (Position.y / infoPtr->nItemHeight);
|
lpht->iItem = (Position.x / infoPtr->nItemWidth) * nPerCol + (Position.y / infoPtr->nItemHeight);
|
||||||
|
if (lpht->iItem < 0 || lpht->iItem >= infoPtr->nItemCount) lpht->iItem = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue