From: Claudio Sacerdoti Coen Date: Mon, 6 Nov 2000 14:02:43 +0000 (+0000) Subject: Initial revision X-Git-Tag: nogzip~214 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=34d83812af9b7064cc8f735c2a78169881140010;p=helm.git Initial revision --- 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 index 000000000..e759a668b 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 index 000000000..63b197d82 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0-1.spec @@ -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 index 000000000..3377d3cd5 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 index 000000000..73f44b364 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 index 000000000..600449bb8 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/.depend @@ -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 index 000000000..20b480a10 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/COPYING @@ -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 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 index 000000000..1195de528 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile @@ -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 index 000000000..d50ffb585 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/config.make @@ -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 index 000000000..73cfc3d35 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/configure.mk @@ -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 + # + echo GTKMATHVIEWLIBS="-ccopt -L/usr/local/lib/gtkmathview -cclib -lgtkmathview " >> config.make + # + @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 index 000000000..b79c81244 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gMathView.ml @@ -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 index 000000000..9ed42b8b7 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtkMathView.ml @@ -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 index 000000000..745a1ba82 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtk_mathview.ml @@ -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 index 000000000..b16f68e50 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/ml_gtk_mathview.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +/* : 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 index 000000000..cc5bd50f5 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/Makefile @@ -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 index 000000000..e914f4d6b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.ml @@ -0,0 +1,141 @@ +(******************************************************************************) +(* Claudio Sacerdoti Coen *) +(* 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 index 000000000..b0f8c1563 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.xml @@ -0,0 +1,123 @@ + + + + + + + + a + + x + + + + b + + + + x + 2 + + + + + p + + x + + + + q + + + + d + x + = + + + a2 + + + ln + + + ( + + x2 + + + + p + + x + + + + q + + ) + + + + + + + + + + 2 + + b + + - + + a + + p + + + + + + 4 + + q + + - + + p + 2 + + + + + + + arctg + + + + + 2 + + x + + + + p + + + + + 4 + + q + + - + + p + 2 + + + + + + + + + c + +