let main (main_ui:Design.main_window_extension_points) =

  (* reset attributes for the list of source files *)
  reset main_ui;

  let value_selector
      menu (main_ui:Design.main_window_extension_points) ~button localizable =
    to_do_on_select
      menu
      main_ui
      button
      localizable
  in
  main_ui#register_source_selector value_selector;

  let highlighter (buffer:GSourceView.source_buffer) localizable ~start ~stop =
    (* highlight the degeneration point *)
    Extlib.may
      (fun loc ->
         if Cilutil.equals localizable loc then
           let orange_area = make_tag
             buffer
             ~name:"degeneration"
             [`BACKGROUND "orange" ]
           in
           apply_tag buffer orange_area start stop)
      (DegeneratedHighlighted.get ());

    (* highlight dead code areas if values were computed.*)
    if Db.Value.is_computed () then
      let ki = match localizable with
      | PStmt (_,stmt) | PCodeAnnot (_,stmt,_) -> Kstmt stmt
      | PLval (_,ki,_) | PTermLval(_,ki,_) 
      | PPredicate (_,ki,_) -> ki
      | PVDecl _ | PGlobal _ | PBehavior _ -> Kglobal
      in
      if not (Value.is_accessible ki) then
        let dead_code_area =
          make_tag
            buffer
            "deadcode"
            [`BACKGROUND "tomato";
             `STRIKETHROUGH true;
             `STYLE `ITALIC;]
        in
        apply_tag buffer dead_code_area start stop
  in
  main_ui#register_source_highlighter highlighter;

  let filetree_selector ~was_activated ~activating globals =
    if Value.is_computed () then begin
      if not was_activated && activating then begin match globals with
(* [JS 2009/30/03] GUI may become too slow if values are displayed *)
(*      | [GFun ({svar=v},_)] ->
          begin try
            let kf = Globals.Functions.get v in
            let s = Pretty_utils.sfprintf "@[%a@]" Value.display kf in
            main_ui#annot_window#buffer#insert s
          with Not_found -> ()
          end*)

      | _ -> ();
      end;
    end
  in
  main_ui#file_tree#add_select_function filetree_selector