8 exception ErrorLoadingFile of string;;
9 exception ErrorWritingFile of string;;
10 exception NoSelection;;
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
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 get_selection = MathView.get_selection obj
27 method set_selection (node : Ominidom.o_mDOMNode option) = MathView.set_selection obj node
28 method get_width = MathView.get_width obj
29 method get_height = MathView.get_height obj
30 method get_top = MathView.get_top obj
31 method set_top = MathView.set_top obj
32 method set_adjustments =
34 MathView.set_adjustments obj (GData.as_adjustment adj1)
35 (GData.as_adjustment adj2)
36 method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
37 method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
38 method get_buffer = MathView.get_buffer obj
39 method get_frame = new GBin.frame (MathView.get_frame obj)
40 method set_font_size = MathView.set_font_size obj
41 method get_font_size = MathView.get_font_size obj
42 method set_anti_aliasing = MathView.set_anti_aliasing obj
43 method get_anti_aliasing = MathView.get_anti_aliasing obj
44 method set_kerning = MathView.set_kerning obj
45 method get_kerning = MathView.get_kerning obj
46 method set_log_verbosity = MathView.set_log_verbosity obj
47 method get_log_verbosity = MathView.get_log_verbosity obj
48 method export_to_postscript
49 ?(width = 595) ?(height = 822) ?(x_margin = 72) ?(y_margin = 72)
50 ?(disable_colors = false) ~filename () =
51 let result = MathView.export_to_postscript obj
52 ~width ~height ~x_margin ~y_margin ~disable_colors ~filename
54 if not result then raise (ErrorWritingFile filename)
55 method get_font_manager_type = MathView.get_font_manager_type obj
56 method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type
59 let math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width
60 ?width ?height ?packing ?show () =
63 ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth)
64 ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv)
67 Container.set w ?border_width ?width ?height;
68 let mathview = pack_return (new math_view w) ~packing ~show in
71 | Some size -> mathview#set_font_size size
75 match font_manager with
76 | Some manager -> mathview#set_font_manager_type ~fm_type:manager