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 *)
55 class sequent_viewer obj =
58 inherit GMathViewAux.multi_selection_math_view obj
60 val mutable current_infos = None
62 method get_selected_terms =
63 let selections = self#get_selections in
67 ((node : Gdome.element)#getAttributeNS
68 ~namespaceURI:Misc.helmns
69 ~localName:(Gdome.domString "xref"))#to_string
71 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
73 match current_infos with
74 Some (ids_to_terms,_,_) ->
77 Hashtbl.find ids_to_terms id
79 | None -> assert false (* "ERROR: No current term!!!" *)
82 method get_selected_hypotheses =
83 let selections = self#get_selections in
87 ((node : Gdome.element)#getAttributeNS
88 ~namespaceURI:Misc.helmns
89 ~localName:(Gdome.domString "xref"))#to_string
91 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
93 match current_infos with
94 Some (_,_,ids_to_hypotheses) ->
97 Hashtbl.find ids_to_hypotheses id
99 | None -> assert false (* "ERROR: No current term!!!" *)
102 method load_sequent (mml:Gdome.document) (metadata:MatitaTypes.hist_metadata)
105 let (annconjecture, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
109 List.assoc sequent_no (snd metadata)
110 with Not_found -> assert false
112 current_infos <- Some (ids_to_terms, ids_to_father_ids, ids_to_hypotheses);
113 self#load_root ~root:mml#get_documentElement
116 class proof_viewer obj =
119 inherit GMathViewAux.single_selection_math_view obj
121 (* initializer self#set_log_verbosity 3 *)
123 val mutable current_infos = None
124 val mutable current_mml = None
126 method load_proof (mml:Gdome.document) (metadata:MatitaTypes.hist_metadata) =
127 let (acic, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts,
128 ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses) =
133 (ids_to_terms,ids_to_father_ids,ids_to_conjectures,ids_to_hypotheses);
134 match current_mml with
136 MatitaTypes.debug_print "no previous MathML";
137 self#load_root ~root:mml#get_documentElement ;
138 current_mml <- Some mml
139 | Some current_mml' ->
140 MatitaTypes.debug_print "Previous MathML available: xmldiffing ...";
142 XmlDiff.update_dom ~from:current_mml' mml ;
148 let sequent_viewer ?hadjustment ?vadjustment ?font_size ?log_verbosity =
149 GtkBase.Widget.size_params
150 ~cont:(OgtkMathViewProps.pack_return (fun p ->
151 OgtkMathViewProps.set_params
152 (new sequent_viewer (GtkMathViewProps.MathView_GMetaDOM.create p))
153 ~font_size ~log_verbosity))
156 let proof_viewer ?hadjustment ?vadjustment ?font_size ?log_verbosity =
157 GtkBase.Widget.size_params
158 ~cont:(OgtkMathViewProps.pack_return (fun p ->
159 OgtkMathViewProps.set_params
160 (new proof_viewer (GtkMathViewProps.MathView_GMetaDOM.create p))
161 ~font_size ~log_verbosity))