Fix for sizes of caption bar items

William Poetra Yoga H williampoetra at yahoo.com
Mon Apr 18 08:28:50 CDT 2005


This fixes the sizes of caption bar items, namely the system menu button, the
spacing between the caption buttons, the sizes of the caption buttons with
respect to the size of the caption bar itself, and the spacing between the
caption bar and
the menu.

William Poetra Yoga Hadisoeseno


		
__________________________________ 
Do you Yahoo!? 
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
http://travel.yahoo.com/p-travelguide
-------------- next part --------------
Index: windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.141
diff -u -p -r1.141 nonclient.c
--- windows/nonclient.c	13 Apr 2005 16:13:45 -0000	1.141
+++ windows/nonclient.c	15 Apr 2005 04:37:28 -0000
@@ -691,21 +691,21 @@ static void NC_DrawCloseButton (HWND hwn
     /* A tool window has a smaller Close button */
     if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW)
     {
-        INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE   */
-        INT iBmpWidth = 11;  /* it uses 11x11 for  the close button in tool window */
-        INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION);
+        INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION) - 1;
+        INT iBmpHeight = iCaptionHeight - 4;
+        INT iBmpWidth = iCaptionHeight - 5;
 
-        rect.top = rect.top + (iCaptionHeight - 1 - iBmpHeight) / 2;
-        rect.left = rect.right - (iCaptionHeight + 1 + iBmpWidth) / 2;
+        rect.top += 2;
+        rect.right -= 2;
         rect.bottom = rect.top + iBmpHeight;
-        rect.right = rect.left + iBmpWidth;
+        rect.left = rect.right - iBmpWidth;
     }
     else
     {
-        rect.left = rect.right - GetSystemMetrics(SM_CXSIZE) - 1;
-        rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1;
         rect.top += 2;
         rect.right -= 2;
+        rect.bottom = rect.top + (GetSystemMetrics(SM_CYSIZE) - 4);
+        rect.left = rect.right - (GetSystemMetrics(SM_CXSIZE) - 2);
     }
     DrawFrameControl( hdc, &rect, DFC_CAPTION,
                       (DFCS_CAPTIONCLOSE |
@@ -731,12 +731,12 @@ static void NC_DrawMaxButton(HWND hwnd,H
     flags = IsZoomed(hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
 
     NC_GetInsideRect( hwnd, &rect );
-    if (GetWindowLongW( hwnd, GWL_STYLE) & WS_SYSMENU)
-        rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
-    rect.left = rect.right - GetSystemMetrics(SM_CXSIZE);
-    rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1;
     rect.top += 2;
+    if (GetWindowLongA( hwnd, GWL_STYLE) & WS_SYSMENU)
+        rect.right -= (GetSystemMetrics(SM_CXSIZE) - 2) + 2;
     rect.right -= 2;
+    rect.bottom = rect.top + (GetSystemMetrics(SM_CYSIZE) - 4);
+    rect.left = rect.right - (GetSystemMetrics(SM_CXSIZE) - 2);
     if (down) flags |= DFCS_PUSHED;
     if (bGrayed) flags |= DFCS_INACTIVE;
     DrawFrameControl( hdc, &rect, DFC_CAPTION, flags );
@@ -759,14 +759,14 @@ static void  NC_DrawMinButton(HWND hwnd,
         return;
 
     NC_GetInsideRect( hwnd, &rect );
+    rect.top += 2;
     if (style & WS_SYSMENU)
-        rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
+        rect.right -= (GetSystemMetrics(SM_CXSIZE) - 2) + 2;
+    rect.right -= 2;
     if (style & (WS_MAXIMIZEBOX|WS_MINIMIZEBOX))
         rect.right -= GetSystemMetrics(SM_CXSIZE) - 2;
-    rect.left = rect.right - GetSystemMetrics(SM_CXSIZE);
-    rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZE) - 1;
-    rect.top += 2;
-    rect.right -= 2;
+    rect.left = rect.right - (GetSystemMetrics(SM_CXSIZE) - 2);
+    rect.bottom = rect.top + (GetSystemMetrics(SM_CYSIZE) - 4);
     if (down) flags |= DFCS_PUSHED;
     if (bGrayed) flags |= DFCS_INACTIVE;
     DrawFrameControl( hdc, &rect, DFC_CAPTION, flags );
@@ -893,19 +893,23 @@ static void  NC_DrawCaption( HDC  hdc, R
 
 	/* Draw a grayed close button if disabled or if SC_CLOSE is not there */
 	NC_DrawCloseButton (hwnd, hdc, FALSE,
-			    (state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF));
-	r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
+			    ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
+	r.right -= (GetSystemMetrics(SM_CXSIZE) - 2) + 2;
 
 	if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX))
 	{
+            /* There's a 2-pixel space between Maximize and Close buttons */
+
+            r.right -= 2;
+
 	    /* In win95 the two buttons are always there */
 	    /* But if the menu item is not in the menu they're disabled*/
 
 	    NC_DrawMaxButton( hwnd, hdc, FALSE, (!(style & WS_MAXIMIZEBOX)));
-	    r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
+	    r.right -= GetSystemMetrics(SM_CXSIZE) - 2;
 
 	    NC_DrawMinButton( hwnd, hdc, FALSE,  (!(style & WS_MINIMIZEBOX)));
-	    r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
+	    r.right -= GetSystemMetrics(SM_CXSIZE) - 2;
 	}
     }
 
@@ -924,6 +928,7 @@ static void  NC_DrawCaption( HDC  hdc, R
 	else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) );
 	SetBkMode( hdc, TRANSPARENT );
 	r.left += 2;
+        r.right -= 2;
 	DrawTextW( hdc, buffer, -1, &r,
 		     DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT );
 	DeleteObject (SelectObject (hdc, hOldFont));
@@ -1025,7 +1030,7 @@ static void  NC_DoNCPaint( HWND  hwnd, H
 	TRACE("Calling DrawMenuBar with rect (%ld, %ld)-(%ld, %ld)\n",
               r.left, r.top, r.right, r.bottom);
 
-	rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1;
+	rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
     }
 
     TRACE("After MenuBar, rect is (%ld, %ld)-(%ld, %ld).\n",


More information about the wine-patches mailing list