Sync to Wine-20050310:
Martijn Vernooij <yuxdwa702@sneakemail.com>
- Scroll instead of repainting when expanding/collapsing trees.
- Don't repaint on hover if 'hot tracking' isn't on.
Francois Gouget <fgouget@free.fr>
- Add the -noname flag to match the Platform SDK.
- Assorted spelling fixes.
Maxime Bellenge <maxime.bellenge@laposte.net>
- Take into account the new size of a column when the header size
  change.
- Correctly displays the text with ellipsis when there is not enough
  room in a header item and an image from an imagelist is displayed on
  the right of the text.
- Fix SetItem so that items don't get wrongly re-ordered.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Fix prototypes of GetClassLongA/W, GetClassLongPtrA/W and
  SetClassLongA/W according to SDK definitions.
- Add prototypes for SetClassLongPtrA/W, protect some GWL_ and GCL_
  constants from using in Wine or in _WIN64 mode.
- Fix all places in Wine affected by the above changes.
Jon Griffiths <jon_p_griffiths@yahoo.com>
- Documentation spelling fixes.
- Remove unneeded calls to TAB_GetInfoPtr(), const fixes, inline small
  funcs & remove unused parameters.
Dimitrie O. Paun <dpaun@rogers.com>
- Fix indentation for consistency with the rest of the file.
- Unicodification. Small cleanups.
Filip Navara <navaraf@reactos.com>
- Implement SB_SETBORDERS.
Alex Villacis Lasso <a_villacis@palosanto.com>
- Change SUBLANG_DEFAULT to SUBLANG_NEUTRAL for LANG_SPANISH in all
  resources, so that Spanish locales other than Spain also use Spanish
  resources.
Robert Shearman <rob@codeweavers.com>
- Fix one more place where the code assumes row indices are
  zero-based.
- Document a known bug in the layout code.
- Make row number be zero-based.
- Improvements to dumping functions to not dump out fields that may
  not have been filled in.
Michael Stefaniuc <mstefani@redhat.de>
- ImageList_LoadImage{A,W} were basicaly a cut'n'paste of each
  other. Removed the A variant and did a A->W translation.
- ImageList_LoadImageW: get the bitmap size from the image itself and
  not from the mask (ImageList_LoadImageA did that).
Modified: trunk/reactos/include/wine/commctrl.h
Modified: trunk/reactos/lib/comctl32/comctl32.spec
Modified: trunk/reactos/lib/comctl32/comctl_Es.rc
Modified: trunk/reactos/lib/comctl32/draglist.c
Modified: trunk/reactos/lib/comctl32/header.c
Modified: trunk/reactos/lib/comctl32/imagelist.c
Modified: trunk/reactos/lib/comctl32/listview.c
Modified: trunk/reactos/lib/comctl32/rebar.c
Modified: trunk/reactos/lib/comctl32/status.c
Modified: trunk/reactos/lib/comctl32/string.c
Modified: trunk/reactos/lib/comctl32/syslink.c
Modified: trunk/reactos/lib/comctl32/tab.c
Modified: trunk/reactos/lib/comctl32/treeview.c
Modified: trunk/reactos/w32api/include/winuser.h

Modified: trunk/reactos/include/wine/commctrl.h
--- trunk/reactos/include/wine/commctrl.h	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/include/wine/commctrl.h	2005-03-14 11:34:02 UTC (rev 14057)
@@ -1,5 +1,4 @@
-/* $Id $
- *
+/*
  * Compatibility header
  *
  * This header is wrapper to allow compilation of Wine DLLs under ReactOS
@@ -59,6 +58,18 @@
 #define HDM_SETBITMAPMARGIN     (HDM_FIRST+20)
 #define HDM_GETBITMAPMARGIN     (HDM_FIRST+21)
 
-#define FLATSB_CLASSA         "flatsb_class32"
+#define SB_SETBORDERS		(WM_USER+5)
 
+#define FLATSB_CLASSA           "flatsb_class32"
+#define DRAGLISTMSGSTRINGA      "commctrl_DragListMsg"
+#if defined(__GNUC__)
+# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \
+  '_','D','r','a','g','L','i','s','t','M','s','g',0 }
+#elif defined(_MSC_VER)
+# define DRAGLISTMSGSTRINGW     L"commctrl_DragListMsg"
+#else
+static const WCHAR DRAGLISTMSGSTRINGW[] = { 'c','o','m','m','c','t','r','l', \
+  '_','D','r','a','g','L','i','s','t','M','s','g',0 };
+#endif
+
 #endif /* __WINE_COMMCTRL_H */

Modified: trunk/reactos/lib/comctl32/comctl32.spec
--- trunk/reactos/lib/comctl32/comctl32.spec	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/comctl32.spec	2005-03-14 11:34:02 UTC (rev 14057)
@@ -101,10 +101,10 @@
 402 stdcall -noname FindMRUStringW(long wstr ptr)
 403 stdcall -noname EnumMRUListW(long long ptr long)
 404 stdcall -noname CreateMRUListLazyW(ptr long long long)
-410 stdcall SetWindowSubclass(long ptr long long)
-411 stdcall GetWindowSubclass(long ptr long ptr)
-412 stdcall RemoveWindowSubclass(long ptr long)
-413 stdcall DefSubclassProc(long long long long)
+410 stdcall -noname SetWindowSubclass(long ptr long long)
+411 stdcall -noname GetWindowSubclass(long ptr long ptr)
+412 stdcall -noname RemoveWindowSubclass(long ptr long)
+413 stdcall -noname DefSubclassProc(long long long long)
 414 stdcall -noname MirrorIcon(ptr ptr)
 415 stdcall DrawTextWrap(long wstr long ptr long) user32.DrawTextW
 416 stdcall DrawTextExPrivWrap(long wstr long ptr long ptr) user32.DrawTextExW

Modified: trunk/reactos/lib/comctl32/comctl_Es.rc
--- trunk/reactos/lib/comctl32/comctl_Es.rc	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/comctl_Es.rc	2005-03-14 11:34:02 UTC (rev 14057)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT
+LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
 
 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE

Modified: trunk/reactos/lib/comctl32/draglist.c
--- trunk/reactos/lib/comctl32/draglist.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/draglist.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -42,10 +42,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
 
-/* for compiler compatibility we only accept literal ASCII strings */
-#undef TEXT
-#define TEXT(string) string
-
 #define DRAGLIST_SUBCLASSID     0
 #define DRAGLIST_SCROLLPERIOD 200
 #define DRAGLIST_TIMERID      666
@@ -95,7 +91,7 @@
 }
 
 /* cleans up after dragging */
-static inline void DragList_EndDrag(HWND hwnd, DRAGLISTDATA * data)
+static void DragList_EndDrag(HWND hwnd, DRAGLISTDATA * data)
 {
     KillTimer(hwnd, DRAGLIST_TIMERID);
     ReleaseCapture();
@@ -207,12 +203,12 @@
  */
 BOOL WINAPI MakeDragList (HWND hwndLB)
 {
-    DRAGLISTDATA * data = Alloc(sizeof(DRAGLISTDATA));
+    DRAGLISTDATA *data = Alloc(sizeof(DRAGLISTDATA));
 
     TRACE("(%p)\n", hwndLB);
 
     if (!uDragListMessage)
-        uDragListMessage = RegisterWindowMessageA(DRAGLISTMSGSTRING);
+        uDragListMessage = RegisterWindowMessageW(DRAGLISTMSGSTRINGW);
 
     return SetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR)data);
 }
@@ -301,14 +297,14 @@
 
     ScreenToClient (hwndLB, &pt);
     GetClientRect (hwndLB, &rcClient);
-    nIndex = (INT)SendMessageA (hwndLB, LB_GETTOPINDEX, 0, 0);
+    nIndex = (INT)SendMessageW (hwndLB, LB_GETTOPINDEX, 0, 0);
 
     if (PtInRect (&rcClient, pt))
     {
         /* point is inside -- get the item index */
         while (TRUE)
         {
-            if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
+            if (SendMessageW (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
                 return -1;
 
             if (PtInRect (&rcClient, pt))
@@ -338,7 +334,7 @@
 
         dwLastScrollTime = dwScrollTime;
 
-        SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
+        SendMessageW (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
     }
 
     return -1;

Modified: trunk/reactos/lib/comctl32/header.c
--- trunk/reactos/lib/comctl32/header.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/header.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -324,9 +324,19 @@
 	    } 
 	    else
 		tx = 0;
-	    ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,
-			     r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top, 
-			     CLR_DEFAULT, CLR_DEFAULT, 0);
+
+	    if (tx < (r.right-r.left - infoPtr->himl->cx - GetSystemMetrics(SM_CXEDGE)))
+		ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,
+				 r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top, 
+				 CLR_DEFAULT, CLR_DEFAULT, 0);
+	    else {
+		INT x = max(r.right - infoPtr->iMargin - infoPtr->himl->cx, r.left);
+		INT cx = min(infoPtr->himl->cx, r.right-r.left - GetSystemMetrics(SM_CXEDGE));
+		ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, x ,
+				 r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, cx, r.bottom-r.top, 
+				 CLR_DEFAULT, CLR_DEFAULT, 0);	
+		r.right -= infoPtr->himl->cx - infoPtr->iMargin;
+	    }
 	}	
 
         if (((phdi->fmt & HDF_STRING)
@@ -1203,10 +1213,8 @@
       {
 	lpItem->iOrder = phdi->iOrder;
       }
-    else
-      lpItem->iOrder = nItem;
 
-	HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem, phdi->mask);
+    HEADER_SendHeaderNotify (hwnd, HDN_ITEMCHANGEDA, nItem, phdi->mask);
 
     HEADER_SetItemBounds (hwnd);
 
@@ -1270,10 +1278,8 @@
       {
 	lpItem->iOrder = phdi->iOrder;
       }
-    else
-      lpItem->iOrder = nItem;
 
-	HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask);
+    HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask);
 
     HEADER_SetItemBounds (hwnd);
 

Modified: trunk/reactos/lib/comctl32/imagelist.c
--- trunk/reactos/lib/comctl32/imagelist.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/imagelist.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -1577,84 +1577,28 @@
  *
  * Creates an image list from a bitmap, icon or cursor.
  *
- * PARAMS
- *     hi      [I] instance handle
- *     lpbmp   [I] name or id of the image
- *     cx      [I] width of each image
- *     cGrow   [I] number of images to expand
- *     clrMask [I] mask color
- *     uType   [I] type of image to load
- *     uFlags  [I] loading flags
- *
- * RETURNS
- *     Success: handle to the loaded image list
- *     Failure: NULL
- *
  * SEE
- *     LoadImage ()
+ *     ImageList_LoadImageW ()
  */
 
 HIMAGELIST WINAPI
 ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
 			COLORREF clrMask, UINT uType, UINT uFlags)
 {
-    HIMAGELIST himl = NULL;
-    HANDLE   handle;
-    INT      nImageCount;
+    HIMAGELIST himl;
+    LPWSTR lpbmpW;
+    DWORD len;
 
-    handle = LoadImageA (hi, lpbmp, uType, 0, 0, uFlags);
-    if (!handle) {
-        ERR("Error loading image!\n");
-        return NULL;
-    }
+    if (!HIWORD(lpbmp))
+        return ImageList_LoadImageW(hi, (LPCWSTR)lpbmp, cx, cGrow, clrMask,
+                                    uType, uFlags);
 
-    if (uType == IMAGE_BITMAP) {
-        BITMAP bmp;
-        GetObjectA (handle, sizeof(BITMAP), &bmp);
+    len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
+    lpbmpW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
 
-        /* To match windows behavior, if cx is set to zero and
-         the flag DI_DEFAULTSIZE is specified, cx becomes the
-         system metric value for icons. If the flag is not specified
-         the function sets the size to the height of the bitmap */
-        if (cx == 0)
-        {
-            if (uFlags & DI_DEFAULTSIZE)
-                cx = GetSystemMetrics (SM_CXICON);
-            else
-                cx = bmp.bmHeight;
-        }
-
-        nImageCount = bmp.bmWidth / cx;
-
-        himl = ImageList_Create (cx, bmp.bmHeight, ILC_MASK | ILC_COLOR,
-                                 nImageCount, cGrow);
-        if (!himl) {
-            DeleteObject (handle);
-            return NULL;
-        }
-        ImageList_AddMasked (himl, (HBITMAP)handle, clrMask);
-    }
-    else if ((uType == IMAGE_ICON) || (uType == IMAGE_CURSOR)) {
-        ICONINFO ii;
-        BITMAP bmp;
-
-        GetIconInfo (handle, &ii);
-        GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
-        himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
-                                 ILC_MASK | ILC_COLOR, 1, cGrow);
-        if (!himl) {
-            DeleteObject (ii.hbmColor);
-            DeleteObject (ii.hbmMask);
-            DeleteObject (handle);
-            return NULL;
-        }
-        ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
-        DeleteObject (ii.hbmColor);
-        DeleteObject (ii.hbmMask);
-    }
-
-    DeleteObject (handle);
-
+    himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
+    HeapFree(GetProcessHeap(), 0, lpbmpW);
     return himl;
 }
 
@@ -1683,7 +1627,7 @@
 
 HIMAGELIST WINAPI
 ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
-			COLORREF clrMask, UINT uType,	UINT uFlags)
+                      COLORREF clrMask, UINT uType, UINT uFlags)
 {
     HIMAGELIST himl = NULL;
     HANDLE   handle;
@@ -1726,7 +1670,7 @@
         BITMAP bmp;
 
         GetIconInfo (handle, &ii);
-        GetObjectW (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
+        GetObjectW (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
         himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
                                  ILC_MASK | ILC_COLOR, 1, cGrow);
         if (!himl) {

Modified: trunk/reactos/lib/comctl32/listview.c
--- trunk/reactos/lib/comctl32/listview.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/listview.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -6276,7 +6276,7 @@
 	if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
 	infoPtr->clrBk = clrBk;
 	if (clrBk == CLR_NONE)
-	    infoPtr->hBkBrush = (HBRUSH)GetClassLongW(infoPtr->hwndSelf, GCL_HBRBACKGROUND);
+	    infoPtr->hBkBrush = (HBRUSH)GetClassLongPtrW(infoPtr->hwndSelf, GCLP_HBRBACKGROUND);
 	else
 	    infoPtr->hBkBrush = CreateSolidBrush(clrBk);
 	LISTVIEW_InvalidateList(infoPtr);
@@ -8253,6 +8253,7 @@
 
 		lpColumnInfo->rcHeader.right += dx;
 		LISTVIEW_ScrollColumns(infoPtr, lpnmh->iItem + 1, dx);
+		LISTVIEW_UpdateItemSize(infoPtr);
 		if (uView == LVS_REPORT && is_redrawing(infoPtr))
 		{
 		    /* this trick works for left aligned columns only */

Modified: trunk/reactos/lib/comctl32/rebar.c
--- trunk/reactos/lib/comctl32/rebar.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/rebar.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -134,7 +134,7 @@
 
     SIZE    offChild;       /* x,y offset if child is not FIXEDSIZE */
     UINT    uMinHeight;
-    INT     iRow;           /* row this band assigned to */
+    INT     iRow;           /* zero-based index of the row this band assigned to */
     UINT    fStatus;        /* status flags, reset only by _Validate */
     UINT    fDraw;          /* drawing flags, reset only by _Layout */
     UINT    uCDret;         /* last return from NM_CUSTOMDRAW */
@@ -360,8 +360,14 @@
 REBAR_DumpBandInfo( LPREBARBANDINFOA pB)
 {
     if( !TRACE_ON(rebar) ) return;
-    TRACE("band info: ID=%u, size=%u, child=%p, clrF=0x%06lx, clrB=0x%06lx\n",
-	  pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
+    TRACE("band info: ");
+    if (pB->fMask & RBBIM_ID);
+        TRACE("ID=%u, ", pB->wID);
+    TRACE("size=%u, child=%p", pB->cbSize, pB->hwndChild);
+    if (pB->fMask & RBBIM_COLORS)
+        TRACE(", clrF=0x%06lx, clrB=0x%06lx", pB->clrFore, pB->clrBack);
+    TRACE("\n");
+
     TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
     if (pB->fMask & RBBIM_STYLE)
 	TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
@@ -403,8 +409,14 @@
 	  (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
     for (i = 0; i < iP->uNumBands; i++) {
 	pB = &iP->bands[i];
-	TRACE("band # %u: ID=%u, child=%p, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",
-	      i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
+	TRACE("band # %u:", i);
+	if (pB->fMask & RBBIM_ID);
+	    TRACE(" ID=%u", pB->wID);
+	if (pB->fMask & RBBIM_CHILD)
+	    TRACE(" child=%p", pB->hwndChild);
+	if (pB->fMask & RBBIM_COLORS)
+	    TRACE(" clrF=0x%06lx clrB=0x%06lx", pB->clrFore, pB->clrBack);
+	TRACE("\n");
 	TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
 	if (pB->fMask & RBBIM_STYLE)
 	    TRACE("band # %u: style=0x%08x (%s)\n",
@@ -1419,7 +1431,7 @@
 	  clientcx, clientcy, adjcx, adjcy);
     x = initx;
     y = inity;
-    row = 1;
+    row = 0;
     cx = 0;
     mcy = 0;
     rowstart = 0;
@@ -1560,7 +1572,7 @@
     }
 
     if (infoPtr->uNumBands)
-        infoPtr->uNumRows = row;
+        infoPtr->uNumRows = row + 1;
 
     /* ******* End Phase 1 - all bands on row at minimum size ******* */
 
@@ -1583,7 +1595,7 @@
 
 	/* now adjust all rectangles by using the height found above */
 	xy = 0;
-	row = 1;
+	row = 0;
 	for (i=0; i<infoPtr->uNumBands; i++) {
 	    lpBand = &infoPtr->bands[i];
 	    if (HIDDENBAND(lpBand)) continue;
@@ -1759,6 +1771,7 @@
             if( !(lpBand->fDraw&DRAW_LAST_IN_ROW) )
                 continue;
 
+            /* FIXME: this next line is wrong, but fixing it to be inverted causes IE's sidebars to be the wrong size */
 	    if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
 	    if (((INT)lpBand->cyMaxChild < 1) ||
 		((INT)lpBand->cyIntegral < 1)) {
@@ -1943,7 +1956,7 @@
     infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
 
     /* Header is where the image, text and gripper exist  */
-    /* in the band and preceed the child window.          */
+    /* in the band and precede the child window.          */
 
     /* count number of non-FIXEDSIZE and non-Hidden bands */
     nonfixed = 0;

Modified: trunk/reactos/lib/comctl32/status.c
--- trunk/reactos/lib/comctl32/status.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/status.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -79,6 +79,9 @@
     BOOL              NtfUnicode;	/* notify format */
     STATUSWINDOWPART  part0;		/* simple window */
     STATUSWINDOWPART* parts;
+    INT               horizontalBorder;
+    INT               verticalBorder;
+    INT               horizontalGap;
 } STATUS_INFO;
 
 /*
@@ -159,28 +162,24 @@
 
     DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
 
-    if (part->style & SBT_OWNERDRAW)
-	{
-	    DRAWITEMSTRUCT dis;
+    if (part->style & SBT_OWNERDRAW) {
+	DRAWITEMSTRUCT dis;
 
-	    dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
-	    dis.itemID = itemID;
-	    dis.hwndItem = infoPtr->Self;
-	    dis.hDC = hdc;
-	    dis.rcItem = r;
-	    dis.itemData = (INT)part->text;
-	    SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
-    }
-    else
-	{
-	    if (part->hIcon)
-		{
-	        INT cy = r.bottom - r.top;
+	dis.CtlID = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
+	dis.itemID = itemID;
+	dis.hwndItem = infoPtr->Self;
+	dis.hDC = hdc;
+	dis.rcItem = r;
+	dis.itemData = (INT)part->text;
+	SendMessageW (infoPtr->Notify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis);
+    } else {
+	if (part->hIcon) {
+	   INT cy = r.bottom - r.top;
 
-	        r.left += 2;
-	        DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
-	        r.left += cy;
-		}
+	    r.left += 2;
+	    DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
+	    r.left += cy;
+	}
         DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
     }
 }
@@ -213,12 +212,11 @@
     if (infoPtr->clrBk != CLR_DEFAULT)
 	    DeleteObject (hbrBk);
 
-    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP)
-	{
-	    RECT rect;
+    if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
+        RECT rect;
 
-	    GetClientRect (infoPtr->Self, &rect);
-	    STATUSBAR_DrawSizeGrip (hdc, &rect);
+	GetClientRect (infoPtr->Self, &rect);
+	STATUSBAR_DrawSizeGrip (hdc, &rect);
     }
 }
 
@@ -240,19 +238,19 @@
     GetClientRect (infoPtr->Self, &rect);
 
     if (infoPtr->clrBk != CLR_DEFAULT)
-	    hbrBk = CreateSolidBrush (infoPtr->clrBk);
+	hbrBk = CreateSolidBrush (infoPtr->clrBk);
     else
-	    hbrBk = GetSysColorBrush (COLOR_3DFACE);
+	hbrBk = GetSysColorBrush (COLOR_3DFACE);
     FillRect(hdc, &rect, hbrBk);
 
     hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
 
     if (infoPtr->simple) {
-	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
+	STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
     } else {
-	    for (i = 0; i < infoPtr->numParts; i++) {
-		    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
-	    }
+	for (i = 0; i < infoPtr->numParts; i++) {
+	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
+	}
     }
 
     SelectObject (hdc, hOldFont);
@@ -278,7 +276,8 @@
     GetClientRect (infoPtr->Self, &rect);
     TRACE("client wnd size is %ld,%ld - %ld,%ld\n", rect.left, rect.top, rect.right, rect.bottom);
 
-    rect.top += VERT_BORDER;
+    rect.left += infoPtr->horizontalBorder;
+    rect.top += infoPtr->verticalBorder;
 
     /* set bounds for simple rectangle */
     infoPtr->part0.bound = rect;
@@ -292,7 +291,7 @@
 	if (i == 0)
 	    r->left = 0;
 	else
-	    r->left = infoPtr->parts[i-1].bound.right + HORZ_GAP;
+	    r->left = infoPtr->parts[i-1].bound.right + infoPtr->horizontalGap;
 	if (part->x == -1)
 	    r->right = rect.right;
 	else
@@ -331,17 +330,30 @@
 
 
 static BOOL
-STATUSBAR_GetBorders (INT out[])
+STATUSBAR_GetBorders (STATUS_INFO *infoPtr, INT out[])
 {
     TRACE("\n");
-    out[0] = HORZ_BORDER; /* horizontal border width */
-    out[1] = VERT_BORDER; /* vertical border width */
-    out[2] = HORZ_GAP; /* width of border between rectangles */
+    out[0] = infoPtr->horizontalBorder;
+    out[1] = infoPtr->verticalBorder;
+    out[2] = infoPtr->horizontalGap;
 
     return TRUE;
 }
 
 
+static BOOL
+STATUSBAR_SetBorders (STATUS_INFO *infoPtr, INT in[])
+{
+    TRACE("\n");
+    infoPtr->horizontalBorder = in[0];
+    infoPtr->verticalBorder = in[1];
+    infoPtr->horizontalGap = in[2];
+    InvalidateRect(infoPtr->Self, NULL, FALSE);
+
+    return TRUE;
+}
+
+
 static HICON
 STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
 {
@@ -560,13 +572,13 @@
 	RECT parent_rect;
 
 	GetClientRect (infoPtr->Notify, &parent_rect);
-	infoPtr->height = height + VERT_BORDER;
+	infoPtr->height = height + infoPtr->verticalBorder;
 	width = parent_rect.right - parent_rect.left;
 	x = parent_rect.left;
 	y = parent_rect.bottom - infoPtr->height;
 	MoveWindow (infoPtr->Self, parent_rect.left,
-		      parent_rect.bottom - infoPtr->height,
-		      width, infoPtr->height, TRUE);
+		    parent_rect.bottom - infoPtr->height,
+		    width, infoPtr->height, TRUE);
 	STATUSBAR_SetPartBounds (infoPtr);
     }
 
@@ -728,8 +740,7 @@
 	ti.uId = id;
 	ti.hinst = 0;
 	ti.lpszText = text;
-	SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
-			0, (LPARAM)&ti);
+	SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, 0, (LPARAM)&ti);
     }
 
     return 0;
@@ -747,8 +758,7 @@
 	ti.uId = id;
 	ti.hinst = 0;
 	ti.lpszText = text;
-	SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW,
-			0, (LPARAM)&ti);
+	SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
     }
 
     return 0;
@@ -838,6 +848,9 @@
     infoPtr->simple = FALSE;
     infoPtr->clrBk = CLR_DEFAULT;
     infoPtr->hFont = 0;
+    infoPtr->horizontalBorder = HORZ_BORDER;
+    infoPtr->verticalBorder = VERT_BORDER;
+    infoPtr->horizontalGap = HORZ_GAP;
 
     i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
     infoPtr->NtfUnicode = (i == NFR_UNICODE);
@@ -929,7 +942,7 @@
     if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
         GetClientRect (infoPtr->Notify, &rect);
         width = rect.right - rect.left;
-        infoPtr->height = textHeight + 4 + VERT_BORDER;
+        infoPtr->height = textHeight + 4 + infoPtr->verticalBorder;
         SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1,
 			width, infoPtr->height, SWP_NOZORDER);
         STATUSBAR_SetPartBounds (infoPtr);
@@ -1069,8 +1082,7 @@
     /* Need to resize width to match parent */
     TRACE("flags %04x\n", flags);
 
-    if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED)
-    {
+    if (flags != SIZE_RESTORED && flags != SIZE_MAXIMIZED) {
 	WARN("flags MUST be SIZE_RESTORED or SIZE_MAXIMIZED\n");
 	return FALSE;
     }
@@ -1129,7 +1141,7 @@
 
     switch (msg) {
 	case SB_GETBORDERS:
-	    return STATUSBAR_GetBorders ((INT *)lParam);
+	    return STATUSBAR_GetBorders (infoPtr, (INT *)lParam);
 
 	case SB_GETICON:
 	    return (LRESULT)STATUSBAR_GetIcon (infoPtr, nPart);
@@ -1162,6 +1174,9 @@
 	case SB_ISSIMPLE:
 	    return infoPtr->simple;
 
+	case SB_SETBORDERS:
+	    return STATUSBAR_SetBorders (infoPtr, (INT *)lParam);
+
 	case SB_SETBKCOLOR:
 	    return STATUSBAR_SetBkColor (infoPtr, (COLORREF)lParam);
 

Modified: trunk/reactos/lib/comctl32/string.c
--- trunk/reactos/lib/comctl32/string.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/string.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -421,7 +421,7 @@
 /**************************************************************************
  * StrRChrA [COMCTL32.351]
  *
- * Find the last occurence of a character in string.
+ * Find the last occurrence of a character in string.
  *
  * PARAMS
  *  lpszStr [I] String to search in
@@ -572,7 +572,7 @@
 /*************************************************************************
  * StrRStrIA	[COMCTL32.372]
  *
- * Find the last occurence of a substring within a string.
+ * Find the last occurrence of a substring within a string.
  *
  * PARAMS
  *  lpszStr    [I] String to search in
@@ -580,7 +580,7 @@
  *  lpszSearch [I] String to look for
  *
  * RETURNS
- *  The last occurence lpszSearch within lpszStr, or NULL if not found.
+ *  The last occurrence lpszSearch within lpszStr, or NULL if not found.
  */
 LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
 {
@@ -709,7 +709,7 @@
 /**************************************************************************
  * StrRChrIA	[COMCTL32.368]
  *
- * Find the last occurence of a character in string, ignoring case.
+ * Find the last occurrence of a character in string, ignoring case.
  *
  * PARAMS
  *  lpszStr [I] String to search in

Modified: trunk/reactos/lib/comctl32/syslink.c
--- trunk/reactos/lib/comctl32/syslink.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/syslink.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -513,7 +513,7 @@
 
 /***********************************************************************
  * SYSLINK_GetLinkItemByIndex
- * Retreives a document link by it's index
+ * Retrieves a document link by its index
  */
 static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
 {
@@ -532,7 +532,7 @@
 
 /***********************************************************************
  * SYSLINK_GetFocusLink
- * Retreives the link that has the LIS_FOCUSED bit
+ * Retrieves the link that has the LIS_FOCUSED bit
  */
 static PDOC_ITEM SYSLINK_GetFocusLink (SYSLINK_INFO *infoPtr, int *LinkId)
 {

Modified: trunk/reactos/lib/comctl32/tab.c
--- trunk/reactos/lib/comctl32/tab.c	2005-03-14 11:01:02 UTC (rev 14056)
+++ trunk/reactos/lib/comctl32/tab.c	2005-03-14 11:34:02 UTC (rev 14057)
@@ -59,7 +59,7 @@
                      * leftmost item (the leftmost item, 0, would have a
                      * "left" member of 0 in this rectangle)
                      *
-                     * additionally the top member hold the row number
+                     * additionally the top member holds the row number
                      * and bottom is unused and should be 0 */
   BYTE   extra[1];  /* Space for caller supplied info, variable size */
 } TAB_ITEM;
@@ -69,6 +69,7 @@
 
 typedef struct
 {
+  HWND       hwnd;            /* Tab control window */
   HWND       hwndNotify;      /* notification window (parent) */
   UINT       uNumItem;        /* number of tab items */
   UINT       uNumRows;	      /* number of tab rows */
@@ -126,20 +127,17 @@
 /******************************************************************************
  * Prototypes
  */
-static void TAB_Refresh (HWND hwnd, HDC hdc);
-static void TAB_InvalidateTabArea(HWND hwnd, TAB_INFO* infoPtr);
-static void TAB_EnsureSelectionVisible(HWND hwnd, TAB_INFO* infoPtr);
-static void TAB_DrawItem(HWND hwnd, HDC hdc, INT iItem);
-static void TAB_DrawItemInterior(HWND hwnd, HDC hdc, INT iItem, RECT* drawRect);
+static void TAB_InvalidateTabArea(TAB_INFO *);
+static void TAB_EnsureSelectionVisible(TAB_INFO *);
+static void TAB_DrawItemInterior(TAB_INFO *, HDC, INT, RECT*);
 
 static BOOL
-TAB_SendSimpleNotify (HWND hwnd, UINT code)
+TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     NMHDR nmhdr;
 
-    nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
+    nmhdr.hwndFrom = infoPtr->hwnd;
+    nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwnd, GWLP_ID);
     nmhdr.code = code;
 
     return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
@@ -203,11 +201,8 @@
 
 /* RETURNS
  *   the index of the selected tab, or -1 if no tab is selected. */
-static LRESULT
-TAB_GetCurSel (HWND hwnd)
+static inline LRESULT TAB_GetCurSel (const TAB_INFO *infoPtr)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-
     return infoPtr->iSelected;
 }
 
@@ -217,10 +212,9 @@
  *   we have not to return negative value
  * TODO
  *   test for windows */
-static LRESULT
-TAB_GetCurFocus (HWND hwnd)
+static inline LRESULT
+TAB_GetCurFocus (const TAB_INFO *infoPtr)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
     if (infoPtr->uFocus<0)
     {
         FIXME("we have not to return negative value");
@@ -229,79 +223,66 @@
     return infoPtr->uFocus;
 }
 
-static LRESULT
-TAB_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
+static inline LRESULT TAB_GetToolTips (const TAB_INFO *infoPtr)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-
     if (infoPtr == NULL) return 0;
     return (LRESULT)infoPtr->hwndToolTip;
 }
 
-static LRESULT
-TAB_SetCurSel (HWND hwnd,WPARAM wParam)
+static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-  INT iItem = (INT)wParam;
-  INT prevItem;
+  INT prevItem = -1;
 
-  prevItem = -1;
-  if ((iItem >= 0) && (iItem < infoPtr->uNumItem)) {
-    prevItem=infoPtr->iSelected;
+  if (iItem >= 0 && iItem < infoPtr->uNumItem) {
+      prevItem=infoPtr->iSelected;
       infoPtr->iSelected=iItem;
-      TAB_EnsureSelectionVisible(hwnd, infoPtr);
-      TAB_InvalidateTabArea(hwnd, infoPtr);
+      TAB_EnsureSelectionVisible(infoPtr);
+      TAB_InvalidateTabArea(infoPtr);
   }
   return prevItem;
 }
 
-static LRESULT
-TAB_SetCurFocus (HWND hwnd,WPARAM wParam)
+static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
 {
-  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-  INT iItem=(INT) wParam;
+  if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0;
 
-  if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0;
-
-  if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) {
+  if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
     FIXME("Should set input focus\n");
   } else {
     int oldFocus = infoPtr->uFocus;
     if (infoPtr->iSelected != iItem || oldFocus == -1 ) {
       infoPtr->uFocus = iItem;
       if (oldFocus != -1) {
-        if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING))  {
+        if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))  {
           infoPtr->iSelected = iItem;
-          TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
+          TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
         }
         else
           infoPtr->iSelected = iItem;
-        TAB_EnsureSelectionVisible(hwnd, infoPtr);
-        TAB_InvalidateTabArea(hwnd, infoPtr);
+        TAB_EnsureSelectionVisible(infoPtr);
+        TAB_InvalidateTabArea(infoPtr);
       }
     }
   }
   return 0;
 }
 
-static LRESULT
-TAB_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
+static inline LRESULT
+TAB_SetToolTips (TAB_INFO *infoPtr, HWND hwndToolTip)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-
-    if (infoPtr == NULL) return 0;
-    infoPtr->hwndToolTip = (HWND)wParam;
+    if (infoPtr)
+        infoPtr->hwndToolTip = hwndToolTip;
     return 0;
 }
 
-static LRESULT
-TAB_SetPadding (HWND hwnd, WPARAM wParam, LPARAM lParam)
+static inline LRESULT
+TAB_SetPadding (TAB_INFO *infoPtr, LPARAM lParam)
 {
-    TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
-    
-    if (infoPtr == NULL) return 0;
-    infoPtr->uHItemPadding_s=LOWORD(lParam);
-    infoPtr->uVItemPadding_s=HIWORD(lParam);
+    if (infoPtr)
+    {
+        infoPtr->uHItemPadding_s=LOWORD(lParam);
+        infoPtr->uVItemPadding_s=HIWORD(lParam);
+    }
     return 0;
 }
 
@@ -315,14 +296,13 @@
  * if it is completely outside the client area.
  */
 static BOOL TAB_InternalGetItemRect(
-  HWND        hwnd,
-  TAB_INFO*   infoPtr,
+  const TAB_INFO* infoPtr,
   INT         itemIndex,
   RECT*       itemRect,
   RECT*       selectedRect)
 {
   RECT tmpItemRect,clientRect;
-  LONG        lStyle  = GetWindowLongA(hwnd, GWL_STYLE);
+  LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
 
   /* Perform a sanity check and a trivial visibility check. */
   if ( (infoPtr->uNumItem <= 0) ||
@@ -341,7 +321,7 @@
   *itemRect = TAB_GetItem(infoPtr,itemIndex)->rect;
 
   /* calculate the times bottom and top based on the row */
-  GetClientRect(hwnd, &clientRect);
+  GetClientRect(infoPtr->hwnd, &clientRect);
 
   if ((lStyle & TCS_BOTTOM) && (lStyle & TCS_VERTICAL))
   {
@@ -440,10 +420,10 @@
   return TRUE;
 }
 
-static BOOL TAB_GetItemRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static inline BOOL
+TAB_GetItemRect(TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
-  return TAB_InternalGetItemRect(hwnd, TAB_GetInfoPtr(hwnd), (INT)wParam,
-                                 (LPRECT)lParam, (LPRECT)NULL);
+  return TAB_InternalGetItemRect(infoPtr, (INT)wParam, (LPRECT)lParam, (LPRECT)NULL);
 }
 
 /******************************************************************************
@@ -451,11 +431,8 @@
  *
  * This method is called to handle keyboard input
  */
-static LRESULT TAB_KeyUp(
-  HWND   hwnd,
-  WPARAM keyCode)
+static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode)
 {
-  TAB_INFO* infoPtr = TAB_GetInfoPtr(hwnd);
   int       newItem = -1;
 
   switch (keyCode)
@@ -471,18 +448,18 @@
   /*
    * If we changed to a valid item, change the selection
    */
-  if ((newItem >= 0) &&
-       (newItem < infoPtr->uNumItem) &&
-       (infoPtr->uFocus != newItem))
+  if (newItem >= 0 &&
+      newItem < infoPtr->uNumItem &&
+      infoPtr->uFocus != newItem)
   {
-    if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING))
+    if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))
     {
       infoPtr->iSelected = newItem;
       infoPtr->uFocus    = newItem;
-      TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
+      TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
 
-      TAB_EnsureSelectionVisible(hwnd, infoPtr);
-      TAB_InvalidateTabArea(hwnd, infoPtr);
+      TAB_EnsureSelectionVisible(infoPtr);
+      TAB_InvalidateTabArea(infoPtr);
     }
   }
 
@@ -495,21 +472,15 @@
  * This method is called whenever the focus goes in or out of this control
  * it is used to update the visual state of the control.
  */
-static LRESULT TAB_FocusChanging(
-  HWND   hwnd,
-  UINT   uMsg,
-  WPARAM wParam,
-  LPARAM lParam)
+static VOID TAB_FocusChanging(const TAB_INFO *infoPtr)
 {
-  TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd);
   RECT      selectedRect;
   BOOL      isVisible;
 
   /*
    * Get the rectangle for the item.
    */
-  isVisible = TAB_InternalGetItemRect(hwnd,
-				      infoPtr,
+  isVisible = TAB_InternalGetItemRect(infoPtr,
 				      infoPtr->uFocus,
 				      NULL,
 				      &selectedRect);
@@ -523,17 +494,11 @@
       TRACE("invalidate (%ld,%ld)-(%ld,%ld)\n",
 	    selectedRect.left,selectedRect.top,
 	    selectedRect.right,selectedRect.bottom);
-    InvalidateRect(hwnd, &selectedRect, TRUE);
[truncated at 1000 lines; 1503 more skipped]