Author: mkupfer
Date: Wed Jan 28 12:00:23 2009
New Revision: 39183
URL:
http://svn.reactos.org/svn/reactos?rev=39183&view=rev
Log:
one more attempt to fix clock size, absolute coord values for hands and clock replaced by
scale of client size
Modified:
trunk/reactos/dll/cpl/timedate/clock.c
Modified: trunk/reactos/dll/cpl/timedate/clock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/clock.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/timedate/clock.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/clock.c [iso-8859-1] Wed Jan 28 12:00:23 2009
@@ -27,7 +27,6 @@
static const WCHAR szClockWndClass[] = L"ClockWndClass";
-
static VOID
RotatePoint(POINT pt[], INT iNum, INT iAngle)
{
@@ -47,10 +46,10 @@
}
-static VOID
+static INT
DrawClock(HDC hdc, PCLOCKDATA pClockData)
{
- INT iAngle;
+ INT iAngle,Radius;
POINT pt[3];
HBRUSH hBrushOld;
HPEN hPenOld = NULL;
@@ -59,12 +58,15 @@
hBrushOld = SelectObject(hdc, pClockData->hGreyBrush);
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 @@
SelectObject(hdc, hBrushOld);
SelectObject(hdc, hPenOld);
+ return Radius;
}
static VOID
-DrawHands(HDC hdc, SYSTEMTIME * pst, BOOL fChange)
-{
- 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}} };
+DrawHands(HDC hdc, SYSTEMTIME * pst, BOOL fChange, INT Radius)
+{
+ 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 @@
if (hBmp)
{
HBRUSH hWinBrush, hWinBrushOld;
- INT oldMap;
+ INT oldMap, Radius;
POINT oldOrg;
hBmpOld = SelectObject(hdcMem, hBmp);
@@ -196,8 +201,8 @@
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);