[ros-diffs] [tkreuzer] 41678: Get rid of the SysColorPen stuff in user32, it's a wine concept. Use DC pen instead.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Jun 29 04:49:58 CEST 2009


Author: tkreuzer
Date: Mon Jun 29 06:49:57 2009
New Revision: 41678

URL: http://svn.reactos.org/svn/reactos?rev=41678&view=rev
Log:
Get rid of the SysColorPen stuff in user32, it's a wine concept. Use DC pen instead.

Modified:
    trunk/reactos/dll/win32/user32/controls/button.c
    trunk/reactos/dll/win32/user32/include/draw.h
    trunk/reactos/dll/win32/user32/include/user32p.h
    trunk/reactos/dll/win32/user32/windows/defwnd.c
    trunk/reactos/dll/win32/user32/windows/draw.c
    trunk/reactos/dll/win32/user32/windows/menu.c
    trunk/reactos/dll/win32/user32/windows/nonclient.c

Modified: trunk/reactos/dll/win32/user32/controls/button.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/button.c?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/button.c [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -860,8 +860,12 @@
     SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
 
     setup_clipping( hwnd, hDC );
-
+#ifdef __REACTOS__
+    hOldPen = SelectObject(hDC, GetStockObject(DC_PEN));
+    SetDCPenColor(hDC, GetSysColor(COLOR_WINDOWFRAME));
+#else
     hOldPen = SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
+#endif
     hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
     oldBkMode = SetBkMode(hDC, TRANSPARENT);
 

Modified: trunk/reactos/dll/win32/user32/include/draw.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/draw.h?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/include/draw.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/draw.h [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -1,2 +1,1 @@
-HPEN WINAPI GetSysColorPen (int nIndex);
 void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);

Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/user32p.h?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -64,9 +64,6 @@
 #define NtUserGetSysColorBrushes(HBrushes, count) \
   (BOOL)NtUserCallTwoParam((DWORD)(HBrushes), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
 
-#define NtUserGetSysColorPens(HPens, count) \
-  (BOOL)NtUserCallTwoParam((DWORD)(HPens), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORPENS)
-
 #define NtUserGetSysColors(ColorRefs, count) \
   (BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
 
@@ -229,7 +226,6 @@
 PUSER_HANDLE_ENTRY FASTCALL GetUser32Handle(HANDLE);
 PVOID FASTCALL ValidateHandle(HANDLE, UINT);
 
-#define SYSCOLOR_GetPen(index) GetSysColorPen(index)
 #define WIN_GetFullHandle(h) ((HWND)(h))
 
 #ifndef __ms_va_list

Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/defwnd.c?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -68,21 +68,6 @@
 
   SetLastError(ERROR_INVALID_PARAMETER);
   return 0;
-}
-
-/*
- * @implemented
- */
-HPEN WINAPI
-GetSysColorPen(int nIndex)
-{
-  if(nIndex >= 0 && nIndex < NUM_SYSCOLORS)
-  {
-    return g_psi->SysColorPens[nIndex];
-  }
-
-  SetLastError(ERROR_INVALID_PARAMETER);
-  return NULL;
 }
 
 /*

Modified: trunk/reactos/dll/win32/user32/windows/draw.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/draw.c?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -120,7 +120,6 @@
 /* FUNCTIONS *****************************************************************/
 
 
-HPEN WINAPI GetSysColorPen(int nIndex);
 HBRUSH WINAPI GetSysColorBrush(int nIndex);
 
 /* Ported from WINE20020904 */
@@ -187,9 +186,9 @@
     }
 
     if(InnerI != -1)
-        InnerPen = GetSysColorPen(InnerI);
+        InnerPen = GetStockObject(DC_PEN);
     if(OuterI != -1)
-        OuterPen = GetSysColorPen(OuterI);
+        OuterPen = GetStockObject(DC_PEN);
 
     MoveToEx(hdc, 0, 0, &SavePoint);
 
@@ -241,9 +240,11 @@
 
     MoveToEx(hdc, spx, spy, NULL);
     SelectObject(hdc, OuterPen);
+    SetDCPenColor(hdc, GetSysColor(OuterI));
     LineTo(hdc, epx, epy);
 
     SelectObject(hdc, InnerPen);
+    SetDCPenColor(hdc, GetSysColor(InnerI));
 
     switch(uFlags & (BF_RECT|BF_DIAGONAL))
     {
@@ -337,11 +338,11 @@
     if((uFlags & BF_MIDDLE) && retval)
     {
         HBRUSH hbsave;
-        HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW : COLOR_BTNFACE);
         HPEN hpsave;
-        HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW : COLOR_BTNFACE);
-        hbsave = (HBRUSH)SelectObject(hdc, hb);
-        hpsave = (HPEN)SelectObject(hdc, hp);
+        hbsave = (HBRUSH)SelectObject(hdc, GetStockObject(DC_BRUSH));
+        hpsave = (HPEN)SelectObject(hdc, GetStockObject(DC_PEN));
+        SetDCBrushColor(hdc, GetSysColor(uFlags & BF_MONO ? COLOR_WINDOW : COLOR_BTNFACE));
+        SetDCPenColor(hdc, GetSysColor(uFlags & BF_MONO ? COLOR_WINDOW : COLOR_BTNFACE));
         Polygon(hdc, Points, 4);
         SelectObject(hdc, hbsave);
         SelectObject(hdc, hpsave);
@@ -503,13 +504,13 @@
         LTpenplus = 1;
 
     if(LTInnerI != -1)
-        LTInnerPen = GetSysColorPen(LTInnerI);
+        LTInnerPen = GetStockObject(DC_PEN);
     if(LTOuterI != -1)
-        LTOuterPen = GetSysColorPen(LTOuterI);
+        LTOuterPen = GetStockObject(DC_PEN);
     if(RBInnerI != -1)
-        RBInnerPen = GetSysColorPen(RBInnerI);
+        RBInnerPen = GetStockObject(DC_PEN);
     if(RBOuterI != -1)
-        RBOuterPen = GetSysColorPen(RBOuterI);
+        RBOuterPen = GetStockObject(DC_PEN);
     if((uFlags & BF_MIDDLE) && retval)
     {
         FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
@@ -519,6 +520,7 @@
 
     /* Draw the outer edge */
     SelectObject(hdc, LTOuterPen);
+    SetDCPenColor(hdc, GetSysColor(LTOuterI));
     if(uFlags & BF_TOP)
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
@@ -530,6 +532,7 @@
         LineTo(hdc, InnerRect.left, InnerRect.bottom);
     }
     SelectObject(hdc, RBOuterPen);
+    SetDCPenColor(hdc, GetSysColor(RBOuterI));
     if(uFlags & BF_BOTTOM)
     {
         MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
@@ -543,6 +546,7 @@
 
     /* Draw the inner edge */
     SelectObject(hdc, LTInnerPen);
+    SetDCPenColor(hdc, GetSysColor(LTInnerI));
     if(uFlags & BF_TOP)
     {
         MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
@@ -554,6 +558,7 @@
         LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
     }
     SelectObject(hdc, RBInnerPen);
+    SetDCPenColor(hdc, GetSysColor(RBInnerI));
     if(uFlags & BF_BOTTOM)
     {
         MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
@@ -891,8 +896,9 @@
     POINT Line[4];
     int SmallDiam = UITOOLS_MakeSquareRect(r, &myr) - 2;
     int i;
-    HBRUSH hbsave, hb, hb2;
-    HPEN hpsave, hp, hp2;
+    HBRUSH hbsave;
+    HPEN hpsave;
+    COLORREF crPen1, crPen2, crBrush1, crBrush2;
     int d46, d93;
     // end scrollgripsize
     switch(uFlags & 0xff)
@@ -909,7 +915,7 @@
 	case DFCS_SCROLLLEFT:
 		Symbol = '3';
 		break;
-        
+
 	case DFCS_SCROLLRIGHT:
 		Symbol = '4';
 		break;
@@ -918,20 +924,21 @@
 	    // FIXME: needs to use marlett too, copied for compatibility only
             /* This one breaks the flow... */
             IntDrawRectEdge(dc, r, EDGE_BUMP, BF_MIDDLE | ((uFlags&(DFCS_MONO|DFCS_FLAT)) ? BF_MONO : 0));
-            hpsave = (HPEN)SelectObject(dc, GetStockObject(NULL_PEN));
-            hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
+            hpsave = (HPEN)SelectObject(dc, GetStockObject(DC_PEN));
+            hbsave = (HBRUSH)SelectObject(dc, GetStockObject(DC_BRUSH));
             if(uFlags & (DFCS_MONO|DFCS_FLAT))
             {
-                hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME);
-                hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME);
+                crPen1 = crPen2 = GetSysColor(COLOR_WINDOWFRAME);
+                crBrush1 = crBrush2 = GetSysColor(COLOR_WINDOWFRAME);
             }
             else
             {
-                hp  = GetSysColorPen(COLOR_BTNHIGHLIGHT);
-                hp2 = GetSysColorPen(COLOR_BTNSHADOW);
-                hb  = GetSysColorBrush(COLOR_BTNHIGHLIGHT);
-                hb2 = GetSysColorBrush(COLOR_BTNSHADOW);
+                crPen1 = GetSysColor(COLOR_BTNHIGHLIGHT);
+                crPen2 = GetSysColor(COLOR_BTNSHADOW);
+                crBrush1 = GetSysColor(COLOR_BTNHIGHLIGHT);
+                crBrush2 = GetSysColor(COLOR_BTNSHADOW);
             }
+
             Line[0].x = Line[1].x = r->right-1;
             Line[2].y = Line[3].y = r->bottom-1;
             d46 = 46*SmallDiam/750;
@@ -942,15 +949,15 @@
             Line[3].x = r->right - i - 1;
             Line[1].y = Line[0].y + d46;
             Line[2].x = Line[3].x + d46;
-            SelectObject(dc, hb);
-            SelectObject(dc, hp);
+            SetDCBrushColor(dc, crBrush1);
+            SetDCPenColor(dc, crPen1);
             Polygon(dc, Line, 4);
 
             Line[1].y++; Line[2].x++;
             Line[0].y = Line[1].y + d93;
             Line[3].x = Line[2].x + d93;
-            SelectObject(dc, hb2);
-            SelectObject(dc, hp2);
+            SetDCBrushColor(dc, crBrush2);
+            SetDCPenColor(dc, crPen2);
             Polygon(dc, Line, 4);
 
             i = 398*SmallDiam/750;
@@ -958,15 +965,15 @@
             Line[3].x = r->right - i - 1;
             Line[1].y = Line[0].y + d46;
             Line[2].x = Line[3].x + d46;
-            SelectObject(dc, hb);
-            SelectObject(dc, hp);
+            SetDCBrushColor(dc, crBrush1);
+            SetDCPenColor(dc, crPen1);
             Polygon(dc, Line, 4);
 
             Line[1].y++; Line[2].x++;
             Line[0].y = Line[1].y + d93;
             Line[3].x = Line[2].x + d93;
-            SelectObject(dc, hb2);
-            SelectObject(dc, hp2);
+            SetDCBrushColor(dc, crBrush2);
+            SetDCPenColor(dc, crPen2);
             Polygon(dc, Line, 4);
 
             i = 210*SmallDiam/750;
@@ -974,15 +981,15 @@
             Line[3].x = r->right - i - 1;
             Line[1].y = Line[0].y + d46;
             Line[2].x = Line[3].x + d46;
-            SelectObject(dc, hb);
-            SelectObject(dc, hp);
+            SetDCBrushColor(dc, crBrush1);
+            SetDCPenColor(dc, crPen1);
             Polygon(dc, Line, 4);
 
             Line[1].y++; Line[2].x++;
             Line[0].y = Line[1].y + d93;
             Line[3].x = Line[2].x + d93;
-            SelectObject(dc, hb2);
-            SelectObject(dc, hp2);
+            SetDCBrushColor(dc, crBrush2);
+            SetDCPenColor(dc, crPen2);
             Polygon(dc, Line, 4);
 
             SelectObject(dc, hpsave);

Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/menu.c?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -659,7 +659,8 @@
     rc.bottom = Height - 3;
     if (flat_menu)
     {
-       oldPen = SelectObject( Dc, GetSysColorPen(COLOR_BTNSHADOW) );
+       oldPen = SelectObject( Dc, GetStockObject(DC_PEN) );
+       SetDCPenColor(Dc, GetSysColor(COLOR_BTNSHADOW));
        MoveToEx( Dc, rc.left, rc.top, NULL );
        LineTo( Dc, rc.left, rc.bottom );
        SelectObject( Dc, oldPen );
@@ -678,7 +679,8 @@
     rc.top += SEPARATOR_HEIGHT / 2;
     if (flat_menu)
     {
-       oldPen = SelectObject( Dc, GetSysColorPen(COLOR_BTNSHADOW) );
+       oldPen = SelectObject( Dc, GetStockObject(DC_PEN) );
+       SetDCPenColor(Dc, GetSysColor(COLOR_BTNSHADOW));
        MoveToEx( Dc, rc.left, rc.top, NULL );
        LineTo( Dc, rc.right, rc.top );
        SelectObject( Dc, oldPen );
@@ -692,7 +694,8 @@
   /* helper lines for debugging */
   /* This is a very good test tool when hacking menus! (JT) 07/16/2006 */
   FrameRect(Dc, &Rect, GetStockObject(BLACK_BRUSH));
-  SelectObject(Dc, GetSysColorPen(COLOR_WINDOWFRAME));
+  SelectObject(Dc, GetStockObject(DC_PEN));
+  SetDCPenColor(Dc, GetSysColor(COLOR_WINDOWFRAME));
   MoveToEx(Dc, Rect.left, (Rect.top + Rect.bottom) / 2, NULL);
   LineTo(Dc, Rect.right, (Rect.top + Rect.bottom) / 2);
 #endif
@@ -1639,7 +1642,8 @@
 
   FillRect(DC, Rect, GetSysColorBrush(flat_menu ? COLOR_MENUBAR : COLOR_MENU));
 
-  SelectObject(DC, GetSysColorPen(COLOR_3DFACE));
+  SelectObject(DC, GetStockObject(DC_PEN));
+  SetDCPenColor(DC, GetSysColor(COLOR_3DFACE));
   MoveToEx(DC, Rect->left, Rect->bottom, NULL);
   LineTo(DC, Rect->right, Rect->bottom);
 
@@ -4010,7 +4014,7 @@
   MenuInfo.Height = 0; // make sure to recalc size
   MenuSetRosMenuInfo(&MenuInfo);
   /* The wine method doesn't work and I suspect it's more effort
-     then hackfix solution 
+     then hackfix solution
   SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
                   SWP_NOZORDER | SWP_FRAMECHANGED );
   return TRUE;*/
@@ -4224,7 +4228,7 @@
 
    RtlFreeHeap(GetProcessHeap(), 0, miiW.dwTypeData);
    mii->dwTypeData = AnsiBuffer;
- 
+
    return TRUE;
 }
 

Modified: trunk/reactos/dll/win32/user32/windows/nonclient.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/nonclient.c?rev=41678&r1=41677&r2=41678&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/nonclient.c [iso-8859-1] Mon Jun 29 06:49:57 2009
@@ -54,8 +54,6 @@
 IntDrawScrollBar(HWND hWnd, HDC hDC, INT nBar);
 DWORD
 IntScrollHitTest(HWND hWnd, INT nBar, POINT pt, BOOL bDragging);
-HPEN WINAPI
-GetSysColorPen(int nIndex);
 
 BOOL WINAPI GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
 
@@ -432,7 +430,8 @@
       if(!(Style & WS_MINIMIZE))
       {
         /* Line under caption */
-        PreviousPen = SelectObject(hDC, GetSysColorPen(
+        PreviousPen = SelectObject(hDC, GetStockObject(DC_PEN));
+        SetDCPenColor(hDC, GetSysColor(
            ((ExStyle & (WS_EX_STATICEDGE | WS_EX_CLIENTEDGE |
                         WS_EX_DLGMODALFRAME)) == WS_EX_STATICEDGE) ?
            COLOR_WINDOWFRAME : COLOR_3DFACE));



More information about the Ros-diffs mailing list