diff calendar.ur @ 15:8300d5f0dc19

Replace ChangePoller with SourceL, plus some other rearrangements
author Adam Chlipala <adam@chlipala.net>
date Sun, 07 Aug 2011 14:38:52 -0400
parents 0827320b0f04
children 554e342665fe
line wrap: on
line diff
--- a/calendar.ur	Fri Aug 05 18:55:24 2011 -0430
+++ b/calendar.ur	Sun Aug 07 14:38:52 2011 -0400
@@ -21,7 +21,7 @@
                           ThisMonthLength : int, PrevMonthLength : int,
                           MondayMonth : month, MondayDay : int,
                           PrevMonthName : string, ThisMonthName : string, NextMonthName : string},
-          Day : ChangePoller.changePoller date}
+          Day : SourceL.t date}
          
 fun pad len n =
     let
@@ -108,7 +108,7 @@
     month <- return (readError (timef "%m" tm));
     minf <- source (monthInfo' {Month = month, Year = year});
     day <- return (readError (timef "%d" tm));
-    day <- ChangePoller.create {Year = year, Month = month, Day = day};
+    day <- SourceL.create {Year = year, Month = month, Day = day};
     return {Month = minf, Day = day}
 
 fun render' t =
@@ -129,12 +129,12 @@
                                                                      | Next => if minf.ThisMonth = 12 then 1 else minf.ThisMonth + 1,
                                                            Day = day}
                                        in
-                                           cday <- ChangePoller.value t.Day;
+                                           cday <- SourceL.value t.Day;
                                            return (if Record.equal thisDate cday then
                                                        <xml><td class={selday}>{[day]}</td></xml>
                                                    else case month of
                                                             This => <xml><td class={curday}
-                                                                             onclick={set (ChangePoller.ctl t.Day) thisDate}>{[day]}</td></xml>
+                                                                             onclick={SourceL.set t.Day thisDate}>{[day]}</td></xml>
                                                           | _ => <xml><td class={otherday}>{[day]}</td></xml>)
                                        end}/>
                             {let
@@ -203,8 +203,8 @@
         </xml>
     end
 
-fun addListener f ctl =
-    ChangePoller.addChangeListener f 100 ctl.Day
+fun onChange ctl f =
+    SourceL.onChange ctl.Day f
 
 val gui_t = Gui.mkGui 
                 (fn ctl =>
@@ -215,6 +215,6 @@
 fun set ctl day =
     minf <- rpc (monthInfo (day -- #Day));
     Basis.set ctl.Month minf;
-    Basis.set (ChangePoller.ctl ctl.Day) day
+    SourceL.set ctl.Day day
 
-fun value ctl = ChangePoller.value ctl.Day
+fun value ctl = SourceL.value ctl.Day