]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.0/gMathView.ml
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / DEVEL / lablgtk_gtkmathview / lablgtk-20000829_gtkmathview-0.2.0 / gMathView.ml
1 open Gaux
2 open Gtk
3 open Gtk_mathview
4 open GtkBase
5 open GtkMathView
6 open GObj
7
8 exception ErrorLoadingFile of string;;
9 exception ErrorWritingFile of string;;
10
11 class math_view_signals obj = object
12   inherit GContainer.container_signals obj
13   method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after
14   method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after
15   method selection_changed =
16   GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after
17 end
18
19 class math_view obj = object
20  inherit GContainer.container (obj : Gtk_mathview.math_view obj)
21  method connect = new math_view_signals obj
22  method load ~filename =
23   if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename)
24  method unload = MathView.unload obj
25  method get_selection = MathView.get_selection obj
26  method set_selection = MathView.set_selection obj
27  method get_width = MathView.get_width obj
28  method get_height = MathView.get_height obj
29  method get_top = MathView.get_top obj
30  method set_top = MathView.set_top obj
31  method set_adjustments =
32   fun adj1 adj2 ->
33    MathView.set_adjustments obj (GData.as_adjustment adj1)
34    (GData.as_adjustment adj2)
35  method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
36  method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
37  method get_buffer = MathView.get_buffer obj
38  method get_frame = new GBin.frame (MathView.get_frame obj)
39  method set_font_size = MathView.set_font_size obj
40  method get_font_size = MathView.get_font_size obj
41  method set_anti_aliasing = MathView.set_anti_aliasing obj
42  method get_anti_aliasing = MathView.get_anti_aliasing obj
43  method set_kerning = MathView.set_kerning obj
44  method get_kerning = MathView.get_kerning obj
45  method set_log_verbosity = MathView.set_log_verbosity obj
46  method get_log_verbosity = MathView.get_log_verbosity obj
47  method export_to_postscript ~filename =
48   if not (MathView.export_to_postscript obj ~filename) then
49    raise (ErrorWritingFile filename)
50 end
51
52 let math_view ?adjustmenth ?adjustmentv ?(use_t1_lib=false) ?border_width
53  ?width ?height ?packing ?show ()
54 =
55  let w =
56    MathView.create
57     ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth)
58     ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv)
59     ?use_t1_lib
60     ()
61  in
62   Container.set w ?border_width ?width ?height;
63   pack_return (new math_view w) ~packing ~show
64 ;;