X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtkmathview%2Fml_gtk_mathview.c;fp=helm%2FDEVEL%2Flablgtkmathview%2Fml_gtk_mathview.c;h=1f6b19b9f47c31358f3ed8ca107bbb9617614143;hb=ee18ff6db8d49339230b4212e145964b12c5a523;hp=7e260cd97817734f367b89031cca9d541f115925;hpb=42fa20a1eac55122a1c6b2b47511ed162212c29b;p=helm.git diff --git a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c index 7e260cd97..1f6b19b9f 100644 --- a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c +++ b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, Luca Padovani . +/* Copyright (C) 2000-2003, Luca Padovani , + * Claudio Sacerdoti Coen . * * This file is part of lablgtkmathview, the Ocaml binding * for the GtkMathView widget. @@ -46,10 +47,13 @@ #define FontManagerId_val(val) Int_val(val) #define Val_FontManagerId(val) Val_int(val) -// As ML_1, but the result is optional +/* As ML_1, but the result is optional */ #define OML_1(cname, conv1, conv) \ value ml_##cname (value arg1) { return Val_option_ptr((cname (conv1 (arg1))),conv); } -// As ML_2, but the second argument is optional +/* As ML_3, but the result is optional */ +#define OML_3(cname, conv1, conv2, conv3, conv) \ +value ml_##cname (value arg1, value arg2, value arg3) { return Val_option_ptr((cname (conv1 (arg1), conv2 (arg2), conv3 (arg3))),conv); } +/* As ML_2, but the second argument is optional */ #define ML_2O(cname, conv1, conv2, conv) \ value ml_##cname (value arg1, value arg2) \ { return conv (cname (conv1(arg1), ptr_val_option(arg2,conv2))); } @@ -76,6 +80,17 @@ value_of_font_manager_id(FontManagerId id) } } +value Val_Element_ref(GdomeElement* elem) +{ + if (elem != NULL) + { + GdomeException exc = 0; + gdome_el_ref(elem, &exc); + g_assert(exc == 0); + } + return Val_Element(elem); +} + ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val, Val_GtkWidget_sink) ML_1 (gtk_math_view_freeze, GtkMathView_val, Unit) ML_1 (gtk_math_view_thaw, GtkMathView_val, Unit) @@ -85,6 +100,7 @@ ML_1 (gtk_math_view_unload, GtkMathView_val, Unit) ML_2 (gtk_math_view_select, GtkMathView_val, Element_val, Unit) ML_2 (gtk_math_view_unselect, GtkMathView_val, Element_val, Unit) ML_2 (gtk_math_view_is_selected, GtkMathView_val, Element_val, Val_bool) +OML_3 (gtk_math_view_get_element_at, GtkMathView_val, Int_val, Int_val, Val_Element_ref) ML_1 (gtk_math_view_get_width, GtkMathView_val, Val_int) ML_1 (gtk_math_view_get_height, GtkMathView_val, Val_int) ML_3 (gtk_math_view_set_top, GtkMathView_val, Int_val, Int_val, Unit) @@ -140,10 +156,24 @@ value ml_gtk_math_view_get_top (value arg1) gtk_math_view_get_top(GtkMathView_val (arg1), &x, &y); result = alloc(2, 0); Store_field(result, 0, Val_int(x)); - Store_field(result, 0, Val_int(y)); + Store_field(result, 1, Val_int(y)); CAMLreturn (result); } +/* +value ml_gtk_math_view_get_element_coords (value arg1, value arg2) +{ + CAMLparam2(arg1, arg2); + CAMLlocal1 (result); + int x, y; + gtk_math_view_get_element_coords(GtkMathView_val (arg1), Element_val(arg2), &x, &y); + result = alloc(2, 0); + Store_field(result, 0, Val_int(x)); + Store_field(result, 1, Val_int(y)); + CAMLreturn (result); +} +*/ + value ml_gtk_math_view_gdome_element_of_boxed_option (value arg1) { CAMLparam1(arg1); @@ -192,3 +222,4 @@ value ml_gtk_math_view_gdome_element_option_of_boxed_option (value arg1) CAMLreturn(res); } +