mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 09:50:43 +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:
|
case WM_TIMER:
|
||||||
GetLocalTime(&pClockData->stCurrent);
|
GetLocalTime(&pClockData->stCurrent);
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
pClockData->stPrevious = pClockData->stCurrent;
|
pClockData->stPrevious = pClockData->stCurrent;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -233,19 +233,22 @@ ClockWndProc(HWND hwnd,
|
||||||
HeapFree(GetProcessHeap(), 0, pClockData);
|
HeapFree(GetProcessHeap(), 0, pClockData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLM_SETTIME:
|
case CLM_STOPCLOCK:
|
||||||
/* Stop the timer if it is still running */
|
|
||||||
if (pClockData->bTimer)
|
if (pClockData->bTimer)
|
||||||
{
|
{
|
||||||
KillTimer(hwnd, ID_TIMER);
|
KillTimer(hwnd, ID_TIMER);
|
||||||
pClockData->bTimer = FALSE;
|
pClockData->bTimer = FALSE;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* Set the current time */
|
case CLM_STARTCLOCK:
|
||||||
CopyMemory(&pClockData->stPrevious, (LPSYSTEMTIME)lParam, sizeof(SYSTEMTIME));
|
if (!pClockData->bTimer)
|
||||||
|
{
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
|
||||||
/* Redraw the clock */
|
SetTimer(hwnd, ID_TIMER, 1000, NULL);
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
pClockData->bTimer = TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -347,8 +347,8 @@ DateTimePageProc(HWND hwndDlg,
|
||||||
KillTimer(hwndDlg, ID_TIMER);
|
KillTimer(hwndDlg, ID_TIMER);
|
||||||
|
|
||||||
/* Tell the clock to stop ticking */
|
/* Tell the clock to stop ticking */
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_SETTIME,
|
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_STOPCLOCK,
|
||||||
0, (LPARAM)&((LPNMDATETIMECHANGE)lpnm)->st);
|
0, 0);
|
||||||
|
|
||||||
/* Enable the 'Apply' button */
|
/* Enable the 'Apply' button */
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
@ -381,6 +381,10 @@ DateTimePageProc(HWND hwndDlg,
|
||||||
case PSN_APPLY:
|
case PSN_APPLY:
|
||||||
SetLocalSystemTime(hwndDlg);
|
SetLocalSystemTime(hwndDlg);
|
||||||
SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
|
SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
|
||||||
|
|
||||||
|
/* Tell the clock to start ticking */
|
||||||
|
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_STARTCLOCK,
|
||||||
|
0, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -51,7 +51,8 @@ VOID DisplayWin32Error(DWORD dwErrorCode);
|
||||||
|
|
||||||
|
|
||||||
/* clock.c */
|
/* clock.c */
|
||||||
#define CLM_SETTIME (WM_USER + 1)
|
#define CLM_STOPCLOCK (WM_USER + 1)
|
||||||
|
#define CLM_STARTCLOCK (WM_USER + 2)
|
||||||
|
|
||||||
BOOL RegisterClockControl(VOID);
|
BOOL RegisterClockControl(VOID);
|
||||||
VOID UnregisterClockControl(VOID);
|
VOID UnregisterClockControl(VOID);
|
||||||
|
|
Loading…
Reference in a new issue