1 (* Copyright (C) 2004, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
28 (** {2 Internal status} *)
30 (* TODO Zack: may be current_proofs if we want an MDI interface *)
31 let (current_proof: MatitaProof.proof option ref) = ref None
35 let untitled_con_uri = UriManager.uri_of_string "cic:/untitled.con"
36 let untitled_def_uri = UriManager.uri_of_string "cic:/untitled.def"
38 (** {2 Initialization} *)
40 let _ = Helm_registry.load_from "matita.conf.xml"
41 let _ = GMain.Main.init ()
42 let gui = new MatitaGui.gui (Helm_registry.get "matita.glade_file")
44 (** quit program, possibly asking for confirmation *)
45 let quit () = GMain.Main.quit ()
48 gui#setQuitCallback quit;
49 gui#main#debugMenu#misc#hide ();
50 ignore (gui#main#newProofMenuItem#connect#activate (fun _ ->
51 if (!current_proof <> None) &&
52 not (ask_confirmation ~gui
53 ~msg:("Starting a new proof will abort current one,\n" ^
54 "are you sure you want to continue?")
57 () (* abort new proof process *)
59 prerr_endline "nuova prova"
60 (* TODO Zack: FINQUI ora mi serve il disambiguatore *)
65 if BuildTimeConf.debug then begin
66 gui#main#debugMenu#misc#show ();
67 let addDebugItem ~label callback =
68 let item = GMenu.menu_item ~label () in
69 gui#main#debugMenu_menu#append item;
70 ignore (item#connect#activate callback)
72 addDebugItem "interactive user uri choice" (fun _ ->
75 interactive_user_uri_choice ~gui ~selection_mode:`MULTIPLE
76 ~msg:"messaggio" ~nonvars_button:true
77 ["cic:/uno.con"; "cic:/due.var"; "cic:/tre.con"; "cic:/quattro.con";
80 List.iter prerr_endline uris
81 with MatitaTypes.No_choice -> MatitaTypes.error "no choice");
82 addDebugItem "toggle auto disambiguation" (fun _ ->
83 Helm_registry.set_bool "matita.auto_disambiguation"
84 (not (Helm_registry.get_bool "matita.auto_disambiguation")))
88 let _ = GtkThread.main ()