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 ~(mml_of_cic_sequent:mml_of_cic_sequent) 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 metasenv sequent =
103 let sequent_mml,(ids_to_terms,ids_to_father_ids,ids_to_hypotheses) =
104 mml_of_cic_sequent metasenv sequent
106 self#load_root ~root:sequent_mml#get_documentElement ;
108 Some (ids_to_terms,ids_to_father_ids,ids_to_hypotheses)
112 class proof_viewer ~(mml_of_cic_object:mml_of_cic_object) obj =
115 inherit GMathViewAux.single_selection_math_view obj
117 val mutable current_infos = None
118 val mutable current_mml = None
120 method load_proof uri currentproof =
122 (acic,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,
123 ids_to_inner_types,ids_to_conjectures,ids_to_hypotheses)
124 = Cic2acic.acic_object_of_cic_object currentproof
128 ~explode_all:true uri acic ids_to_inner_sorts ids_to_inner_types
132 (ids_to_terms,ids_to_father_ids,ids_to_conjectures,ids_to_hypotheses);
133 (match current_mml with
135 self#load_root ~root:mml#get_documentElement ;
136 current_mml <- Some mml
137 | Some current_mml' ->
139 XmlDiff.update_dom ~from:current_mml' mml ;
141 (acic, ids_to_inner_types, ids_to_inner_sorts)
146 let sequent_viewer ~(mml_of_cic_sequent: mml_of_cic_sequent) =
147 GtkBase.Widget.size_params
148 ~cont:(OgtkMathViewProps.pack_return (fun p ->
149 OgtkMathViewProps.set_params
150 (new sequent_viewer ~mml_of_cic_sequent
151 (GtkMathViewProps.MathView_GMetaDOM.create p))
152 ?font_size:None ?log_verbosity:None))
153 ?width:None ?height:None []
155 let proof_viewer ~(mml_of_cic_object: mml_of_cic_object) =
156 GtkBase.Widget.size_params
157 ~cont:(OgtkMathViewProps.pack_return (fun p ->
158 OgtkMathViewProps.set_params
159 (new proof_viewer ~mml_of_cic_object
160 (GtkMathViewProps.MathView_GMetaDOM.create p))
161 ?font_size:None ?log_verbosity:None))
162 ?width:None ?height:None []