diff --git a/reactos/dll/win32/user32/controls/button.c b/reactos/dll/win32/user32/controls/button.c index b746d3a2eba..5dd03c0aeda 100644 --- a/reactos/dll/win32/user32/controls/button.c +++ b/reactos/dll/win32/user32/controls/button.c @@ -860,8 +860,12 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action ) 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); diff --git a/reactos/dll/win32/user32/include/draw.h b/reactos/dll/win32/user32/include/draw.h index 313577d3d97..07163f5f6a2 100644 --- a/reactos/dll/win32/user32/include/draw.h +++ b/reactos/dll/win32/user32/include/draw.h @@ -1,2 +1 @@ -HPEN WINAPI GetSysColorPen (int nIndex); void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo); diff --git a/reactos/dll/win32/user32/include/user32p.h b/reactos/dll/win32/user32/include/user32p.h index 7c6ba9db253..f7195ff56c0 100644 --- a/reactos/dll/win32/user32/include/user32p.h +++ b/reactos/dll/win32/user32/include/user32p.h @@ -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 @@ extern PUSER_HANDLE_ENTRY gHandleEntries; 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 diff --git a/reactos/dll/win32/user32/windows/defwnd.c b/reactos/dll/win32/user32/windows/defwnd.c index 98648dd1180..8c41edfee22 100644 --- a/reactos/dll/win32/user32/windows/defwnd.c +++ b/reactos/dll/win32/user32/windows/defwnd.c @@ -70,21 +70,6 @@ GetSysColor(int nIndex) 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; -} - /* * @implemented */ diff --git a/reactos/dll/win32/user32/windows/draw.c b/reactos/dll/win32/user32/windows/draw.c index f6dd3f88ce7..d2d884ca907 100644 --- a/reactos/dll/win32/user32/windows/draw.c +++ b/reactos/dll/win32/user32/windows/draw.c @@ -120,7 +120,6 @@ static const signed char LTRBInnerFlat[] = { /* FUNCTIONS *****************************************************************/ -HPEN WINAPI GetSysColorPen(int nIndex); HBRUSH WINAPI GetSysColorBrush(int nIndex); /* Ported from WINE20020904 */ @@ -187,9 +186,9 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) } 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 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) 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 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) 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 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) 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 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) /* 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 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) 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 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) /* 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 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags) 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 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) 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 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) case DFCS_SCROLLLEFT: Symbol = '3'; break; - + case DFCS_SCROLLRIGHT: Symbol = '4'; break; @@ -918,20 +924,21 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) // 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 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) 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 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) 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 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) 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); diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index 253252afd14..979a492b168 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -659,7 +659,8 @@ MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc, 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 @@ MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc, 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 @@ MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND WndOwner, HDC Dc, /* 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 @@ DrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font) 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 @@ DrawMenuBar(HWND hWnd) 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 @@ GetMenuItemInfoA( RtlFreeHeap(GetProcessHeap(), 0, miiW.dwTypeData); mii->dwTypeData = AnsiBuffer; - + return TRUE; } diff --git a/reactos/dll/win32/user32/windows/nonclient.c b/reactos/dll/win32/user32/windows/nonclient.c index f2ef7b55757..6e209864d79 100644 --- a/reactos/dll/win32/user32/windows/nonclient.c +++ b/reactos/dll/win32/user32/windows/nonclient.c @@ -54,8 +54,6 @@ VOID 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 @@ DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active) 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));