Index: trunk/src/user32/uitools.cpp
===================================================================
--- trunk/src/user32/uitools.cpp	(revision 220)
+++ trunk/src/user32/uitools.cpp	(revision 221)
@@ -1,3 +1,3 @@
-/* $Id: uitools.cpp,v 1.2 1999-06-23 16:36:56 achimha Exp $ */
+/* $Id: uitools.cpp,v 1.3 1999-06-26 15:29:11 achimha Exp $ */
 /*
  * User Interface Functions
@@ -6,4 +6,5 @@
  * Copyright 1997 Bertho A. Stultiens
  * Copyright 1999 Achim Hasenmueller
+ * Copyright 1999 Christoph Bratschi
  */
 
@@ -100,6 +101,6 @@
  * See also comments with UITOOLS_DrawRectEdge()
  */
-static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc, 
-				     UINT uType, UINT uFlags)
+static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
+                                     UINT uType, UINT uFlags)
 {
     POINT Points[4];
@@ -119,9 +120,11 @@
             + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
 
+    if (IsRectEmpty(rc)) return retval; //nothing to do
+
     /* Init some vars */
     OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
     SavePen = (HPEN)SelectObject(hdc, InnerPen);
     spx = spy = epx = epy = 0; /* Satisfy the compiler... */
-    
+
     /* Determine the colors of the edges */
     if(uFlags & BF_MONO)
@@ -184,4 +187,6 @@
         epy = rc->bottom;
         spy = epy - SmallDiam;
+        epx++;
+        epy--;
         break;
 
@@ -193,4 +198,6 @@
         epy = rc->top-1;
         spy = epy + SmallDiam;
+        epx++;
+        epy++;
         break;
 
@@ -210,4 +217,6 @@
         spy = rc->bottom-1;
         epy = spy - SmallDiam;
+        epx--;
+        epy++;
         break;
     }
@@ -312,8 +321,8 @@
         HBRUSH hbsave;
         HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW
-					 :COLOR_BTNFACE);
+                                         :COLOR_BTNFACE);
         HPEN hpsave;
         HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW
-				     : COLOR_BTNFACE);
+                                     : COLOR_BTNFACE);
         hbsave = (HBRUSH)SelectObject(hdc, hb);
         hpsave = (HPEN)SelectObject(hdc, hp);
@@ -345,4 +354,9 @@
  *
  * 23-Nov-1997: Changed by Bertho Stultiens
+ * 25-June-1999: Changed by Christoph Bratschi
+ *
+ * Attention: only draw in the rect's range!
+ *   left to right-1
+ *   top to bottom-1
  *
  * Well, I started testing this and found out that there are a few things
@@ -413,6 +427,6 @@
 
 
-static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc, 
-				     UINT uType, UINT uFlags)
+static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
+                                     UINT uType, UINT uFlags)
 {
     char LTInnerI, LTOuterI;
@@ -430,5 +444,7 @@
                        || (uType & BDR_OUTER) == BDR_OUTER)
                       && !(uFlags & (BF_FLAT|BF_MONO)) );
-        
+
+    if  (IsRectEmpty(rc)) return retval; //nothing to do
+
     /* Init some vars */
     LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
@@ -473,6 +489,6 @@
     if((uFlags & BF_MIDDLE) && retval)
     {
-        FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ? 
-					    COLOR_WINDOW : COLOR_BTNFACE));
+        FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
+                                            COLOR_WINDOW : COLOR_BTNFACE));
     }
 
@@ -484,21 +500,22 @@
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
-        LineTo(hdc, InnerRect.right, InnerRect.top);
+        LineTo(hdc, InnerRect.right-1, InnerRect.top);
     }
     if(uFlags & BF_LEFT)
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
-        LineTo(hdc, InnerRect.left, InnerRect.bottom);
-    }
+        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
+    }
+
     SelectObject(hdc, RBOuterPen);
     if(uFlags & BF_BOTTOM)
     {
         MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
-        LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1);
+        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
     }
     if(uFlags & BF_RIGHT)
     {
         MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
-        LineTo(hdc, InnerRect.right-1, InnerRect.top-1);
+        LineTo(hdc, InnerRect.right-1, InnerRect.top);
     }
 
@@ -508,10 +525,10 @@
     {
         MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
-        LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
+        LineTo(hdc, InnerRect.right-RTpenplus-1, InnerRect.top+1);
     }
     if(uFlags & BF_LEFT)
     {
         MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
-        LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
+        LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus-1);
     }
     SelectObject(hdc, RBInnerPen);
@@ -519,10 +536,10 @@
     {
         MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL);
-        LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2);
+        LineTo(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2);
     }
     if(uFlags & BF_RIGHT)
     {
         MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL);
-        LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus);
+        LineTo(hdc, InnerRect.right-2, InnerRect.top+RTpenplus);
     }
 
@@ -551,5 +568,5 @@
 {
 
-    if(flags & BF_DIAGONAL)
+    if (flags & BF_DIAGONAL)
       return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
     else
@@ -558,5 +575,5 @@
 
 /************************************************************************
- *	UITOOLS_MakeSquareRect
+ *      UITOOLS_MakeSquareRect
  *
  * Utility to create a square rectangle and returning the width
@@ -587,5 +604,5 @@
 
 /************************************************************************
- *	UITOOLS_DFC_ButtonPush
+ *      UITOOLS_DFC_ButtonPush
  *
  * Draw a push button coming from DrawFrameControl()
@@ -657,5 +674,5 @@
 
 /************************************************************************
- *	UITOOLS_DFC_ButtonChcek
+ *      UITOOLS_DFC_ButtonChcek
  *
  * Draw a check/3state button coming from DrawFrameControl()
@@ -767,5 +784,5 @@
 
 /************************************************************************
- *	UITOOLS_DFC_ButtonRadio
+ *      UITOOLS_DFC_ButtonRadio
  *
  * Draw a radio/radioimage/radiomask button coming from DrawFrameControl()
@@ -1340,5 +1357,5 @@
     if(GetMapMode(hdc) != MM_TEXT)
         return FALSE;
-        
+
     switch(uType)
     {
@@ -1353,5 +1370,5 @@
 //    default:
 //      WARN("(%x,%p,%d,%x), bad type!\n",
-//	   hdc,rc,uType,uState );
+//         hdc,rc,uType,uState );
     }
     return FALSE;
