]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matita.ml
snapshot
[helm.git] / helm / matita / matita.ml
1 (* Copyright (C) 2004, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 open MatitaGtkMisc
27
28 exception Not_implemented of string
29 let not_implemented feature = raise (Not_implemented feature)
30
31   (** exceptions whose content should be presented to the user *)
32 exception Failure of string
33 let error s = raise (Failure s)
34
35 let _ = Helm_registry.load_from "matita.conf.xml"
36 let _ = GMain.Main.init ()
37 let gui = new MatitaGui.gui (Helm_registry.get "matita.glade_file")
38
39   (** quit program, possibly asking for confirmation *)
40 let quit () = GMain.Main.quit ()
41 let _ = gui#setQuitCallback quit
42 let _ = gui#main#debugMenu#misc#hide ()
43
44   (** <DEBUGGING> *)
45 if BuildTimeConf.debug then begin
46   gui#main#debugMenu#misc#show ();
47   let addDebugItem ~label callback =
48     let item = GMenu.menu_item ~label () in
49     gui#main#debugMenu_menu#append item;
50     ignore (item#connect#activate callback);
51   in
52   addDebugItem "interactive user uri choice" (fun _ ->
53     try
54       let uris =
55         interactive_user_uri_choice ~gui ~selection_mode:`MULTIPLE
56           ~title:"titolo" ~msg:"messaggio" ~nonvars_button:true
57           ["cic:/uno.con"; "cic:/due.var"; "cic:/tre.con"; "cic:/quattro.con";
58           "cic:/cinque.var"]
59       in
60       List.iter prerr_endline uris
61     with No_choice -> error "no choice");
62   addDebugItem "toggle auto disambiguation" (fun _ ->
63     Helm_registry.set_bool "matita.auto_disambiguation"
64       (not (Helm_registry.get_bool "matita.auto_disambiguation")))
65 end
66   (** </DEBUGGING> *)
67
68 let _ = GtkThread.main ()
69