From 33dcab0b5868d4bfd2f813445cfc94827f1fc555 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Tue, 7 Nov 2000 09:56:56 +0000 Subject: [PATCH] Start of test phase --- .../gMathView.ml | 4 +- .../gtkMathView.ml | 8 +-- .../ml_gtk_mathview.c | 4 +- .../test/test.ml | 59 +++++++++++-------- 4 files changed, 42 insertions(+), 33 deletions(-) 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 915cd313f..f83774444 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 @@ -42,8 +42,8 @@ class math_view obj = object 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 set_log_verbosity = MathView.set_log_verbosity obj + method get_log_verbosity = MathView.get_log_verbosity obj method export_to_postscript = MathView.export_to_postscript obj end 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 a612a8b00..1deb11182 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 @@ -53,10 +53,10 @@ module MathView = struct "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 set_log_verbosity : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_log_verbosity" + external get_log_verbosity : [>`math_view] obj -> int = + "ml_gtk_math_view_get_log_verbosity" external export_to_postscript : [>`math_view] obj -> int = "ml_gtk_math_view_export_to_postscript" 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 f043b4b4b..a51539791 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 @@ -41,8 +41,8 @@ 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_set_log_verbosity, GtkMathView_val, Int_val, Unit) +ML_1 (gtk_math_view_get_log_verbosity, GtkMathView_val, Val_int) ML_2 (gtk_math_view_export_to_postscript, GtkMathView_val, Int_val, Unit) 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 () -- 2.39.2