mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
restart the clock when it's been stopped to be altered
svn path=/trunk/; revision=35940
This commit is contained in:
parent
7f1a28a669
commit
c98c9900e0
3 changed files with 18 additions and 10 deletions
|
@ -158,7 +158,7 @@ ClockWndProc(HWND hwnd,
|
|||
|
||||
case WM_TIMER:
|
||||
GetLocalTime(&pClockData->stCurrent);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
pClockData->stPrevious = pClockData->stCurrent;
|
||||
break;
|
||||
|
||||
|
@ -233,19 +233,22 @@ ClockWndProc(HWND hwnd,
|
|||
HeapFree(GetProcessHeap(), 0, pClockData);
|
||||
break;
|
||||
|
||||
case CLM_SETTIME:
|
||||
/* Stop the timer if it is still running */
|
||||
case CLM_STOPCLOCK:
|
||||
if (pClockData->bTimer)
|
||||
{
|
||||
KillTimer(hwnd, ID_TIMER);
|
||||
pClockData->bTimer = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Set the current time */
|
||||
CopyMemory(&pClockData->stPrevious, (LPSYSTEMTIME)lParam, sizeof(SYSTEMTIME));
|
||||
case CLM_STARTCLOCK:
|
||||
if (!pClockData->bTimer)
|
||||
{
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
|
||||
/* Redraw the clock */
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
SetTimer(hwnd, ID_TIMER, 1000, NULL);
|
||||
pClockData->bTimer = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -347,8 +347,8 @@ DateTimePageProc(HWND hwndDlg,
|
|||
KillTimer(hwndDlg, ID_TIMER);
|
||||
|
||||
/* Tell the clock to stop ticking */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_SETTIME,
|
||||
0, (LPARAM)&((LPNMDATETIMECHANGE)lpnm)->st);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_STOPCLOCK,
|
||||
0, 0);
|
||||
|
||||
/* Enable the 'Apply' button */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
|
@ -381,6 +381,10 @@ DateTimePageProc(HWND hwndDlg,
|
|||
case PSN_APPLY:
|
||||
SetLocalSystemTime(hwndDlg);
|
||||
SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
|
||||
|
||||
/* Tell the clock to start ticking */
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_STARTCLOCK,
|
||||
0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -51,7 +51,8 @@ VOID DisplayWin32Error(DWORD dwErrorCode);
|
|||
|
||||
|
||||
/* clock.c */
|
||||
#define CLM_SETTIME (WM_USER + 1)
|
||||
#define CLM_STOPCLOCK (WM_USER + 1)
|
||||
#define CLM_STARTCLOCK (WM_USER + 2)
|
||||
|
||||
BOOL RegisterClockControl(VOID);
|
||||
VOID UnregisterClockControl(VOID);
|
||||
|
|
Loading…
Reference in a new issue