]> matita.cs.unibo.it Git - helm.git/commitdiff
First release. All implemented but the PostScript output. Nothing tested
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 6 Nov 2000 18:42:59 +0000 (18:42 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 6 Nov 2000 18:42:59 +0000 (18:42 +0000)
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/Makefile
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/config.make
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/configure.mk
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gMathView.ml
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/gtkMathView.ml
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/ml_gtk_mathview.c
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/Makefile
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.1.0/test/test.ml

index 1195de5286e1d92ab0c3d8881dbc827844bc1f27..57a3849032a6e566e05ebb94a3cc6d153bc9cd82 100644 (file)
@@ -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
 
index d50ffb58536ea2e9ca2850d0f289427f16a3c05b..d7e9241c5fec1e3e64fd94c7ff9bca97d97e9e96 100644 (file)
@@ -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=
index 73cfc3d3558e82b91b8de3b4b5c6871448491afb..ec5f79995abe48adcc2af5a23707cbe67362d341 100644 (file)
@@ -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
index b79c8124469971b1074518720f10d1090d9ee0b6..915cd313fd2fcf66da8e30125f632c7afb1940fb 100644 (file)
@@ -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;
index 9ed42b8b7092ce33f7cc8144ae064fc8d86c3e8b..a612a8b00f0482668a2e625cd440c629205b96c6 100644 (file)
@@ -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
index b16f68e50c2a50b948ee192278c7102b7405be98..f043b4b4b2a6db5ef12142987dd2384a00c84f6f 100644 (file)
 #include <ml_gtk.h>
 #include <gtk_tags.h>
 
+#include "minidom/ml_minidom.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_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);
 }
index cc5bd50f578221aa4d0e9fd2799b0add73eee976..788db50a75a573990d764b1c184188a7064f508e 100644 (file)
@@ -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
index e914f4d6b04a8ce0144adc9a9f47630a79af2c9d..96788c32fcfadc8acbfd7c23a614ccf41c9c699c 100644 (file)
@@ -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)) ;