]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml
Initial revision
[helm.git] / helm / DEVEL / lablgtk_gtkmathview / lablgtk-20000829_gtkmathview-0.2.1 / gMathView.ml
index 9108b866d4b2ead341825f9bd30d08801a082ac4..951b8d46ccc8822861407c7b75e54af5a00cb3fe 100644 (file)
@@ -23,10 +23,8 @@ class math_view obj = object
  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 set_selection (node : Ominidom.o_mDOMNode option) = MathView.set_selection obj node
  method get_width = MathView.get_width obj
  method get_height = MathView.get_height obj
  method get_top = MathView.get_top obj
@@ -47,16 +45,19 @@ class math_view obj = object
  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 export_to_postscript
+       ?(width = 595) ?(height = 822) ?(x_margin = 72) ?(y_margin = 72)
+       ?(disable_colors = false) ~filename () =
+  let result = MathView.export_to_postscript obj
+       ~width ~height ~x_margin ~y_margin ~disable_colors ~filename
+  in
+  if not result 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 math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width
+ ?width ?height ?packing ?show () =
  let w =
    MathView.create
     ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth)
@@ -64,5 +65,15 @@ let math_view ?adjustmenth ?adjustmentv ?border_width
     ()
  in
   Container.set w ?border_width ?width ?height;
-  pack_return (new math_view w) ~packing ~show
+ let mathview = pack_return (new math_view w) ~packing ~show in
+ begin
+    match font_size with
+    | Some size -> mathview#set_font_size size
+    | None      -> ()
+  end;
+  begin
+    match font_manager with
+    | Some manager -> mathview#set_font_manager_type ~fm_type:manager
+    | None         -> ()
+  end;
 ;;