Fix TAB_DeleteItem and TAB_DeleteAllItems regressions introduced by

the last TAB_InvalidateTabArea changes.
Correct the indentation for these functions.
oldstable
Maxime Bellengé 2003-10-21 23:44:03 +00:00 committed by Alexandre Julliard
parent 8a6ca5ad3f
commit ed3847247e
1 changed files with 40 additions and 38 deletions

View File

@ -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;
TAB_InvalidateTabArea(hwnd, infoPtr);
infoPtr->uNumItem--; infoPtr->uNumItem--;
infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem); infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
if (iItem > 0) if (iItem > 0)
memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM)); memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
if (iItem < infoPtr->uNumItem) if (iItem < infoPtr->uNumItem)
memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1], memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
(infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM)); (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
Free(oldItems); Free(oldItems);
/* Readjust the selected index */ /* Readjust the selected index */
if ((iItem == infoPtr->iSelected) && (iItem > 0)) if ((iItem == infoPtr->iSelected) && (iItem > 0))
infoPtr->iSelected--; infoPtr->iSelected--;
if (iItem < infoPtr->iSelected) if (iItem < infoPtr->iSelected)
infoPtr->iSelected--; infoPtr->iSelected--;
if (infoPtr->uNumItem == 0) if (infoPtr->uNumItem == 0)
infoPtr->iSelected = -1; infoPtr->iSelected = -1;
/* Reposition and repaint tabs */ /* Reposition and repaint tabs */
TAB_SetItemBounds(hwnd); TAB_SetItemBounds(hwnd);
TAB_InvalidateTabArea(hwnd,infoPtr);
bResult = TRUE; bResult = TRUE;
} }
return bResult; 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);
TAB_InvalidateTabArea(hwnd,infoPtr);
Free (infoPtr->items); Free (infoPtr->items);
infoPtr->uNumItem = 0; infoPtr->uNumItem = 0;
infoPtr->iSelected = -1; infoPtr->iSelected = -1;
if (infoPtr->iHotTracked >= 0) if (infoPtr->iHotTracked >= 0)
KillTimer(hwnd, TAB_HOTTRACK_TIMER); KillTimer(hwnd, TAB_HOTTRACK_TIMER);
infoPtr->iHotTracked = -1; infoPtr->iHotTracked = -1;
TAB_SetItemBounds(hwnd); TAB_SetItemBounds(hwnd);
TAB_InvalidateTabArea(hwnd,infoPtr); return TRUE;
return TRUE;
} }