From: Luca Padovani Date: Thu, 25 Jan 2001 11:12:56 +0000 (+0000) Subject: updated the binding so that it works well with lablgtk-1.00, X-Git-Tag: no-uwobo~12 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=4a97b3700b140024e1783ac12501ad5dfa4be9b5;p=helm.git updated the binding so that it works well with lablgtk-1.00, configuration script improved --- diff --git a/helm/DEVEL/lablgtkmathview/Makefile.in b/helm/DEVEL/lablgtkmathview/Makefile.in index 7dfbb1e16..bc875865f 100644 --- a/helm/DEVEL/lablgtkmathview/Makefile.in +++ b/helm/DEVEL/lablgtkmathview/Makefile.in @@ -114,5 +114,6 @@ clean: distclean: clean rm -f configure config.cache config.status config.log Makefile + cd $(TESTDIR); make distclean include .depend diff --git a/helm/DEVEL/lablgtkmathview/configure.in b/helm/DEVEL/lablgtkmathview/configure.in index 011dccbe8..296ab85c9 100644 --- a/helm/DEVEL/lablgtkmathview/configure.in +++ b/helm/DEVEL/lablgtkmathview/configure.in @@ -16,19 +16,19 @@ if test $HAVE_OCAMLC = "no"; then fi AC_MSG_CHECKING(for the ocaml library dir) -OCAML_ROOT=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'` -AC_MSG_RESULT($OCAML_ROOT) +OCAML_LIB_DIR=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'` +AC_MSG_RESULT($OCAML_LIB_DIR) -AC_CHECK_FILE($OCAML_ROOT/lablgtk/gtk.ml, +AC_CHECK_FILE($OCAML_LIB_DIR/lablgtk/gtk.ml, RES="yes" - LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk, + LABLGTK_LIB_DIR=$OCAML_LIB_DIR/lablgtk, RES="no" ) if test $RES = "no"; then RES="" AC_CACHE_VAL(lablgtkmathview_cv_LABLGTK_LIB_DIR, - echo "In which directory can I find the lablgtk library? (I haven't found it in the usual location $OCAML_ROOT/lablgtk)" + echo "In which directory can I find the lablgtk library? (I haven't found it in the usual location $OCAML_LIB_DIR/lablgtk)" read lablgtkmathview_cv_LABLGTK_LIB_DIR RES="Asked" ) @@ -39,16 +39,16 @@ if test $RES = "no"; then AC_CACHE_SAVE fi -AC_CHECK_FILE($OCAML_ROOT/mlminidom/minidom.mli, +AC_CHECK_FILE($OCAML_LIB_DIR/mlminidom/minidom.mli, RES="yes" - MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom, + MLMINIDOM_LIB_DIR=$OCAML_LIB_DIR/mlminidom, RES="no" ) if test $RES = "no"; then RES="" AC_CACHE_VAL(lablgtkmathview_cv_MLMINIDOM_LIB_DIR, - echo "In which directory can I find the mlminidom library? (I haven't found it in the usual location $OCAML_ROOT/mlminidom)" + echo "In which directory can I find the mlminidom library? (I haven't found it in the usual location $OCAML_LIB_DIR/mlminidom)" read lablgtkmathview_cv_MLMINIDOM_LIB_DIR RES="Asked" ) @@ -60,8 +60,11 @@ if test $RES = "no"; then fi AC_SUBST(LABLGTKMATHVIEW_VERSION) -AC_SUBST(OCAML_ROOT) +AC_SUBST(OCAML_LIB_DIR) AC_SUBST(LABLGTK_LIB_DIR) AC_SUBST(MLMINIDOM_LIB_DIR) -AC_OUTPUT([Makefile]) +AC_OUTPUT([ + Makefile + test/Makefile +]) diff --git a/helm/DEVEL/lablgtkmathview/gMathView.ml b/helm/DEVEL/lablgtkmathview/gMathView.ml index b937831f7..41df00632 100644 --- a/helm/DEVEL/lablgtkmathview/gMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gMathView.ml @@ -20,12 +20,13 @@ * For details, send a mail to the author. *) -open Gaux +(*open Gaux*) open Gtk open Gtk_mathview open GtkBase open GtkMathView open GObj +open Misc exception ErrorLoadingFile of string;; exception ErrorWritingFile of string;; @@ -58,7 +59,7 @@ class math_view obj = object 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 get_frame = new GFrame.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 diff --git a/helm/DEVEL/lablgtkmathview/gtkMathView.ml b/helm/DEVEL/lablgtkmathview/gtkMathView.ml index 67a634a16..3eefbd6de 100644 --- a/helm/DEVEL/lablgtkmathview/gtkMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gtkMathView.ml @@ -24,15 +24,15 @@ open Gtk open Gtk_mathview open Tags open GtkBase -open Gpointer +open Misc -external mDOMNode_of_boxed_option : - Gpointer.boxed option -> Minidom.mDOMNode = - "ml_gtk_math_view_mDOMNode_of_bodex_option" +external mDOMNode_of_boxed : + Misc.pointer -> Minidom.mDOMNode = + "ml_gtk_math_view_mDOMNode_of_boxed" -external mDOMNode_option_of_boxed_option : - Gpointer.boxed option -> Minidom.mDOMNode option = - "ml_gtk_math_view_mDOMNode_option_of_bodex_option" +external mDOMNode_option_of_boxed : + Misc.pointer -> Minidom.mDOMNode option = + "ml_gtk_math_view_mDOMNode_option_of_boxed" let o_mDOMNode_of_mDOMNode node = new Ominidom.o_mDOMNode node @@ -114,26 +114,26 @@ module MathView = struct open GtkSignal let clicked : ([>`math_view],_) t = - let marshal_clicked f _ = - function - [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + let marshal_clicked f argv = + match GtkArgv.get_pointer argv ~pos:0 with + Some p -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed (Obj.magic p))) | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" in { name = "clicked"; marshaller = marshal_clicked } let jump : ([>`math_view],_) t = - let marshal_jump f _ = - function - [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + let marshal_jump f argv = + match GtkArgv.get_pointer argv ~pos:0 with + Some p -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed (Obj.magic p))) | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump" in { name = "jump"; marshaller = marshal_jump } let selection_changed : ([>`math_view],_) t = - let marshal_selection_changed f _ = - function - [GtkArgv.POINTER node] -> f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed_option node)) - | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed" + let marshal_selection_changed f argv = + match GtkArgv.get_pointer argv ~pos:0 with + Some p ->f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed (Obj.magic p))) + | None -> f None in { name = "selection_changed"; marshaller = marshal_selection_changed } end diff --git a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c index bc7d13528..5f86ff03c 100644 --- a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c +++ b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -40,10 +40,18 @@ #include #include -#include "minidom/ml_minidom.h" +#include "mlminidom/ml_minidom.h" /* : Next row should be put in a .h of lablgtk. */ #define GtkAdjustment_val(val) check_cast(GTK_ADJUSTMENT,val) +/* : Next rows too */ + +extern value Val_GtkObject_sink(); + +#define Val_GtkAny(w) Val_GtkObject((GtkObject*)w) +#define Val_GtkAny_sink(w) Val_GtkObject_sink((GtkObject*)w) +#define Val_GtkWidget Val_GtkAny +#define Val_GtkWidget_sink Val_GtkAny_sink #define GtkMathView_val(val) check_cast(GTK_MATH_VIEW,val) @@ -137,22 +145,15 @@ value ml_gtk_math_view_get_top (value arg1) CAMLreturn (result); } - -value ml_gtk_math_view_mDOMNode_of_bodex_option (value arg1) +value ml_gtk_math_view_mDOMNode_of_boxed (value arg1) { CAMLparam1(arg1); mDOMNodeRef nr; - CAMLlocal1 (tmp); CAMLlocal1 (optval); CAMLlocal1 (res); - if (arg1==Val_int(0)) { - assert(0); - } else { - tmp = Field(arg1, 0); - nr = (mDOMNodeRef) Field(tmp, 1); - } + nr = (mDOMNodeRef) Field(arg1, 1); optval = Val_mDOMNodeRef(nr); if (optval==Val_int(0)) { assert(0); @@ -163,19 +164,13 @@ value ml_gtk_math_view_mDOMNode_of_bodex_option (value arg1) CAMLreturn(res); } -value ml_gtk_math_view_mDOMNode_option_of_bodex_option (value arg1) +value ml_gtk_math_view_mDOMNode_option_of_boxed (value arg1) { CAMLparam1(arg1); mDOMNodeRef nr; - CAMLlocal1 (tmp); - if (arg1==Val_int(0)) { - nr=NULL; - } else { - tmp = Field(arg1, 0); - nr = (mDOMNodeRef) Field(tmp, 1); - } + nr = (mDOMNodeRef) Field(arg1, 1); - CAMLreturn(Val_mDOMNodeRef(nr)); + CAMLreturn(Val_mDOMNodeRef(nr)); } diff --git a/helm/DEVEL/lablgtkmathview/test/test.ml b/helm/DEVEL/lablgtkmathview/test/test.ml index 3e2edeed1..1f2718003 100644 --- a/helm/DEVEL/lablgtkmathview/test/test.ml +++ b/helm/DEVEL/lablgtkmathview/test/test.ml @@ -256,7 +256,7 @@ let export_to_postscript (mathview : GMathView.math_view) () = (* Widget creation *) let main_window = GWindow.window ~title:"GtkMathView test" () in let vbox = GPack.vbox ~packing:main_window#add () in -let sw = GBin.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in +let sw = GFrame.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in let mathview= GMathView.math_view ~packing:sw#add ~width:50 ~height:50 () in let table = GPack.table ~rows:6 ~columns:5 ~packing:vbox#pack () in let button_gtk=GButton.button ~label:"activate Gtk fonts" ~packing:(table#attach ~left:0 ~top:0) () in