]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtkmathview/gMathViewAux.ml
* fixed bug of multiple selections
[helm.git] / helm / DEVEL / lablgtkmathview / gMathViewAux.ml
index 01465cb0a98ff686f1dae036cf468f3961da999c..8dfb919ba9d26c66494494ba9b5af0be68af5238 100644 (file)
@@ -156,13 +156,13 @@ class single_selection_math_view obj =
 
     ignore
      (self#connect#select_begin
-       (fun (elem : Gdome.element option) _ ->
+       (fun ((elem : Gdome.element option), _, _, _) ->
          if not (same_element root_selected elem) then selection_changed elem ;
          first_selected <- elem)) ;
 
     ignore
      (self#connect#select_over
-       (fun (elem : Gdome.element option) _ ->
+       (fun ((elem : Gdome.element option), _, _, _) ->
          let new_selected =
           match first_selected, elem with
              Some first', Some last' ->
@@ -176,7 +176,7 @@ class single_selection_math_view obj =
              
     ignore
      (self#connect#select_end
-       (fun (elem : Gdome.element option) _ -> first_selected <- None)) ;
+       (fun ((elem : Gdome.element option), _, _, _) -> first_selected <- None)) ;
 
     ignore
      (self#connect#select_abort
@@ -184,7 +184,7 @@ class single_selection_math_view obj =
          first_selected <- None ;
          selection_changed None)) ;
 
-    ignore (self#connect#click (fun _ -> self#set_selection None))
+    ignore (self#connect#click (fun _ -> self#set_selection None))
   end
 ;;
 
@@ -226,8 +226,9 @@ class multi_selection_math_view obj =
     self#thaw
 
    method add_selection (elem : Gdome.element) =
+    List.iter self#unselect selected ;
     selected <- elem::(remove_descendants_of elem selected) ;
-    self#select elem
+    List.iter self#select selected
 
    method get_selections = selected
 
@@ -249,13 +250,13 @@ class multi_selection_math_view obj =
    initializer
     ignore
      (self#connect#select_begin
-       (fun _ state ->
+       (fun (_,_,_,state) ->
          if not (List.mem `CONTROL (Gdk.Convert.modifier state)) then
           self#remove_selections)) ;
 
     ignore
      (self#connect#select_over
-       (fun _ state ->
+       (fun (_,_,_,state) ->
          let c = 
           function
              `SHIFT -> "shift "
@@ -270,7 +271,7 @@ class multi_selection_math_view obj =
 
     ignore
      (self#connect#select_end
-       (fun _ state ->
+       (fun (_,_,_,state) ->
          if not (List.mem `CONTROL (Gdk.Convert.modifier state)) then
           self#remove_selections ;
          match root_selected with
@@ -279,7 +280,7 @@ class multi_selection_math_view obj =
 
     ignore
      (self#connect#click
-       (fun _ -> self#remove_selections))
+       (fun _ -> self#remove_selections))
    end
  ;;