1 (* Copyright (C) 2000, 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 (* Claudio Sacerdoti Coen <sacerdot@cs.unibo.it> *)
34 (******************************************************************************)
36 (* GLOBAL CONSTANTS *)
38 let helmns = Gdome.domString "http://www.cs.unibo.it/helm";;
42 " <body bgColor=\"white\">"
50 (* GLOBAL REFERENCES (USED BY CALLBACKS) *)
52 let htmlheader_and_content = ref htmlheader;;
54 let current_cic_infos = ref None;;
55 let current_goal_infos = ref None;;
60 let domImpl = Gdome.domImplementation ();;
64 domImpl#createDocumentFromURI
66 ~uri:("http://phd.cs.unibo.it:8081/getxslt?uri=" ^ name) ?mode:None
68 ~uri:("styles/" ^ name) ()
70 Gdome_xslt.processStylesheet style
73 let d_c = parseStyle "drop_coercions.xsl";;
74 let tc1 = parseStyle "objtheorycontent.xsl";;
75 let hc2 = parseStyle "content_to_html.xsl";;
76 let l = parseStyle "link.xsl";;
78 let c1 = parseStyle "rootcontent.xsl";;
79 let g = parseStyle "genmmlid.xsl";;
80 let c2 = parseStyle "annotatedpres.xsl";;
83 let getterURL = Configuration.getter_url;;
84 let processorURL = Configuration.processor_url;;
86 let processorURL = "http://phd.cs.unibo.it:8080/helm/servelt/uwobo/";;
87 let getterURL = "http://phd.cs.unibo.it:8081/";;
88 let processorURL = "http://localhost:8080/helm/servelt/uwobo/";;
89 let getterURL = "http://localhost:8081/";;
92 let mml_styles = [d_c ; c1 ; g ; c2 ; l];;
94 ["processorURL", "'" ^ processorURL ^ "'" ;
95 "getterURL", "'" ^ getterURL ^ "'" ;
96 "draw_graphURL", "'http%3A//phd.cs.unibo.it%3A8083/'" ;
97 "uri_set_queueURL", "'http%3A//phd.cs.unibo.it%3A8084/'" ;
98 "UNICODEvsSYMBOL", "'symbol'" ;
99 "doctype-public", "'-//W3C//DTD%20XHTML%201.0%20Transitional//EN'" ;
100 "encoding", "'iso-8859-1'" ;
101 "media-type", "'text/html'" ;
102 "keys", "'d_c%2CC1%2CG%2CC2%2CL'" ;
103 "interfaceURL", "'http%3A//phd.cs.unibo.it/helm/html/cic/index.html'" ;
104 "naturalLanguage", "'yes'" ;
105 "annotations", "'no'" ;
106 "explodeall", "'true()'" ;
107 "topurl", "'http://phd.cs.unibo.it/helm'" ;
108 "CICURI", "'cic:/Coq/Init/Datatypes/bool_ind.con'" ]
111 let sequent_styles = [d_c ; c1 ; g ; c2 ; l];;
113 ["processorURL", "'" ^ processorURL ^ "'" ;
114 "getterURL", "'" ^ getterURL ^ "'" ;
115 "draw_graphURL", "'http%3A//phd.cs.unibo.it%3A8083/'" ;
116 "uri_set_queueURL", "'http%3A//phd.cs.unibo.it%3A8084/'" ;
117 "UNICODEvsSYMBOL", "'symbol'" ;
118 "doctype-public", "'-//W3C//DTD%20XHTML%201.0%20Transitional//EN'" ;
119 "encoding", "'iso-8859-1'" ;
120 "media-type", "'text/html'" ;
121 "keys", "'d_c%2CC1%2CG%2CC2%2CL'" ;
122 "interfaceURL", "'http%3A//phd.cs.unibo.it/helm/html/cic/index.html'" ;
123 "naturalLanguage", "'no'" ;
124 "annotations", "'no'" ;
125 "explodeall", "'true()'" ;
126 "topurl", "'http://phd.cs.unibo.it/helm'" ;
127 "CICURI", "'cic:/Coq/Init/Datatypes/bool_ind.con'" ]
130 let parse_file filename =
131 let inch = open_in filename in
132 let rec read_lines () =
134 let line = input_line inch in
142 let applyStylesheets input styles args =
143 List.fold_left (fun i style -> Gdome_xslt.applyStylesheet i style args)
147 let mml_of_cic_object uri annobj ids_to_inner_sorts ids_to_inner_types =
149 Cic2Xml.print_object uri ids_to_inner_sorts annobj
152 Cic2Xml.print_inner_types uri ids_to_inner_sorts
155 let input = Xml2Gdome.document_of_xml domImpl xml in
156 (*CSC: We save the innertypes to disk so that we can retrieve them in the *)
157 (*CSC: stylesheet. This DOES NOT work when UWOBO and/or the getter are not *)
159 Xml.pp xmlinnertypes (Some "/public/sacerdot/innertypes") ;
160 let output = applyStylesheets input mml_styles mml_args in
167 let refresh_proof (output : GMathView.math_view) =
168 let uri,currentproof =
169 match !ProofEngine.proof with
171 | Some (uri,metasenv,bo,ty) ->
172 uri,(Cic.CurrentProof (UriManager.name_of_uri uri, metasenv, bo, ty))
175 (acic,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_inner_types)
177 Cic2acic.acic_object_of_cic_object currentproof
179 let mml = mml_of_cic_object uri acic ids_to_inner_sorts ids_to_inner_types in
180 output#load_tree mml ;
181 current_cic_infos := Some (ids_to_terms,ids_to_father_ids)
184 let refresh_sequent (proofw : GMathView.math_view) =
185 match !ProofEngine.goal with
186 None -> proofw#unload
187 | Some (_,currentsequent) ->
189 match !ProofEngine.proof with
191 | Some (_,metasenv,_,_) -> metasenv
193 let sequent_gdome,ids_to_terms,ids_to_father_ids =
194 SequentPp.XmlPp.print_sequent metasenv currentsequent
197 Xml2Gdome.document_of_xml domImpl sequent_gdome
200 applyStylesheets sequent_doc sequent_styles sequent_args
202 proofw#load_tree ~dom:sequent_mml ;
203 current_goal_infos := Some (ids_to_terms,ids_to_father_ids)
205 ignore(domImpl#saveDocumentToFile ~doc:sequent_doc
206 ~name:"/public/sacerdot/guruguru1" ~indent:true ()) ;
207 ignore(domImpl#saveDocumentToFile ~doc:sequent_mml
208 ~name:"/public/sacerdot/guruguru2" ~indent:true ())
212 let output_html outputhtml msg =
213 htmlheader_and_content := !htmlheader_and_content ^ msg ;
214 outputhtml#source (!htmlheader_and_content ^ htmlfooter) ;
215 outputhtml#set_topline (-1)
218 (***********************)
220 (***********************)
222 let call_tactic tactic rendering_window () =
223 let proofw = (rendering_window#proofw : GMathView.math_view) in
224 let output = (rendering_window#output : GMathView.math_view) in
225 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
226 let savedproof = !ProofEngine.proof in
227 let savedgoal = !ProofEngine.goal in
231 refresh_sequent proofw ;
235 output_html outputhtml
236 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>") ;
237 ProofEngine.proof := savedproof ;
238 ProofEngine.goal := savedgoal ;
242 let call_tactic_with_input tactic rendering_window () =
243 let proofw = (rendering_window#proofw : GMathView.math_view) in
244 let output = (rendering_window#output : GMathView.math_view) in
245 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
246 let inputt = (rendering_window#inputt : GEdit.text) in
247 let savedproof = !ProofEngine.proof in
248 let savedgoal = !ProofEngine.goal in
249 (*CSC: Gran cut&paste da sotto... *)
250 let inputlen = inputt#length in
251 let input = inputt#get_chars 0 inputlen ^ "\n" in
252 let lexbuf = Lexing.from_string input in
254 match !ProofEngine.proof with
256 | Some (curi,_,_,_) -> curi
260 (function (_,n,_) -> n)
261 (match !ProofEngine.goal with
263 | Some (_,(ctx,_)) -> ctx
269 CicTextualParserContext.main curi context CicTextualLexer.token lexbuf
274 refresh_sequent proofw ;
278 CicTextualParser0.Eof ->
279 inputt#delete_text 0 inputlen
281 prerr_endline ("? " ^ Printexc.to_string e) ; flush stderr ;
282 output_html outputhtml
283 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>");
284 ProofEngine.proof := savedproof ;
285 ProofEngine.goal := savedgoal
288 let call_tactic_with_goal_input tactic rendering_window () =
289 let module L = LogicalOperations in
290 let module G = Gdome in
291 let proofw = (rendering_window#proofw : GMathView.math_view) in
292 let output = (rendering_window#output : GMathView.math_view) in
293 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
294 let savedproof = !ProofEngine.proof in
295 let savedgoal = !ProofEngine.goal in
296 match proofw#get_selection with
299 ((node : Gdome.element)#getAttributeNS
301 ~localName:(G.domString "xref"))#to_string
303 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
307 match !current_goal_infos with
308 Some (ids_to_terms, ids_to_father_ids) ->
310 tactic (Hashtbl.find ids_to_terms id) ;
311 refresh_sequent rendering_window#proofw ;
312 refresh_proof rendering_window#output
313 | None -> assert false (* "ERROR: No current term!!!" *)
316 prerr_endline ("? " ^ Printexc.to_string e) ; flush stderr ;
317 output_html outputhtml
318 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
321 output_html outputhtml
322 ("<h1 color=\"red\">No term selected</h1>")
325 let call_tactic_with_input_and_goal_input tactic rendering_window () =
326 let module L = LogicalOperations in
327 let module G = Gdome in
328 let proofw = (rendering_window#proofw : GMathView.math_view) in
329 let output = (rendering_window#output : GMathView.math_view) in
330 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
331 let inputt = (rendering_window#inputt : GEdit.text) in
332 let savedproof = !ProofEngine.proof in
333 let savedgoal = !ProofEngine.goal in
334 match proofw#get_selection with
337 ((node : Gdome.element)#getAttributeNS
339 ~localName:(G.domString "xref"))#to_string
341 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
345 match !current_goal_infos with
346 Some (ids_to_terms, ids_to_father_ids) ->
348 (* Let's parse the input *)
349 let inputlen = inputt#length in
350 let input = inputt#get_chars 0 inputlen ^ "\n" in
351 let lexbuf = Lexing.from_string input in
353 match !ProofEngine.proof with
355 | Some (curi,_,_,_) -> curi
359 (function (_,n,_) -> n)
360 (match !ProofEngine.goal with
362 | Some (_,(ctx,_)) -> ctx
369 CicTextualParserContext.main curi context
370 CicTextualLexer.token lexbuf
374 tactic ~goal_input:(Hashtbl.find ids_to_terms id)
376 refresh_sequent proofw ;
380 CicTextualParser0.Eof ->
381 inputt#delete_text 0 inputlen
383 | None -> assert false (* "ERROR: No current term!!!" *)
386 prerr_endline ("? " ^ Printexc.to_string e) ; flush stderr ;
387 output_html outputhtml
388 ("<h1 color=\"red\">" ^ Printexc.to_string e ^ "</h1>")
391 output_html outputhtml
392 ("<h1 color=\"red\">No term selected</h1>")
395 let intros rendering_window = call_tactic ProofEngine.intros rendering_window;;
396 let exact rendering_window =
397 call_tactic_with_input ProofEngine.exact rendering_window
399 let apply rendering_window =
400 call_tactic_with_input ProofEngine.apply rendering_window
402 let elim rendering_window =
403 call_tactic_with_input ProofEngine.elim rendering_window
405 let whd rendering_window =
406 call_tactic_with_goal_input ProofEngine.whd rendering_window
408 let reduce rendering_window =
409 call_tactic_with_goal_input ProofEngine.reduce rendering_window
411 let simpl rendering_window =
412 call_tactic_with_goal_input ProofEngine.simpl rendering_window
414 let fold rendering_window =
415 call_tactic_with_input ProofEngine.fold rendering_window
417 let cut rendering_window =
418 call_tactic_with_input ProofEngine.cut rendering_window
420 let change rendering_window =
421 call_tactic_with_input_and_goal_input ProofEngine.change rendering_window
427 (**********************)
429 (**********************)
431 exception OpenConjecturesStillThere;;
432 exception WrongProof;;
434 let save rendering_window () =
435 match !ProofEngine.proof with
437 | Some (uri,[],bo,ty) ->
438 if CicReduction.are_convertible (CicTypeChecker.type_of_aux' [] [] bo) ty then
440 (*CSC: Wrong: [] is just plainly wrong *)
441 let proof = Cic.Definition (UriManager.name_of_uri uri,bo,ty,[]) in
443 (acic,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,
446 Cic2acic.acic_object_of_cic_object proof
449 mml_of_cic_object uri acic ids_to_inner_sorts ids_to_inner_types
451 (rendering_window#output : GMathView.math_view)#load_tree mml ;
452 current_cic_infos := Some (ids_to_terms,ids_to_father_ids)
456 | _ -> raise OpenConjecturesStillThere
459 let proveit rendering_window () =
460 let module L = LogicalOperations in
461 let module G = Gdome in
462 match rendering_window#output#get_selection with
465 ((node : Gdome.element)#getAttributeNS
467 ((element : G.element)#getAttributeNS
470 ~localName:(G.domString "xref"))#to_string
472 if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
476 match !current_cic_infos with
477 Some (ids_to_terms, ids_to_father_ids) ->
479 if L.to_sequent id ids_to_terms ids_to_father_ids then
480 refresh_proof rendering_window#output ;
481 refresh_sequent rendering_window#proofw
482 | None -> assert false (* "ERROR: No current term!!!" *)
484 e -> print_endline ("Error: " ^ Printexc.to_string e) ; flush stdout
486 | None -> assert false (* "ERROR: No selection!!!" *)
489 let state rendering_window () =
490 let inputt = (rendering_window#inputt : GEdit.text) in
491 let oldinputt = (rendering_window#oldinputt : GEdit.text) in
492 let outputhtml = (rendering_window#outputhtml : GHtml.xmhtml) in
493 let output = (rendering_window#output : GMathView.math_view) in
494 let proofw = (rendering_window#proofw : GMathView.math_view) in
495 let inputlen = inputt#length in
496 let input = inputt#get_chars 0 inputlen ^ "\n" in
497 (* Do something interesting *)
498 let lexbuf = Lexing.from_string input in
501 (* Execute the actions *)
502 match CicTextualParser.main CicTextualLexer.token lexbuf with
506 let _ = CicTypeChecker.type_of_aux' [] [] expr in
508 Some (UriManager.uri_of_string "cic:/dummy.con",
509 [1,expr], Cic.Meta 1, expr) ;
510 ProofEngine.goal := Some (1,([],expr)) ;
511 refresh_sequent proofw ;
512 refresh_proof output ;
515 print_endline ("? " ^ CicPp.ppterm expr) ;
519 CicTextualParser0.Eof ->
520 inputt#delete_text 0 inputlen ;
521 ignore(oldinputt#insert_text input oldinputt#length) ;
523 print_endline ("Error: " ^ Printexc.to_string e) ; flush stdout
527 (mmlwidget : GMathView.math_view) (element : Gdome.element option)
529 let module G = Gdome in
530 let rec aux element =
531 if element#hasAttributeNS
533 ~localName:(G.domString "xref")
535 mmlwidget#set_selection (Some element)
537 match element#get_parentNode with
539 (*CSC: OCAML DIVERGES!
540 | Some p -> aux (new G.element_of_node p)
542 | Some p -> aux (new Gdome.element_of_node p)
546 | None -> mmlwidget#set_selection None
549 (* STUFF TO BUILD THE GTK INTERFACE *)
551 (* Stuff for the widget settings *)
553 let export_to_postscript (output : GMathView.math_view) () =
554 output#export_to_postscript ~filename:"output.ps" ();
557 let activate_t1 (output : GMathView.math_view) button_set_anti_aliasing
558 button_set_kerning button_set_transparency button_export_to_postscript
561 let is_set = button_t1#active in
562 output#set_font_manager_type
563 (if is_set then `font_manager_t1 else `font_manager_gtk) ;
566 button_set_anti_aliasing#misc#set_sensitive true ;
567 button_set_kerning#misc#set_sensitive true ;
568 button_set_transparency#misc#set_sensitive true ;
569 button_export_to_postscript#misc#set_sensitive true ;
573 button_set_anti_aliasing#misc#set_sensitive false ;
574 button_set_kerning#misc#set_sensitive false ;
575 button_set_transparency#misc#set_sensitive false ;
576 button_export_to_postscript#misc#set_sensitive false ;
580 let set_anti_aliasing output button_set_anti_aliasing () =
581 output#set_anti_aliasing button_set_anti_aliasing#active
584 let set_kerning output button_set_kerning () =
585 output#set_kerning button_set_kerning#active
588 let set_transparency output button_set_transparency () =
589 output#set_transparency button_set_transparency#active
592 let changefont output font_size_spinb () =
593 output#set_font_size font_size_spinb#value_as_int
596 let set_log_verbosity output log_verbosity_spinb () =
597 output#set_log_verbosity log_verbosity_spinb#value_as_int
600 class settings_window (output : GMathView.math_view) sw
601 button_export_to_postscript selection_changed_callback
603 let settings_window = GWindow.window ~title:"GtkMathView settings" () in
605 GPack.vbox ~packing:settings_window#add () in
608 ~rows:1 ~columns:3 ~homogeneous:false ~row_spacings:5 ~col_spacings:5
609 ~border_width:5 ~packing:vbox#add () in
611 GButton.toggle_button ~label:"activate t1 fonts"
612 ~packing:(table#attach ~left:0 ~top:0) () in
613 let button_set_anti_aliasing =
614 GButton.toggle_button ~label:"set_anti_aliasing"
615 ~packing:(table#attach ~left:0 ~top:1) () in
616 let button_set_kerning =
617 GButton.toggle_button ~label:"set_kerning"
618 ~packing:(table#attach ~left:1 ~top:1) () in
619 let button_set_transparency =
620 GButton.toggle_button ~label:"set_transparency"
621 ~packing:(table#attach ~left:2 ~top:1) () in
624 ~rows:2 ~columns:2 ~homogeneous:false ~row_spacings:5 ~col_spacings:5
625 ~border_width:5 ~packing:vbox#add () in
626 let font_size_label =
627 GMisc.label ~text:"font size:"
628 ~packing:(table#attach ~left:0 ~top:0 ~expand:`NONE) () in
629 let font_size_spinb =
631 GData.adjustment ~value:14.0 ~lower:5.0 ~upper:50.0 ~step_incr:1.0 ()
634 ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:0 ~fill:`NONE) () in
635 let log_verbosity_label =
636 GMisc.label ~text:"log verbosity:"
637 ~packing:(table#attach ~left:0 ~top:1) () in
638 let log_verbosity_spinb =
640 GData.adjustment ~value:0.0 ~lower:0.0 ~upper:3.0 ~step_incr:1.0 ()
643 ~adjustment:sadj ~packing:(table#attach ~left:1 ~top:1) () in
645 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
647 GButton.button ~label:"Close"
648 ~packing:(hbox#pack ~expand:false ~fill:false ~padding:5) () in
650 method show = settings_window#show
652 button_set_anti_aliasing#misc#set_sensitive false ;
653 button_set_kerning#misc#set_sensitive false ;
654 button_set_transparency#misc#set_sensitive false ;
655 (* Signals connection *)
656 ignore(button_t1#connect#clicked
657 (activate_t1 output button_set_anti_aliasing button_set_kerning
658 button_set_transparency button_export_to_postscript button_t1)) ;
659 ignore(font_size_spinb#connect#changed (changefont output font_size_spinb)) ;
660 ignore(button_set_anti_aliasing#connect#toggled
661 (set_anti_aliasing output button_set_anti_aliasing));
662 ignore(button_set_kerning#connect#toggled
663 (set_kerning output button_set_kerning)) ;
664 ignore(button_set_transparency#connect#toggled
665 (set_transparency output button_set_transparency)) ;
666 ignore(log_verbosity_spinb#connect#changed
667 (set_log_verbosity output log_verbosity_spinb)) ;
668 ignore(closeb#connect#clicked settings_window#misc#hide)
673 class rendering_window output proofw (label : GMisc.label) =
675 GWindow.window ~title:"MathML viewer" ~border_width:2 () in
677 GPack.hbox ~packing:window#add () in
679 GPack.vbox ~packing:(hbox0#pack ~expand:false ~fill:false ~padding:5) () in
680 let _ = vbox#pack ~expand:false ~fill:false ~padding:5 label#coerce in
681 let scrolled_window0 =
682 GBin.scrolled_window ~border_width:10
683 ~packing:(vbox#pack ~expand:true ~padding:5) () in
684 let _ = scrolled_window0#add output#coerce in
686 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
688 GButton.button ~label:"Settings"
689 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
690 let button_export_to_postscript =
691 GButton.button ~label:"export_to_postscript"
692 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
694 GButton.button ~label:"Save"
695 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
697 GButton.button ~label:"Close"
698 ~packing:(hbox1#pack ~expand:false ~fill:false ~padding:5) () in
700 GPack.hbox ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
702 GButton.button ~label:"Prove It"
703 ~packing:(hbox2#pack ~expand:false ~fill:false ~padding:5) () in
704 let oldinputt = GEdit.text ~editable:false ~width:400 ~height:180
705 ~packing:(vbox#pack ~padding:5) () in
707 GButton.button ~label:"State"
708 ~packing:(vbox#pack ~expand:false ~fill:false ~padding:5) () in
709 let inputt = GEdit.text ~editable:true ~width:400 ~height: 100
710 ~packing:(vbox#pack ~padding:5) () in
712 GPack.vbox ~packing:(hbox0#pack ~expand:false ~fill:false ~padding:5) () in
713 let scrolled_window1 =
714 GBin.scrolled_window ~border_width:10
715 ~packing:(vbox1#pack ~expand:true ~padding:5) () in
716 let _ = scrolled_window1#add proofw#coerce in
718 GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
720 GButton.button ~label:"Exact"
721 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
723 GButton.button ~label:"Intros"
724 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
726 GButton.button ~label:"Apply"
727 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
729 GButton.button ~label:"Elim"
730 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
732 GButton.button ~label:"Whd"
733 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
735 GButton.button ~label:"Reduce"
736 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
738 GButton.button ~label:"Simpl"
739 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
741 GButton.button ~label:"Fold"
742 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
744 GButton.button ~label:"Cut"
745 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
747 GButton.button ~label:"Change"
748 ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
751 ~source:"<html><body bgColor=\"white\"></body></html>"
752 ~width:400 ~height: 200
753 ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5)
756 method outputhtml = outputhtml
757 method oldinputt = oldinputt
758 method inputt = inputt
759 method output = (output : GMathView.math_view)
760 method proofw = (proofw : GMathView.math_view)
761 method show () = window#show ()
763 button_export_to_postscript#misc#set_sensitive false ;
765 (* signal handlers here *)
766 ignore(output#connect#selection_changed
767 (function elem -> proofw#unload ; choose_selection output elem)) ;
768 ignore(proofw#connect#selection_changed (choose_selection proofw)) ;
769 ignore(closeb#connect#clicked (fun _ -> GMain.Main.quit ())) ;
770 let settings_window = new settings_window output scrolled_window0
771 button_export_to_postscript (choose_selection output) in
772 ignore(settingsb#connect#clicked settings_window#show) ;
773 ignore(button_export_to_postscript#connect#clicked (export_to_postscript output)) ;
774 ignore(saveb#connect#clicked (save self)) ;
775 ignore(proveitb#connect#clicked (proveit self)) ;
776 ignore(window#event#connect#delete (fun _ -> GMain.Main.quit () ; true )) ;
777 ignore(stateb#connect#clicked (state self)) ;
778 ignore(exactb#connect#clicked (exact self)) ;
779 ignore(applyb#connect#clicked (apply self)) ;
780 ignore(elimb#connect#clicked (elim self)) ;
781 ignore(whdb#connect#clicked (whd self)) ;
782 ignore(reduceb#connect#clicked (reduce self)) ;
783 ignore(simplb#connect#clicked (simpl self)) ;
784 ignore(foldb#connect#clicked (fold self)) ;
785 ignore(cutb#connect#clicked (cut self)) ;
786 ignore(changeb#connect#clicked (change self)) ;
787 ignore(introsb#connect#clicked (intros self)) ;
788 Logger.log_callback :=
789 (Logger.log_to_html ~print_and_flush:(output_html outputhtml))
794 let initialize_everything () =
795 let module U = Unix in
796 let output = GMathView.math_view ~width:400 ~height:280 ()
797 and proofw = GMathView.math_view ~width:400 ~height:275 ()
798 and label = GMisc.label ~text:"gTopLevel" () in
799 let rendering_window =
800 new rendering_window output proofw label
802 rendering_window#show () ;
808 ignore (GtkMain.Main.init ()) ;
809 initialize_everything ()