]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c
ocaml 3.09 transition
[helm.git] / helm / DEVEL / lablgtkmathview / ml_gtk_mathview.c
index 41175584dcf5f03d8816f3cdd6d169403350e5b8..5d36bc0c481f4dc0a7bf07a14c692e4c2052ffbf 100644 (file)
@@ -1,24 +1,27 @@
-/* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+/* Copyright (C) 2000-2005,
+ *    Luca Padovani          <lpadovan@cs.unibo.it>
+ *    Claudio Sacerdoti Coen  <sacerdot@cs.unibo.it>
+ *    Stefano Zacchiroli      <zacchiro@cs.unibo.it>
  *
- * This file is part of lablgtkmathview, the Ocaml binding
- * for the GtkMathView widget.
+ * This file is part of lablgtkmathview, the Ocaml binding for the
+ * GtkMathView widget.
  * 
  * lablgtkmathview is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
  *
  * lablgtkmathview is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with lablgtkmathview; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
  * 
- * For details, send a mail to the author.
+ * For details, send a mail to the authors.
  */
 
 #include <assert.h>
@@ -97,19 +100,25 @@ ML_2 (gtk_math_view_unselect, GtkMathView_val, Element_val, Unit)
 ML_2 (gtk_math_view_is_selected, GtkMathView_val, Element_val, Val_bool)
 /*
 ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val, Val_GtkWidget_sink)
-*/
 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)
 ML_3 (gtk_math_view_set_adjustments, GtkMathView_val, GtkAdjustment_val, GtkAdjustment_val, Unit)
+/*
 ML_1 (gtk_math_view_get_hadjustment, GtkMathView_val, Val_GtkWidget)
 ML_1 (gtk_math_view_get_vadjustment, GtkMathView_val, Val_GtkWidget)
+*/
 ML_1 (gtk_math_view_get_buffer, GtkMathView_val, Val_GdkPixmap)
-ML_1 (gtk_math_view_get_drawing_area, GtkMathView_val, Val_GtkWidget)
 ML_2 (gtk_math_view_set_font_size, GtkMathView_val, Int_val, Unit)
 ML_1 (gtk_math_view_get_font_size, GtkMathView_val, Val_int)
 ML_2 (gtk_math_view_set_log_verbosity, GtkMathView_val, Int_val, Unit)
 ML_1 (gtk_math_view_get_log_verbosity, GtkMathView_val, Val_int)
+ML_2 (gtk_math_view_set_t1_opaque_mode, GtkMathView_val, Bool_val, Unit)
+ML_1 (gtk_math_view_get_t1_opaque_mode, GtkMathView_val, Val_bool)
+ML_2 (gtk_math_view_set_t1_anti_aliased_mode, GtkMathView_val, Bool_val, Unit)
+ML_1 (gtk_math_view_get_t1_anti_aliased_mode, GtkMathView_val, Val_bool)
+ML_1 (gtk_math_view_add_configuration_path, String_val, Unit)
 
 value ml_gtk_math_view_get_element_at (value arg1, value arg2, value arg3)
 {
@@ -123,10 +132,47 @@ value ml_gtk_math_view_get_element_at (value arg1, value arg2, value arg3)
    CAMLreturn (result);
 }
 
+value ml_gtk_math_view_get_document (value arg1)
+{
+   CAMLparam1(arg1);
+   CAMLlocal1(result);
+   GdomeDocument* doc = gtk_math_view_get_document(GtkMathView_val (arg1));
+   if (doc == NULL)
+          result = Val_unit;
+   else
+          result = Val_option_ptr(doc, Val_Document);
+   CAMLreturn (result);
+}
+
+value ml_gtk_math_view_get_adjustments(value arg1)
+{
+   CAMLparam1(arg1);
+   CAMLlocal1(result);
+   GtkAdjustment* hadj;
+   GtkAdjustment* vadj;
+   gtk_math_view_get_adjustments(GtkMathView_val (arg1), &hadj, &vadj);
+   result = alloc(2, 0);
+   Store_field(result, 0, Val_GtkWidget(hadj));
+   Store_field(result, 1, Val_GtkWidget(vadj));
+   CAMLreturn(result);
+}
+
+value ml_gtk_math_view_get_size (value arg1)
+{
+   CAMLparam1(arg1);
+   CAMLlocal1(result);
+   int width, height;
+   gtk_math_view_get_size(GtkMathView_val (arg1), &width, &height);
+   result = alloc(1, 0);
+   Store_field(result, 0, Val_int(width));
+   Store_field(result, 1, Val_int(height));
+   CAMLreturn (result);
+}
+
 value ml_gtk_math_view_get_bounding_box (value arg1)
 {
    CAMLparam1(arg1);
-   CAMLlocal1 (result);
+   CAMLlocal1(result);
    int width, height, depth;
    GtkMathViewBoundingBox gbox;
    gtk_math_view_get_bounding_box(GtkMathView_val (arg1), &gbox);
@@ -140,7 +186,7 @@ value ml_gtk_math_view_get_bounding_box (value arg1)
 value ml_gtk_math_view_get_top (value arg1)
 {
    CAMLparam1(arg1);
-   CAMLlocal1 (result);
+   CAMLlocal1(result);
    int x, y;
    gtk_math_view_get_top(GtkMathView_val (arg1), &x, &y);
    result = alloc(2, 0);
@@ -204,3 +250,22 @@ value ml_gtk_math_view_gdome_element_option_of_boxed_option (value arg1)
 
    CAMLreturn(res);
 }
+
+value ml_gtk_math_view_model_event_of_boxed_option (value arg1)
+{
+   CAMLparam1(arg1);
+   GdomeElement* nr;
+   CAMLlocal1 (valnr);
+   CAMLlocal1 (res);
+
+   assert(arg1 != Val_int(0));
+   GtkMathViewModelEvent* event = (GtkMathViewModelEvent*) Field(Field(arg1,0),1);
+   res = alloc(4, 0);
+   Store_field(res, 0, Val_option_ptr(event->id, Val_Element_ref));
+   Store_field(res, 1, Val_int(event->x));
+   Store_field(res, 2, Val_int(event->y));
+   Store_field(res, 3, Val_int(event->state));
+
+   CAMLreturn(res);
+}
+