24 |
|
proc gethelp {helpfile category topic} { # Open help window |
25 |
|
global curhelp helpfontwidth |
26 |
|
if {! [winfo exists .helpwin]} { # Set up window |
27 |
< |
toplevel .helpwin |
27 |
> |
toplevel .helpwin -cursor top_left_arrow |
28 |
|
wm minsize .helpwin 500 400 |
29 |
|
wm iconbitmap .helpwin question |
30 |
|
frame .helpwin.but -geometry 150x400 |
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 exists $ifile] || |
133 |
> |
[file mtime $fname] > [file mtime $ifile]} { |
134 |
> |
set curhelp(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 $curhelp(catlist) $cat] < 0} { |
142 |
> |
lappend curhelp(catlist) $cat |
143 |
> |
} |
144 |
|
} |
145 |
|
} |
146 |
+ |
if {! [catch {set fi [open $ifile w]}]} { |
147 |
+ |
writevars $fi {curhelp(catlist) helpindex} |
148 |
+ |
close $fi |
149 |
+ |
catch {exec chmod 666 $ifile} |
150 |
+ |
} |
151 |
+ |
} else { |
152 |
+ |
source $ifile |
153 |
|
} |
154 |
|
.helpwin.but.catb.m delete 0 last |
155 |
|
foreach cat $curhelp(catlist) { |