X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtkmathview%2FgMathViewAux.ml;h=8dfb919ba9d26c66494494ba9b5af0be68af5238;hb=6a9a80d3c988c355e8067013cb9d34d92404454b;hp=928e2196522e5981be0cc2efc98341de2a08dbcf;hpb=93393088bc8d331fb1cb0a81d94074240b16df4d;p=helm.git diff --git a/helm/DEVEL/lablgtkmathview/gMathViewAux.ml b/helm/DEVEL/lablgtkmathview/gMathViewAux.ml index 928e21965..8dfb919ba 100644 --- a/helm/DEVEL/lablgtkmathview/gMathViewAux.ml +++ b/helm/DEVEL/lablgtkmathview/gMathViewAux.ml @@ -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,33 +184,15 @@ 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 ;; -let single_selection_math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width - ?width ?height ?packing ?show () = - let w = - GtkMathView.MathView.create - ?adjustmenth:(Gaux.may_map ~f:GData.as_adjustment adjustmenth) - ?adjustmentv:(Gaux.may_map ~f:GData.as_adjustment adjustmentv) - () - in - GtkBase.Container.set w ?border_width ?width ?height; - let mathview = - GObj.pack_return (new single_selection_math_view w) ~packing ~show - in - begin - match font_size with - | Some size -> mathview#set_font_size size - | None -> () - end; - begin - match font_manager with - | Some manager -> mathview#set_font_manager_type ~fm_type:manager - | None -> () - end; - mathview +let single_selection_math_view ?hadjustment ?vadjustment ?font_size ?log_verbosity = + GtkBase.Widget.size_params ~cont:( + OgtkMathViewProps.pack_return + (fun p -> OgtkMathViewProps.set_params (new single_selection_math_view + (GtkMathViewProps.MathView_GMetaDOM.create p)) ~font_size ~log_verbosity)) [] ;; class multi_selection_math_view_signals obj @@ -244,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 @@ -267,15 +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 -> - Printf.printf "stable selections: %d\n" (List.length selected) ; - Printf.printf "select_over with state: " ; + (fun (_,_,_,state) -> let c = function `SHIFT -> "shift " @@ -290,8 +271,7 @@ class multi_selection_math_view obj = ignore (self#connect#select_end - (fun _ state -> - Printf.printf "select_end\n" ; flush stdout ; + (fun (_,_,_,state) -> if not (List.mem `CONTROL (Gdk.Convert.modifier state)) then self#remove_selections ; match root_selected with @@ -300,30 +280,13 @@ class multi_selection_math_view obj = ignore (self#connect#click - (fun _ _ -> self#remove_selections)) + (fun _ -> self#remove_selections)) end ;; -let multi_selection_math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width - ?width ?height ?packing ?show () = - let w = - GtkMathView.MathView.create - ?adjustmenth:(Gaux.may_map ~f:GData.as_adjustment adjustmenth) - ?adjustmentv:(Gaux.may_map ~f:GData.as_adjustment adjustmentv) - () - in - GtkBase.Container.set w ?border_width ?width ?height; - let mathview = GObj.pack_return (new multi_selection_math_view w) ~packing ~show in - begin - match font_size with - | Some size -> mathview#set_font_size size - | None -> () - end; - begin - match font_manager with - | Some manager -> mathview#set_font_manager_type ~fm_type:manager - | None -> () - end; - mathview +let multi_selection_math_view ?hadjustment ?vadjustment ?font_size ?log_verbosity = + GtkBase.Widget.size_params ~cont:( + OgtkMathViewProps.pack_return + (fun p -> OgtkMathViewProps.set_params (new multi_selection_math_view + (GtkMathViewProps.MathView_GMetaDOM.create p)) ~font_size ~log_verbosity)) [] ;; -