From e6e86da377812286d8250f04a9e416e100d66091 Mon Sep 17 00:00:00 2001 From: Pascal Brisset Date: Tue, 16 Oct 2007 06:43:08 +0000 Subject: [PATCH] timescale reset to sensitive at the end --- sw/logalizer/play.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sw/logalizer/play.ml b/sw/logalizer/play.ml index bea9f0a4d2..af49462d2a 100644 --- a/sw/logalizer/play.ml +++ b/sw/logalizer/play.ml @@ -132,18 +132,20 @@ let index_of_time = fun log t -> if t <= time_of log.(c) then loop a c else loop (c+1) b in loop 0 (Array.length log - 1) -let rec run log adj i speed = +let rec run = fun timescale log adj i speed -> let (t, ac, m) = log.(i) in Ivy.send (Printf.sprintf "replay%s %s" ac m); adj#set_value t; if i + 1 < Array.length log then let dt = time_of log.(i+1) -. t in - timer := Some (GMain.Timeout.add (truncate (1000. *. dt /. speed#value)) (fun () -> run log adj (i+1) speed; false)) + timer := Some (GMain.Timeout.add (truncate (1000. *. dt /. speed#value)) (fun () -> run timescale log adj (i+1) speed; false)) + else + timescale#misc#set_sensitive true -let play adj speed = +let play = fun timescale adj speed -> stop (); if Array.length !log > 1 then - run !log adj (index_of_time !log adj#value) speed + run timescale !log adj (index_of_time !log adj#value) speed @@ -177,7 +179,7 @@ let _ = let timescale = GRange.scale `HORIZONTAL ~adjustment:adj ~packing:window#vbox#pack () in ignore (file_menu_fact#add_item "Open Log" ~key:GdkKeysyms._O ~callback:(open_log window adj)); - ignore (file_menu_fact#add_item "Play" ~key:GdkKeysyms._X ~callback:(fun () -> timescale#misc#set_sensitive false; play adj speed)); + ignore (file_menu_fact#add_item "Play" ~key:GdkKeysyms._X ~callback:(fun () -> timescale#misc#set_sensitive false; play timescale adj speed)); ignore (file_menu_fact#add_item "Stop" ~key:GdkKeysyms._S ~callback:(fun () -> timescale#misc#set_sensitive true; stop ())); ignore (file_menu_fact#add_item "Quit" ~key:GdkKeysyms._Q ~callback:quit);