X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2FmatitaMathView.ml;h=bb62f51c98d334818e64eb013b6300e0ca783e3e;hb=a785a3526d4dcbb6c5810ed4fb943132c9ff2d45;hp=b83c9b37fa9abe3c21fc28bdae1b266581e021b7;hpb=190e42f1030ea3d459c4040bb0e8503a7c096820;p=helm.git diff --git a/helm/matita/matitaMathView.ml b/helm/matita/matitaMathView.ml index b83c9b37f..bb62f51c9 100644 --- a/helm/matita/matitaMathView.ml +++ b/helm/matita/matitaMathView.ml @@ -44,6 +44,25 @@ let list_map_fail f = in aux +let choose_selection mmlwidget (element : Gdome.element option) = + let rec aux element = + if element#hasAttributeNS + ~namespaceURI:Misc.helmns + ~localName:(Gdome.domString "xref") + then + mmlwidget#set_selection (Some element) + else + try + match element#get_parentNode with + | None -> assert false + | Some p -> aux (new Gdome.element_of_node p) + with GdomeInit.DOMCastException _ -> + debug_print "trying to select above the document root" + in + match element with + | Some x -> aux x + | None -> mmlwidget#set_selection None + class proof_viewer obj = object(self) @@ -59,11 +78,7 @@ class proof_viewer obj = prerr_endline (gdome_elt#get_nodeName#to_string); ignore (self#action_toggle gdome_elt) | None -> ())); - (* bugfix: until mapping gtkmathview doesn't draw anything *) - ignore (self#misc#connect#after#map (fun _ -> - match current_mathml with - | None -> () - | Some mathml -> self#load_root ~root:mathml#get_documentElement)) + ignore (self#connect#selection_changed (choose_selection self)) method load_proof ((uri_opt, _, _, _) as proof, (goal_opt: int option)) = let (annobj, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts, @@ -93,6 +108,9 @@ class sequent_viewer obj = inherit GMathViewAux.multi_selection_math_view obj + initializer + ignore (self#connect#selection_changed (choose_selection self)) + val mutable current_infos = None method get_selected_terms = @@ -187,7 +205,7 @@ class sequents_viewer ~(notebook:GPack.notebook) let win metano = let w = GBin.scrolled_window ~hpolicy:`AUTOMATIC ~vpolicy:`AUTOMATIC - ~show:true () + ~shadow_type:`IN ~show:true () in let reparent () = match sequent_viewer#misc#parent with @@ -206,7 +224,7 @@ class sequents_viewer ~(notebook:GPack.notebook) notebook#append_page ~tab_label:(tab_label metano) (win metano)) metasenv; switch_page_callback <- - Some (notebook#connect#after#switch_page ~callback:(fun page -> + Some (notebook#connect#switch_page ~callback:(fun page -> let goal = try List.assoc page page2goal @@ -218,7 +236,9 @@ class sequents_viewer ~(notebook:GPack.notebook) method private render_page ~page ~goal = sequent_viewer#load_sequent _metasenv goal; try - List.assoc goal goal2win () + List.assoc goal goal2win (); + debug_print "set_selection none"; + sequent_viewer#set_selection None with Not_found -> assert false method goto_sequent goal = @@ -228,7 +248,7 @@ class sequents_viewer ~(notebook:GPack.notebook) with Not_found -> assert false in notebook#goto_page page; - self#render_page page goal + self#render_page page goal; end @@ -253,11 +273,7 @@ let proof_viewer ?hadjustment ?vadjustment ?font_size ?log_verbosity = let proof_viewer_instance = let instance = lazy ( let gui = MatitaGui.instance () in - let frame = - GBin.frame ~packing:(gui#proof#scrolledProof#add_with_viewport) - ~show:true () - in - proof_viewer ~show:true ~packing:(frame#add) () + proof_viewer ~show:true ~packing:gui#proof#scrolledProof#add () ) in fun () -> Lazy.force instance