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
|
||||
TAB_DeleteItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||
INT iItem = (INT) wParam;
|
||||
BOOL bResult = FALSE;
|
||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||
INT iItem = (INT) wParam;
|
||||
BOOL bResult = FALSE;
|
||||
|
||||
if ((iItem >= 0) && (iItem < infoPtr->uNumItem))
|
||||
{
|
||||
TAB_ITEM *oldItems = infoPtr->items;
|
||||
if ((iItem >= 0) && (iItem < infoPtr->uNumItem))
|
||||
{
|
||||
TAB_ITEM *oldItems = infoPtr->items;
|
||||
|
||||
infoPtr->uNumItem--;
|
||||
infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
|
||||
TAB_InvalidateTabArea(hwnd, infoPtr);
|
||||
|
||||
if (iItem > 0)
|
||||
memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
|
||||
infoPtr->uNumItem--;
|
||||
infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
|
||||
|
||||
if (iItem < infoPtr->uNumItem)
|
||||
memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
|
||||
(infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
|
||||
if (iItem > 0)
|
||||
memcpy(&infoPtr->items[0], &oldItems[0], 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 */
|
||||
if ((iItem == infoPtr->iSelected) && (iItem > 0))
|
||||
infoPtr->iSelected--;
|
||||
Free(oldItems);
|
||||
|
||||
if (iItem < infoPtr->iSelected)
|
||||
infoPtr->iSelected--;
|
||||
/* Readjust the selected index */
|
||||
if ((iItem == infoPtr->iSelected) && (iItem > 0))
|
||||
infoPtr->iSelected--;
|
||||
|
||||
if (infoPtr->uNumItem == 0)
|
||||
infoPtr->iSelected = -1;
|
||||
if (iItem < infoPtr->iSelected)
|
||||
infoPtr->iSelected--;
|
||||
|
||||
/* Reposition and repaint tabs */
|
||||
TAB_SetItemBounds(hwnd);
|
||||
TAB_InvalidateTabArea(hwnd,infoPtr);
|
||||
if (infoPtr->uNumItem == 0)
|
||||
infoPtr->iSelected = -1;
|
||||
|
||||
bResult = TRUE;
|
||||
}
|
||||
/* Reposition and repaint tabs */
|
||||
TAB_SetItemBounds(hwnd);
|
||||
|
||||
return bResult;
|
||||
bResult = TRUE;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
static LRESULT
|
||||
TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||
TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
|
||||
|
||||
Free (infoPtr->items);
|
||||
infoPtr->uNumItem = 0;
|
||||
infoPtr->iSelected = -1;
|
||||
if (infoPtr->iHotTracked >= 0)
|
||||
KillTimer(hwnd, TAB_HOTTRACK_TIMER);
|
||||
infoPtr->iHotTracked = -1;
|
||||
TAB_InvalidateTabArea(hwnd,infoPtr);
|
||||
|
||||
TAB_SetItemBounds(hwnd);
|
||||
TAB_InvalidateTabArea(hwnd,infoPtr);
|
||||
return TRUE;
|
||||
Free (infoPtr->items);
|
||||
infoPtr->uNumItem = 0;
|
||||
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