]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matitaMathView.ml
simplified cicBrowser: whelp bar is now always visible
[helm.git] / helm / matita / matitaMathView.ml
1 (* Copyright (C) 2004-2005, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 open Printf
27
28 open MatitaTypes
29
30 let list_map_fail f =
31   let rec aux = function
32     | [] -> []
33     | he::tl ->
34         try
35           let he' = f he in
36           he'::(aux tl)
37         with Exit ->
38           (aux tl)
39   in
40   aux
41
42 let add_trailing_slash =
43   let rex = Pcre.regexp "/$" in
44   fun s ->
45     if Pcre.pmatch ~rex s then s
46     else s ^ "/"
47
48 let strip_blanks =
49   let rex = Pcre.regexp "^\\s*([^\\s]*)\\s*$" in
50   fun s ->
51     (Pcre.extract ~rex s).(1)
52
53 (** inherit from this class if you want to access current script *)
54 class scriptAccessor =
55 object (self)
56   method private script = MatitaScript.instance ()
57 end
58
59 class clickableMathView obj =
60   let href = Gdome.domString "href" in
61   let xref = Gdome.domString "xref" in
62   object (self)
63     inherit GMathViewAux.multi_selection_math_view obj
64
65     val mutable href_callback: (string -> unit) option = None
66     method set_href_callback f = href_callback <- f
67
68     initializer
69       ignore (self#connect#selection_changed self#choose_selection);
70       ignore (self#connect#click (fun (gdome_elt, _, _, _) ->
71         match gdome_elt with
72         | Some elt  (* element is an hyperlink, use href_callback on it *)
73           when elt#hasAttributeNS ~namespaceURI:Misc.xlink_ns ~localName:href ->
74             (match href_callback with
75             | None -> ()
76             | Some f ->
77                 let uri =
78                   elt#getAttributeNS ~namespaceURI:Misc.xlink_ns ~localName:href
79                 in
80                 f (uri#to_string))
81         | Some elt -> ignore (self#action_toggle elt)
82         | None -> ()))
83     method private choose_selection gdome_elt =
84       let rec aux elt =
85         if elt#hasAttributeNS ~namespaceURI:Misc.helm_ns ~localName:xref then
86           self#set_selection (Some elt)
87         else
88           try
89             (match elt#get_parentNode with
90             | None -> assert false
91             | Some p -> aux (new Gdome.element_of_node p))
92           with GdomeInit.DOMCastException _ -> ()
93 (*             debug_print "trying to select above the document root" *)
94       in
95       match gdome_elt with
96       | Some elt -> aux elt
97       | None   -> self#set_selection None
98   end
99
100 let clickableMathView ?hadjustment ?vadjustment ?font_size ?log_verbosity =
101   GtkBase.Widget.size_params
102     ~cont:(OgtkMathViewProps.pack_return (fun p ->
103       OgtkMathViewProps.set_params
104         (new clickableMathView (GtkMathViewProps.MathView_GMetaDOM.create p))
105         ~font_size:None ~log_verbosity:None))
106     []
107
108 class sequentViewer obj =
109   object(self)
110
111     inherit clickableMathView obj
112
113     val mutable current_infos = None
114
115     method get_selected_terms =
116       let selections = self#get_selections in
117       list_map_fail
118         (fun node ->
119           let xpath =
120             ((node : Gdome.element)#getAttributeNS
121               ~namespaceURI:Misc.helm_ns
122               ~localName:(Gdome.domString "xref"))#to_string
123           in
124           if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
125           else
126             match current_infos with
127             | Some (ids_to_terms,_,_) ->
128                 (try Hashtbl.find ids_to_terms xpath with _ -> raise Exit)
129             | None -> assert false) (* "ERROR: No current term!!!" *)
130         selections
131
132     method get_selected_hypotheses =
133       let selections = self#get_selections in
134       list_map_fail
135         (fun node ->
136           let xpath =
137             ((node : Gdome.element)#getAttributeNS
138               ~namespaceURI:Misc.helm_ns
139               ~localName:(Gdome.domString "xref"))#to_string
140           in
141           if xpath = "" then assert false (* "ERROR: No xref found!!!" *)
142           else
143             match current_infos with
144             | Some (_,_,ids_to_hypotheses) ->
145                 (try Hashtbl.find ids_to_hypotheses xpath with _ -> raise Exit)
146             | None -> assert false) (* "ERROR: No current term!!!" *)
147         selections
148   
149   method load_sequent metasenv metano =
150     let sequent = CicUtil.lookup_meta metano metasenv in
151     let (mathml,(_,(ids_to_terms, ids_to_father_ids, ids_to_hypotheses,_))) =
152       ApplyTransformation.mml_of_cic_sequent metasenv sequent
153     in
154     current_infos <- Some (ids_to_terms, ids_to_father_ids, ids_to_hypotheses);
155 (*
156     debug_print "load_sequent: dumping MathML to ./prova";
157     ignore (Misc.domImpl#saveDocumentToFile ~name:"./prova" ~doc:mathml ());
158 *)
159     self#load_root ~root:mathml#get_documentElement
160  end
161
162 class sequentsViewer ~(notebook:GPack.notebook)
163   ~(sequentViewer:sequentViewer) ()
164 =
165   object (self)
166     inherit scriptAccessor
167
168     val mutable pages = 0
169     val mutable switch_page_callback = None
170     val mutable page2goal = []  (* associative list: page no -> goal no *)
171     val mutable goal2page = []  (* the other way round *)
172     val mutable goal2win = []   (* associative list: goal no -> scrolled win *)
173     val mutable _metasenv = []
174     val mutable scrolledWin: GBin.scrolled_window option = None
175       (* scrolled window to which the sequentViewer is currently attached *)
176
177     method private tab_label metano =
178       (GMisc.label ~text:(sprintf "?%d" metano) ~show:true ())#coerce
179
180     method reset =
181       (match scrolledWin with
182       | Some w ->
183           (* removing page from the notebook will destroy all contained widget,
184           * we do not want the sequentViewer to be destroyed as well *)
185           w#remove sequentViewer#coerce;
186           scrolledWin <- None
187       | None -> ());
188       for i = 1 to pages do notebook#remove_page 0 done;
189       pages <- 0;
190       page2goal <- [];
191       goal2page <- [];
192       goal2win <- [];
193       _metasenv <- [];
194       self#script#setGoal ~-1;
195       (match switch_page_callback with
196       | Some id ->
197           GtkSignal.disconnect notebook#as_widget id;
198           switch_page_callback <- None
199       | None -> ())
200
201     method load_sequents (status: ProofEngineTypes.status) =
202       let ((_, metasenv, _, _), goal) = status in
203       let sequents_no = List.length metasenv in
204       _metasenv <- metasenv;
205       pages <- sequents_no;
206       self#script#setGoal goal;
207       let win metano =
208         let w =
209           GBin.scrolled_window ~hpolicy:`AUTOMATIC ~vpolicy:`AUTOMATIC
210             ~shadow_type:`IN ~show:true ()
211         in
212         let reparent () =
213           scrolledWin <- Some w;
214           match sequentViewer#misc#parent with
215           | None -> w#add sequentViewer#coerce
216           | Some _ -> sequentViewer#misc#reparent w#coerce
217         in
218         goal2win <- (metano, reparent) :: goal2win;
219         w#coerce
220       in
221       let page = ref 0 in
222       List.iter
223         (fun (metano, _, _) ->
224           page2goal <- (!page, metano) :: page2goal;
225           goal2page <- (metano, !page) :: goal2page;
226           incr page;
227           notebook#append_page ~tab_label:(self#tab_label metano) (win metano))
228         metasenv;
229       switch_page_callback <-
230         Some (notebook#connect#switch_page ~callback:(fun page ->
231           let goal =
232             try
233               List.assoc page page2goal
234             with Not_found -> assert false
235           in
236           self#script#setGoal goal;
237           self#render_page ~page ~goal))
238
239     method private render_page ~page ~goal =
240       sequentViewer#load_sequent _metasenv goal;
241       try
242         List.assoc goal goal2win ();
243         sequentViewer#set_selection None
244       with Not_found -> assert false
245
246     method goto_sequent goal =
247       let page =
248         try
249           List.assoc goal goal2page
250         with Not_found -> assert false
251       in
252       notebook#goto_page page;
253       self#render_page page goal
254
255   end
256
257  (** constructors *)
258
259 type 'widget constructor =
260   ?hadjustment:GData.adjustment ->
261   ?vadjustment:GData.adjustment ->
262   ?font_size:int ->
263   ?log_verbosity:int ->
264   ?width:int ->
265   ?height:int ->
266   ?packing:(GObj.widget -> unit) ->
267   ?show:bool ->
268   unit ->
269     'widget
270
271 let sequentViewer ?hadjustment ?vadjustment ?font_size ?log_verbosity =
272   GtkBase.Widget.size_params
273     ~cont:(OgtkMathViewProps.pack_return (fun p ->
274       OgtkMathViewProps.set_params
275         (new sequentViewer (GtkMathViewProps.MathView_GMetaDOM.create p))
276         ~font_size ~log_verbosity))
277     []
278
279 let blank_uri = BuildTimeConf.blank_uri
280 let current_proof_uri = BuildTimeConf.current_proof_uri
281
282 type term_source =
283   [ `Ast of DisambiguateTypes.term
284   | `Cic of Cic.term * Cic.metasenv
285   | `String of string
286   ]
287
288 exception Browser_failure of string
289
290 let cicBrowsers = ref []
291
292 class type cicBrowser =
293 object
294   method load: MatitaTypes.mathViewer_entry -> unit
295   (* method loadList: string list -> MatitaTypes.mathViewer_entry-> unit *)
296   method loadInput: string -> unit
297 end
298
299 class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history)
300   ()
301 =
302   let term_RE = Pcre.regexp "^term:(.*)" in
303   let whelp_RE = Pcre.regexp "^\\s*whelp" in
304   let uri_RE =
305     Pcre.regexp
306       "^cic:/(\\w+/)*\\w+\\.(con|ind|var)(#xpointer\\(\\d+(/\\d+)+\\))?$"
307   in
308   let dir_RE = Pcre.regexp "^cic:((/(\\w+/)*\\w+(/)?)|/|)$" in
309   let whelp_query_RE = Pcre.regexp "^\\s*whelp\\s+([^\\s]+)\\s+(.*)$" in
310   let trailing_slash_RE = Pcre.regexp "/$" in
311   let has_xpointer_RE = Pcre.regexp "#xpointer\\(\\d+/\\d+(/\\d+)?\\)$" in
312   let is_whelp txt = Pcre.pmatch ~rex:whelp_RE txt in
313   let is_uri txt = Pcre.pmatch ~rex:uri_RE txt in
314   let is_dir txt = Pcre.pmatch ~rex:dir_RE txt in
315   let gui = MatitaGui.instance () in
316   let win = gui#newBrowserWin () in
317   let queries = ["Locate";"Hint";"Match";"Elim";"Instance"] in
318   let combo,_ = GEdit.combo_box_text ~strings:queries () in
319   let activate_combo_query input q =
320     let q' = String.lowercase q in
321     let rec aux i = function
322       | [] -> failwith ("Whelp query '" ^ q ^ "' not found")
323       | h::_ when String.lowercase h = q' -> i
324       | _::tl -> aux (i+1) tl
325     in
326     combo#set_active (aux 0 queries);
327     win#queryInputText#set_text input
328   in
329   let set_whelp_query txt =
330     let query, arg = 
331       try
332         let q = Pcre.extract ~rex:whelp_query_RE txt in
333         q.(1), q.(2)
334       with Invalid_argument _ -> failwith "Malformed Whelp query"
335     in
336     activate_combo_query arg query
337   in
338   let toplevel = win#toplevel in
339   let mathView = sequentViewer ~packing:win#scrolledBrowser#add () in
340   let fail msg =
341     ignore (MatitaGtkMisc.ask_confirmation ~gui:(MatitaGui.instance ())
342       ~title:"Cic browser" ~msg ~cancel:false ());
343   in
344   let tags =
345     [ "dir", GdkPixbuf.from_file (MatitaMisc.image_path "matita-folder.png");
346       "obj", GdkPixbuf.from_file (MatitaMisc.image_path "matita-object.png") ]
347   in
348   let handle_error f =
349     try
350       f ()
351     with exn ->
352       fail (sprintf "Uncaught exception:\n%s" (Printexc.to_string exn))
353   in
354   let handle_error' f = (fun () -> handle_error (fun () -> f ())) in
355   object (self)
356     inherit scriptAccessor
357     
358     (* Whelp bar queries *)
359
360     initializer
361       activate_combo_query "" "locate";
362       win#whelpBarComboVbox#add combo#coerce;
363       let start_query () = 
364         let query = String.lowercase (List.nth queries combo#active) in
365         let input = win#queryInputText#text in
366         let statement = "whelp " ^ query ^ " " ^ input ^ "." in
367         (MatitaScript.instance ())#advance ~statement ()
368       in
369       ignore(win#queryInputText#connect#activate ~callback:start_query);
370       ignore(combo#connect#changed ~callback:start_query);
371       win#whelpBarImage#set_file (MatitaMisc.image_path "whelp.png");
372       win#mathOrListNotebook#set_show_tabs false;
373
374       win#browserForwardButton#misc#set_sensitive false;
375       win#browserBackButton#misc#set_sensitive false;
376       ignore (win#browserUri#entry#connect#activate (handle_error' (fun () ->
377         self#loadInput win#browserUri#entry#text)));
378       ignore (win#browserHomeButton#connect#clicked (handle_error' (fun () ->
379         self#load (`About `Current_proof))));
380       ignore (win#browserRefreshButton#connect#clicked
381         (handle_error' self#refresh));
382       ignore (win#browserBackButton#connect#clicked (handle_error' self#back));
383       ignore (win#browserForwardButton#connect#clicked
384         (handle_error' self#forward));
385       ignore (win#toplevel#event#connect#delete (fun _ ->
386         let my_id = Oo.id self in
387         cicBrowsers := List.filter (fun b -> Oo.id b <> my_id) !cicBrowsers;
388         if !cicBrowsers = [] &&
389           Helm_registry.get "matita.mode" = "cicbrowser"
390         then
391           GMain.quit ();
392         false));
393       ignore(win#whelpResultTreeview#connect#row_activated 
394         ~callback:(fun _ _ -> self#loadInput (self#_getSelectedUri ())));
395       mathView#set_href_callback (Some (fun uri ->
396         handle_error (fun () -> self#load (`Uri uri))));
397       self#_load (`About `Blank);
398       toplevel#show ()
399
400     val mutable current_entry = `About `Blank 
401     val mutable current_infos = None
402     val mutable current_mathml = None
403
404     val model =
405       new MatitaGtkMisc.taggedStringListModel tags win#whelpResultTreeview
406
407     method private _getSelectedUri () =
408       match model#easy_selection () with
409       | [sel] when is_uri sel -> sel  (* absolute URI selected *)
410       | [sel] -> win#browserUri#entry#text ^ sel  (* relative URI selected *)
411       | _ -> assert false
412
413     (** history RATIONALE 
414      *
415      * All operations about history are done using _historyFoo.
416      * Only toplevel functions (ATM load and loadInput) call _historyAdd.
417      *)
418           
419     method private _historyAdd item = 
420       history#add item;
421       win#browserBackButton#misc#set_sensitive true;
422       win#browserForwardButton#misc#set_sensitive false
423
424     method private _historyPrev () =
425       let item = history#previous in
426       if history#is_begin then win#browserBackButton#misc#set_sensitive false;
427       win#browserForwardButton#misc#set_sensitive true;
428       item
429     
430     method private _historyNext () =
431       let item = history#next in
432       if history#is_end then win#browserForwardButton#misc#set_sensitive false;
433       win#browserBackButton#misc#set_sensitive true;
434       item
435
436     (** notebook RATIONALE 
437      * 
438      * Use only these functions to switch between the tabs
439      *)
440     method private _showList = win#mathOrListNotebook#goto_page 1
441     method private _showMath = win#mathOrListNotebook#goto_page 0
442     
443     method private back () =
444       try
445         self#_load (self#_historyPrev ())
446       with MatitaMisc.History_failure -> ()
447
448     method private forward () =
449       try
450         self#_load (self#_historyNext ())
451       with MatitaMisc.History_failure -> ()
452
453       (* loads a uri which can be a cic uri or an about:* uri
454       * @param uri string *)
455     method private _load entry =
456       try
457           if entry <> current_entry || entry = `About `Current_proof then begin
458             (match entry with
459             | `About `Current_proof -> self#home ()
460             | `About `Blank -> self#blank ()
461             | `About `Us -> () (* TODO implement easter egg here :-] *)
462             | `Check term -> self#_loadCheck term
463             | `Cic (term, metasenv) -> self#_loadTermCic term metasenv
464             | `Dir dir -> self#_loadDir dir
465             | `Uri uri -> self#_loadUriManagerUri (UriManager.uri_of_string uri)
466             | `Whelp (query, results) -> 
467                 set_whelp_query query;
468                 self#_loadList (List.map (fun r -> "obj", r) results));
469             self#setEntry entry
470           end
471       with
472       | UriManager.IllFormedUri uri -> fail (sprintf "invalid uri: %s" uri)
473       | CicEnvironment.Object_not_found uri ->
474           fail (sprintf "object not found: %s" (UriManager.string_of_uri uri))
475       | Browser_failure msg -> fail msg
476
477     method private blank () =
478       self#_showMath;
479       mathView#load_root (MatitaMisc.empty_mathml ())#get_documentElement
480
481     method private _loadCheck term =
482       failwith "not implemented _loadCheck";
483       self#_showMath
484
485     method private home () =
486       self#_showMath;
487       match self#script#status.proof_status with
488       | Proof  (uri, metasenv, bo, ty) ->
489           let name = UriManager.name_of_uri (MatitaMisc.unopt uri) in
490           let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], []) in
491           self#_loadObj obj
492       | Incomplete_proof ((uri, metasenv, bo, ty), _) -> 
493           let name = UriManager.name_of_uri (MatitaMisc.unopt uri) in
494           let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], []) in
495           self#_loadObj obj
496       | _ -> self#blank ()
497
498       (** loads a cic uri from the environment
499       * @param uri UriManager.uri *)
500     method private _loadUriManagerUri uri =
501       let uri = UriManager.strip_xpointer uri in
502       let (obj, _) = CicEnvironment.get_obj CicUniv.empty_ugraph uri in
503       self#_loadObj obj
504       
505     method private _loadDir dir = 
506       let content = Http_getter.ls dir in
507       let l =
508         List.map
509           (function 
510             | Http_getter_types.Ls_section s -> "dir", s
511             | Http_getter_types.Ls_object o -> "obj", o.Http_getter_types.uri)
512           content
513       in
514       if l = [] then raise (Browser_failure "no such directory");
515       self#_loadList l
516
517     method private setEntry entry =
518       win#browserUri#entry#set_text (string_of_entry entry);
519       current_entry <- entry
520
521     method private _loadObj obj =
522       self#_showMath; 
523       (* this must be _before_ loading the document, since 
524        * if the widget is not mapped (hidden by the notebook)
525        * the document is not rendered *)
526       let use_diff = false in (* ZACK TODO use XmlDiff when re-rendering? *)
527       let (mathml, (_,(ids_to_terms, ids_to_father_ids, ids_to_conjectures,
528            ids_to_hypotheses,_,_))) =
529         ApplyTransformation.mml_of_cic_object obj
530       in
531       current_infos <- Some (ids_to_terms, ids_to_father_ids,
532         ids_to_conjectures, ids_to_hypotheses);
533       (match current_mathml with
534       | Some current_mathml when use_diff ->
535           mathView#freeze;
536           XmlDiff.update_dom ~from:current_mathml mathml;
537           mathView#thaw
538       |  _ ->
539           mathView#load_root ~root:mathml#get_documentElement;
540           current_mathml <- Some mathml);
541
542     method private _loadTermCic term metasenv =
543       let context = self#script#proofContext in
544       let dummyno = CicMkImplicit.new_meta metasenv [] in
545       let sequent = (dummyno, context, term) in
546       mathView#load_sequent (sequent :: metasenv) dummyno;
547       self#_showMath
548
549     method private _loadList l =
550       model#list_store#clear ();
551       List.iter (fun (tag, s) -> model#easy_append ~tag s) l;
552       self#_showList
553     
554     (** { public methods, all must call _load!! } *)
555       
556     method load entry =
557       handle_error (fun () -> self#_load entry; self#_historyAdd entry)
558
559     (**  this is what the browser does when you enter a string an hit enter *)
560     method loadInput txt =
561       let txt = strip_blanks txt in
562       let fix_uri txt =
563         UriManager.string_of_uri
564           (UriManager.strip_xpointer (UriManager.uri_of_string txt))
565       in
566       if is_whelp txt then begin
567         set_whelp_query txt;  
568         (MatitaScript.instance ())#advance ~statement:(txt ^ ".") ()
569       end else begin
570         let entry =
571           match txt with
572           | txt when is_uri txt -> `Uri (fix_uri txt)
573           | txt when is_dir txt -> `Dir (add_trailing_slash txt)
574           | txt ->
575               (try
576                 entry_of_string txt
577               with Invalid_argument _ ->
578                 raise (Browser_failure (sprintf "unsupported uri: %s" txt)))
579         in
580         self#_load entry;
581         self#_historyAdd entry
582       end
583
584       (** {2 methods used by constructor only} *)
585
586     method win = win
587     method history = history
588     method currentEntry = current_entry
589     method refresh () =
590       if current_entry = `About `Current_proof then
591       self#_load (`About `Current_proof) 
592   end
593
594   
595 let sequentsViewer ~(notebook:GPack.notebook)
596   ~(sequentViewer:sequentViewer) ()
597 =
598   new sequentsViewer ~notebook ~sequentViewer ()
599
600 let cicBrowser () =
601   let size = BuildTimeConf.browser_history_size in
602   let rec aux history =
603     let browser = new cicBrowser_impl ~history () in
604     let win = browser#win in
605     ignore (win#browserNewButton#connect#clicked (fun () ->
606       let history =
607         new MatitaMisc.browser_history ~memento:history#save size
608           (`About `Blank)
609       in
610       let newBrowser = aux history in
611       newBrowser#load browser#currentEntry));
612 (*
613       (* attempt (failed) to close windows on CTRL-W ... *)
614     MatitaGtkMisc.connect_key win#browserWinEventBox#event ~modifiers:[`CONTROL]
615       GdkKeysyms._W (fun () -> win#toplevel#destroy ());
616 *)
617     cicBrowsers := browser :: !cicBrowsers;
618     (browser :> cicBrowser)
619   in
620   let history = new MatitaMisc.browser_history size (`About `Blank) in
621   aux history
622
623 let refresh_all_browsers () = List.iter (fun b -> b#refresh ()) !cicBrowsers
624
625 let default_sequentViewer () = sequentViewer ~show:true ()
626 let sequentViewer_instance = MatitaMisc.singleton default_sequentViewer
627
628 let default_sequentsViewer () =
629   let gui = MatitaGui.instance () in
630   let sequentViewer = sequentViewer_instance () in
631   sequentsViewer ~notebook:gui#main#sequentsNotebook ~sequentViewer ()
632 let sequentsViewer_instance = MatitaMisc.singleton default_sequentsViewer
633
634 let mathViewer () = 
635   object(self)
636     method private get_browser reuse = 
637       if reuse then
638         (match !cicBrowsers with
639         | [] -> cicBrowser ()
640         | b :: _ -> (b :> cicBrowser))
641       else
642         (cicBrowser ())
643           
644     method show_entry ?(reuse=false) t = (self#get_browser reuse)#load t
645       
646     method show_uri_list ?(reuse=false) ~entry l =
647       (self#get_browser reuse)#load entry
648   end