paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4087] add right button to reset y scale


From: Pascal Brisset
Subject: [paparazzi-commits] [4087] add right button to reset y scale
Date: Sat, 05 Sep 2009 10:16:36 +0000

Revision: 4087
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4087
Author:   hecto
Date:     2009-09-05 10:16:35 +0000 (Sat, 05 Sep 2009)
Log Message:
-----------
 add right button to reset y scale

Modified Paths:
--------------
    paparazzi3/trunk/sw/logalizer/plotter.ml

Modified: paparazzi3/trunk/sw/logalizer/plotter.ml
===================================================================
--- paparazzi3/trunk/sw/logalizer/plotter.ml    2009-09-05 09:50:36 UTC (rev 
4086)
+++ paparazzi3/trunk/sw/logalizer/plotter.ml    2009-09-05 10:16:35 UTC (rev 
4087)
@@ -159,6 +159,20 @@
          max <- Pervasives.max max v
        end
 
+    method reset_scale = fun () ->
+      min <- max_float;
+      max <- -. max_float;
+      Hashtbl.iter (* for all curves *)
+       (fun name a ->
+         Array.iter (* for all values *)
+           (function
+               None -> ()
+             | Some v ->
+                 min <- Pervasives.min min v;
+                 max <- Pervasives.max max v)
+           a.array)
+       curves
+       
     method shift = fun () ->
       Hashtbl.iter
        (fun _ a ->
@@ -287,6 +301,14 @@
       self#stop_timer ();
       dt <- delay;
       timer <- Some (GMain.Timeout.add (truncate (dt*.1000.)) (fun () 
->self#update_curves (); true))
+
+    method button_press = fun ev ->
+      match GdkEvent.Button.button ev with
+       3 -> self#reset_scale (); true
+      | _ -> false
+
+    initializer ignore (self#drawing_area#event#add [`BUTTON_PRESS])
+    initializer ignore (self#drawing_area#event#connect#button_press 
~callback:self#button_press);
   end
 
 let update_time = ref 0.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]