From: Claudio Sacerdoti Coen Date: Mon, 6 Nov 2000 18:42:59 +0000 (+0000) Subject: First release. All implemented but the PostScript output. Nothing tested X-Git-Tag: nogzip~212 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=fb6e592cfeee3b5d1c59e66888c953bd9c43156f;p=helm.git First release. All implemented but the PostScript output. Nothing tested --- 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 index 1195de528..57a384903 100644 --- a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile @@ -1,7 +1,8 @@ # Makefile for lablgtk_mathview. -LABLGTKDIR = /usr/local/lib/ocaml/lablgtk -MLFLAGS += -I $(LABLGTKDIR) +LABLGTKDIR = /usr/lib/ocaml/lablgtk +MINIDOMDIR = ./minidom +MLFLAGS += -I $(LABLGTKDIR) -I $(MINIDOMDIR) TARGETS = ml_gtk_mathview.o lablgtkmathview.cma 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 index d50ffb585..d7e9241c5 100644 --- 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 @@ -9,7 +9,7 @@ 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 +GTKCFLAGS=-I/usr/lib/glib/include -I/usr/X11R6/include -I/usr/include/libxml -I/usr/include -I/usr/local/include/gtkmathview -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 index 73cfc3d35..ec5f79995 100644 --- 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 @@ -15,10 +15,10 @@ 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 +GTKGETCFLAGS = gtk-config --cflags`" -I"`gnome-config --includedir" "`xml-config --cflags`" "`gtkmathview-config --cflags GNOMELIBS = `gnome-config --libs gtkxmhtml` else -GTKGETCFLAGS = gtk-config --cflags +GTKGETCFLAGS = gtk-config --cflags`" "`xml-config --cflags`" "`gtkmathview-config --cflags endif GTKGETLIBS = gtk-config --libs 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 index b79c81244..915cd313f 100644 --- 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 @@ -9,8 +9,10 @@ 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 + method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after + method selection_changed = + GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after end class math_view obj = object @@ -18,11 +20,14 @@ class math_view obj = object 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 dump = MathView.dump obj*) + method get_selection = MathView.get_selection obj + method set_selection = MathView.set_selection obj method get_width = MathView.get_width obj method get_height = MathView.get_height obj + method get_top = MathView.get_top obj + method set_top = MathView.set_top obj method set_adjustments = fun adj1 adj2 -> MathView.set_adjustments obj (GData.as_adjustment adj1) @@ -32,17 +37,24 @@ class math_view obj = object 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*) + method get_font_size = MathView.get_font_size obj + method set_anti_aliasing = MathView.set_anti_aliasing obj + method get_anti_aliasing = MathView.get_anti_aliasing obj + method set_kerning = MathView.set_kerning obj + method get_kerning = MathView.get_kerning obj + method log_set_verbosity = MathView.log_set_verbosity obj + method log_get_verbosity = MathView.log_get_verbosity obj + method export_to_postscript = MathView.export_to_postscript obj end -let math_view ?adjustmenth ?adjustmentv ?border_width ?width ?height - ?packing ?show () +let math_view ?adjustmenth ?adjustmentv ?(use_t1_lib=false) ?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) + ?use_t1_lib () in Container.set w ?border_width ?width ?height; 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 index 9ed42b8b7..a612a8b00 100644 --- 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 @@ -4,24 +4,33 @@ open Tags open GtkBase open Gpointer +external mDOMNode_of_boxed_option : Gpointer.boxed option -> Minidom.mDOMNode = + "ml_gtk_math_view_mDOMNode_of_bodex_option" + module MathView = struct let cast w : math_view obj = Object.try_cast w "GtkMathView" - external create : Gtk.adjustment optobj -> Gtk.adjustment optobj -> + external create : Gtk.adjustment optobj -> Gtk.adjustment optobj -> bool -> math_view obj = "ml_gtk_math_view_new" - let create ~adjustmenth ~adjustmentv () = - create (optboxed adjustmenth) (optboxed adjustmentv) + let create ~adjustmenth ~adjustmentv ~use_t1_lib () = + create (optboxed adjustmenth) (optboxed adjustmentv) use_t1_lib 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 dump : [>`math_view] obj -> unit = + "ml_gtk_math_view_dump"*) + external get_selection : [>`math_view] obj -> Minidom.mDOMNode = + "ml_gtk_math_view_get_selection" + external set_selection : [>`math_view] obj -> Minidom.mDOMNode -> unit = + "ml_gtk_math_view_set_selection" 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 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" 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 = @@ -34,28 +43,48 @@ module MathView = struct "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"*) + external get_font_size : [>`math_view] obj -> int = + "ml_gtk_math_view_get_font_size" + external set_anti_aliasing : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_anti_aliasing" + external get_anti_aliasing : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_anti_aliasing" + external set_kerning : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_kerning" + external get_kerning : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_kerning" + external log_set_verbosity : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_log_set_verbosity" + external log_get_verbosity : [>`math_view] obj -> int = + "ml_gtk_math_view_log_get_verbosity" + external export_to_postscript : [>`math_view] obj -> int = + "ml_gtk_math_view_export_to_postscript" module Signals = struct open GtkSignal + let clicked : ([>`math_view],_) t = + let marshal_clicked f _ = + function + [GtkArgv.POINTER node] -> f (mDOMNode_of_boxed_option node) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" + in + { name = "clicked"; marshaller = marshal_clicked } + let jump : ([>`math_view],_) t = let marshal_jump f _ = function - [GtkArgv.STRING (Some str)] -> f str + [GtkArgv.POINTER node] -> f (mDOMNode_of_boxed_option node) | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump" in { name = "jump"; marshaller = marshal_jump } - let clicked : ([>`math_view],_) t = - let marshal_clicked f _ = + let selection_changed : ([>`math_view],_) t = + let marshal_selection_changed f _ = function - [] -> f () - | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" + [GtkArgv.POINTER node] -> f (mDOMNode_of_boxed_option node) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed" in - { name = "clicked"; marshaller = marshal_clicked } + { name = "selection_changed"; marshaller = marshal_selection_changed } end end 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 index b16f68e50..f043b4b4b 100644 --- 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 @@ -15,25 +15,37 @@ #include #include +#include "minidom/ml_minidom.h" + /* : 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_3 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val, Bool_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_dump, GtkMathView_val, Unit)*/ +ML_1 (gtk_math_view_get_selection, GtkMathView_val, Val_ptr) +ML_2 (gtk_math_view_set_selection, GtkMathView_val, mDOMNode_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_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) +ML_1 (gtk_math_view_get_font_size, GtkMathView_val, Val_int) +ML_2 (gtk_math_view_set_anti_aliasing, GtkMathView_val, Bool_val, Unit) +ML_1 (gtk_math_view_get_anti_aliasing, GtkMathView_val, Val_bool) +ML_2 (gtk_math_view_set_kerning, GtkMathView_val, Bool_val, Unit) +ML_1 (gtk_math_view_get_kerning, GtkMathView_val, Val_bool) +ML_2 (gtk_math_view_log_set_verbosity, GtkMathView_val, Int_val, Unit) +ML_1 (gtk_math_view_log_get_verbosity, GtkMathView_val, Val_int) +ML_2 (gtk_math_view_export_to_postscript, GtkMathView_val, Int_val, Unit) + -/* value ml_gtk_math_view_get_top (value arg1) { CAMLparam1(arg1); @@ -45,11 +57,19 @@ value ml_gtk_math_view_get_top (value arg1) Store_field(result, 0, Val_int(y)); CAMLreturn (result); } -*/ -value ml_gtk_math_view_get_selection (value arg1) + +value ml_gtk_math_view_mDOMNode_of_bodex_option (value arg1) { - const char *stringa; - stringa = gtk_math_view_get_selection (GtkMathView_val (arg1)); - return Val_option (stringa, Val_string); + CAMLparam1(arg1); + + mDOMNodeRef nr; + + if (arg1==Val_int(0)) { + nr = NULL; + } else { + nr = (mDOMNodeRef) Field(arg1, 0); + } + + CAMLreturn((value) nr); } 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 index cc5bd50f5..788db50a7 100644 --- 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 @@ -1,4 +1,4 @@ -LABLGTK_DIR = ../../lablgtk-20000829 +LABLGTK_DIR = /usr/lib/ocaml/lablgtk 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 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 index e914f4d6b..96788c32f 100644 --- 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 @@ -7,14 +7,18 @@ (******************************************************************************) (* Callbacks *) -let jump s = +let jump node = +(* print_string ("jump: " ^ s ^ "\n") ; flush stdout +*) () ;; -let clicked () = +let clicked node = +(* print_string "clicked: IT WORKS\n" ; flush stdout +*) () ;; let load mathview () = @@ -25,6 +29,7 @@ let load mathview () = exception Ok;; let get_selection mathview () = +(* let selection = match mathview#get_selection with None -> "NO SELECTION" @@ -32,6 +37,7 @@ let get_selection mathview () = in print_string ("get_selection: " ^ selection ^ "\n") ; flush stdout +*) () ;; let unload mathview () = @@ -40,11 +46,13 @@ let unload mathview () = 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") ; @@ -111,7 +119,7 @@ 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_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 @@ -124,7 +132,7 @@ let button_set_font_size = GButton.button ~label:"set_font_size" ~packing:hbox#p 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_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)) ;