1 (* Copyright (C) 2000-2002, 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://cs.unibo.it/helm/.
26 (***************************************************************************)
30 (* 29/01/2003 Claudio Sacerdoti Coen *)
33 (***************************************************************************)
37 (* List utility functions *)
53 (* End of the list utility functions *)
56 class sequent_viewer obj =
59 inherit GMathViewAux.multi_selection_math_view obj
61 val mutable current_infos = None
63 method get_selected_terms =
64 let selections = self#get_selections in
68 ((node : Gdome.element)#getAttributeNS
69 ~namespaceURI:Misc.helmns
70 ~localName:(Gdome.domString "xref"))#to_string
72 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
74 match current_infos with
75 Some (ids_to_terms,_,_) ->
78 Hashtbl.find ids_to_terms id
80 | None -> assert false (* "ERROR: No current term!!!" *)
83 method get_selected_hypotheses =
84 let selections = self#get_selections in
88 ((node : Gdome.element)#getAttributeNS
89 ~namespaceURI:Misc.helmns
90 ~localName:(Gdome.domString "xref"))#to_string
92 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
94 match current_infos with
95 Some (_,_,ids_to_hypotheses) ->
98 Hashtbl.find ids_to_hypotheses id
100 | None -> assert false (* "ERROR: No current term!!!" *)
103 method load_sequent metasenv sequent =
104 let sequent_mml,(ids_to_terms,ids_to_father_ids,ids_to_hypotheses) =
105 mml_of_cic_sequent metasenv sequent
107 self#load_root ~root:sequent_mml#get_documentElement ;
109 Some (ids_to_terms,ids_to_father_ids,ids_to_hypotheses)
113 class proof_viewer obj =
116 inherit GMathViewAux.single_selection_math_view obj
118 (* initializer self#set_log_verbosity 3 *)
120 val mutable current_infos = None
121 val mutable current_mml = None
123 method load_proof (mml:Gdome.document) (metadata:MatitaTypes.hist_metadata) =
124 let (acic, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
125 ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses) =
130 (ids_to_terms,ids_to_father_ids,ids_to_conjectures,ids_to_hypotheses);
131 match current_mml with
133 MatitaTypes.debug_print "no previous MathML";
134 self#load_root ~root:mml#get_documentElement ;
135 current_mml <- Some mml
136 | Some current_mml' ->
137 MatitaTypes.debug_print "Previous MathML available: xmldiffing ...";
139 XmlDiff.update_dom ~from:current_mml' mml ;
146 let sequent_viewer ?hadjustment ?vadjustment ?font_size ?log_verbosity =
147 GtkBase.Widget.size_params
148 ~cont:(OgtkMathViewProps.pack_return (fun p ->
149 OgtkMathViewProps.set_params
150 (new sequent_viewer (GtkMathViewProps.MathView_GMetaDOM.create p))
151 ~font_size ~log_verbosity))
155 let proof_viewer ?hadjustment ?vadjustment ?font_size ?log_verbosity =
156 GtkBase.Widget.size_params
157 ~cont:(OgtkMathViewProps.pack_return (fun p ->
158 OgtkMathViewProps.set_params
159 (new proof_viewer (GtkMathViewProps.MathView_GMetaDOM.create p))
160 ~font_size ~log_verbosity))