Fix TAB_DeleteItem and TAB_DeleteAllItems regressions introduced by
the last TAB_InvalidateTabArea changes. Correct the indentation for these functions.
This commit is contained in:
parent
8a6ca5ad3f
commit
ed3847247e
|
@ -2800,61 +2800,63 @@ TAB_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||||
INT iItem = (INT) wParam;
|
INT iItem = (INT) wParam;
|
||||||
BOOL bResult = FALSE;
|
BOOL bResult = FALSE;
|
||||||
|
|
||||||
if ((iItem >= 0) && (iItem < infoPtr->uNumItem))
|
if ((iItem >= 0) && (iItem < infoPtr->uNumItem))
|
||||||
{
|
{
|
||||||
TAB_ITEM *oldItems = infoPtr->items;
|
TAB_ITEM *oldItems = infoPtr->items;
|
||||||
|
|
||||||
infoPtr->uNumItem--;
|
TAB_InvalidateTabArea(hwnd, infoPtr);
|
||||||
infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
|
|
||||||
|
|
||||||
if (iItem > 0)
|
infoPtr->uNumItem--;
|
||||||
memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
|
infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
|
||||||
|
|
||||||
if (iItem < infoPtr->uNumItem)
|
if (iItem > 0)
|
||||||
memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
|
memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
|
||||||
(infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
|
|
||||||
|
|
||||||
Free(oldItems);
|
if (iItem < infoPtr->uNumItem)
|
||||||
|
memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
|
||||||
|
(infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
|
||||||
|
|
||||||
/* Readjust the selected index */
|
Free(oldItems);
|
||||||
if ((iItem == infoPtr->iSelected) && (iItem > 0))
|
|
||||||
infoPtr->iSelected--;
|
|
||||||
|
|
||||||
if (iItem < infoPtr->iSelected)
|
/* Readjust the selected index */
|
||||||
infoPtr->iSelected--;
|
if ((iItem == infoPtr->iSelected) && (iItem > 0))
|
||||||
|
infoPtr->iSelected--;
|
||||||
|
|
||||||
if (infoPtr->uNumItem == 0)
|
if (iItem < infoPtr->iSelected)
|
||||||
infoPtr->iSelected = -1;
|
infoPtr->iSelected--;
|
||||||
|
|
||||||
/* Reposition and repaint tabs */
|
if (infoPtr->uNumItem == 0)
|
||||||
TAB_SetItemBounds(hwnd);
|
infoPtr->iSelected = -1;
|
||||||
TAB_InvalidateTabArea(hwnd,infoPtr);
|
|
||||||
|
|
||||||
bResult = TRUE;
|
/* Reposition and repaint tabs */
|
||||||
}
|
TAB_SetItemBounds(hwnd);
|
||||||
|
|
||||||
return bResult;
|
bResult = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||||
|
|
||||||
Free (infoPtr->items);
|
TAB_InvalidateTabArea(hwnd,infoPtr);
|
||||||
infoPtr->uNumItem = 0;
|
|
||||||
infoPtr->iSelected = -1;
|
|
||||||
if (infoPtr->iHotTracked >= 0)
|
|
||||||
KillTimer(hwnd, TAB_HOTTRACK_TIMER);
|
|
||||||
infoPtr->iHotTracked = -1;
|
|
||||||
|
|
||||||
TAB_SetItemBounds(hwnd);
|
Free (infoPtr->items);
|
||||||
TAB_InvalidateTabArea(hwnd,infoPtr);
|
infoPtr->uNumItem = 0;
|
||||||
return TRUE;
|
infoPtr->iSelected = -1;
|
||||||
|
if (infoPtr->iHotTracked >= 0)
|
||||||
|
KillTimer(hwnd, TAB_HOTTRACK_TIMER);
|
||||||
|
infoPtr->iHotTracked = -1;
|
||||||
|
|
||||||
|
TAB_SetItemBounds(hwnd);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue