status: cleanups

Dimitrie O. Paun dpaun at rogers.com
Wed Oct 27 00:00:03 CDT 2004


ChangeLog
    Rename STATUSWINDOWINFO to STATUS_INFO, for consistency with 
    other controls. Fix some prototypes. Always pass infoPtr around.


Index: dlls/comctl32/status.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/status.c,v
retrieving revision 1.66
diff -u -r1.66 status.c
--- dlls/comctl32/status.c	14 Sep 2004 00:45:26 -0000	1.66
+++ dlls/comctl32/status.c	27 Oct 2004 04:59:22 -0000
@@ -79,7 +79,7 @@
     BOOL              NtfUnicode;	/* notify format */
     STATUSWINDOWPART  part0;		/* simple window */
     STATUSWINDOWPART* parts;
-} STATUSWINDOWINFO;
+} STATUS_INFO;
 
 /*
  * Run tests using Waite Group Windows95 API Bible Vol. 1&2
@@ -91,11 +91,9 @@
 #define VERT_BORDER 2
 #define HORZ_GAP    2
 
-#define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongPtrW (hwnd, 0))
-
 /* prototype */
 static void
-STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr);
+STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr);
 
 static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW)
 {
@@ -148,7 +146,7 @@
 
 
 static void
-STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID)
+STATUSBAR_DrawPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
 {
     RECT r = part->bound;
     UINT border = BDR_SUNKENOUTER;
@@ -189,7 +187,7 @@
 
 
 static void
-STATUSBAR_RefreshPart (const STATUSWINDOWINFO *infoPtr, const STATUSWINDOWPART *part, HDC hdc, int itemID)
+STATUSBAR_RefreshPart (STATUS_INFO *infoPtr, HDC hdc, STATUSWINDOWPART *part, int itemID)
 {
     HBRUSH hbrBk;
     HFONT  hOldFont;
@@ -208,7 +206,7 @@
 
     hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
 
-	STATUSBAR_DrawPart (hdc, part, infoPtr, itemID);
+	STATUSBAR_DrawPart (infoPtr, hdc, part, itemID);
 
     SelectObject (hdc, hOldFont);
 
@@ -226,7 +224,7 @@
 
 
 static LRESULT
-STATUSBAR_Refresh (STATUSWINDOWINFO *infoPtr, HDC hdc)
+STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc)
 {
     int      i;
     RECT   rect;
@@ -250,10 +248,10 @@
     hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
 
     if (infoPtr->simple) {
-	    STATUSBAR_RefreshPart (infoPtr, &infoPtr->part0, hdc, 0);
+	    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->part0, 0);
     } else {
 	    for (i = 0; i < infoPtr->numParts; i++) {
-		    STATUSBAR_RefreshPart (infoPtr, &infoPtr->parts[i], hdc, i);
+		    STATUSBAR_RefreshPart (infoPtr, hdc, &infoPtr->parts[i], i);
 	    }
     }
 
@@ -270,7 +268,7 @@
 
 
 static void
-STATUSBAR_SetPartBounds (STATUSWINDOWINFO *infoPtr)
+STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
 {
     STATUSWINDOWPART *part;
     RECT rect, *r;
@@ -315,7 +313,7 @@
 
 
 static LRESULT
-STATUSBAR_Relay2Tip (STATUSWINDOWINFO *infoPtr, UINT uMsg,
+STATUSBAR_Relay2Tip (STATUS_INFO *infoPtr, UINT uMsg,
 		     WPARAM wParam, LPARAM lParam)
 {
     MSG msg;
@@ -345,7 +343,7 @@
 
 
 static HICON
-STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
+STATUSBAR_GetIcon (STATUS_INFO *infoPtr, INT nPart)
 {
     TRACE("%d\n", nPart);
     /* MSDN says: "simple parts are indexed with -1" */
@@ -360,7 +358,7 @@
 
 
 static INT
-STATUSBAR_GetParts (STATUSWINDOWINFO *infoPtr, INT num_parts, INT parts[])
+STATUSBAR_GetParts (STATUS_INFO *infoPtr, INT num_parts, INT parts[])
 {
     INT   i;
 
@@ -375,7 +373,7 @@
 
 
 static BOOL
-STATUSBAR_GetRect (STATUSWINDOWINFO *infoPtr, INT nPart, LPRECT rect)
+STATUSBAR_GetRect (STATUS_INFO *infoPtr, INT nPart, LPRECT rect)
 {
     TRACE("part %d\n", nPart);
     if (infoPtr->simple)
@@ -387,7 +385,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
+STATUSBAR_GetTextA (STATUS_INFO *infoPtr, INT nPart, LPSTR buf)
 {
     STATUSWINDOWPART *part;
     LRESULT result;
@@ -416,7 +414,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextW (STATUSWINDOWINFO *infoPtr, INT nPart, LPWSTR buf)
+STATUSBAR_GetTextW (STATUS_INFO *infoPtr, INT nPart, LPWSTR buf)
 {
     STATUSWINDOWPART *part;
     LRESULT result;
@@ -442,7 +440,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTextLength (STATUSWINDOWINFO *infoPtr, INT nPart)
+STATUSBAR_GetTextLength (STATUS_INFO *infoPtr, INT nPart)
 {
     STATUSWINDOWPART *part;
     DWORD result;
@@ -467,7 +465,7 @@
 }
 
 static LRESULT
-STATUSBAR_GetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR tip, INT size)
+STATUSBAR_GetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -489,7 +487,7 @@
 
 
 static LRESULT
-STATUSBAR_GetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR tip, INT size)
+STATUSBAR_GetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR tip, INT size)
 {
     TRACE("\n");
     if (tip) {
@@ -512,7 +510,7 @@
 
 
 static COLORREF
-STATUSBAR_SetBkColor (STATUSWINDOWINFO *infoPtr, COLORREF color)
+STATUSBAR_SetBkColor (STATUS_INFO *infoPtr, COLORREF color)
 {
     COLORREF oldBkColor;
 
@@ -526,7 +524,7 @@
 
 
 static BOOL
-STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
+STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon)
 {
     if ((nPart < -1) || (nPart >= infoPtr->numParts))
 	return FALSE;
@@ -553,7 +551,7 @@
 
 
 static BOOL
-STATUSBAR_SetMinHeight (STATUSWINDOWINFO *infoPtr, INT height)
+STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height)
 {
 
     TRACE("(height=%d)\n", height);
@@ -577,7 +575,7 @@
 
 
 static BOOL
-STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
+STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
 {
     STATUSWINDOWPART *tmp;
     int	i, oldNumParts;
@@ -647,7 +645,7 @@
 
 
 static BOOL
-STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
+STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
 		    LPCWSTR text, BOOL isW)
 {
     STATUSWINDOWPART *part=NULL;
@@ -715,7 +713,7 @@
 
 
 static LRESULT
-STATUSBAR_SetTipTextA (STATUSWINDOWINFO *infoPtr, INT id, LPSTR text)
+STATUSBAR_SetTipTextA (STATUS_INFO *infoPtr, INT id, LPSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, text);
     if (infoPtr->hwndToolTip) {
@@ -734,7 +732,7 @@
 
 
 static LRESULT
-STATUSBAR_SetTipTextW (STATUSWINDOWINFO *infoPtr, INT id, LPWSTR text)
+STATUSBAR_SetTipTextW (STATUS_INFO *infoPtr, INT id, LPWSTR text)
 {
     TRACE("part %d: \"%s\"\n", id, debugstr_w(text));
     if (infoPtr->hwndToolTip) {
@@ -753,7 +751,7 @@
 
 
 inline static LRESULT
-STATUSBAR_SetUnicodeFormat (STATUSWINDOWINFO *infoPtr, BOOL bUnicode)
+STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
 {
     BOOL bOld = infoPtr->bUnicode;
 
@@ -765,7 +763,7 @@
 
 
 static BOOL
-STATUSBAR_Simple (STATUSWINDOWINFO *infoPtr, BOOL simple)
+STATUSBAR_Simple (STATUS_INFO *infoPtr, BOOL simple)
 {
     NMHDR  nmhdr;
 
@@ -786,7 +784,7 @@
 
 
 static LRESULT
-STATUSBAR_WMDestroy (STATUSWINDOWINFO *infoPtr)
+STATUSBAR_WMDestroy (STATUS_INFO *infoPtr)
 {
     int	i;
 
@@ -816,7 +814,7 @@
 static LRESULT
 STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
 {
-    STATUSWINDOWINFO *infoPtr;
+    STATUS_INFO *infoPtr;
     NONCLIENTMETRICSW nclm;
     DWORD dwStyle;
     RECT rect;
@@ -824,7 +822,7 @@
     HDC	hdc;
 
     TRACE("\n");
-    infoPtr = (STATUSWINDOWINFO*)Alloc (sizeof(STATUSWINDOWINFO));
+    infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
     if (!infoPtr) goto create_fail;
     SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
 
@@ -944,7 +942,7 @@
 /* in contrast to SB_GETTEXT*, WM_GETTEXT handles the text
  * of the first part only (usual behaviour) */
 static INT
-STATUSBAR_WMGetText (STATUSWINDOWINFO *infoPtr, INT size, LPWSTR buf)
+STATUSBAR_WMGetText (STATUS_INFO *infoPtr, INT size, LPWSTR buf)
 {
     INT len;
 
@@ -970,7 +968,7 @@
 
 
 static BOOL
-STATUSBAR_WMNCHitTest (STATUSWINDOWINFO *infoPtr, INT x, INT y)
+STATUSBAR_WMNCHitTest (STATUS_INFO *infoPtr, INT x, INT y)
 {
     if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) {
 	RECT  rect;
@@ -994,7 +992,7 @@
 
 
 static LRESULT
-STATUSBAR_WMPaint (STATUSWINDOWINFO *infoPtr, HDC hdc)
+STATUSBAR_WMPaint (STATUS_INFO *infoPtr, HDC hdc)
 {
     PAINTSTRUCT ps;
 
@@ -1009,7 +1007,7 @@
 
 
 static LRESULT
-STATUSBAR_WMSetFont (STATUSWINDOWINFO *infoPtr, HFONT font, BOOL redraw)
+STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw)
 {
     infoPtr->hFont = font;
     TRACE("%p\n", infoPtr->hFont);
@@ -1021,7 +1019,7 @@
 
 
 static BOOL
-STATUSBAR_WMSetText (STATUSWINDOWINFO *infoPtr, LPCSTR text)
+STATUSBAR_WMSetText (STATUS_INFO *infoPtr, LPCSTR text)
 {
     STATUSWINDOWPART *part;
     int len;
@@ -1058,7 +1056,7 @@
 
 
 static BOOL
-STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
+STATUSBAR_WMSize (STATUS_INFO *infoPtr, WORD flags)
 {
     INT  width, x, y;
     RECT parent_rect;
@@ -1088,7 +1086,7 @@
 
 
 static LRESULT
-STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
+STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
 {
     if (cmd == NF_REQUERY) {
 	INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY);
@@ -1099,14 +1097,13 @@
 
 
 static LRESULT
-STATUSBAR_SendNotify (HWND hwnd, UINT code)
+STATUSBAR_SendNotify (STATUS_INFO *infoPtr, UINT code)
 {
-    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
     NMHDR  nmhdr;
 
     TRACE("code %04x\n", code);
-    nmhdr.hwndFrom = hwnd;
-    nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
+    nmhdr.hwndFrom = infoPtr->Self;
+    nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
     nmhdr.code = code;
     SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr);
     return 0;
@@ -1117,7 +1114,7 @@
 static LRESULT WINAPI
 StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr(hwnd);
+    STATUS_INFO *infoPtr = (STATUS_INFO *)GetWindowLongPtrW (hwnd, 0);
     INT nPart = ((INT) wParam) & 0x00ff;
     LRESULT res;
 
@@ -1206,10 +1203,10 @@
 	    return STATUSBAR_GetTextLength (infoPtr, 0);
 
 	case WM_LBUTTONDBLCLK:
-            return STATUSBAR_SendNotify (hwnd, NM_DBLCLK);
+            return STATUSBAR_SendNotify (infoPtr, NM_DBLCLK);
 
 	case WM_LBUTTONUP:
-	    return STATUSBAR_SendNotify (hwnd, NM_CLICK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_CLICK);
 
 	case WM_MOUSEMOVE:
 	    return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
@@ -1232,10 +1229,10 @@
 	    return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
 
 	case WM_RBUTTONDBLCLK:
-	    return STATUSBAR_SendNotify (hwnd, NM_RDBLCLK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_RDBLCLK);
 
 	case WM_RBUTTONUP:
-	    return STATUSBAR_SendNotify (hwnd, NM_RCLICK);
+	    return STATUSBAR_SendNotify (infoPtr, NM_RCLICK);
 
 	case WM_SETFONT:
 	    return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
@@ -1272,7 +1269,7 @@
     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW;
     wndClass.lpfnWndProc   = StatusWindowProc;
     wndClass.cbClsExtra    = 0;
-    wndClass.cbWndExtra    = sizeof(STATUSWINDOWINFO *);
+    wndClass.cbWndExtra    = sizeof(STATUS_INFO *);
     wndClass.hCursor       = LoadCursorW (0, (LPWSTR)IDC_ARROW);
     wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
     wndClass.lpszClassName = STATUSCLASSNAMEW;



More information about the wine-patches mailing list