]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml
This commit was manufactured by cvs2svn to create branch 'helm'.
[helm.git] / helm / DEVEL / lablgtk_gtkmathview / lablgtk-20000829_gtkmathview-0.2.1 / 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 exception NoSelection;;
11
12 class math_view_signals obj = object
13   inherit GContainer.container_signals obj
14   method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after
15   method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after
16   method selection_changed =
17   GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after
18 end
19
20 class math_view obj = object
21  inherit GContainer.container (obj : Gtk_mathview.math_view obj)
22  method connect = new math_view_signals obj
23  method load ~filename =
24   if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename)
25  method unload = MathView.unload obj
26  method has_selection = MathView.has_selection obj
27  method get_selection = MathView.get_selection obj
28  method set_selection node = MathView.set_selection obj node
29  method reset_selection = MathView.reset_selection obj
30  method get_width = MathView.get_width obj
31  method get_height = MathView.get_height obj
32  method get_top = MathView.get_top obj
33  method set_top = MathView.set_top obj
34  method set_adjustments =
35   fun adj1 adj2 ->
36    MathView.set_adjustments obj (GData.as_adjustment adj1)
37    (GData.as_adjustment adj2)
38  method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
39  method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
40  method get_buffer = MathView.get_buffer obj
41  method get_frame = new GBin.frame (MathView.get_frame obj)
42  method set_font_size = MathView.set_font_size obj
43  method get_font_size = MathView.get_font_size obj
44  method set_anti_aliasing = MathView.set_anti_aliasing obj
45  method get_anti_aliasing = MathView.get_anti_aliasing obj
46  method set_kerning = MathView.set_kerning obj
47  method get_kerning = MathView.get_kerning obj
48  method set_log_verbosity = MathView.set_log_verbosity obj
49  method get_log_verbosity = MathView.get_log_verbosity obj
50  method export_to_postscript ~width ~height ~x_margin ~y_margin ~disable_colors ~filename =
51   if not (MathView.export_to_postscript obj ~width ~height ~x_margin ~y_margin ~disable_colors ~filename) then
52    raise (ErrorWritingFile filename)
53  method get_font_manager_type = MathView.get_font_manager_type obj
54  method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type
55 end
56
57 let math_view ?adjustmenth ?adjustmentv ?border_width
58  ?width ?height ?packing ?show ()
59 =
60  let w =
61    MathView.create
62     ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth)
63     ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv)
64     ()
65  in
66   Container.set w ?border_width ?width ?height;
67   pack_return (new math_view w) ~packing ~show
68 ;;