]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matita.ml
various updates, removed proofs for now because they are the real bottleneck!!
[helm.git] / helm / matita / matita.ml
index cf7939fa7c7ce10300751c9db2a17e3e0dc42492..6e2fe2526e7d0d53d089a9ebaef533e7a11abe97 100644 (file)
@@ -37,7 +37,7 @@ let _ =
   MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
   MatitaDb.clean_owner_environment ();
   MatitaDb.create_owner_environment ();
-  GtkMain.Rc.add_default_file BuildTimeConf.gtkrc;  (* loads gtk rc files *)
+  GtkMain.Rc.add_default_file BuildTimeConf.gtkrc_file; (* loads gtk rc *)
   ignore (GMain.Main.init ());
 
   (* environment trust *)
@@ -52,6 +52,20 @@ let gui = MatitaGui.instance ()
 let _ =
   ignore (gui#main#newCicBrowserMenuItem#connect#activate (fun _ ->
     ignore (MatitaMathView.cicBrowser ())));
+  (* font sizes *)
+  ignore (gui#main#increaseFontSizeMenuItem#connect#activate (fun _ ->
+    gui#increaseFontSize ();
+    MatitaMathView.increase_font_size ();
+    MatitaMathView.update_font_sizes ()));
+  ignore (gui#main#decreaseFontSizeMenuItem#connect#activate (fun _ ->
+    gui#decreaseFontSize ();
+    MatitaMathView.decrease_font_size ();
+    MatitaMathView.update_font_sizes ()));
+  ignore (gui#main#normalFontSizeMenuItem#connect#activate (fun _ ->
+    gui#resetFontSize ();
+    MatitaMathView.reset_font_size ();
+    MatitaMathView.update_font_sizes ()));
+  MatitaMathView.reset_font_size ();
   (* disambiguator callback *)
   MatitaDisambiguator.set_choose_uris_callback
     (MatitaGui.interactive_uri_choice ());
@@ -60,7 +74,7 @@ let _ =
 
 let script =
   MatitaScript.script 
-    ~buffer:gui#main#scriptTextView#buffer
+    ~buffer:gui#sourceView#buffer
     ~init:(Lazy.force MatitaEngine.initial_status) 
     ~mathviewer:(MatitaMathView.mathViewer ())
     ~urichooser:(fun uris ->
@@ -68,10 +82,11 @@ let script =
         MatitaGui.interactive_uri_choice ~selection_mode:`SINGLE
         ~title:"Matita: URI chooser" 
         ~msg:"Select the URI" ~hide_uri_entry:true
-        ~hide_try:true ~ok_label:"_Apply" 
-        ~copy_cb:(fun s -> gui#main#scriptTextView#buffer#insert ("\n"^s^"\n"))
+        ~hide_try:true ~ok_label:"_Apply" ~ok_action:`SELECT
+        ~copy_cb:(fun s -> gui#sourceView#buffer#insert ("\n"^s^"\n"))
         () ~id:"boh?" uris
       with MatitaTypes.Cancel -> [])
+    ~set_star:gui#setStar
     ()
 
   (* math viewers *)
@@ -79,7 +94,7 @@ let _ =
   let sequent_viewer = MatitaMathView.sequentViewer_instance () in
   let sequents_viewer = MatitaMathView.sequentsViewer_instance () in
   sequent_viewer#set_href_callback
-    (Some (fun uri -> (MatitaMathView.cicBrowser ())#load (`Uri uri)));
+    (Some (fun uri -> (MatitaMathView.cicBrowser ())#load (`Uri (UriManager.uri_of_string uri))));
   let browser_observer _ = MatitaMathView.refresh_all_browsers () in
   let sequents_observer status =
     sequents_viewer#reset;
@@ -142,10 +157,24 @@ let _ =
       (fun _ ->
          if script#onGoingProof () then
            MatitaLog.debug (CicMetaSubst.ppmetasenv script#proofMetasenv []));
+    addDebugItem "dump coercions Db" (fun _ ->
+      List.iter (
+        fun (s,t,u) -> 
+          MatitaLog.debug (
+            UriManager.name_of_uri u ^ ":" ^ 
+            UriManager.name_of_uri s ^ " -> " ^ UriManager.name_of_uri t))
+      (CoercDb.to_list ())
+    );
     addDebugItem "rotate light bulbs"
       (fun _ ->
          let nb = gui#main#hintNotebook in
          nb#goto_page ((nb#current_page + 1) mod 3));
+         (*
+    addDebugItem "print (on stdout) \"statement\" grammar entry"
+      (fun _ ->
+        Grammar.print_entry Format.std_formatter
+          (Grammar.Entry.obj CicTextualParser2.statement);
+        Format.pp_print_flush Format.std_formatter ());*)
   end
 
   (** </DEBUGGING> *)
@@ -163,9 +192,12 @@ let _ =
   if Filename.basename Sys.argv.(0) = "cicbrowser" then begin (* cicbrowser *)
     Helm_registry.set "matita.mode" "cicbrowser";
     let browser = MatitaMathView.cicBrowser () in
-    try
-      browser#load (`Uri Sys.argv.(1))
-    with Invalid_argument _ -> ()
+    let entry =
+      try
+        `Uri (UriManager.uri_of_string Sys.argv.(1))
+      with Invalid_argument _ -> `Dir "cic:/"
+    in
+    browser#load entry
   end else begin  (* matita *)
     Helm_registry.set "matita.mode" "matita";
     gui#main#mainWin#show ();