X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Fmatita.ml;h=b946ec69bf353f8028f8022f771b5c47130186ea;hb=ac7687ce66526f905874ed99a845223c853c558a;hp=fb163aa9cfac9f0e0dc03db0874d562078b079eb;hpb=3705200c998538c28d8cd9d3ca557616837daf05;p=helm.git diff --git a/helm/matita/matita.ml b/helm/matita/matita.ml index fb163aa9c..b946ec69b 100644 --- a/helm/matita/matita.ml +++ b/helm/matita/matita.ml @@ -26,6 +26,10 @@ 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))) (** *) + +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 + (** *) let _ = GtkThread.main ()