X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtk_gtkmathview%2Flablgtk-20000829_gtkmathview-0.1.0%2Ftest%2Ftest.ml;h=c58549e51235390aa5a68baa9f36233c481db3bb;hb=33dcab0b5868d4bfd2f813445cfc94827f1fc555;hp=96788c32fcfadc8acbfd7c23a614ccf41c9c699c;hpb=fb6e592cfeee3b5d1c59e66888c953bd9c43156f;p=helm.git 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 96788c32f..c58549e51 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 @@ -14,6 +14,13 @@ let jump node = *) () ;; +let selection_changed node = +(* + print_string ("jump: " ^ s ^ "\n") ; + flush stdout +*) () +;; + let clicked node = (* print_string "clicked: IT WORKS\n" ; @@ -21,8 +28,18 @@ let clicked node = *) () ;; +let activate_t1 mathview sw () = + mathview := + (GMathView.math_view ~packing:sw#add ~width:50 ~height:50 + ~use_t1_lib:true ()) ; + ignore(!mathview#connect#jump jump) ; + ignore(!mathview#connect#clicked clicked) ; + ignore(!mathview#connect#selection_changed selection_changed) ; + print_string "WIDGET RECREATED WITH T1 FONTS ACTIVATED\n" ; +;; + let load mathview () = - mathview#load "test.xml" ; + !mathview#load "test.xml" ; print_string "load: SEEMS TO WORK\n" ; flush stdout ;; @@ -31,7 +48,7 @@ exception Ok;; let get_selection mathview () = (* let selection = - match mathview#get_selection with + match !mathview#get_selection with None -> "NO SELECTION" | Some s -> s in @@ -41,33 +58,25 @@ let get_selection mathview () = ;; let unload mathview () = - mathview#unload ; + !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") ; + 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") ; + 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 ; + !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" ; @@ -75,21 +84,21 @@ let set_adjustments mathview () = ;; let get_hadjustment mathview () = - let adj = mathview#get_hadjustment in + 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 + 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 + 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"; @@ -97,14 +106,14 @@ let get_buffer mathview () = ;; let get_frame mathview () = - let frame = mathview#get_frame in + 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 ; + !mathview#set_font_size 24 ; print_string "set_font_size: FONT IS NOW 24\n" ; flush stdout ;; @@ -113,13 +122,12 @@ let set_font_size mathview () = 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 mathview= ref (GMathView.math_view ~packing:sw#add ~width:50 ~height:50 ()) in let hbox = GPack.hbox ~packing:vbox#pack () in +let button_t1=GButton.button ~label:"activate t1 fonts" ~packing:hbox#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 @@ -129,10 +137,10 @@ let button_get_buffer = GButton.button ~label:"get_buffer" ~packing:hbox#pack () 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_t1#connect#clicked (activate_t1 mathview sw)) ; 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)) ; @@ -141,8 +149,9 @@ 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) ; +ignore(!mathview#connect#jump jump) ; +ignore(!mathview#connect#clicked clicked) ; +ignore(!mathview#connect#selection_changed selection_changed) ; (* Main Loop *) main_window#show () ; GMain.Main.main ()