]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml
This commit was manufactured by cvs2svn to create branch 'start'.
[helm.git] / helm / DEVEL / lablgtk_gtkmathview / lablgtk-20000829_gtkmathview-0.2.1 / gMathView.ml
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml
new file mode 100644 (file)
index 0000000..9108b86
--- /dev/null
@@ -0,0 +1,68 @@
+open Gaux
+open Gtk
+open Gtk_mathview
+open GtkBase
+open GtkMathView
+open GObj
+
+exception ErrorLoadingFile of string;;
+exception ErrorWritingFile of string;;
+exception NoSelection;;
+
+class math_view_signals obj = object
+  inherit GContainer.container_signals obj
+  method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after
+  method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after
+  method selection_changed =
+  GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after
+end
+
+class math_view obj = object
+ inherit GContainer.container (obj : Gtk_mathview.math_view obj)
+ method connect = new math_view_signals obj
+ method load ~filename =
+  if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename)
+ method unload = MathView.unload obj
+ method has_selection = MathView.has_selection obj
+ method get_selection = MathView.get_selection obj
+ method set_selection node = MathView.set_selection obj node
+ method reset_selection = MathView.reset_selection obj
+ method get_width = MathView.get_width obj
+ method get_height = MathView.get_height obj
+ method get_top = MathView.get_top obj
+ method set_top = MathView.set_top obj
+ method set_adjustments =
+  fun adj1 adj2 ->
+   MathView.set_adjustments obj (GData.as_adjustment adj1)
+   (GData.as_adjustment adj2)
+ method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj)
+ method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj)
+ method get_buffer = MathView.get_buffer obj
+ method get_frame = new GBin.frame (MathView.get_frame obj)
+ method set_font_size = MathView.set_font_size obj
+ method get_font_size = MathView.get_font_size obj
+ method set_anti_aliasing = MathView.set_anti_aliasing obj
+ method get_anti_aliasing = MathView.get_anti_aliasing obj
+ method set_kerning = MathView.set_kerning obj
+ method get_kerning = MathView.get_kerning obj
+ method set_log_verbosity = MathView.set_log_verbosity obj
+ method get_log_verbosity = MathView.get_log_verbosity obj
+ method export_to_postscript ~width ~height ~x_margin ~y_margin ~disable_colors ~filename =
+  if not (MathView.export_to_postscript obj ~width ~height ~x_margin ~y_margin ~disable_colors ~filename) then
+   raise (ErrorWritingFile filename)
+ method get_font_manager_type = MathView.get_font_manager_type obj
+ method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type
+end
+
+let math_view ?adjustmenth ?adjustmentv ?border_width
+ ?width ?height ?packing ?show ()
+=
+ let w =
+   MathView.create
+    ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth)
+    ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv)
+    ()
+ in
+  Container.set w ?border_width ?width ?height;
+  pack_return (new math_view w) ~packing ~show
+;;