ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/gethelp3.6.tcl
(Generate patch)

Comparing ray/src/util/gethelp3.6.tcl (file contents):
Revision 2.5 by greg, Fri Oct 28 20:14:44 1994 UTC vs.
Revision 2.11 by greg, Tue Oct 17 21:28:18 1995 UTC

# Line 27 | Line 27 | proc gethelp {helpfile category topic} {       # Open help w
27                  toplevel .helpwin -cursor top_left_arrow
28                  wm minsize .helpwin 500 400
29                  wm iconbitmap .helpwin question
30 <                frame .helpwin.but -geometry 150x400
30 >                frame .helpwin.but -width 150 -height 400
31                  pack .helpwin.but -side right -fill none -expand no
32                  label .helpwin.but.lab -textvariable curhelp(title)
33                  place .helpwin.but.lab -relx .1667 -rely 0
# Line 122 | Line 122 | proc helpopen fname {                  # open the named help file
122          wm title .helpwin $fname
123          set curhelp(title) "[string toupper\
124                          [file rootname [file tail $fname]]]  HELP"
125 +        set ifile [file rootname $fname].ndx
126          wm iconname .helpwin [string tolower $curhelp(title)]
127          .helpwin.txt configure -state normal
128          .helpwin.txt delete 1.0 end
129          .helpwin.txt insert end "Loading $fname..."
130          update
131          set curhelp(fid) [open $fname r]
132 <        set curhelp(catlist) {}
133 <        while {[gets $curhelp(fid) li] >= 0} {
134 <                if [regexp -nocase {^\.([A-Z][A-Z0-9]*)\.([A-Z][A-Z0-9]*)$} \
135 <                                $li dummy cat top] {
136 <                        lappend helpindex([string toupper $cat]) $top
137 <                        set helpindex([string toupper $cat,$top]) \
138 <                                        [tell $curhelp(fid)]
139 <                        if {[lsearch -exact $curhelp(catlist) $cat] < 0} {
140 <                                lappend curhelp(catlist) $cat
132 >        if {! [file isfile $ifile] ||
133 >                        [file mtime $fname] > [file mtime $ifile]} {
134 >                set helpindex(catlist) {}
135 >                while {[gets $curhelp(fid) li] >= 0} {
136 >                        if [regexp -nocase {^\.([A-Z][A-Z0-9]*)\.([A-Z][A-Z0-9]*)$} \
137 >                                        $li dummy cat top] {
138 >                                lappend helpindex([string toupper $cat]) $top
139 >                                set helpindex([string toupper $cat,$top]) \
140 >                                                [tell $curhelp(fid)]
141 >                                if {[lsearch -exact $helpindex(catlist) $cat] < 0} {
142 >                                        lappend helpindex(catlist) $cat
143 >                                }
144                          }
145                  }
146 +                if {! [catch {set fi [open $ifile w]}]} {
147 +                        puts $fi "# This is an automatically created index\
148 +                                        file -- DO NOT EDIT!"
149 +                        writevars $fi helpindex
150 +                        close $fi
151 +                        catch {exec chmod 666 $ifile}
152 +                }
153 +        } else {
154 +                source $ifile
155          }
156          .helpwin.but.catb.m delete 0 last
157 <        foreach cat $curhelp(catlist) {
157 >        foreach cat $helpindex(catlist) {
158                  .helpwin.but.catb.m add command -label $cat \
159                                  -command "helphist new $cat intro"
160          }
# Line 237 | Line 250 | proc helpupdate {} {                   # update help text window
250                  set curhelp(next) "$cat $top"
251                  .helpwin.but.next configure -state normal
252          } else {
253 +                set curhelp(next) {}
254                  .helpwin.but.next configure -state disabled
255          }
256          .helpwin.txt configure -state disabled
# Line 297 | Line 311 | proc helpsearch word {         # search for occurances of the
311                  return 0
312          }
313          set nmatches 0
314 <        set cat [lindex $curhelp(catlist) 0]
314 >        set cat [lindex $helpindex(catlist) 0]
315          set top [lindex $helpindex([string toupper $cat]) 0]
316          set startpos [tell $curhelp(fid)]
317          seek $curhelp(fid) $helpindex([string toupper $cat,$top])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines