-(* Copyright (C) 2000-2003, Luca Padovani <luca.padovani@cs.unibo.it>,
- * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>.
+(* Copyright (C) 2000-2005,
+ * Luca Padovani <lpadovan@cs.unibo.it>
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zacchiro@cs.unibo.it>
*
- * This file is part of lablgtkmathview, the Ocaml binding
- * for the GtkMathView widget.
+ * This file is part of lablgtkmathview, the Ocaml binding for the
+ * GtkMathView widget.
*
* lablgtkmathview is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
*
* lablgtkmathview is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with lablgtkmathview; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
*
- * For details, send a mail to the author.
+ * For details, send a mail to the authors.
*)
(* finds the common node ancestor of two nodes *)
method action_toggle (elem : Gdome.element) =
match elem#get_namespaceURI, elem#get_localName with
Some ns, Some ln
- when ns#to_string = "http://www.w3.org/1998/Math/MathML" &&
- ln#to_string = "maction"
+ when
+ (ns#to_string = "http://www.w3.org/1998/Math/MathML" && ln#to_string = "maction") ||
+ (ns#to_string = "http://helm.cs.unibo.it/2003/BoxML" && ln#to_string = "action")
->
begin
let selection_attr = Gdome.domString "selection" in
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' ->
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
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
;;
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
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 ->
- let c =
- function
- `SHIFT -> "shift "
- | `LOCK -> "lock "
- | `CONTROL -> "control "
- | `MOD1 -> "mod1 "
- | _ -> ""
- in
- List.iter (fun x -> print_string (c x)) (Gdk.Convert.modifier state) ;
- print_char '\n' ;
- flush stdout)) ;
-
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
ignore
(self#connect#click
- (fun _ _ -> self#remove_selections))
+ (fun _ -> self#remove_selections))
end
;;