[ComCtl32] Fix tab components when deleting a tab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My last patch to fix the way a tab control is invalidated introduced a
regression in TAB_DeleteItem and TAB_DeleteAllItems. This patch fixes
it.

Changelog:
     * Fix TAB_DeleteItem and TAB_DeleteAllItems regressions introduced
by the last TAB_InvalidateTabAre changes.
     * Correct the indentation for these functions.
-- 
Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/dlls/comctl32/tab.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/tab.c,v
retrieving revision 1.86
diff -u -r1.86 tab.c
--- wine/dlls/comctl32/tab.c	14 Oct 2003 20:12:05 -0000	1.86
+++ wine/dlls/comctl32/tab.c	18 Oct 2003 08:15:12 -0000
@@ -2800,61 +2800,63 @@
 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;
+	
+	TAB_InvalidateTabArea(hwnd, infoPtr);
 
-    infoPtr->uNumItem--;
-    infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
+	infoPtr->uNumItem--;
+	infoPtr->items = Alloc(sizeof (TAB_ITEM) * infoPtr->uNumItem);
 
-    if (iItem > 0)
-      memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
+	if (iItem > 0)
+	    memcpy(&infoPtr->items[0], &oldItems[0], iItem * sizeof(TAB_ITEM));
 
-    if (iItem < infoPtr->uNumItem)
-      memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
-              (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
+	if (iItem < infoPtr->uNumItem)
+	    memcpy(&infoPtr->items[iItem], &oldItems[iItem + 1],
+		   (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM));
 
-    Free(oldItems);
+	Free(oldItems);
 
-    /* Readjust the selected index */
-    if ((iItem == infoPtr->iSelected) && (iItem > 0))
-      infoPtr->iSelected--;
+	/* Readjust the selected index */
+	if ((iItem == infoPtr->iSelected) && (iItem > 0))
+	    infoPtr->iSelected--;
 
-    if (iItem < infoPtr->iSelected)
-      infoPtr->iSelected--;
+	if (iItem < infoPtr->iSelected)
+	    infoPtr->iSelected--;
 
-    if (infoPtr->uNumItem == 0)
-      infoPtr->iSelected = -1;
+	if (infoPtr->uNumItem == 0)
+	    infoPtr->iSelected = -1;
 
-    /* Reposition and repaint tabs */
-    TAB_SetItemBounds(hwnd);
-    TAB_InvalidateTabArea(hwnd,infoPtr);
+	/* Reposition and repaint tabs */
+	TAB_SetItemBounds(hwnd);
 
-    bResult = TRUE;
-  }
+	bResult = TRUE;
+    }
 
-  return bResult;
+    return bResult;
 }
 
 static LRESULT
 TAB_DeleteAllItems (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
-   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_SetItemBounds(hwnd);
-  TAB_InvalidateTabArea(hwnd,infoPtr);
-  return TRUE;
+    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
+   
+    TAB_InvalidateTabArea(hwnd,infoPtr);  
+
+    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;
 }
 
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux