From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact insight-help@sources.redhat.com; run by ezmlm Received: (qmail 690 invoked from network); 11 Nov 2002 22:33:52 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 11 Nov 2002 22:33:52 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id gABMAnw25481 for ; Mon, 11 Nov 2002 17:10:49 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gABMXpD12353 for ; Mon, 11 Nov 2002 17:33:51 -0500 Received: from DRAGON (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gABMXpq32721 for ; Mon, 11 Nov 2002 17:33:51 -0500 Subject: [patch] new help browser code From: "Martin M. Hunt" To: "insight@sources.redhat.com" Content-Type: multipart/mixed; boundary="=-cUgOY6OLl2wJ//iKeQkt" Date: Mon, 11 Nov 2002 14:33:00 -0000 Message-Id: <1037054119.1175.26.camel@localhost.localdomain> Mime-Version: 1.0 X-SW-Source: 2002-q4/txt/msg00091.txt.bz2 --=-cUgOY6OLl2wJ//iKeQkt Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 740 This patch removes the old, broken htmlviewer used to display the help pages. Instead the new code attempts to find an appropriate help viewer based on the OS and compatibility settings. If one cannot be found, the user is prompted. 2002-11-11 Martin M. Hunt * library/helpviewer.tcl: New file. Finds an appropriate help browser and displays the help files. * library/vartree.itb: Fix open_help calls. * library/helpviewer.ith: Deleted. * library/helpviewer.itb: Deleted. * library/prefs.tcl (pref_set_defaults): Remove pref gdb/help/browser. Add pref gdb/help/browsername. We couldn't simply rename because it would break older versions of Insight that expect gdb/help/browser to be a number. --=-cUgOY6OLl2wJ//iKeQkt Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Content-Type: text/x-patch; name=p; charset=UTF-8 Content-length: 3075 Index: prefs.tcl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v retrieving revision 1.20 diff -p -r1.20 prefs.tcl *** prefs.tcl 8 Nov 2002 20:56:44 -0000 1.20 --- prefs.tcl 11 Nov 2002 22:28:03 -0000 *************** proc pref_set_defaults {} { *** 385,391 **** pref define gdb/bp/show_threads 0 =20=20 # Help ! pref define gdb/help/browser 0 =20=20 # Kernel Objects (kod) pref define gdb/kod/show_icon 0 --- 385,391 ---- pref define gdb/bp/show_threads 0 =20=20 # Help ! pref define gdb/help/browsername "" =20=20 # Kernel Objects (kod) pref define gdb/kod/show_icon 0 Index: vartree.itb =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/gdbtk/library/vartree.itb,v retrieving revision 1.1 diff -p -r1.1 vartree.itb *** vartree.itb 6 Nov 2002 21:05:23 -0000 1.1 --- vartree.itb 11 Nov 2002 22:28:03 -0000 *************** itcl::body VarTree::_but3 {x y X Y} { *** 335,343 **** $pop add command -label "Delete" -command [code $this remove $var] $pop add separator if {$type =3D=3D "local"} { ! $pop add command -label "Help" -command "HtmlViewer::open_help watch.= html" } else { ! $pop add command -label "Help" -command "HtmlViewer::open_help locals= .html" } $pop add separator $pop add command -label "Close" -command "destroy [winfo toplevel $itk_= interior]" --- 335,343 ---- $pop add command -label "Delete" -command [code $this remove $var] $pop add separator if {$type =3D=3D "local"} { ! $pop add command -label "Help" -command "open_help watch.html" } else { ! $pop add command -label "Help" -command "open_help locals.html" } $pop add separator $pop add command -label "Close" -command "destroy [winfo toplevel $itk_= interior]" *************** itcl::body VarTree::_do_default_menu {X *** 356,364 **** $pop add separator $pop add command -label "Sort" -command [code $this _sort] if {$type =3D=3D "local"} { ! $pop add command -label "Help" -command "HtmlViewer::open_help watch.= html" } else { ! $pop add command -label "Help" -command "HtmlViewer::open_help locals= .html" } $pop add separator $pop add command -label "Close" -command "destroy [winfo toplevel $itk_= interior]" --- 356,364 ---- $pop add separator $pop add command -label "Sort" -command [code $this _sort] if {$type =3D=3D "local"} { ! $pop add command -label "Help" -command "open_help watch.html" } else { ! $pop add command -label "Help" -command "open_help locals.html" } $pop add separator $pop add command -label "Close" -command "destroy [winfo toplevel $itk_= interior]" --=-cUgOY6OLl2wJ//iKeQkt Content-Disposition: attachment; filename=helpviewer.tcl Content-Transfer-Encoding: quoted-printable Content-Type: text/x-tcl; name=helpviewer.tcl; charset=UTF-8 Content-length: 2866 # Open a viewer for HTML help info # Copyright 2002, Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License (GPL) as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program 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. # -------------------------------------------------------------------------= ----- # NAME: public proc open_help # SYNOPSIS: open_help file # DESC: Opens html help file using an appropriate # browser. # -------------------------------------------------------------------------= ----- proc open_help {hfile} { debug $hfile # create full pathname link set link file://[file join $::GDBTK_LIBRARY help $hfile] # windows is easy if {$::tcl_platform(platform) =3D=3D "windows"} { ide_shell_execute open $link return } # # for Unix, we never know what is installed # # set list of viewer apps to try switch [pref get gdb/compat] { "KDE" { # set apps {htmlview khelpcenter mozilla} set apps {xhtmlview xkhelpcenter xmozilla} } "GNOME" { set apps {htmlview mozilla gnome-help khelpcenter} }=20=20=20=20=20=20 default { set apps {htmlview mozilla gnome-help khelpcenter netscape} } } # If the user has previously entered a browser name, append it # to the list. Should it go first or last?=20 set bname [pref get gdb/help/browsername] if {$bname !=3D ""} { lappend apps $bname } =20=20 # now loop through list checking each application foreach app $apps { debug "app=3D$app" if {[catch "exec $app $link &" result]} { debug "$app failed: $result" } else { return } } =20=20 # if we reached here, nothing worked, so prompt for a name set text "No help browser was found on your system.\n\ Please enter the name of an HTML viewer application." while {[set app [prompt_helpname $text]] !=3D "0"} { if {$app !=3D ""} { if {[catch "exec $app $link &" result]} { dbug W "$app failed: $result" set text "Could not run application $app.\n\ Please enter the name of an HTML viewer application." } else { pref set gdb/help/browsername $app return } } } } # displays an entry dialog and asks for the name of an application # returns 0 on cancel # name on success proc prompt_helpname {text} { iwidgets::promptdialog .pd -title "Browser Query" -modality application \ -labeltext $text if {[.pd activate]} { set app [string trim [.pd get]] destroy .pd return $app } destroy .pd debug "cancelled" return 0 } --=-cUgOY6OLl2wJ//iKeQkt--