]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/matitaAutoGui.ml
- oCic2NCic and nCic2OCic moved to ng_library
[helm.git] / helm / software / matita / matitaAutoGui.ml
index 23905905bf73b11f16aa1a2a05e7aa40572e399c..588dc5fecd09363f7de821a80eecb261ed083624 100644 (file)
@@ -25,9 +25,9 @@
  *)
 
 type status = 
-  Cic.context * (int * Cic.term * bool * int * (int * Cic.term) list) list * 
+  Cic.context * (int * Cic.term * bool * int * (int * Cic.term Lazy.t) list) list * 
   (int * Cic.term * int) list *
-  Cic.term list
+  Cic.term Lazy.t list
 let fake_goal = Cic.Implicit None;;
 let fake_candidates = [];;
 
@@ -49,25 +49,24 @@ let pp ?(size=(!font_size)) c t =
       ~what:[Cic.Rel 1] ~with_what:[Cic.Implicit None] ~where:t
   in
   (if size > 0 then "<span font_desc=\""^string_of_int size^"\">" else "") ^
-  (Pcre.replace ~pat:"<" ~templ:"&lt;"
-   (Pcre.replace ~pat:">" ~templ:"&gt;"
+  (MatitaGtkMisc.escape_pango_markup
     (ApplyTransformation.txt_of_cic_term ~map_unicode_to_tex:false
-      max_int [] c t)))^
+      max_int [] c t))^
   (if size > 0 then "</span>" else "")
 ;;
 let pp_goal context x = 
   if x == fake_goal then "" else pp context x
 ;;
-let pp_candidate context x = pp context x
-let pp_candidate_tip context x = pp ~size:0 context x
+let pp_candidate context x = pp context (Lazy.force x)
+let pp_candidate_tip context x = pp ~size:0 context (Lazy.force x)
 let pp_candidate_type context x = 
   try 
     let ty, _ = 
       CicTypeChecker.type_of_aux' [] ~subst:[] 
-       context x CicUniv.oblivion_ugraph
+       context (Lazy.force x) CicUniv.oblivion_ugraph
     in
       pp ~size:0 context ty
-  with CicUtil.Meta_not_found _ ->  pp ~size:0 context x
+  with CicUtil.Meta_not_found _ ->  pp ~size:0 context (Lazy.force x)
 ;;
 
 let sublist start len l = 
@@ -161,7 +160,7 @@ let old_displayed_status = ref [];;
 let old_size = ref 0;;
 
 let fill_win (win : MatitaGeneratedGui.autoWin) cb =
-  let init = Unix.gettimeofday () in
+(*   let init = Unix.gettimeofday () in *)
     try 
       let (status : status) = cb () in
       let win_size = win#toplevel#misc#allocation.Gtk.width in
@@ -181,8 +180,10 @@ let fill_win (win : MatitaGeneratedGui.autoWin) cb =
           List.iter win#table#remove win#table#children;
           let height = win#viewportAREA#misc#allocation.Gtk.height in
           elems_to_rows height ctx win_size win#table displayed_status;
+(*
           Printf.eprintf 
             "REDRAW COST: %2.1f\n%!" (Unix.gettimeofday () -.  init);
+*)
         end
     with exn -> prerr_endline (Printexc.to_string exn); ()
 ;;
@@ -214,7 +215,10 @@ let auto_dialog elems =
       Auto.step ();
       win#toplevel#destroy ();
       GMain.Main.quit ();true));
-  let redraw_callback _ = fill_win win elems;true in
+  let redraw_callback _ = 
+    fill_win win elems;
+    true 
+  in
   let redraw = GMain.Timeout.add ~ms:400 ~callback:redraw_callback in
   ignore(win#buttonPAUSE#connect#clicked 
     (fun _ ->