[ros-diffs] [gedmurphy] 35940: restart the clock when it's been stopped to be altered

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Sep 4 17:51:11 CEST 2008


Author: gedmurphy
Date: Thu Sep  4 10:51:11 2008
New Revision: 35940

URL: http://svn.reactos.org/svn/reactos?rev=35940&view=rev
Log:
restart the clock when it's been stopped to be altered

Modified:
    trunk/reactos/dll/cpl/timedate/clock.c
    trunk/reactos/dll/cpl/timedate/dateandtime.c
    trunk/reactos/dll/cpl/timedate/timedate.h

Modified: trunk/reactos/dll/cpl/timedate/clock.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/clock.c?rev=35940&r1=35939&r2=35940&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/clock.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/clock.c [iso-8859-1] Thu Sep  4 10:51:11 2008
@@ -158,7 +158,7 @@
 
         case WM_TIMER:
             GetLocalTime(&pClockData->stCurrent);
-            InvalidateRect(hwnd, NULL, TRUE);
+            InvalidateRect(hwnd, NULL, FALSE);
             pClockData->stPrevious = pClockData->stCurrent;
             break;
 
@@ -233,19 +233,22 @@
             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;
             }
-
-            /* Set the current time */
-            CopyMemory(&pClockData->stPrevious, (LPSYSTEMTIME)lParam, sizeof(SYSTEMTIME));
-
-            /* Redraw the clock */
-            InvalidateRect(hwnd, NULL, TRUE);
+            break;
+
+        case CLM_STARTCLOCK:
+            if (!pClockData->bTimer)
+            {
+                InvalidateRect(hwnd, NULL, FALSE);
+
+                SetTimer(hwnd, ID_TIMER, 1000, NULL);
+                pClockData->bTimer = TRUE;
+            }
             break;
 
         default:

Modified: trunk/reactos/dll/cpl/timedate/dateandtime.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/dateandtime.c?rev=35940&r1=35939&r2=35940&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/dateandtime.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/dateandtime.c [iso-8859-1] Thu Sep  4 10:51:11 2008
@@ -347,8 +347,8 @@
                             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 @@
                         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;

Modified: trunk/reactos/dll/cpl/timedate/timedate.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/timedate.h?rev=35940&r1=35939&r2=35940&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/timedate.h [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/timedate.h [iso-8859-1] Thu Sep  4 10:51:11 2008
@@ -51,7 +51,8 @@
 
 
 /* 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);



More information about the Ros-diffs mailing list