mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
one more attempt to fix clock size, absolute coord values for hands and clock replaced by scale of client size
svn path=/trunk/; revision=39183
This commit is contained in:
parent
9ef3e5fb21
commit
165d233b51
1 changed files with 16 additions and 11 deletions
|
@ -27,7 +27,6 @@ typedef struct _CLOCKDATA
|
|||
|
||||
static const WCHAR szClockWndClass[] = L"ClockWndClass";
|
||||
|
||||
|
||||
static VOID
|
||||
RotatePoint(POINT pt[], INT iNum, INT iAngle)
|
||||
{
|
||||
|
@ -47,10 +46,10 @@ RotatePoint(POINT pt[], INT iNum, INT iAngle)
|
|||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static INT
|
||||
DrawClock(HDC hdc, PCLOCKDATA pClockData)
|
||||
{
|
||||
INT iAngle;
|
||||
INT iAngle,Radius;
|
||||
POINT pt[3];
|
||||
HBRUSH hBrushOld;
|
||||
HPEN hPenOld = NULL;
|
||||
|
@ -60,11 +59,14 @@ DrawClock(HDC hdc, PCLOCKDATA pClockData)
|
|||
|
||||
hPenOld = GetCurrentObject(hdc, OBJ_PEN);
|
||||
|
||||
// TODO: check if this conversion is correct resp. usable
|
||||
Radius = min(pClockData->cxClient,pClockData->cyClient) * 2;
|
||||
|
||||
for (iAngle = 0; iAngle < 360; iAngle += 6)
|
||||
{
|
||||
/* starting coords */
|
||||
pt[0].x = 0;
|
||||
pt[0].y = 180;
|
||||
pt[0].y = Radius;
|
||||
|
||||
/* rotate start coords */
|
||||
RotatePoint(pt, 1, iAngle);
|
||||
|
@ -93,15 +95,18 @@ DrawClock(HDC hdc, PCLOCKDATA pClockData)
|
|||
|
||||
SelectObject(hdc, hBrushOld);
|
||||
SelectObject(hdc, hPenOld);
|
||||
return Radius;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
DrawHands(HDC hdc, SYSTEMTIME * pst, BOOL fChange)
|
||||
DrawHands(HDC hdc, SYSTEMTIME * pst, BOOL fChange, INT Radius)
|
||||
{
|
||||
static POINT pt[3][5] = { {{0, -30}, {20, 0}, {0, 100}, {-20, 0}, {0, -30}},
|
||||
{{0, -40}, {10, 0}, {0, 160}, {-10, 0}, {0, -40}},
|
||||
{{0, 0}, { 0, 0}, {0, 0}, { 0, 0}, {0, 160}} };
|
||||
POINT pt[3][5] = { {{0, (INT)-Radius/6}, {(INT)Radius/9, 0},
|
||||
{0, (INT)Radius/1.8}, {(INT)-Radius/9, 0}, {0, (INT)-Radius/6}},
|
||||
{{0, (INT)-Radius/4.5}, {(INT)Radius/18, 0}, {0, (INT) Radius*0.89},
|
||||
{(INT)-Radius/18, 0}, {0, (INT)-Radius/4.5}},
|
||||
{{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, (INT) Radius*0.89}} };
|
||||
INT i, iAngle[3];
|
||||
POINT ptTemp[3][5];
|
||||
|
||||
|
@ -176,7 +181,7 @@ ClockWndProc(HWND hwnd,
|
|||
if (hBmp)
|
||||
{
|
||||
HBRUSH hWinBrush, hWinBrushOld;
|
||||
INT oldMap;
|
||||
INT oldMap, Radius;
|
||||
POINT oldOrg;
|
||||
|
||||
hBmpOld = SelectObject(hdcMem, hBmp);
|
||||
|
@ -196,8 +201,8 @@ ClockWndProc(HWND hwnd,
|
|||
pClockData->cyClient / 2,
|
||||
&oldOrg);
|
||||
|
||||
DrawClock(hdcMem, pClockData);
|
||||
DrawHands(hdcMem, &pClockData->stPrevious, TRUE);
|
||||
Radius = DrawClock(hdcMem, pClockData);
|
||||
DrawHands(hdcMem, &pClockData->stPrevious, TRUE, Radius);
|
||||
|
||||
SetMapMode(hdcMem, oldMap);
|
||||
SetViewportOrgEx(hdcMem, oldOrg.x, oldOrg.y, NULL);
|
||||
|
|
Loading…
Reference in a new issue