Author: tkreuzer Date: Thu Nov 8 03:36:15 2007 New Revision: 30255
URL: http://svn.reactos.org/svn/reactos?rev=30255&view=rev Log: clean up indentation, no code change
Modified: trunk/reactos/dll/win32/user32/windows/draw.c
Modified: trunk/reactos/dll/win32/user32/windows/draw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/dr... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/draw.c (original) +++ trunk/reactos/dll/win32/user32/windows/draw.c Thu Nov 8 03:36:15 2007 @@ -34,7 +34,7 @@
/* GLOBALS *******************************************************************/
-#define DSS_DEFAULT 0x0040 /* Make it bold */ +#define DSS_DEFAULT 0x0040 /* Make it bold */
static const WORD wPattern_AA55[8] = { 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555 }; @@ -44,76 +44,76 @@ * UITOOLS_DrawRectEdge() */ static const signed char LTInnerNormal[] = { - -1, -1, -1, -1, - -1, COLOR_BTNHIGHLIGHT, COLOR_BTNHIGHLIGHT, -1, - -1, COLOR_3DDKSHADOW, COLOR_3DDKSHADOW, -1, - -1, -1, -1, -1 + -1, -1, -1, -1, + -1, COLOR_BTNHIGHLIGHT, COLOR_BTNHIGHLIGHT, -1, + -1, COLOR_3DDKSHADOW, COLOR_3DDKSHADOW, -1, + -1, -1, -1, -1 };
static const signed char LTOuterNormal[] = { - -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, - COLOR_BTNHIGHLIGHT, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, - COLOR_3DDKSHADOW, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, - -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1 + -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, + COLOR_BTNHIGHLIGHT, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, + COLOR_3DDKSHADOW, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1, + -1, COLOR_3DLIGHT, COLOR_BTNSHADOW, -1 };
static const signed char RBInnerNormal[] = { - -1, -1, -1, -1, - -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1, - -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1, - -1, -1, -1, -1 + -1, -1, -1, -1, + -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1, + -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1, + -1, -1, -1, -1 };
static const signed char RBOuterNormal[] = { - -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, - COLOR_BTNSHADOW, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, - COLOR_3DLIGHT, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, - -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1 + -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, + COLOR_BTNSHADOW, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, + COLOR_3DLIGHT, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1, + -1, COLOR_3DDKSHADOW, COLOR_BTNHIGHLIGHT, -1 };
static const signed char LTInnerSoft[] = { - -1, -1, -1, -1, - -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1, - -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1, - -1, -1, -1, -1 + -1, -1, -1, -1, + -1, COLOR_3DLIGHT, COLOR_3DLIGHT, -1, + -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, -1, + -1, -1, -1, -1 };
static const signed char LTOuterSoft[] = { - -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, - COLOR_3DLIGHT, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, - COLOR_BTNSHADOW, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, - -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1 + -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, + COLOR_3DLIGHT, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, + COLOR_BTNSHADOW, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1, + -1, COLOR_BTNHIGHLIGHT, COLOR_3DDKSHADOW, -1 };
#define RBInnerSoft RBInnerNormal /* These are the same */ #define RBOuterSoft RBOuterNormal
static const signed char LTRBOuterMono[] = { - -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, - COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, - COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, - COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, + -1, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, + COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, + COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, + COLOR_WINDOW, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, COLOR_WINDOWFRAME, };
static const signed char LTRBInnerMono[] = { - -1, -1, -1, -1, - -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, - -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, - -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, + -1, -1, -1, -1, + -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, + -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, + -1, COLOR_WINDOW, COLOR_WINDOW, COLOR_WINDOW, };
static const signed char LTRBOuterFlat[] = { - -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, - COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, - COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, - COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, + -1, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, + COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, + COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, + COLOR_BTNFACE, COLOR_BTNSHADOW, COLOR_BTNSHADOW, COLOR_BTNSHADOW, };
static const signed char LTRBInnerFlat[] = { - -1, -1, -1, -1, - -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, - -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, - -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, + -1, -1, -1, -1, + -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, + -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, + -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, }; /* FUNCTIONS *****************************************************************/
@@ -136,10 +136,10 @@ int Height= rc->bottom - rc->top; int SmallDiam = Width > Height ? Height : Width; BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER - || (uType & BDR_OUTER) == BDR_OUTER) - && !(uFlags & (BF_FLAT|BF_MONO)) ); + || (uType & BDR_OUTER) == BDR_OUTER) + && !(uFlags & (BF_FLAT|BF_MONO)) ); int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0) - + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0); + + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
/* Init some vars */ OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN); @@ -184,8 +184,10 @@ } }
- if(InnerI != -1) InnerPen = GetSysColorPen(InnerI); - if(OuterI != -1) OuterPen = GetSysColorPen(OuterI); + if(InnerI != -1) + InnerPen = GetSysColorPen(InnerI); + if(OuterI != -1) + OuterPen = GetSysColorPen(OuterI);
MoveToEx(hdc, 0, 0, &SavePoint);
@@ -197,42 +199,42 @@
switch(uFlags & BF_RECT) { - case 0: - case BF_LEFT: - case BF_BOTTOM: - case BF_BOTTOMLEFT: - /* Left bottom endpoint */ - epx = rc->left-1; - spx = epx + SmallDiam; - epy = rc->bottom; - spy = epy - SmallDiam; - break; - - case BF_TOPLEFT: - case BF_BOTTOMRIGHT: - /* Left top endpoint */ - epx = rc->left-1; - spx = epx + SmallDiam; - epy = rc->top-1; - spy = epy + SmallDiam; - break; - - case BF_TOP: - case BF_RIGHT: - case BF_TOPRIGHT: - case BF_RIGHT|BF_LEFT: - case BF_RIGHT|BF_LEFT|BF_TOP: - case BF_BOTTOM|BF_TOP: - case BF_BOTTOM|BF_TOP|BF_LEFT: - case BF_BOTTOMRIGHT|BF_LEFT: - case BF_BOTTOMRIGHT|BF_TOP: - case BF_RECT: - /* Right top endpoint */ - spx = rc->left; - epx = spx + SmallDiam; - spy = rc->bottom-1; - epy = spy - SmallDiam; - break; + case 0: + case BF_LEFT: + case BF_BOTTOM: + case BF_BOTTOMLEFT: + /* Left bottom endpoint */ + epx = rc->left-1; + spx = epx + SmallDiam; + epy = rc->bottom; + spy = epy - SmallDiam; + break; + + case BF_TOPLEFT: + case BF_BOTTOMRIGHT: + /* Left top endpoint */ + epx = rc->left-1; + spx = epx + SmallDiam; + epy = rc->top-1; + spy = epy + SmallDiam; + break; + + case BF_TOP: + case BF_RIGHT: + case BF_TOPRIGHT: + case BF_RIGHT|BF_LEFT: + case BF_RIGHT|BF_LEFT|BF_TOP: + case BF_BOTTOM|BF_TOP: + case BF_BOTTOM|BF_TOP|BF_LEFT: + case BF_BOTTOMRIGHT|BF_LEFT: + case BF_BOTTOMRIGHT|BF_TOP: + case BF_RECT: + /* Right top endpoint */ + spx = rc->left; + epx = spx + SmallDiam; + spy = rc->bottom-1; + epy = spy - SmallDiam; + break; }
MoveToEx(hdc, spx, spy, NULL); @@ -243,90 +245,90 @@
switch(uFlags & (BF_RECT|BF_DIAGONAL)) { - case BF_DIAGONAL_ENDBOTTOMLEFT: - case (BF_DIAGONAL|BF_BOTTOM): - case BF_DIAGONAL: - case (BF_DIAGONAL|BF_LEFT): - MoveToEx(hdc, spx-1, spy, NULL); - LineTo(hdc, epx, epy-1); - Points[0].x = spx-add; - Points[0].y = spy; - Points[1].x = rc->left; - Points[1].y = rc->top; - Points[2].x = epx+1; - Points[2].y = epy-1-add; - Points[3] = Points[2]; - break; - - case BF_DIAGONAL_ENDBOTTOMRIGHT: - MoveToEx(hdc, spx-1, spy, NULL); - LineTo(hdc, epx, epy+1); - Points[0].x = spx-add; - Points[0].y = spy; - Points[1].x = rc->left; - Points[1].y = rc->bottom-1; - Points[2].x = epx+1; - Points[2].y = epy+1+add; - Points[3] = Points[2]; - break; - - case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP): - case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP|BF_LEFT): - case BF_DIAGONAL_ENDTOPRIGHT: - case (BF_DIAGONAL|BF_RIGHT|BF_TOP|BF_LEFT): - MoveToEx(hdc, spx+1, spy, NULL); - LineTo(hdc, epx, epy+1); - Points[0].x = epx-1; - Points[0].y = epy+1+add; - Points[1].x = rc->right-1; - Points[1].y = rc->top+add; - Points[2].x = rc->right-1; - Points[2].y = rc->bottom-1; - Points[3].x = spx+add; - Points[3].y = spy; - break; - - case BF_DIAGONAL_ENDTOPLEFT: - MoveToEx(hdc, spx, spy-1, NULL); - LineTo(hdc, epx+1, epy); - Points[0].x = epx+1+add; - Points[0].y = epy+1; - Points[1].x = rc->right-1; - Points[1].y = rc->top; - Points[2].x = rc->right-1; - Points[2].y = rc->bottom-1-add; - Points[3].x = spx; - Points[3].y = spy-add; - break; - - case (BF_DIAGONAL|BF_TOP): - case (BF_DIAGONAL|BF_BOTTOM|BF_TOP): - case (BF_DIAGONAL|BF_BOTTOM|BF_TOP|BF_LEFT): - MoveToEx(hdc, spx+1, spy-1, NULL); - LineTo(hdc, epx, epy); - Points[0].x = epx-1; - Points[0].y = epy+1; - Points[1].x = rc->right-1; - Points[1].y = rc->top; - Points[2].x = rc->right-1; - Points[2].y = rc->bottom-1-add; - Points[3].x = spx+add; - Points[3].y = spy-add; - break; - - case (BF_DIAGONAL|BF_RIGHT): - case (BF_DIAGONAL|BF_RIGHT|BF_LEFT): - case (BF_DIAGONAL|BF_RIGHT|BF_LEFT|BF_BOTTOM): - MoveToEx(hdc, spx, spy, NULL); - LineTo(hdc, epx-1, epy+1); - Points[0].x = spx; - Points[0].y = spy; - Points[1].x = rc->left; - Points[1].y = rc->top+add; - Points[2].x = epx-1-add; - Points[2].y = epy+1+add; - Points[3] = Points[2]; - break; + case BF_DIAGONAL_ENDBOTTOMLEFT: + case (BF_DIAGONAL|BF_BOTTOM): + case BF_DIAGONAL: + case (BF_DIAGONAL|BF_LEFT): + MoveToEx(hdc, spx-1, spy, NULL); + LineTo(hdc, epx, epy-1); + Points[0].x = spx-add; + Points[0].y = spy; + Points[1].x = rc->left; + Points[1].y = rc->top; + Points[2].x = epx+1; + Points[2].y = epy-1-add; + Points[3] = Points[2]; + break; + + case BF_DIAGONAL_ENDBOTTOMRIGHT: + MoveToEx(hdc, spx-1, spy, NULL); + LineTo(hdc, epx, epy+1); + Points[0].x = spx-add; + Points[0].y = spy; + Points[1].x = rc->left; + Points[1].y = rc->bottom-1; + Points[2].x = epx+1; + Points[2].y = epy+1+add; + Points[3] = Points[2]; + break; + + case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP): + case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP|BF_LEFT): + case BF_DIAGONAL_ENDTOPRIGHT: + case (BF_DIAGONAL|BF_RIGHT|BF_TOP|BF_LEFT): + MoveToEx(hdc, spx+1, spy, NULL); + LineTo(hdc, epx, epy+1); + Points[0].x = epx-1; + Points[0].y = epy+1+add; + Points[1].x = rc->right-1; + Points[1].y = rc->top+add; + Points[2].x = rc->right-1; + Points[2].y = rc->bottom-1; + Points[3].x = spx+add; + Points[3].y = spy; + break; + + case BF_DIAGONAL_ENDTOPLEFT: + MoveToEx(hdc, spx, spy-1, NULL); + LineTo(hdc, epx+1, epy); + Points[0].x = epx+1+add; + Points[0].y = epy+1; + Points[1].x = rc->right-1; + Points[1].y = rc->top; + Points[2].x = rc->right-1; + Points[2].y = rc->bottom-1-add; + Points[3].x = spx; + Points[3].y = spy-add; + break; + + case (BF_DIAGONAL|BF_TOP): + case (BF_DIAGONAL|BF_BOTTOM|BF_TOP): + case (BF_DIAGONAL|BF_BOTTOM|BF_TOP|BF_LEFT): + MoveToEx(hdc, spx+1, spy-1, NULL); + LineTo(hdc, epx, epy); + Points[0].x = epx-1; + Points[0].y = epy+1; + Points[1].x = rc->right-1; + Points[1].y = rc->top; + Points[2].x = rc->right-1; + Points[2].y = rc->bottom-1-add; + Points[3].x = spx+add; + Points[3].y = spy-add; + break; + + case (BF_DIAGONAL|BF_RIGHT): + case (BF_DIAGONAL|BF_RIGHT|BF_LEFT): + case (BF_DIAGONAL|BF_RIGHT|BF_LEFT|BF_BOTTOM): + MoveToEx(hdc, spx, spy, NULL); + LineTo(hdc, epx-1, epy+1); + Points[0].x = spx; + Points[0].y = spy; + Points[1].x = rc->left; + Points[1].y = rc->top+add; + Points[2].x = epx-1-add; + Points[2].y = epy+1+add; + Points[3] = Points[2]; + break; }
/* Fill the interior if asked */ @@ -346,10 +348,14 @@ /* Adjust rectangle if asked */ if(uFlags & BF_ADJUST) { - if(uFlags & BF_LEFT) rc->left += add; - if(uFlags & BF_RIGHT) rc->right -= add; - if(uFlags & BF_TOP) rc->top += add; - if(uFlags & BF_BOTTOM) rc->bottom -= add; + if(uFlags & BF_LEFT) + rc->left += add; + if(uFlags & BF_RIGHT) + rc->right -= add; + if(uFlags & BF_TOP) + rc->top += add; + if(uFlags & BF_BOTTOM) + rc->bottom -= add; }
/* Cleanup */ @@ -443,8 +449,8 @@ int RTpenplus = 0; int RBpenplus = 0; BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER - || (uType & BDR_OUTER) == BDR_OUTER) - && !(uFlags & (BF_FLAT|BF_MONO)) ); + || (uType & BDR_OUTER) == BDR_OUTER) + && !(uFlags & (BF_FLAT|BF_MONO)) ); /* Init some vars */ LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN); SavePen = (HPEN)SelectObject(hdc, LTInnerPen); @@ -462,12 +468,12 @@
/* Bertho Stultiens states above that this function exactly matches win95 * In win98 BF_FLAT rectangles have an inner border same color as the - * middle (COLOR_BTNFACE). I believe it's the same for win95 but since - * I don't know I go with Bertho and just sets it for win98 until proven - * otherwise. - * Dennis Björklund, 10 June, 99 - */ - if( LTInnerI != -1 ) + * middle (COLOR_BTNFACE). I believe it's the same for win95 but since + * I don't know I go with Bertho and just sets it for win98 until proven + * otherwise. + * Dennis Björklund, 10 June, 99 + */ + if( LTInnerI != -1 ) LTInnerI = RBInnerI = COLOR_BTNFACE; } else if(uFlags & BF_SOFT) @@ -485,20 +491,28 @@ RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)]; }
- if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) LBpenplus = 1; - if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) RTpenplus = 1; - if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) RBpenplus = 1; - if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1; - - if(LTInnerI != -1) LTInnerPen = GetSysColorPen(LTInnerI); - if(LTOuterI != -1) LTOuterPen = GetSysColorPen(LTOuterI); - if(RBInnerI != -1) RBInnerPen = GetSysColorPen(RBInnerI); - if(RBOuterI != -1) RBOuterPen = GetSysColorPen(RBOuterI); + if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) + LBpenplus = 1; + if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) + RTpenplus = 1; + if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) + RBpenplus = 1; + if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) + LTpenplus = 1; + + if(LTInnerI != -1) + LTInnerPen = GetSysColorPen(LTInnerI); + if(LTOuterI != -1) + LTOuterPen = GetSysColorPen(LTOuterI); + if(RBInnerI != -1) + RBInnerPen = GetSysColorPen(RBInnerI); + if(RBOuterI != -1) + RBOuterPen = GetSysColorPen(RBOuterI); 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)); + } MoveToEx(hdc, 0, 0, &SavePoint);
/* Draw the outer edge */ @@ -552,15 +566,19 @@ if( ((uFlags & BF_MIDDLE) && retval) || (uFlags & BF_ADJUST) ) { int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0) - + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0); - - if(uFlags & BF_LEFT) InnerRect.left += add; - if(uFlags & BF_RIGHT) InnerRect.right -= add; - if(uFlags & BF_TOP) InnerRect.top += add; - if(uFlags & BF_BOTTOM) InnerRect.bottom -= add; - - if(uFlags & BF_ADJUST) - *rc = InnerRect; + + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0); + + if(uFlags & BF_LEFT) + InnerRect.left += add; + if(uFlags & BF_RIGHT) + InnerRect.right -= add; + if(uFlags & BF_TOP) + InnerRect.top += add; + if(uFlags & BF_BOTTOM) + InnerRect.bottom -= add; + + if(uFlags & BF_ADJUST) + *rc = InnerRect; }
/* Cleanup */ @@ -591,7 +609,7 @@ dst->right = dst->left + SmallDiam; }
- return SmallDiam; + return SmallDiam; }
/* Ported from WINE20020904 */ @@ -599,19 +617,19 @@ { if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255)) { - HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55); - HBRUSH hbsave; - HBRUSH hb = CreatePatternBrush(hbm); - COLORREF bg; - - FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE)); - bg = SetBkColor(dc, RGB(255, 255, 255)); - hbsave = (HBRUSH)SelectObject(dc, hb); - PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); - SelectObject(dc, hbsave); - SetBkColor(dc, bg); - DeleteObject(hb); - DeleteObject(hbm); + HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55); + HBRUSH hbsave; + HBRUSH hb = CreatePatternBrush(hbm); + COLORREF bg; + + FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE)); + bg = SetBkColor(dc, RGB(255, 255, 255)); + hbsave = (HBRUSH)SelectObject(dc, hb); + PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); + SelectObject(dc, hbsave); + SetBkColor(dc, bg); + DeleteObject(hb); + DeleteObject(hbm); } else { @@ -683,8 +701,10 @@ UINT flags = BF_RECT | BF_ADJUST; UITOOLS_MakeSquareRect(r, &myr);
- if(uFlags & DFCS_FLAT) flags |= BF_FLAT; - else if(uFlags & DFCS_MONO) flags |= BF_MONO; + if(uFlags & DFCS_FLAT) + flags |= BF_FLAT; + else if(uFlags & DFCS_MONO) + flags |= BF_MONO;
IntDrawRectEdge( dc, &myr, EDGE_SUNKEN, flags );
@@ -701,18 +721,18 @@ { int i, k; i = (uFlags & DFCS_INACTIVE) || (uFlags & 0xff) == DFCS_BUTTON3STATE ? - COLOR_BTNSHADOW : COLOR_WINDOWTEXT; + COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
/* draw 7 bars, with h=3w to form the check */ bar.left = myr.left; - bar.top = myr.top + 2; + bar.top = myr.top + 2; for (k = 0; k < 7; k++) { bar.left = bar.left + 1; - bar.top = (k < 3) ? bar.top + 1 : bar.top - 1; - bar.bottom = bar.top + 3; - bar.right = bar.left + 1; + bar.top = (k < 3) ? bar.top + 1 : bar.top - 1; + bar.bottom = bar.top + 3; + bar.right = bar.left + 1; FillRect(dc, &bar, GetSysColorBrush(i)); - } + } } return TRUE; } @@ -801,21 +821,21 @@ { switch(uState & 0xff) { - case DFCS_BUTTONPUSH: - return UITOOLS95_DFC_ButtonPush(hdc, rc, uState); - - case DFCS_BUTTONCHECK: - case DFCS_BUTTON3STATE: - return UITOOLS95_DFC_ButtonCheck(hdc, rc, uState); - - case DFCS_BUTTONRADIOIMAGE: - case DFCS_BUTTONRADIOMASK: - case DFCS_BUTTONRADIO: - return UITOOLS95_DFC_ButtonRadio(hdc, rc, uState); + case DFCS_BUTTONPUSH: + return UITOOLS95_DFC_ButtonPush(hdc, rc, uState); + + case DFCS_BUTTONCHECK: + case DFCS_BUTTON3STATE: + return UITOOLS95_DFC_ButtonCheck(hdc, rc, uState); + + case DFCS_BUTTONRADIOIMAGE: + case DFCS_BUTTONRADIOMASK: + case DFCS_BUTTONRADIO: + return UITOOLS95_DFC_ButtonRadio(hdc, rc, uState);
/* - default: - DbgPrint("Invalid button state=0x%04x\n", uState); + default: + DbgPrint("Invalid button state=0x%04x\n", uState); */ }
@@ -846,102 +866,102 @@ COLORREF clrsave; SIZE size;
- if(uFlags & DFCS_PUSHED) - IntDrawRectEdge(dc,r,EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_SOFT); + if(uFlags & DFCS_PUSHED) + IntDrawRectEdge(dc,r,EDGE_SUNKEN, BF_RECT | BF_MIDDLE | BF_SOFT); else - IntDrawRectEdge(dc,r,BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT | - BF_SOFT | BF_MIDDLE); + IntDrawRectEdge(dc,r,BDR_RAISEDINNER | BDR_RAISEDOUTER, BF_RECT | + BF_SOFT | BF_MIDDLE);
switch(uFlags & 0xff) { - case DFCS_CAPTIONCLOSE: - { - /* The "X" is made by drawing a series of lines. - * The number of lines drawn depends on the size - * of the bounding rect. e.g. For a 6x5 inside rect, - * two lines are drawn from top-left to bottom-right, - * and two lines from top-right to bottom-left. - * - * 0 1 2 3 4 5 0 1 2 3 4 5 - * 1 * * * * - * 2 * * * * - * 3 * * * * - * 4 * * * * - * - * Drawing one line for every 6 pixels in width - * seems to provide the best proportions. - */ - - POINT start, oldPos; - INT width = myr.right - (++myr.left) - 5; - INT height = (--myr.bottom) - myr.top - 6; - INT numLines = (width / 6) + 1; - - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); - - start.x = myr.left + 2; - start.y = myr.top + 2; - - if (width < 6) - height = width; - else - start.y++; - - if (uFlags & DFCS_PUSHED) + case DFCS_CAPTIONCLOSE: { - start.x++; - start.y++; + /* The "X" is made by drawing a series of lines. + * The number of lines drawn depends on the size + * of the bounding rect. e.g. For a 6x5 inside rect, + * two lines are drawn from top-left to bottom-right, + * and two lines from top-right to bottom-left. + * + * 0 1 2 3 4 5 0 1 2 3 4 5 + * 1 * * * * + * 2 * * * * + * 3 * * * * + * 4 * * * * + * + * Drawing one line for every 6 pixels in width + * seems to provide the best proportions. + */ + + POINT start, oldPos; + INT width = myr.right - (++myr.left) - 5; + INT height = (--myr.bottom) - myr.top - 6; + INT numLines = (width / 6) + 1; + + hpsave = (HPEN)SelectObject(dc, GetSysColorPen(colorIdx)); + + start.x = myr.left + 2; + start.y = myr.top + 2; + + if (width < 6) + height = width; + else + start.y++; + + if (uFlags & DFCS_PUSHED) + { + start.x++; + start.y++; + } + + /* now use the width of each line */ + width -= numLines - 1; + + for (i = 0; i < numLines; i++) + { + MoveToEx(dc, start.x + i, start.y, &oldPos); + LineTo(dc, start.x + i + width, start.y + height); + + MoveToEx(dc, start.x + i, start.y + height - 1, &oldPos); + LineTo(dc, start.x + i + width, start.y - 1); + } + + SelectObject(dc, hpsave); + return TRUE; }
- /* now use the width of each line */ - width -= numLines - 1; - - for (i = 0; i < numLines; i++) - { - MoveToEx(dc, start.x + i, start.y, &oldPos); - LineTo(dc, start.x + i + width, start.y + height); - - MoveToEx(dc, start.x + i, start.y + height - 1, &oldPos); - LineTo(dc, start.x + i + width, start.y - 1); - } - - SelectObject(dc, hpsave); - return TRUE; - } - - case DFCS_CAPTIONHELP: - /* This one breaks the flow */ - /* FIXME: We need the Marlett font in order to get this right. */ - - hf = CreateFontA(-SmallDiam, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "System"); - alignsave = SetTextAlign(dc, TA_TOP|TA_LEFT); - bksave = SetBkMode(dc, TRANSPARENT); - clrsave = GetTextColor(dc); - hfsave = (HFONT)SelectObject(dc, hf); - GetTextExtentPoint32A(dc, str, 1, &size); - - if(uFlags & DFCS_INACTIVE) - { - SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); - TextOutA(dc, xc-size.cx/2+1, yc-size.cy/2+1, str, 1); - } - SetTextColor(dc, GetSysColor(colorIdx)); - TextOutA(dc, xc-size.cx/2, yc-size.cy/2, str, 1); - - SelectObject(dc, hfsave); - SetTextColor(dc, clrsave); - SetBkMode(dc, bksave); - SetTextAlign(dc, alignsave); - DeleteObject(hf); - return TRUE; - - case DFCS_CAPTIONMIN: - /* - * If the button goes from x 0 -- w-1, the leftmost point of the - * minimize line always starts at x>=4. - */ + case DFCS_CAPTIONHELP: + /* This one breaks the flow */ + /* FIXME: We need the Marlett font in order to get this right. */ + + hf = CreateFontA(-SmallDiam, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "System"); + alignsave = SetTextAlign(dc, TA_TOP|TA_LEFT); + bksave = SetBkMode(dc, TRANSPARENT); + clrsave = GetTextColor(dc); + hfsave = (HFONT)SelectObject(dc, hf); + GetTextExtentPoint32A(dc, str, 1, &size); + + if(uFlags & DFCS_INACTIVE) + { + SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); + TextOutA(dc, xc-size.cx/2+1, yc-size.cy/2+1, str, 1); + } + SetTextColor(dc, GetSysColor(colorIdx)); + TextOutA(dc, xc-size.cx/2, yc-size.cy/2, str, 1); + + SelectObject(dc, hfsave); + SetTextColor(dc, clrsave); + SetBkMode(dc, bksave); + SetTextAlign(dc, alignsave); + DeleteObject(hf); + return TRUE; + + case DFCS_CAPTIONMIN: + /* + * If the button goes from x 0 -- w-1, the leftmost point of the + * minimize line always starts at x>=4. + */ { const int width = myr.right - myr.left; const int xInsetPixels = (width>=9 ? width - 9 : 0) / 8 + 4; @@ -954,54 +974,54 @@ } break;
- case DFCS_CAPTIONMAX: - edge = 47*SmallDiam/750; - Line1[0].x = Line1[5].x = myr.left + 57*SmallDiam/750+3; - Line1[0].y = Line1[1].y = myr.top + 143*SmallDiam/750+1; - Line1[1].x = Line1[2].x = Line1[0].x + 562*SmallDiam/750; - Line1[5].y = Line1[4].y = Line1[0].y + 93*SmallDiam/750; - Line1[2].y = Line1[3].y = Line1[0].y + 513*SmallDiam/750; - Line1[3].x = Line1[4].x = Line1[1].x - edge; - - Line2[0].x = Line2[5].x = Line1[0].x; - Line2[3].x = Line2[4].x = Line1[1].x; - Line2[1].x = Line2[2].x = Line1[0].x + edge; - Line2[0].y = Line2[1].y = Line1[0].y; - Line2[4].y = Line2[5].y = Line1[2].y; - Line2[2].y = Line2[3].y = Line1[2].y - edge; - Line1N = 6; - Line2N = 6; - break; - - case DFCS_CAPTIONRESTORE: - /* FIXME: this one looks bad at small sizes < 15x15 :( */ - edge = 47*SmallDiam/750; - move = 420*SmallDiam/750; - Line1[0].x = Line1[9].x = myr.left + 198*SmallDiam/750+2; - Line1[0].y = Line1[1].y = myr.top + 169*SmallDiam/750+1; - Line1[6].y = Line1[7].y = Line1[0].y + 93*SmallDiam/750; - Line1[7].x = Line1[8].x = Line1[0].x + edge; - Line1[1].x = Line1[2].x = Line1[0].x + move; - Line1[5].x = Line1[6].x = Line1[1].x - edge; - Line1[9].y = Line1[8].y = Line1[0].y + 187*SmallDiam/750; - Line1[2].y = Line1[3].y = Line1[0].y + 327*SmallDiam/750; - Line1[4].y = Line1[5].y = Line1[2].y - edge; - Line1[3].x = Line1[4].x = Line1[2].x - 140*SmallDiam/750; - - Line2[1].x = Line2[2].x = Line1[3].x; - Line2[7].x = Line2[8].x = Line2[1].x - edge; - Line2[0].x = Line2[9].x = Line2[3].x = Line2[4].x = Line2[1].x - move; - Line2[5].x = Line2[6].x = Line2[0].x + edge; - Line2[0].y = Line2[1].y = Line1[9].y + 93*SmallDiam/750; - Line2[4].y = Line2[5].y = Line2[8].y = Line2[9].y = Line2[0].y + 93*SmallDiam/750; - Line2[2].y = Line2[3].y = Line2[0].y + 327*SmallDiam/750; - Line2[6].y = Line2[7].y = Line2[2].y - edge; - Line1N = 10; - Line2N = 10; - break; - - default: - return FALSE; + case DFCS_CAPTIONMAX: + edge = 47*SmallDiam/750; + Line1[0].x = Line1[5].x = myr.left + 57*SmallDiam/750+3; + Line1[0].y = Line1[1].y = myr.top + 143*SmallDiam/750+1; + Line1[1].x = Line1[2].x = Line1[0].x + 562*SmallDiam/750; + Line1[5].y = Line1[4].y = Line1[0].y + 93*SmallDiam/750; + Line1[2].y = Line1[3].y = Line1[0].y + 513*SmallDiam/750; + Line1[3].x = Line1[4].x = Line1[1].x - edge; + + Line2[0].x = Line2[5].x = Line1[0].x; + Line2[3].x = Line2[4].x = Line1[1].x; + Line2[1].x = Line2[2].x = Line1[0].x + edge; + Line2[0].y = Line2[1].y = Line1[0].y; + Line2[4].y = Line2[5].y = Line1[2].y; + Line2[2].y = Line2[3].y = Line1[2].y - edge; + Line1N = 6; + Line2N = 6; + break; + + case DFCS_CAPTIONRESTORE: + /* FIXME: this one looks bad at small sizes < 15x15 :( */ + edge = 47*SmallDiam/750; + move = 420*SmallDiam/750; + Line1[0].x = Line1[9].x = myr.left + 198*SmallDiam/750+2; + Line1[0].y = Line1[1].y = myr.top + 169*SmallDiam/750+1; + Line1[6].y = Line1[7].y = Line1[0].y + 93*SmallDiam/750; + Line1[7].x = Line1[8].x = Line1[0].x + edge; + Line1[1].x = Line1[2].x = Line1[0].x + move; + Line1[5].x = Line1[6].x = Line1[1].x - edge; + Line1[9].y = Line1[8].y = Line1[0].y + 187*SmallDiam/750; + Line1[2].y = Line1[3].y = Line1[0].y + 327*SmallDiam/750; + Line1[4].y = Line1[5].y = Line1[2].y - edge; + Line1[3].x = Line1[4].x = Line1[2].x - 140*SmallDiam/750; + + Line2[1].x = Line2[2].x = Line1[3].x; + Line2[7].x = Line2[8].x = Line2[1].x - edge; + Line2[0].x = Line2[9].x = Line2[3].x = Line2[4].x = Line2[1].x - move; + Line2[5].x = Line2[6].x = Line2[0].x + edge; + Line2[0].y = Line2[1].y = Line1[9].y + 93*SmallDiam/750; + Line2[4].y = Line2[5].y = Line2[8].y = Line2[9].y = Line2[0].y + 93*SmallDiam/750; + Line2[2].y = Line2[3].y = Line2[0].y + 327*SmallDiam/750; + Line2[6].y = Line2[7].y = Line2[2].y - edge; + Line1N = 10; + Line2N = 10; + break; + + default: + return FALSE; }
/* Here the drawing takes place */ @@ -1062,128 +1082,128 @@ * Making sure that the arrow is as least 3 pixels wide (or high). */ if (tri == 0) - tri = 1; + tri = 1;
switch(uFlags & 0xff) { - case DFCS_SCROLLCOMBOBOX: - case DFCS_SCROLLDOWN: - Line[2].x = myr.left + 470*SmallDiam/1000 + 2; - Line[2].y = myr.top + 687*SmallDiam/1000 + 1; - Line[0].x = Line[2].x - tri; - Line[1].x = Line[2].x + tri; - Line[0].y = Line[1].y = Line[2].y - tri; - break; - - case DFCS_SCROLLUP: - Line[2].x = myr.left + 470*SmallDiam/1000 + 2; - Line[2].y = myr.bottom - (687*SmallDiam/1000 + 1); - Line[0].x = Line[2].x - tri; - Line[1].x = Line[2].x + tri; - Line[0].y = Line[1].y = Line[2].y + tri; - break; - - case DFCS_SCROLLLEFT: - Line[2].x = myr.right - (687*SmallDiam/1000 + 1); - Line[2].y = myr.top + 470*SmallDiam/1000 + 2; - Line[0].y = Line[2].y - tri; - Line[1].y = Line[2].y + tri; - Line[0].x = Line[1].x = Line[2].x + tri; - break; - - case DFCS_SCROLLRIGHT: - Line[2].x = myr.left + 687*SmallDiam/1000 + 1; - Line[2].y = myr.top + 470*SmallDiam/1000 + 2; - Line[0].y = Line[2].y - tri; - Line[1].y = Line[2].y + tri; - Line[0].x = Line[1].x = Line[2].x - tri; - break; - - case DFCS_SCROLLSIZEGRIP: - /* 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)); - if(uFlags & (DFCS_MONO|DFCS_FLAT)) - { - hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME); - hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME); - } - else - { - hp = GetSysColorPen(COLOR_BTNHIGHLIGHT); - hp2 = GetSysColorPen(COLOR_BTNSHADOW); - hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT); - hb2 = GetSysColorBrush(COLOR_BTNSHADOW); - } - Line[0].x = Line[1].x = r->right-1; - Line[2].y = Line[3].y = r->bottom-1; - d46 = 46*SmallDiam/750; - d93 = 93*SmallDiam/750; - - i = 586*SmallDiam/750; - Line[0].y = r->bottom - i - 1; - 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); - 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); - Polygon(dc, Line, 4); - - i = 398*SmallDiam/750; - Line[0].y = r->bottom - i - 1; - 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); - 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); - Polygon(dc, Line, 4); - - i = 210*SmallDiam/750; - Line[0].y = r->bottom - i - 1; - 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); - 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); - Polygon(dc, Line, 4); - - SelectObject(dc, hpsave); - SelectObject(dc, hbsave); - return TRUE; - - default: - return FALSE; + case DFCS_SCROLLCOMBOBOX: + case DFCS_SCROLLDOWN: + Line[2].x = myr.left + 470*SmallDiam/1000 + 2; + Line[2].y = myr.top + 687*SmallDiam/1000 + 1; + Line[0].x = Line[2].x - tri; + Line[1].x = Line[2].x + tri; + Line[0].y = Line[1].y = Line[2].y - tri; + break; + + case DFCS_SCROLLUP: + Line[2].x = myr.left + 470*SmallDiam/1000 + 2; + Line[2].y = myr.bottom - (687*SmallDiam/1000 + 1); + Line[0].x = Line[2].x - tri; + Line[1].x = Line[2].x + tri; + Line[0].y = Line[1].y = Line[2].y + tri; + break; + + case DFCS_SCROLLLEFT: + Line[2].x = myr.right - (687*SmallDiam/1000 + 1); + Line[2].y = myr.top + 470*SmallDiam/1000 + 2; + Line[0].y = Line[2].y - tri; + Line[1].y = Line[2].y + tri; + Line[0].x = Line[1].x = Line[2].x + tri; + break; + + case DFCS_SCROLLRIGHT: + Line[2].x = myr.left + 687*SmallDiam/1000 + 1; + Line[2].y = myr.top + 470*SmallDiam/1000 + 2; + Line[0].y = Line[2].y - tri; + Line[1].y = Line[2].y + tri; + Line[0].x = Line[1].x = Line[2].x - tri; + break; + + case DFCS_SCROLLSIZEGRIP: + /* 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)); + if(uFlags & (DFCS_MONO|DFCS_FLAT)) + { + hp = hp2 = GetSysColorPen(COLOR_WINDOWFRAME); + hb = hb2 = GetSysColorBrush(COLOR_WINDOWFRAME); + } + else + { + hp = GetSysColorPen(COLOR_BTNHIGHLIGHT); + hp2 = GetSysColorPen(COLOR_BTNSHADOW); + hb = GetSysColorBrush(COLOR_BTNHIGHLIGHT); + hb2 = GetSysColorBrush(COLOR_BTNSHADOW); + } + Line[0].x = Line[1].x = r->right-1; + Line[2].y = Line[3].y = r->bottom-1; + d46 = 46*SmallDiam/750; + d93 = 93*SmallDiam/750; + + i = 586*SmallDiam/750; + Line[0].y = r->bottom - i - 1; + 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); + 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); + Polygon(dc, Line, 4); + + i = 398*SmallDiam/750; + Line[0].y = r->bottom - i - 1; + 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); + 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); + Polygon(dc, Line, 4); + + i = 210*SmallDiam/750; + Line[0].y = r->bottom - i - 1; + 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); + 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); + Polygon(dc, Line, 4); + + SelectObject(dc, hpsave); + SelectObject(dc, hbsave); + return TRUE; + + default: + return FALSE; }
/* Here do the real scroll-bar controls end up */ if( ! (uFlags & (0xff00 & ~DFCS_ADJUSTRECT)) ) - /* UITOOLS95_DFC_ButtonPush always uses BF_SOFT which we don't */ - /* want for the normal scroll-arrow button. */ - IntDrawRectEdge( dc, r, EDGE_RAISED, (uFlags&DFCS_ADJUSTRECT) | BF_MIDDLE | BF_RECT); + /* UITOOLS95_DFC_ButtonPush always uses BF_SOFT which we don't */ + /* want for the normal scroll-arrow button. */ + IntDrawRectEdge( dc, r, EDGE_RAISED, (uFlags&DFCS_ADJUSTRECT) | BF_MIDDLE | BF_RECT); else - UITOOLS95_DFC_ButtonPush(dc, r, (uFlags & 0xff00) ); + UITOOLS95_DFC_ButtonPush(dc, r, (uFlags & 0xff00) );
if(uFlags & DFCS_INACTIVE) { @@ -1195,11 +1215,11 @@ }
if( (uFlags & DFCS_INACTIVE) || !(uFlags & DFCS_PUSHED) ) - for(i = 0; i < 3; i++) - { - Line[i].x--; - Line[i].y--; - } + for(i = 0; i < 3; i++) + { + Line[i].x--; + Line[i].y--; + }
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT; hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); @@ -1237,52 +1257,52 @@
switch(uFlags & 0xff) { - case DFCS_MENUARROW: - i = 187*SmallDiam/750; - Points[2].x = myr.left + 468*SmallDiam/750; - Points[2].y = myr.top + 352*SmallDiam/750+1; - Points[0].y = Points[2].y - i; - Points[1].y = Points[2].y + i; - Points[0].x = Points[1].x = Points[2].x - i; - Polygon(dc, Points, 3); - break; - - case DFCS_MENUBULLET: - xe = myr.left; - ye = myr.top + SmallDiam - SmallDiam/2; - xc = myr.left + SmallDiam - SmallDiam/2; - yc = myr.top + SmallDiam - SmallDiam/2; - i = 234*SmallDiam/750; - i = i < 1 ? 1 : i; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; - Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye); - break; - - case DFCS_MENUCHECK: - Points[0].x = myr.left + 253*SmallDiam/1000; - Points[0].y = myr.top + 445*SmallDiam/1000; - Points[1].x = myr.left + 409*SmallDiam/1000; - Points[1].y = Points[0].y + (Points[1].x-Points[0].x); - Points[2].x = myr.left + 690*SmallDiam/1000; - Points[2].y = Points[1].y - (Points[2].x-Points[1].x); - Points[3].x = Points[2].x; - Points[3].y = Points[2].y + 3*SmallDiam/16; - Points[4].x = Points[1].x; - Points[4].y = Points[1].y + 3*SmallDiam/16; - Points[5].x = Points[0].x; - Points[5].y = Points[0].y + 3*SmallDiam/16; - Polygon(dc, Points, 6); - break; - - default: + case DFCS_MENUARROW: + i = 187*SmallDiam/750; + Points[2].x = myr.left + 468*SmallDiam/750; + Points[2].y = myr.top + 352*SmallDiam/750+1; + Points[0].y = Points[2].y - i; + Points[1].y = Points[2].y + i; + Points[0].x = Points[1].x = Points[2].x - i; + Polygon(dc, Points, 3); + break; + + case DFCS_MENUBULLET: + xe = myr.left; + ye = myr.top + SmallDiam - SmallDiam/2; + xc = myr.left + SmallDiam - SmallDiam/2; + yc = myr.top + SmallDiam - SmallDiam/2; + i = 234*SmallDiam/750; + i = i < 1 ? 1 : i; + myr.left = xc - i+i/2; + myr.right = xc + i/2; + myr.top = yc - i+i/2; + myr.bottom = yc + i/2; + Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye); + break; + + case DFCS_MENUCHECK: + Points[0].x = myr.left + 253*SmallDiam/1000; + Points[0].y = myr.top + 445*SmallDiam/1000; + Points[1].x = myr.left + 409*SmallDiam/1000; + Points[1].y = Points[0].y + (Points[1].x-Points[0].x); + Points[2].x = myr.left + 690*SmallDiam/1000; + Points[2].y = Points[1].y - (Points[2].x-Points[1].x); + Points[3].x = Points[2].x; + Points[3].y = Points[2].y + 3*SmallDiam/16; + Points[4].x = Points[1].x; + Points[4].y = Points[1].y + 3*SmallDiam/16; + Points[5].x = Points[0].x; + Points[5].y = Points[0].y + 3*SmallDiam/16; + Polygon(dc, Points, 6); + break; + + default: /* - DbgPrint("Invalid menu; flags=0x%04x\n", uFlags); + DbgPrint("Invalid menu; flags=0x%04x\n", uFlags); */ - retval = FALSE; - break; + retval = FALSE; + break; }
SelectObject(dc, hpsave); @@ -1294,16 +1314,16 @@ BOOL STDCALL IntGrayString( - HDC hDC, - HBRUSH hBrush, - GRAYSTRINGPROC lpOutputFunc, - LPARAM lpData, - int nCount, - int X, - int Y, - int nWidth, - int nHeight, - BOOL unicode) + HDC hDC, + HBRUSH hBrush, + GRAYSTRINGPROC lpOutputFunc, + LPARAM lpData, + int nCount, + int X, + int Y, + int nWidth, + int nHeight, + BOOL unicode) { // AG: Mostly implemented, but probably won't work properly or return // correct error codes. I doubt it grays strings either... Untested! @@ -1311,7 +1331,7 @@ BOOL success = FALSE; HDC MemDC = NULL; HBITMAP MemBMP = NULL, - OldBMP = NULL; + OldBMP = NULL; HBRUSH OldBrush = NULL; HFONT OldFont = NULL; RECT r; @@ -1404,20 +1424,20 @@
if (! BitBlt(hDC, X, Y, nWidth, nHeight, MemDC, 0, 0, SRCCOPY)) goto cleanup;
- cleanup : - SetTextColor(hDC, ForeColor); - SetBkColor(hDC, BackColor); - - if (MemDC) - { - if (OldFont) SelectObject(MemDC, OldFont); - if (OldBrush) SelectObject(MemDC, OldBrush); - if (OldBMP) SelectObject(MemDC, OldBMP); - if (MemBMP) DeleteObject(MemBMP); - DeleteDC(MemDC); - } - - return success; +cleanup: + SetTextColor(hDC, ForeColor); + SetBkColor(hDC, BackColor); + + if (MemDC) + { + if (OldFont) SelectObject(MemDC, OldFont); + if (OldBrush) SelectObject(MemDC, OldBrush); + if (OldBMP) SelectObject(MemDC, OldBMP); + if (MemBMP) DeleteObject(MemBMP); + DeleteDC(MemDC); + } + + return success; }
/********************************************************************** @@ -1437,49 +1457,54 @@
switch(opcode) { - case DST_TEXT: - case DST_PREFIXTEXT: - if(unicode) - return DrawTextW(hdc, (LPWSTR)lp, (INT)wp, rc, dtflags); - else - return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags); - - case DST_ICON: - return DrawIconEx(hdc, rc->left, rc->top, (HICON)lp, cx, cy, 0, NULL, DI_NORMAL); - - case DST_BITMAP: - memdc = CreateCompatibleDC(hdc); - if(!memdc) return FALSE; - hbmsave = (HBITMAP)SelectObject(memdc, (HBITMAP)lp); - if(!hbmsave) - { + case DST_TEXT: + case DST_PREFIXTEXT: + if(unicode) + return DrawTextW(hdc, (LPWSTR)lp, (INT)wp, rc, dtflags); + else + return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags); + + case DST_ICON: + return DrawIconEx(hdc, rc->left, rc->top, (HICON)lp, cx, cy, 0, NULL, DI_NORMAL); + + case DST_BITMAP: + memdc = CreateCompatibleDC(hdc); + if(!memdc) + return FALSE; + hbmsave = (HBITMAP)SelectObject(memdc, (HBITMAP)lp); + if(!hbmsave) + { + DeleteDC(memdc); + return FALSE; + } + retval = BitBlt(hdc, rc->left, rc->top, cx, cy, memdc, 0, 0, SRCCOPY); + SelectObject(memdc, hbmsave); DeleteDC(memdc); - return FALSE; - } - retval = BitBlt(hdc, rc->left, rc->top, cx, cy, memdc, 0, 0, SRCCOPY); - SelectObject(memdc, hbmsave); - DeleteDC(memdc); - return retval; - - case DST_COMPLEX: - if(func) { - BOOL bRet; - /* DRAWSTATEPROC assumes that it draws at the center of coordinates */ - - OffsetViewportOrgEx(hdc, rc->left, rc->top, NULL); - bRet = func(hdc, lp, wp, cx, cy); - /* Restore origin */ - OffsetViewportOrgEx(hdc, -rc->left, -rc->top, NULL); - return bRet; - } else - return FALSE; + return retval; + + case DST_COMPLEX: + if(func) + { + BOOL bRet; + /* DRAWSTATEPROC assumes that it draws at the center of coordinates */ + + OffsetViewportOrgEx(hdc, rc->left, rc->top, NULL); + bRet = func(hdc, lp, wp, cx, cy); + /* Restore origin */ + OffsetViewportOrgEx(hdc, -rc->left, -rc->top, NULL); + return bRet; + } + else + { + return FALSE; + } } return FALSE; }
static BOOL IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp, - INT x, INT y, INT cx, INT cy, UINT flags, BOOL unicode) + INT x, INT y, INT cx, INT cy, UINT flags, BOOL unicode) { HBITMAP hbm, hbmsave; HFONT hfsave; @@ -1505,41 +1530,44 @@ { SIZE s; ICONINFO ici; - BITMAP bm; + BITMAP bm;
switch(opcode) { - case DST_TEXT: - case DST_PREFIXTEXT: - if(unicode) - retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s); - else - retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s); - if(!retval) return FALSE; - break; - - case DST_ICON: - if(!GetIconInfo((HICON)lp, &ici)) + case DST_TEXT: + case DST_PREFIXTEXT: + if(unicode) + retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s); + else + retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s); + if(!retval) + return FALSE; + break; + + case DST_ICON: + if(!GetIconInfo((HICON)lp, &ici)) + return FALSE; + if(!GetObjectW(ici.hbmColor, sizeof(bm), &bm)) + return FALSE; + s.cx = bm.bmWidth; + s.cy = bm.bmHeight; + break; + + case DST_BITMAP: + if(!GetObjectW((HBITMAP)lp, sizeof(bm), &bm)) + return FALSE; + s.cx = bm.bmWidth; + s.cy = bm.bmHeight; + break; + + case DST_COMPLEX: /* cx and cy must be set in this mode */ return FALSE; - if(!GetObjectW(ici.hbmColor, sizeof(bm), &bm)) - return FALSE; - s.cx = bm.bmWidth; - s.cy = bm.bmHeight; - break; - - case DST_BITMAP: - if(!GetObjectW((HBITMAP)lp, sizeof(bm), &bm)) - return FALSE; - s.cx = bm.bmWidth; - s.cy = bm.bmHeight; - break; - - case DST_COMPLEX: /* cx and cy must be set in this mode */ - return FALSE; - } - - if(!cx) cx = s.cx; - if(!cy) cy = s.cy; + } + + if(!cx) + cx = s.cx; + if(!cy) + cy = s.cy; }
rc.left = x; @@ -1568,15 +1596,19 @@
/* From here on we must use "goto cleanup" when something goes wrong */ hbm = CreateBitmap(cx, cy, 1, 1, NULL); - if(!hbm) goto cleanup; + if(!hbm) + goto cleanup; memdc = CreateCompatibleDC(hdc); - if(!memdc) goto cleanup; + if(!memdc) + goto cleanup; hbmsave = (HBITMAP)SelectObject(memdc, hbm); - if(!hbmsave) goto cleanup; + if(!hbmsave) + goto cleanup; rc.left = rc.top = 0; rc.right = cx; rc.bottom = cy; - if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH))) goto cleanup; + if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH))) + goto cleanup; SetBkColor(memdc, RGB(255, 255, 255)); SetTextColor(memdc, RGB(0, 0, 0)); hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT)); @@ -1584,55 +1616,65 @@ /* DST_COMPLEX may draw text as well, * so we must be sure that correct font is selected */ - if(!hfsave && (opcode <= DST_PREFIXTEXT)) goto cleanup; + if(!hfsave && (opcode <= DST_PREFIXTEXT)) + goto cleanup; tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode); - if(hfsave) SelectObject(memdc, hfsave); - if(!tmp) goto cleanup; + if(hfsave) + SelectObject(memdc, hfsave); + if(!tmp) + goto cleanup;
/* This state cause the image to be dithered */ if(flags & DSS_UNION) { #if 0 hbsave = (HBRUSH)SelectObject(memdc, CACHE_GetPattern55AABrush()); - if(!hbsave) goto cleanup; + if(!hbsave) + goto cleanup; tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089); SelectObject(memdc, hbsave); - if(!tmp) goto cleanup; + if(!tmp) + goto cleanup; #else UNIMPLEMENTED; #endif }
if (flags & DSS_DISABLED) - hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT)); + hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT)); else if (flags & DSS_DEFAULT) - hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW)); + hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW));
/* Draw light or dark shadow */ if (flags & (DSS_DISABLED|DSS_DEFAULT)) { - if(!hbrtmp) goto cleanup; - hbsave = (HBRUSH)SelectObject(hdc, hbrtmp); - if(!hbsave) goto cleanup; - if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup; - SelectObject(hdc, hbsave); - DeleteObject(hbrtmp); - hbrtmp = 0; + if(!hbrtmp) + goto cleanup; + hbsave = (HBRUSH)SelectObject(hdc, hbrtmp); + if(!hbsave) + goto cleanup; + if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A)) + goto cleanup; + SelectObject(hdc, hbsave); + DeleteObject(hbrtmp); + hbrtmp = 0; }
if (flags & DSS_DISABLED) { - hbr = hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW)); - if(!hbrtmp) goto cleanup; + hbr = hbrtmp = CreateSolidBrush(GetSysColor(COLOR_3DSHADOW)); + if(!hbrtmp) + goto cleanup; } else if (!hbr) { - hbr = (HBRUSH)GetStockObject(BLACK_BRUSH); + hbr = (HBRUSH)GetStockObject(BLACK_BRUSH); }
hbsave = (HBRUSH)SelectObject(hdc, hbr);
- if(!BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup; + if(!BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) + goto cleanup;
retval = TRUE; /* We succeeded */
@@ -1640,11 +1682,16 @@ SetTextColor(hdc, fg); SetBkColor(hdc, bg);
- if(hbsave) SelectObject(hdc, hbsave); - if(hbmsave) SelectObject(memdc, hbmsave); - if(hbrtmp) DeleteObject(hbrtmp); - if(hbm) DeleteObject(hbm); - if(memdc) DeleteDC(memdc); + if(hbsave) + SelectObject(hdc, hbsave); + if(hbmsave) + SelectObject(memdc, hbmsave); + if(hbrtmp) + DeleteObject(hbrtmp); + if(hbm) + DeleteObject(hbm); + if(memdc) + DeleteDC(memdc);
return retval; } @@ -1655,26 +1702,26 @@ BOOL STDCALL DrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState) { - if (GetMapMode(hDC) != MM_TEXT) - return FALSE; - - switch(uType) - { - case DFC_BUTTON: - return UITOOLS95_DrawFrameButton(hDC, rc, uState); - case DFC_CAPTION: - return UITOOLS95_DrawFrameCaption(hDC, rc, uState); - case DFC_MENU: - return UITOOLS95_DrawFrameMenu(hDC, rc, uState); + if (GetMapMode(hDC) != MM_TEXT) + return FALSE; + + switch(uType) + { + case DFC_BUTTON: + return UITOOLS95_DrawFrameButton(hDC, rc, uState); + case DFC_CAPTION: + return UITOOLS95_DrawFrameCaption(hDC, rc, uState); + case DFC_MENU: + return UITOOLS95_DrawFrameMenu(hDC, rc, uState); #if 0 - case DFC_POPUPMENU: - UNIMPLEMENTED; - break; + case DFC_POPUPMENU: + UNIMPLEMENTED; + break; #endif - case DFC_SCROLL: - return UITOOLS95_DrawFrameScroll(hDC, rc, uState); - } - return FALSE; + case DFC_SCROLL: + return UITOOLS95_DrawFrameScroll(hDC, rc, uState); + } + return FALSE; }
/* @@ -1683,10 +1730,10 @@ BOOL STDCALL DrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags) { - if (flags & BF_DIAGONAL) - return IntDrawDiagEdge(hDC, rc, edge, flags); - else - return IntDrawRectEdge(hDC, rc, edge, flags); + if (flags & BF_DIAGONAL) + return IntDrawDiagEdge(hDC, rc, edge, flags); + else + return IntDrawRectEdge(hDC, rc, edge, flags); }
/* @@ -1694,9 +1741,9 @@ */ BOOL STDCALL GrayStringA(HDC hDC, HBRUSH hBrush, GRAYSTRINGPROC lpOutputFunc, LPARAM lpData, - int nCount, int X, int Y, int nWidth, int nHeight) -{ - return IntGrayString(hDC, hBrush, lpOutputFunc, lpData, nCount, X, Y, nWidth, nHeight, FALSE); + int nCount, int X, int Y, int nWidth, int nHeight) +{ + return IntGrayString(hDC, hBrush, lpOutputFunc, lpData, nCount, X, Y, nWidth, nHeight, FALSE); }
/* @@ -1704,9 +1751,9 @@ */ BOOL STDCALL GrayStringW(HDC hDC, HBRUSH hBrush, GRAYSTRINGPROC lpOutputFunc, LPARAM lpData, - int nCount, int X, int Y, int nWidth, int nHeight) -{ - return IntGrayString(hDC, hBrush, lpOutputFunc, lpData, nCount, X, Y, nWidth, nHeight, TRUE); + int nCount, int X, int Y, int nWidth, int nHeight) +{ + return IntGrayString(hDC, hBrush, lpOutputFunc, lpData, nCount, X, Y, nWidth, nHeight, TRUE); }
/* @@ -1715,8 +1762,8 @@ BOOL STDCALL InvertRect(HDC hDC, CONST RECT *lprc) { - return PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, - lprc->bottom - lprc->top, DSTINVERT); + return PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, + lprc->bottom - lprc->top, DSTINVERT); }
/* @@ -1725,19 +1772,19 @@ INT STDCALL FrameRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) { - HBRUSH oldbrush; - RECT r = *lprc; - - if ((r.right <= r.left) || (r.bottom <= r.top)) return 0; - if (!(oldbrush = SelectObject(hDC, hbr))) return 0; - - PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY); - PatBlt(hDC, r.right - 1, r.top, 1, r.bottom - r.top, PATCOPY); - PatBlt(hDC, r.left, r.top, r.right - r.left, 1, PATCOPY); - PatBlt(hDC, r.left, r.bottom - 1, r.right - r.left, 1, PATCOPY); - - SelectObject(hDC, oldbrush); - return TRUE; + HBRUSH oldbrush; + RECT r = *lprc; + + if ((r.right <= r.left) || (r.bottom <= r.top)) return 0; + if (!(oldbrush = SelectObject(hDC, hbr))) return 0; + + PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY); + PatBlt(hDC, r.right - 1, r.top, 1, r.bottom - r.top, PATCOPY); + PatBlt(hDC, r.left, r.top, r.right - r.left, 1, PATCOPY); + PatBlt(hDC, r.left, r.bottom - 1, r.right - r.left, 1, PATCOPY); + + SelectObject(hDC, oldbrush); + return TRUE; }
/* @@ -1746,8 +1793,8 @@ BOOL STDCALL FlashWindow(HWND hWnd, BOOL bInvert) { - UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; }
/* @@ -1756,8 +1803,8 @@ BOOL STDCALL FlashWindowEx(PFLASHWINFO pfwi) { - UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; }
/* @@ -1766,20 +1813,20 @@ INT STDCALL FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr) { - HBRUSH prevhbr; - - if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1)) - { - hbr = GetSysColorBrush((int)hbr - 1); - } - if ((prevhbr = NtGdiSelectObject(hDC, hbr)) == NULL) - { - return FALSE; - } - NtGdiPatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, - lprc->bottom - lprc->top, PATCOPY); - NtGdiSelectObject(hDC, prevhbr); - return TRUE; + HBRUSH prevhbr; + + if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1)) + { + hbr = GetSysColorBrush((int)hbr - 1); + } + if ((prevhbr = NtGdiSelectObject(hDC, hbr)) == NULL) + { + return FALSE; + } + NtGdiPatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left, + lprc->bottom - lprc->top, PATCOPY); + NtGdiSelectObject(hDC, prevhbr); + return TRUE; }
/* @@ -1787,10 +1834,10 @@ */ BOOL STDCALL DrawAnimatedRects(HWND hWnd, int idAni, CONST RECT *lprcFrom, - CONST RECT *lprcTo) -{ - UNIMPLEMENTED; - return FALSE; + CONST RECT *lprcTo) +{ + UNIMPLEMENTED; + return FALSE; }
/* @@ -1799,35 +1846,35 @@ BOOL STDCALL DrawFocusRect(HDC hdc, CONST RECT *rect) { - static HBRUSH hFocusRectBrush = NULL; - HGDIOBJ OldObj; - UINT cx, cy; - - if(!hFocusRectBrush) - { - static HBITMAP hFocusPattern = NULL; - const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA}; - - hFocusPattern = CreateBitmap(8, 8, 1, 1, Pattern); - hFocusRectBrush = CreatePatternBrush(hFocusPattern); - } - - NtUserSystemParametersInfo(SPI_GETFOCUSBORDERWIDTH, 0, &cx, 0); - NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &cy, 0); - - OldObj = SelectObject(hdc, hFocusRectBrush); - - /* top */ - PatBlt(hdc, rect->left, rect->top, rect->right - rect->left, cy, PATINVERT); - /* bottom */ - PatBlt(hdc, rect->left, rect->bottom - cy, rect->right - rect->left, cy, PATINVERT); - /* left */ - PatBlt(hdc, rect->left, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); - /* right */ - PatBlt(hdc, rect->right - cx, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); - - SelectObject(hdc, OldObj); - return TRUE; + static HBRUSH hFocusRectBrush = NULL; + HGDIOBJ OldObj; + UINT cx, cy; + + if(!hFocusRectBrush) + { + static HBITMAP hFocusPattern = NULL; + const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA}; + + hFocusPattern = CreateBitmap(8, 8, 1, 1, Pattern); + hFocusRectBrush = CreatePatternBrush(hFocusPattern); + } + + NtUserSystemParametersInfo(SPI_GETFOCUSBORDERWIDTH, 0, &cx, 0); + NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &cy, 0); + + OldObj = SelectObject(hdc, hFocusRectBrush); + + /* top */ + PatBlt(hdc, rect->left, rect->top, rect->right - rect->left, cy, PATINVERT); + /* bottom */ + PatBlt(hdc, rect->left, rect->bottom - cy, rect->right - rect->left, cy, PATINVERT); + /* left */ + PatBlt(hdc, rect->left, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); + /* right */ + PatBlt(hdc, rect->right - cx, rect->top + cy, cx, rect->bottom - rect->top - (2 * cy), PATINVERT); + + SelectObject(hdc, OldObj); + return TRUE; }
/* @@ -1835,9 +1882,9 @@ */ BOOL STDCALL DrawStateA(HDC hDC, HBRUSH hBrush, DRAWSTATEPROC lpOutputFunc, LPARAM lData, - WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags) -{ - return IntDrawState(hDC, hBrush, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags, FALSE); + WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags) +{ + return IntDrawState(hDC, hBrush, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags, FALSE); }
/* @@ -1845,7 +1892,7 @@ */ BOOL STDCALL DrawStateW(HDC hDC, HBRUSH hBrush, DRAWSTATEPROC lpOutputFunc, LPARAM lData, - WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags) -{ - return IntDrawState(hDC, hBrush, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags, TRUE); -} + WPARAM wData, int x, int y, int cx, int cy, UINT fuFlags) +{ + return IntDrawState(hDC, hBrush, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags, TRUE); +}