]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matita.ml
snapshot, notably:
[helm.git] / helm / matita / matita.ml
index fb163aa9cfac9f0e0dc03db0874d562078b079eb..b946ec69bf353f8028f8022f771b5c47130186ea 100644 (file)
 open Printf
 
 open MatitaGtkMisc
+open MatitaTypes
+open MatitaMisc
+
+module DB = BuildTimeConf.DB
 
 (** {2 Internal status} *)
 
@@ -40,28 +44,19 @@ let (get_proof, set_proof, has_proof) =
    (fun () -> (* has_proof *)
       !current_proof <> None))
 
-(** {2 Settings} *)
-
-let debug_print = MatitaTypes.debug_print
-
-let save_dom =
-  let domImpl = lazy (Gdome.domImplementation ()) in
-  fun ~doc ~dest ->
-    ignore
-      ((Lazy.force domImpl)#saveDocumentToFile ~doc ~name:dest ~indent:true ())
-
 (** {2 Initialization} *)
 
 let _ =
+  Helm_registry.load_from "matita.conf.xml";
   GtkMain.Rc.add_default_file BuildTimeConf.gtkrc;
-  GtkMain.Main.init ()
-let _ = Helm_registry.load_from "matita.conf.xml"
-let _ = GMain.Main.init ()
+  GMain.Main.init ()
 let parserr = new MatitaDisambiguator.parserr ()
-let mqiconn = MQIConn.init ()
+let dbh =
+  new DB.connection ~host:(Helm_registry.get "db.host")
+    ~user:(Helm_registry.get "db.user") (Helm_registry.get "db.database")
 let gui = MatitaGui.instance ()
 let disambiguator =
-  new MatitaDisambiguator.disambiguator ~parserr ~mqiconn
+  new MatitaDisambiguator.disambiguator ~parserr ~dbh
     ~chooseUris:(interactive_user_uri_choice ~gui)
     ~chooseInterp:(interactive_interp_choice ~gui)
     ()
@@ -148,9 +143,24 @@ let _ =
         disambiguator#disambiguateTerm (Stream.of_string input)
       in
       let proof = MatitaProof.proof ~typ:expr ~metasenv () in
-      new_proof proof))
+      new_proof proof));
+  ignore (gui#main#openMenuItem#connect#activate (fun _ ->
+    match gui#chooseFile () with
+    | None -> ()
+    | Some f when is_proof_script f ->
+        gui#script#scriptTextView#buffer#set_text (input_file f)
+    | Some f ->
+        gui#console#echo_error (sprintf
+          "Don't know what to do with file: %s\nUnrecognized file format." f)))
 
   (** <DEBUGGING> *)
+
+let save_dom =
+  let domImpl = lazy (Gdome.domImplementation ()) in
+  fun ~doc ~dest ->
+    ignore
+      ((Lazy.force domImpl)#saveDocumentToFile ~doc ~name:dest ~indent:true ())
+
 let _ =
   if BuildTimeConf.debug then begin
     gui#main#debugMenu#misc#show ();
@@ -181,6 +191,7 @@ let _ =
     addDebugItem "dump proof status to stdout" (fun _ ->
       print_endline ((get_proof ())#toString));
   end
+
   (** </DEBUGGING> *)
 
 let _ = GtkThread.main ()