]> matita.cs.unibo.it Git - helm.git/commitdiff
Initial revision
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 6 Nov 2000 14:02:43 +0000 (14:02 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 6 Nov 2000 14:02:43 +0000 (14:02 +0000)
16 files changed:
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.i386.rpm [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.spec [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.src.rpm [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0.tar.gz [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/.depend [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/COPYING [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/config.make [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/configure.mk [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gMathView.ml [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtkMathView.ml [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtk_mathview.ml [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/ml_gtk_mathview.c [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/Makefile [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.ml [new file with mode: 0644]
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.xml [new file with mode: 0644]

diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.i386.rpm b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.i386.rpm
new file mode 100644 (file)
index 0000000..e759a66
Binary files /dev/null and b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.i386.rpm differ
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.spec b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.spec
new file mode 100644 (file)
index 0000000..63b197d
--- /dev/null
@@ -0,0 +1,25 @@
+Summary: GtkMathView : the binding for lablgtk of the GtkMathView widget
+Name: lablgtk-20000829_gtkmathview
+Version: 0.1.0
+Release: 1
+Copyright: LGPL
+Group: Development/Libraries
+Requires: lablgtk_20000829 gtkmathview
+Source: www.cs.unibo.it:/~lpadovan/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0.tar.gz
+%description
+GtkMathView is the binding for lablgtk of the GtkMathView widget.
+
+%prep
+%setup
+
+%build
+make
+make opt
+
+%install
+make install
+
+%files
+%doc COPYING
+
+/usr/lib/ocaml/lablgtk/mathview
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.src.rpm b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.src.rpm
new file mode 100644 (file)
index 0000000..3377d3c
Binary files /dev/null and b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.src.rpm differ
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0.tar.gz b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0.tar.gz
new file mode 100644 (file)
index 0000000..73f44b3
Binary files /dev/null and b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0.tar.gz differ
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/.depend b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/.depend
new file mode 100644 (file)
index 0000000..600449b
--- /dev/null
@@ -0,0 +1,4 @@
+gMathView.cmo: gtkMathView.cmo gtk_mathview.cmo 
+gMathView.cmx: gtkMathView.cmx gtk_mathview.cmx 
+gtkMathView.cmo: gtk_mathview.cmo 
+gtkMathView.cmx: gtk_mathview.cmx 
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/COPYING b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/COPYING
new file mode 100644 (file)
index 0000000..20b480a
--- /dev/null
@@ -0,0 +1,11 @@
+This library is made available under the LGPL.
+You should have got a copy of the LGPL with Objective Caml.
+The LGPL applies to all the files in this directory, but not in
+subdirectories.
+
+For the test subdirectory, there is no specific licensing policy,
+but you may freely take inspiration from the code, and copy parts of
+it in your application.
+
+Author:
+       Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile
new file mode 100644 (file)
index 0000000..1195de5
--- /dev/null
@@ -0,0 +1,98 @@
+# Makefile for lablgtk_mathview.
+
+LABLGTKDIR = /usr/local/lib/ocaml/lablgtk
+MLFLAGS += -I $(LABLGTKDIR)
+
+TARGETS = ml_gtk_mathview.o lablgtkmathview.cma
+
+all: $(TARGETS)
+
+opt: lablgtkmathviewopt
+
+configure:
+       @rm -f config.make
+       @$(MAKE) --no-print-directory -f configure.mk
+
+depend:
+       @rm -f .depend
+       @$(MAKE) --no-print-directory -f configure.mk .depend
+
+.depend config.make:
+       @$(MAKE) --no-print-directory -f configure.mk
+
+COMPILER = $(CAMLC) $(MLFLAGS) -w s -labels -c
+LINKER = $(CAMLC) $(MLFLAGS)
+COMPOPT = $(CAMLOPT) $(MLFLAGS) -w s -labels -c
+LINKOPT = $(CAMLOPT) $(MLFLAGS)
+
+include config.make
+
+INSTALLDIR = $(LIBDIR)/lablgtk/mathview
+
+MLLIBS = lablgtkmathview.cma
+CLIBS = 
+MLLINK = unix.cma str.cma
+
+ifdef DEBUG
+CFLAGS = -g $(GTKCFLAGS)
+MLLINK += -cclib -lcamlrund
+MLFLAGS += -g
+else
+CFLAGS = -O -DGTK_NO_CHECK_CASTS -DGTK_DISABLE_COMPAT_H $(GTKCFLAGS)
+endif
+
+THFLAGS = -thread
+THLINK = unix.cma threads.cma
+
+ifdef USE_CC
+CCOMPILER = $(CC) -c -I$(LIBDIR) $(CFLAGS)
+else
+CCOMPILER = ocamlc -c -ccopt "$(CFLAGS)"
+endif
+
+# Rules
+.SUFFIXES: .ml .mli .cmo .cmi .cmx .c .o .var .h .opt .def
+.c.o:
+       $(CCOMPILER) $<
+.ml.cmo:
+       $(COMPILER) $<
+.mli.cmi:
+       $(COMPILER) $<
+.ml.cmx:
+       $(COMPOPT) $<
+.var.h:
+       ./var2def < $< > $@
+.var.c:
+       ./var2conv < $< > $@
+
+# Targets
+COBJS = ml_gtk_mathview.o
+MLOBJS = gtk_mathview.cmo gtkMathView.cmo gMathView.cmo
+ALLOBJS = $(MLOBJS)
+
+lablgtkmathviewopt: $(CLIBS) $(MLLIBS:.cma=.cmxa)
+
+install:
+       if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi
+       cp $(ALLOBJS:.cmo=.cmi) $(INSTALLDIR)
+       if test -f *.mli ; then cp *.mli $(INSTALLDIR) ; fi
+       cp $(ALLOBJS:.cmo=.ml) $(INSTALLDIR)
+       cp $(MLLIBS) $(INSTALLDIR)
+       cp $(COBJS) $(INSTALLDIR)
+       if test ! -z "$(CLIBS)" ; then cp $(CLIBS) $(INSTALLDIR) ; fi
+       if test -f lablgtkmathview.cmxa; then \
+          cp $(MLLIBS:.cma=.cmxa) $(MLLIBS:.cma=.a) \
+             $(INSTALLDIR); fi
+
+lablgtkmathview.cma: $(MLOBJS)
+       $(LINKER) -a -custom -o $@ $(MLOBJS) $(GTKLIBS) $(GTKMATHVIEWLIBS)
+lablgtkmathview.cmxa: $(MLOBJS:.cmo=.cmx)
+       $(LINKOPT) -a -o $@ $(MLOBJS:.cmo=.cmx) $(GTKLIBS) $(GTKMATHVIEWLIBS)
+
+ml_gtk.o: $(LABLGTKDIR)/gtk_tags.c $(LABLGTKDIR)/gtk_tags.h \
+          $(LABLGTKDIR)/ml_gtk.h $(LABLGTKDIR)/ml_gdk.h $(LABLGTKDIR)/wrappers.h
+
+clean:
+       rm -f *.cm* *.o *.a *_tags.[ch] $(TARGETS)
+
+include .depend
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/config.make b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/config.make
new file mode 100644 (file)
index 0000000..d50ffb5
--- /dev/null
@@ -0,0 +1,15 @@
+CAMLC=ocamlc
+CAMLOPT=ocamlopt
+USE_GL=
+USE_GNOME=
+USE_CC=
+DEBUG=
+CC=cc
+RANLIB=ranlib
+LIBDIR=/usr/lib/ocaml
+BINDIR=/usr/bin
+INSTALLDIR=/usr/lib/ocaml/lablgtk/mathview
+GTKCFLAGS=-I/usr/lib/glib/include -I/usr/X11R6/include -I/usr/lib/ocaml/lablgtk
+GTKLIBS=-ccopt -L/usr/lib -ccopt -L/usr/X11R6/lib -cclib -lgtk -cclib -lgdk -ccopt -rdynamic -cclib -lgmodule -cclib -lglib -cclib -ldl -cclib -lXi -cclib -lXext -cclib -lX11 -cclib -lm
+GTKMATHVIEWLIBS=-ccopt -L/usr/local/lib/gtkmathview -cclib -lgtkmathview 
+GNOMELIBS=
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/configure.mk b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/configure.mk
new file mode 100644 (file)
index 0000000..73cfc3d
--- /dev/null
@@ -0,0 +1,53 @@
+# makefile for configuring lablGTK_mathview
+
+# Default compilers
+CAMLC = ocamlc
+CAMLOPT = ocamlopt
+
+# Default installation directories
+BINDIR = `$(GETBINDIR)`
+INSTALLDIR = $(LIBDIR)/lablgtk/mathview
+
+# Autoconf
+GETLIBDIR = ocamlc -v | grep "^Standard" | sed 's/^.*: *//'
+LIBDIR = `$(GETLIBDIR)`
+GETBINDIR = $(GETLIBDIR) | sed -e 's|/lib/[^/]*$$|/bin|' -e 's|/lib$$|/bin|'
+GETRANLIB = which ranlib 2>/dev/null | sed -e 's|.*/ranlib$$|!|' -e 's/^[^!]*$$/:/' -e 's/!/ranlib/'
+
+ifdef USE_GNOME
+GTKGETCFLAGS = gtk-config --cflags`" -I"`gnome-config --includedir
+GNOMELIBS = `gnome-config --libs gtkxmhtml`
+else
+GTKGETCFLAGS = gtk-config --cflags
+endif
+
+GTKGETLIBS = gtk-config --libs
+
+configure: .depend config.make
+
+.depend:
+       ocamldep *.ml *.mli > .depend
+
+config.make:
+       @echo CAMLC=$(CAMLC) > config.make
+       @echo CAMLOPT=$(CAMLOPT) >> config.make
+       @echo USE_GL=$(USE_GL) >> config.make
+       @echo USE_GNOME=$(USE_GNOME) >> config.make
+       @echo USE_CC=$(USE_CC) >> config.make
+       @echo DEBUG=$(DEBUG) >> config.make
+       @echo CC=$(CC) >> config.make
+       @echo RANLIB=`$(GETRANLIB)` >> config.make
+       @echo LIBDIR=$(LIBDIR) >> config.make
+       @echo BINDIR=`$(GETBINDIR)` >> config.make
+       @echo INSTALLDIR=$(INSTALLDIR) >> config.make
+       @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I/usr/lib/ocaml/lablgtk >> config.make
+       @echo GTKLIBS=`$(GTKGETLIBS)` | \
+         sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \
+         >> config.make
+       #<CSC>
+       echo GTKMATHVIEWLIBS="-ccopt -L/usr/local/lib/gtkmathview -cclib -lgtkmathview " >> config.make
+       #</CSC>
+       @echo GNOMELIBS=$(GNOMELIBS) | \
+         sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \
+         >> config.make
+       cat config.make
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gMathView.ml
new file mode 100644 (file)
index 0000000..b79c812
--- /dev/null
@@ -0,0 +1,50 @@
+open Gaux
+open Gtk
+open Gtk_mathview
+open GtkBase
+open GtkMathView
+open GObj
+
+exception ErrorLoadingFile of string;;
+
+class math_view_signals obj = object
+  inherit GContainer.container_signals obj
+  method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after
+  method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked 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 get_selection = MathView.get_selection obj
+ method unload = MathView.unload obj
+ method dump = MathView.dump obj
+ method get_width = MathView.get_width obj
+ method get_height = MathView.get_height 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_top = MathView.get_top obj
+ method set_top = MathView.set_top obj*)
+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
+;;
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtkMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtkMathView.ml
new file mode 100644 (file)
index 0000000..9ed42b8
--- /dev/null
@@ -0,0 +1,61 @@
+open Gtk
+open Gtk_mathview
+open Tags
+open GtkBase
+open Gpointer
+
+module MathView = struct
+  let cast w : math_view obj = Object.try_cast w "GtkMathView"
+  external create : Gtk.adjustment optobj -> Gtk.adjustment optobj ->
+   math_view obj = "ml_gtk_math_view_new"
+  let create ~adjustmenth ~adjustmentv () =
+   create (optboxed adjustmenth) (optboxed adjustmentv)
+  external load : [>`math_view] obj -> filename:string -> bool =
+   "ml_gtk_math_view_load"
+  external get_selection : [>`math_view] obj -> string option =
+   "ml_gtk_math_view_get_selection"
+  external unload : [>`math_view] obj -> unit =
+   "ml_gtk_math_view_unload"
+  external dump : [>`math_view] obj -> unit =
+   "ml_gtk_math_view_dump"
+  external get_width : [>`math_view] obj -> int =
+   "ml_gtk_math_view_get_width"
+  external get_height : [>`math_view] obj -> int =
+   "ml_gtk_math_view_get_height"
+  external set_adjustments : [>`math_view] obj -> Gtk.adjustment obj -> Gtk.adjustment obj -> unit =
+   "ml_gtk_math_view_set_adjustments"
+  external get_hadjustment : [>`math_view] obj -> Gtk.adjustment obj =
+   "ml_gtk_math_view_get_hadjustment"
+  external get_vadjustment : [>`math_view] obj -> Gtk.adjustment obj =
+   "ml_gtk_math_view_get_vadjustment"
+  external get_buffer : [>`math_view] obj -> Gdk.pixmap =
+   "ml_gtk_math_view_get_buffer"
+  external get_frame : [>`math_view] obj -> [`frame] obj =
+   "ml_gtk_math_view_get_frame"
+  external set_font_size : [>`math_view] obj -> int -> unit =
+   "ml_gtk_math_view_set_font_size"
+  (*external get_top : [>`math_view] obj -> (int * int) =
+   "ml_gtk_math_view_get_top"
+  external set_top : [>`math_view] obj -> int -> int -> unit =
+   "ml_gtk_math_view_set_top"*)
+
+  module Signals = struct
+    open GtkSignal
+
+    let jump : ([>`math_view],_) t =
+     let marshal_jump f _ =
+      function
+         [GtkArgv.STRING (Some str)] -> f str
+       | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump"
+     in
+      { name = "jump"; marshaller = marshal_jump }
+
+    let clicked : ([>`math_view],_) t =
+     let marshal_clicked f _ =
+      function
+         [] -> f ()
+       | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked"
+     in
+      { name = "clicked"; marshaller = marshal_clicked }
+  end
+end
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtk_mathview.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtk_mathview.ml
new file mode 100644 (file)
index 0000000..745a1ba
--- /dev/null
@@ -0,0 +1 @@
+type math_view = [`widget|`container|`bin|`eventbox|`math_view]
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/ml_gtk_mathview.c b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/ml_gtk_mathview.c
new file mode 100644 (file)
index 0000000..b16f68e
--- /dev/null
@@ -0,0 +1,55 @@
+#include <string.h>
+#include <gtk/gtk.h>
+#include <caml/mlvalues.h>
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/callback.h>
+#include <caml/fail.h>
+
+#include <gtkmathview/gtkmathview.h>
+#include <ml_gtk.h>
+
+#include <wrappers.h>
+#include <ml_glib.h>
+#include <ml_gdk.h>
+#include <ml_gtk.h>
+#include <gtk_tags.h>
+
+/* <CSC/>: Next row should be put in a .h of lablgtk. */
+#define GtkAdjustment_val(val) check_cast(GTK_ADJUSTMENT,val)
+
+#define GtkMathView_val(val) check_cast(GTK_MATH_VIEW,val)
+ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val,Val_GtkWidget_sink)
+ML_2 (gtk_math_view_load, GtkMathView_val, String_val, Val_bool)
+ML_1 (gtk_math_view_unload, GtkMathView_val, Unit)
+ML_1 (gtk_math_view_dump, GtkMathView_val, Unit)
+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_frame, GtkMathView_val, Val_GtkWidget)
+ML_2 (gtk_math_view_set_font_size, GtkMathView_val, Int_val, Unit)
+
+/*
+value ml_gtk_math_view_get_top (value arg1)
+{
+   CAMLparam1(arg1);
+   CAMLlocal1 (result);
+   int x, y;
+   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));
+   CAMLreturn (result);
+}
+*/
+
+value ml_gtk_math_view_get_selection (value arg1)
+{
+   const char *stringa;
+   stringa = gtk_math_view_get_selection (GtkMathView_val (arg1));
+   return Val_option (stringa, Val_string);
+}
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/Makefile
new file mode 100644 (file)
index 0000000..cc5bd50
--- /dev/null
@@ -0,0 +1,36 @@
+LABLGTK_DIR = ../../lablgtk-20000829
+LABLGTK_MATHVIEW_DIR = ..
+OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) -I mlmathview
+OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) -I mlmathview
+
+all: test
+opt: test.opt
+
+test: test.cmo
+       $(OCAMLC) -custom -o test lablgtk.cma gtkInit.cmo \
+                  $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \
+                  test.cmo \
+                  -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
+                  -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
+                  -L/usr/local/lib/gtkmathview -lgtkmathview \
+                  $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o"
+
+test.opt: test.cmx
+       $(OCAMLOPT) -o test.opt lablgtk.cmxa gtkInit.cmx \
+                  $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \
+                  test.cmx \
+                  -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
+                  -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
+                  -L/usr/local/lib/gtkmathview -lgtkmathview \
+                  $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o"
+
+.SUFFIXES: .ml .mli .cmo .cmi .cmx
+.ml.cmo:
+       $(OCAMLC) -c $<
+.mli.cmi:
+       $(OCAMLC) -c $<
+.ml.cmx:
+       $(OCAMLOPT) -c $<
+
+clean:
+       rm -f *.cm[iox] *.o test test.opt
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.ml
new file mode 100644 (file)
index 0000000..e914f4d
--- /dev/null
@@ -0,0 +1,141 @@
+(******************************************************************************)
+(*                Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>               *)
+(*                                 25/09/2000                                 *)
+(*                                                                            *)
+(*     This is a simple test for the OCaml (LablGtk indeed) binding of the    *)
+(*                             MathView widget                                *)
+(******************************************************************************)
+
+(* Callbacks *)
+let jump s =
+ print_string ("jump: " ^ s ^ "\n") ;
+ flush stdout
+;;
+
+let clicked () =
+ print_string "clicked: IT WORKS\n" ;
+ flush stdout
+;;
+
+let load mathview () =
+ mathview#load "test.xml" ;
+ print_string "load: SEEMS TO WORK\n" ;
+ flush stdout
+;;
+
+exception Ok;;
+let get_selection mathview () =
+ let selection =
+  match mathview#get_selection with
+     None -> "NO SELECTION"
+   | Some s -> s
+ in
+  print_string ("get_selection: " ^ selection ^ "\n") ;
+  flush stdout
+;;
+
+let unload mathview () =
+ mathview#unload ;
+ print_string "unload: SEEMS TO WORK\n" ;
+ flush stdout
+;;
+
+let dump mathview () =
+ mathview#dump ;
+ print_string "dump: SEEMS TO WORK\n" ;
+ flush stdout
+;;
+
+let get_width mathview () =
+ print_string ("get_width: " ^ string_of_int (mathview#get_width) ^ "\n") ;
+ flush stdout
+;;
+
+let get_height mathview () =
+ print_string ("get_height: " ^ string_of_int (mathview#get_height) ^ "\n") ;
+ flush stdout
+;;
+
+let set_adjustments mathview () =
+ let adj1 = GData.adjustment () in
+ let adj2 = GData.adjustment () in
+  mathview#set_adjustments adj1 adj2 ;
+  adj1#set_value ((adj1#lower +. adj1#upper) /. 2.0) ;
+  adj2#set_value ((adj2#lower +. adj2#upper) /. 2.0) ;
+  print_string "set_adjustments: SEEM TO WORK\n" ;
+  flush stdout
+;;
+
+let get_hadjustment mathview () =
+ let adj = mathview#get_hadjustment in
+  adj#set_value ((adj#lower +. adj#upper) /. 2.0) ;
+  print_string "get_hadjustment: SEEM TO WORK\n" ;
+  flush stdout
+;;
+
+let get_vadjustment mathview () =
+ let adj = mathview#get_vadjustment in
+  adj#set_value ((adj#lower +. adj#upper) /. 2.0) ;
+  print_string "get_vadjustment: SEEM TO WORK\n" ;
+  flush stdout
+;;
+
+let get_buffer mathview () =
+ let buffer = mathview#get_buffer in
+  Gdk.Draw.rectangle buffer (Gdk.GC.create buffer) ~x:0 ~y:0
+   ~width:50 ~height:50 ~filled:true () ;
+  print_string "get_buffer: SEEMS TO WORK (hint: force the widget redrawing)\n";
+  flush stdout
+;;
+
+let get_frame mathview () =
+ let frame = mathview#get_frame in
+  frame#set_shadow_type `NONE ;
+  print_string "get_frame: SEEMS TO WORK\n" ;
+  flush stdout
+;;
+
+let set_font_size mathview () =
+ mathview#set_font_size 24 ;
+ print_string "set_font_size: FONT IS NOW 24\n" ;
+ flush stdout
+;;
+(* 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 mathview = GMathView.math_view ~packing:sw#add_with_viewport ~width:50 ~height:50 () in*)
+let mathview = GMathView.math_view ~packing:sw#add ~width:50 ~height:50 () in
+let hbox = GPack.hbox ~packing:vbox#pack () in
+let button_load = GButton.button ~label:"load" ~packing:hbox#pack () in
+let button_get_selection = GButton.button ~label:"get_selection" ~packing:hbox#pack () in
+let button_unload = GButton.button ~label:"unload" ~packing:hbox#pack () in
+let button_dump = GButton.button ~label:"dump" ~packing:hbox#pack () in
+let button_get_width = GButton.button ~label:"get_width" ~packing:hbox#pack () in
+let button_get_height = GButton.button ~label:"get_height" ~packing:hbox#pack () in
+let button_set_adjustments = GButton.button ~label:"set_adjustments" ~packing:hbox#pack () in
+let button_get_hadjustment = GButton.button ~label:"get_hadjustment" ~packing:hbox#pack () in
+let button_get_vadjustment = GButton.button ~label:"get_vadjustment" ~packing:hbox#pack () in
+let button_get_buffer = GButton.button ~label:"get_buffer" ~packing:hbox#pack () in
+let button_get_frame = GButton.button ~label:"get_frame" ~packing:hbox#pack () in
+let button_set_font_size = GButton.button ~label:"set_font_size" ~packing:hbox#pack () in
+(* Signals connection *)
+ignore(button_load#connect#clicked (load mathview)) ;
+ignore(button_get_selection#connect#clicked (get_selection mathview)) ;
+ignore(button_unload#connect#clicked (unload mathview)) ;
+ignore(button_dump#connect#clicked (dump mathview)) ;
+ignore(button_get_width#connect#clicked (get_width mathview)) ;
+ignore(button_get_height#connect#clicked (get_height mathview)) ;
+ignore(button_set_adjustments#connect#clicked (set_adjustments mathview)) ;
+ignore(button_get_hadjustment#connect#clicked (get_hadjustment mathview)) ;
+ignore(button_get_vadjustment#connect#clicked (get_vadjustment mathview)) ;
+ignore(button_get_buffer#connect#clicked (get_buffer mathview)) ;
+ignore(button_get_frame#connect#clicked (get_frame mathview)) ;
+ignore(button_set_font_size#connect#clicked (set_font_size mathview)) ;
+ignore(mathview#connect#jump jump) ;
+ignore(mathview#connect#clicked clicked) ;
+(* Main Loop *)
+main_window#show () ;
+GMain.Main.main ()
+;;
diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.xml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.xml
new file mode 100644 (file)
index 0000000..b0f8c15
--- /dev/null
@@ -0,0 +1,123 @@
+<math display="block">
+  <mrow helm:xref="SELECTION OK">
+    <mo>&int;</mo>
+    <mo>&ApplyFunction;</mo>
+    <mfrac>
+      <mrow>
+        <mrow>
+          <mi>a</mi>
+         <mo>&InvisibleTimes;</mo>
+         <mi>x</mi>
+       </mrow>
+       <mo>+</mo>
+       <mi>b</mi>
+      </mrow>
+      <mrow>
+        <msup>
+         <mi>x</mi>
+         <mn>2</mn>
+       </msup>
+       <mo>+</mo>
+       <mrow>
+         <mi>p</mi>
+         <mo>&InvisibleTimes;</mo>
+         <mi>x</mi>
+       </mrow>
+       <mo>+</mo>
+       <mi>q</mi>
+      </mrow>
+    </mfrac>
+  </mrow>
+  <mo fontstyle="italic">d</mo>
+  <mi>x</mi>
+  <mo>=</mo>
+  <mrow>
+    <mrow>
+      <mfrac><mi>a</mi><mn>2</mn></mfrac>
+      <mo>&InvisibleTimes;</mo>
+      <mrow>
+        <mi>ln</mi>
+       <mo>&ApplyFunction;</mo>
+       <mrow>
+         <mo>(</mo>
+         <mrow>
+           <msup><mi>x</mi><mn>2</mn></msup>
+           <mo>+</mo>
+           <mrow>
+             <mi>p</mi>
+             <mo>&InvisibleTimes;</mo>
+             <mi>x</mi>
+           </mrow>
+           <mo>+</mo>
+           <mi>q</mi>
+         </mrow>
+         <mo>)</mo>
+       </mrow>
+      </mrow>
+    </mrow>
+    <mo>+</mo>
+    <mrow>
+      <mfrac>
+        <mrow>
+         <mrow>
+           <mn>2</mn>
+           <mo>&InvisibleTimes;</mo>
+           <mi>b</mi>
+         </mrow>
+         <mo>-</mo>
+         <mrow>
+           <mi>a</mi>
+           <mo>&InvisibleTimes;</mo>
+           <mi>p</mi>
+         </mrow>
+       </mrow>
+       <msqrt>
+         <mrow>
+           <mrow>
+             <mn>4</mn>
+             <mo>&InvisibleTimes;</mo>
+             <mi>q</mi>
+           </mrow>
+           <mo>-</mo>
+           <msup>
+             <mi>p</mi>
+             <mn>2</mn>
+           </msup>
+         </mrow>
+       </msqrt>
+      </mfrac>
+      <mo>&InvisibleTimes;</mo>
+      <mrow>
+        <mi xlink:href="JUMPS WORK">arctg</mi>
+       <mo>&ApplyFunction;</mo>
+       <mfrac>
+         <mrow>
+           <mrow>
+             <mn>2</mn>
+             <mo>&InvisibleTimes;</mo>
+             <mi>x</mi>
+           </mrow>
+           <mo>+</mo>
+           <mi>p</mi>
+         </mrow>
+         <msqrt>
+           <mrow>
+             <mrow>
+               <mn>4</mn>
+               <mo>&InvisibleTimes;</mo>
+               <mi>q</mi>
+             </mrow>
+             <mo>-</mo>
+             <msup>
+               <mi>p</mi>
+               <mn>2</mn>
+             </msup>
+           </mrow>
+         </msqrt>
+       </mfrac>
+      </mrow>
+    </mrow>
+    <mo>+</mo>
+    <mi>c</mi>
+  </mrow>  
+</math>