/*
* PROJECT: ReactOS Timedate Control Panel
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: lib/cpl/timedate/monthcal.c
+ * FILE: dll/cpl/timedate/monthcal.c
* PURPOSE: Calander implementation
* COPYRIGHT: Copyright 2006 Thomas Weidenmueller <w3seek@reactos.com>
*
*/
-#include <timedate.h>
+#include "timedate.h"
+
+#include <windowsx.h>
static const WCHAR szMonthCalWndClass[] = L"MonthCalWnd";
}
/*
- * for the year range 1..9999
+ * For the year range 1..9999
* return 1 if is leap year otherwise 0
*/
static WORD LeapYear(IN WORD Year)
{
#ifdef WITH_1752
if ((Year == 1752) && (Month == 9))
- return 19; // special case: September 1752 has no 3rd-13th
+ return 19; // Special case: September 1752 has no 3rd-13th
else
#endif
return MonthDays[Month - 1];
RepaintHeader = TRUE;
}
- /* update the days layout of the current month */
+ /* Update the days layout of the current month */
ZeroMemory(infoPtr->Days,
sizeof(infoPtr->Days));
*(pDay++) = (BYTE)++d;
}
- /* repaint the control */
+ /* Repaint the control */
if (RepaintHeader)
{
InvalidateRect(infoPtr->hSelf,
SYSTEMTIME LocalTime = {0};
UINT uElapse;
- /* update the current date */
+ /* Update the current date */
GetLocalTime(&LocalTime);
- /* calculate the number of remaining milliseconds until midnight */
+ /* Calculate the number of remaining milliseconds until midnight */
uElapse = 1000 - (UINT)LocalTime.wMilliseconds;
uElapse += (59 - (UINT)LocalTime.wSecond) * 1000;
uElapse += (59 - (UINT)LocalTime.wMinute) * 60 * 1000;
else
uElapse += 100; /* Add a delay of 0.1 seconds */
- /* setup the new timer */
+ /* Setup the new timer */
if (SetTimer(infoPtr->hSelf,
ID_DAYTIMER,
uElapse,
0,
0);
- /* cache the configuration */
+ /* Cache the configuration */
infoPtr->FirstDayOfWeek = MonthCalFirstDayOfWeek();
infoPtr->hbHeader = GetSysColorBrush(infoPtr->Enabled ? MONTHCAL_HEADERBG : MONTHCAL_DISABLED_HEADERBG);
}
}
- /* update the control */
+ /* Update the control */
MonthCalUpdate(infoPtr);
}
{
infoPtr->Changed = TRUE;
- /* kill the day timer */
+ /* Kill the day timer */
if (infoPtr->DayTimerSet)
{
KillTimer(infoPtr->hSelf,
sc.NewMonth = Month;
sc.NewYear = Year;
- /* notify the parent */
+ /* Notify the parent */
if (!MonthCalNotifyControlParent(infoPtr,
MCCN_SELCHANGE,
&sc))
{
- /* check if we actually need to update */
+ /* Check if we actually need to update */
if (infoPtr->Month != sc.NewMonth ||
infoPtr->Year != sc.NewYear)
{
MonthCalChange(infoPtr);
- /* repaint the entire control */
+ /* Repaint the entire control */
MonthCalUpdate(infoPtr);
Ret = TRUE;
sc.OldDay,
&rcUpdate))
{
- /* repaint the day cells that need to be updated */
+ /* Repaint the day cells that need to be updated */
InvalidateRect(infoPtr->hSelf,
&rcUpdate,
TRUE);
}
}
- /* kill the day timer */
+ /* Kill the day timer */
if (infoPtr->DayTimerSet)
{
KillTimer(infoPtr->hSelf,
infoPtr->DayTimerSet = FALSE;
}
- /* setup the new day timer */
+ /* Setup the new day timer */
MonthCalSetupDayTimer(infoPtr);
if (Time != NULL)
{
RECT rcHeader;
- /* paint the header */
+ /* Paint the header */
rcHeader.left = prcUpdate->left;
rcHeader.top = rcCell.top;
rcHeader.right = prcUpdate->right;
rcCell.left = x * infoPtr->CellSize.cx;
rcCell.right = rcCell.left + infoPtr->CellSize.cx;
- /* write the first letter of each weekday */
+ /* Write the first letter of each weekday */
DrawTextW(hDC,
&infoPtr->Week[x],
1,
rcCell.left = x * infoPtr->CellSize.cx;
rcCell.right = rcCell.left + infoPtr->CellSize.cx;
- /* write the day number */
+ /* Write the day number */
if (Day != 0 && Day < 100)
{
WCHAR szDay[3];
goto FailNoHighlight;
}
- /* highlight the selected day */
+ /* Highlight the selected day */
crOldText = SetTextColor(hDC,
GetSysColor(infoPtr->Enabled ? MONTHCAL_SELFG : MONTHCAL_DISABLED_SELFG));
}
else
{
FailNoHighlight:
- /* don't change the text color, we're not highlighting it... */
+ /* Don't change the text color, we're not highlighting it... */
crOldText = CLR_INVALID;
}
infoPtr->Year);
}
- /* fall through */
+ /* Fall through */
}
case WM_MBUTTONDOWN:
}
}
- /* update the selection */
+ /* Update the selection */
if (NewDay != 0)
{
MonthCalSetDate(infoPtr,
{
case VK_TAB:
{
- /* change the UI status */
+ /* Change the UI status */
SendMessageW(GetAncestor(hwnd,
GA_PARENT),
WM_CHANGEUISTATE,
{
case ID_DAYTIMER:
{
- /* kill the timer */
+ /* Kill the timer */
KillTimer(hwnd,
ID_DAYTIMER);
infoPtr->DayTimerSet = FALSE;
if (!infoPtr->Changed)
{
- /* update the system time and setup the new day timer */
+ /* Update the system time and setup the new day timer */
MonthCalSetLocalTime(infoPtr,
NULL);
- /* update the control */
+ /* Update the control */
MonthCalUpdate(infoPtr);
}
break;
infoPtr->CellSize.cx = infoPtr->ClientSize.cx / 7;
infoPtr->CellSize.cy = infoPtr->ClientSize.cy / 7;
- /* repaint the control */
+ /* Repaint the control */
InvalidateRect(hwnd,
NULL,
TRUE);