X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtkmathview%2Ftest%2Ftest.ml;h=0e8eca5cf2947d497661cba093b1c10e53ad1464;hb=ee18ff6db8d49339230b4212e145964b12c5a523;hp=76b2856d30e5e5f2a8a99f975e66bfdfeef5a61a;hpb=42fa20a1eac55122a1c6b2b47511ed162212c29b;p=helm.git diff --git a/helm/DEVEL/lablgtkmathview/test/test.ml b/helm/DEVEL/lablgtkmathview/test/test.ml index 76b2856d3..0e8eca5cf 100644 --- a/helm/DEVEL/lablgtkmathview/test/test.ml +++ b/helm/DEVEL/lablgtkmathview/test/test.ml @@ -1,4 +1,5 @@ -(* Copyright (C) 2000, Luca Padovani . +(* Copyright (C) 2000-2003, Luca Padovani , + * Claudio Sacerdoti Coen . * * This file is part of lablgtkmathview, the Ocaml binding * for the GtkMathView widget. @@ -106,22 +107,6 @@ let click mathview (element : Gdome.element) _ = let module G = Gdome in if not (jump element) then if not (mathview#action_toggle element) then - (* - match mathview#get_action with - Some n -> - mathview#action_toggle ; - print_string ("current action selection: " ^ - string_of_int mathview#action_get_selected ^ "\n") ; - flush stdout ; - | None -> - print_string ("mouse is on: " ^ - (match (mathview#get_element : Gdome.element option) with - Some e -> e#get_tagName#to_string - | None -> "NO ELEMENT!\n" - ) ^ "\n") ; - print_endline ("clicked: " ^ element#get_tagName#to_string) ; - flush stdout - *) () ;; @@ -347,6 +332,19 @@ let export_to_postscript (mathview : GMathViewAux.multi_selection_math_view) () flush stdout ;; +let x_coord = ref 0 +;; + +let get_element_at mathview () = + begin + match mathview#get_element_at !x_coord 10 with + None -> print_string ("there is no element at " ^ (string_of_int !x_coord) ^ " 10\n") + | Some e -> print_string ("at " ^ (string_of_int !x_coord) ^ " 10 found element " ^ (e#get_nodeName#to_string) ^ "\n") + end ; + x_coord := !x_coord + 10 ; + flush stdout +;; + (* Widget creation *) let main_window = GWindow.window ~title:"GtkMathView test" () in let vbox = GPack.vbox ~packing:main_window#add () in @@ -381,6 +379,7 @@ let button_get_font_manager_type = GButton.button ~label:"get_font_manager" ~pac let button_get_transparency = GButton.button ~label:"get_transparency" ~packing:(table#attach ~left:0 ~top:5) () in let button_set_transparency = GButton.button ~label:"set_transparency" ~packing:(table#attach ~left:1 ~top:5) () in let button_load_dom = GButton.button ~label:"load from DOM" ~packing:(table#attach ~left:2 ~top:5) () in +let button_get_element_at = GButton.button ~label:"get_element_at" ~packing:(table#attach ~left:3 ~top:5) () in (* Signals connection *) ignore(button_gtk#connect#clicked (activate_gtk mathview)) ; ignore(button_load#connect#clicked (load_uri mathview)) ; @@ -413,6 +412,7 @@ ignore(mathview#connect#click (click mathview)) ; ignore(mathview#connect#selection_changed (selection_changed mathview)); ignore(mathview#connect#element_over (element_over mathview)) ; ignore(button_load_dom#connect#clicked (load_doc mathview)) ; +ignore(button_get_element_at#connect#clicked (get_element_at mathview)) ; (* Main Loop *) main_window#show () ; GMain.Main.main ()