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
+MINIDOM_DIR = ../minidom
+OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \
+ -I $(MINIDOM_DIR) -I mlmathview
+OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \
+ -I $(MINIDOM_DIR) -I mlmathview
all: test
opt: test.opt
test: test.cmo
$(OCAMLC) -custom -o test lablgtk.cma gtkInit.cmo \
$(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \
+ $(MINIDOM_DIR)/minidom.cmo \
+ -cclib "$(MINIDOM_DIR)/ml_minidom.o" \
test.cmo \
-cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
-rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
test.opt: test.cmx
$(OCAMLOPT) -o test.opt lablgtk.cmxa gtkInit.cmx \
$(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \
+ $(MINIDOM_DIR)/minidom.cmx \
+ -cclib "$(MINIDOM_DIR)/ml_minidom.o" \
test.cmx \
-cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
-rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
(* Callbacks *)
let jump node =
-(*
- print_string ("jump: " ^ s ^ "\n") ;
- flush stdout
-*) ()
+ let module M = Minidom in
+ print_string ("jump: " ^
+ (match
+ M.node_get_attribute_ns node
+ (M.mDOMString_of_string "xlink")
+ (M.mDOMString_of_string "href")
+ with
+ None -> "DOES NOT WORKS (if you have clicked on the hyperlink)!!!!!"
+ | Some s -> M.string_of_mDOMString s
+ ) ^ "\n");
+ print_string ("jump: " ^
+ (match
+ M.node_get_attribute node
+ (M.mDOMString_of_string "href")
+ with
+ None -> "DOES NOT WORKS (if you have clicked on the hyperlink)!!!!!"
+ | Some s -> M.string_of_mDOMString s
+ ) ^ "\n");
+ flush stdout
;;
let selection_changed node =
-(*
- print_string ("jump: " ^ s ^ "\n") ;
- flush stdout
-*) ()
+ let module M = Minidom in
+ print_string ("selection_changed: " ^
+ (match
+ M.node_get_name node
+ with
+ None -> "selection_changed on nothing (???)"
+ | Some s -> "selection changed on " ^ M.string_of_mDOMString s
+ ) ^ "\n");
+ flush stdout
;;
+
let clicked node =
-(*
- print_string "clicked: IT WORKS\n" ;
- flush stdout
-*) ()
+ let module M = Minidom in
+ print_string ("clicked: " ^
+ (match
+ M.node_get_name node
+ with
+ None -> "Nothing clicked (???)"
+ | Some s -> M.string_of_mDOMString s ^ " clicked"
+ ) ^ "\n");
+ flush stdout
;;
+
let activate_t1 mathview sw () =
sw#remove !mathview#coerce ;
mathview :=