]> matita.cs.unibo.it Git - helm.git/commitdiff
* some small bug fixes
authorLuca Padovani <luca.padovani@unito.it>
Wed, 29 Jan 2003 18:15:56 +0000 (18:15 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Wed, 29 Jan 2003 18:15:56 +0000 (18:15 +0000)
* updated licenses in all source files

helm/DEVEL/lablgtkmathview/ChangeLog
helm/DEVEL/lablgtkmathview/LICENSE
helm/DEVEL/lablgtkmathview/gMathView.ml
helm/DEVEL/lablgtkmathview/gMathView.mli
helm/DEVEL/lablgtkmathview/gMathViewAux.ml
helm/DEVEL/lablgtkmathview/gMathViewAux.mli
helm/DEVEL/lablgtkmathview/gtkMathView.ml
helm/DEVEL/lablgtkmathview/gtk_mathview.ml
helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c
helm/DEVEL/lablgtkmathview/test/test.ml

index 2635a4b0025202e54eeac1be295dc2b60f65e2c8..19ce76012b80b770e063ec6402fa8dfb91326d70 100644 (file)
@@ -1,3 +1,6 @@
+* 0.4.1
+ - Upgraded to GtkMathView 0.4.[0,1]
 * 0.3.0
- - Upgraded to GtkMathView 3.0
+ - Upgraded to GtkMathView 0.3.0
  - Now based on the gmetadom (alias gdome2) binding to GDOMe Level 2
index 3781bdacccd300de6114c21bdf52e5c731d41597..691e4e01c428b6912e73a0daa5b6281d9fe47b23 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
index d1028d189f67eae1c066d988c09573c6b06781e4..fd505f1dcda9b23358d8732899bf3c15b8012a5e 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
@@ -120,6 +121,7 @@ class math_view_skel obj = object
  method select element = MathView.select obj ((element : Gdome.element)#as_Element)
  method unselect element = MathView.unselect obj ((element : Gdome.element)#as_Element)
  method is_selected element = MathView.is_selected obj ((element : Gdome.element)#as_Element)
+ method get_element_at x y = option_element_of_option (MathView.get_element_at obj x y)
  method get_width = MathView.get_width obj
  method get_height = MathView.get_height obj
  method get_top = MathView.get_top obj
index e52a7a484c7d0a6cecc0bf9cc961492addf92ace..d8a5dd61694be3dd496361d2863a1d1181e504e2 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
@@ -77,6 +78,7 @@ class math_view_skel :
     method set_log_verbosity : int -> unit
     method select : Gdome.element -> unit
     method unselect : Gdome.element -> unit
+    method get_element_at : int -> int -> Gdome.element option
     method is_selected : Gdome.element -> bool
     method set_top : int -> int -> unit
     method set_transparency : bool -> unit
index 4d10bf395b63a6376cb0fdd4caa76a57a3a72cfc..ba12fdfdfcc46bc06f796c39919e189834eeda60 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
index e63c41173a41586d8e71dbb7a210596dd33741f9..edcf156357e7f65097bab15d0c85b8aff099c1c4 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
index dbb1463b7b825095078e9957f7957c7241969b32..4af1ae7826340b471b170701ab16c08f1de8fb4e 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
@@ -61,6 +62,9 @@ module MathView = struct
   external is_selected :
    [>`math_view] obj -> [> `Element] GdomeT.t -> bool =
    "ml_gtk_math_view_is_selected"
+  external get_element_at :
+   [> `math_view] obj -> int -> int -> TElement.t option =
+   "ml_gtk_math_view_get_element_at"
   external get_width : [>`math_view] obj -> int =
    "ml_gtk_math_view_get_width"
   external get_height : [>`math_view] obj -> int =
index 27ca4c45c7cf78e441f9b900f27611f3e5b9e535..5472acbe5bd55b4a0f8df155628083dcaa7cf5b4 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
index 7e260cd97817734f367b89031cca9d541f115925..1f6b19b9f47c31358f3ed8ca107bbb9617614143 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+/* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * This file is part of lablgtkmathview, the Ocaml binding
  * for the GtkMathView widget.
 #define FontManagerId_val(val) Int_val(val)
 #define Val_FontManagerId(val) Val_int(val)
 
-// As ML_1, but the result is optional
+/* As ML_1, but the result is optional */
 #define OML_1(cname, conv1, conv) \
 value ml_##cname (value arg1) { return Val_option_ptr((cname (conv1 (arg1))),conv); }
-// As ML_2, but the second argument is optional
+/* As ML_3, but the result is optional */
+#define OML_3(cname, conv1, conv2, conv3, conv) \
+value ml_##cname (value arg1, value arg2, value arg3) { return Val_option_ptr((cname (conv1 (arg1), conv2 (arg2), conv3 (arg3))),conv); }
+/* As ML_2, but the second argument is optional */
 #define ML_2O(cname, conv1, conv2, conv) \
 value ml_##cname (value arg1, value arg2) \
 { return conv (cname (conv1(arg1), ptr_val_option(arg2,conv2))); }
@@ -76,6 +80,17 @@ value_of_font_manager_id(FontManagerId id)
   }
 }
 
+value Val_Element_ref(GdomeElement* elem)
+{
+  if (elem != NULL)
+    {
+      GdomeException exc = 0;
+      gdome_el_ref(elem, &exc);
+      g_assert(exc == 0);
+    }
+  return Val_Element(elem);
+}
+
 ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val, Val_GtkWidget_sink)
 ML_1 (gtk_math_view_freeze, GtkMathView_val, Unit)
 ML_1 (gtk_math_view_thaw, GtkMathView_val, Unit)
@@ -85,6 +100,7 @@ ML_1 (gtk_math_view_unload, GtkMathView_val, Unit)
 ML_2 (gtk_math_view_select, GtkMathView_val, Element_val, Unit)
 ML_2 (gtk_math_view_unselect, GtkMathView_val, Element_val, Unit)
 ML_2 (gtk_math_view_is_selected, GtkMathView_val, Element_val, Val_bool)
+OML_3 (gtk_math_view_get_element_at, GtkMathView_val, Int_val, Int_val, Val_Element_ref)
 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)
@@ -140,10 +156,24 @@ value ml_gtk_math_view_get_top (value arg1)
    gtk_math_view_get_top(GtkMathView_val (arg1), &x, &y);
    result = alloc(2, 0);
    Store_field(result, 0, Val_int(x));
-   Store_field(result, 0, Val_int(y));
+   Store_field(result, 1, Val_int(y));
    CAMLreturn (result);
 }
 
+/*
+value ml_gtk_math_view_get_element_coords (value arg1, value arg2)
+{
+  CAMLparam2(arg1, arg2);
+  CAMLlocal1 (result);
+  int x, y;
+  gtk_math_view_get_element_coords(GtkMathView_val (arg1), Element_val(arg2), &x, &y);
+  result = alloc(2, 0);
+  Store_field(result, 0, Val_int(x));
+  Store_field(result, 1, Val_int(y));
+  CAMLreturn (result);
+}
+*/
+
 value ml_gtk_math_view_gdome_element_of_boxed_option (value arg1)
 {
    CAMLparam1(arg1);
@@ -192,3 +222,4 @@ value ml_gtk_math_view_gdome_element_option_of_boxed_option (value arg1)
 
    CAMLreturn(res);
 }
+
index 76b2856d30e5e5f2a8a99f975e66bfdfeef5a61a..0e8eca5cf2947d497661cba093b1c10e53ad1464 100644 (file)
@@ -1,4 +1,5 @@
-(* Copyright (C) 2000, Luca Padovani <luca.padovani@cs.unibo.it>.
+(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
+ *                          Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
  *
  * 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 ()