| 1 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 2 |
% |
|---|
| 3 |
% help system |
|---|
| 4 |
% |
|---|
| 5 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 6 |
|
|---|
| 7 |
% global vars used by help system |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
/help.context "main" def |
|---|
| 11 |
|
|---|
| 12 |
/help.light white def |
|---|
| 13 |
/help.dark black def |
|---|
| 14 |
/help.font font.normal def |
|---|
| 15 |
/help.normal.bg lightgray def |
|---|
| 16 |
/help.normal.fg black def |
|---|
| 17 |
/help.highlight.fg green def |
|---|
| 18 |
/help.link.fg blue def |
|---|
| 19 |
/help.link.selected.fg white def |
|---|
| 20 |
/help.link.selected.bg blue def |
|---|
| 21 |
|
|---|
| 22 |
/help.x 80 def |
|---|
| 23 |
/help.y 50 def |
|---|
| 24 |
/help.width 480 def |
|---|
| 25 |
/help.height 322 def |
|---|
| 26 |
|
|---|
| 27 |
/help.text.x help.x 10 add def |
|---|
| 28 |
/help.text.y help.y 30 add def |
|---|
| 29 |
|
|---|
| 30 |
/help.text.width help.width 20 sub def |
|---|
| 31 |
/help.text.height help.height help.text.y sub help.y add 4 sub def |
|---|
| 32 |
/help.text.rightmargin help.text.x help.text.width add def |
|---|
| 33 |
|
|---|
| 34 |
/help.title.x help.x 10 add def |
|---|
| 35 |
/help.title.y help.y 3 add def |
|---|
| 36 |
/help.title.height 20 def |
|---|
| 37 |
/help.title.font font.normal def |
|---|
| 38 |
|
|---|
| 39 |
/help.hist.page 16 array def |
|---|
| 40 |
/help.hist.startrow help.hist.page length array def |
|---|
| 41 |
/help.hist.selectedlink help.hist.page length array def |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
% for boot option lookup |
|---|
| 45 |
/bo.opt.max 32 def |
|---|
| 46 |
/bo.opt bo.opt.max 3 add string def |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 50 |
% Map help context. |
|---|
| 51 |
% |
|---|
| 52 |
% ( context ) ==> ( new_context ) |
|---|
| 53 |
% |
|---|
| 54 |
/help.mapcontext { |
|---|
| 55 |
dup "o_vncpassword" eq { pop "o_vnc" } if |
|---|
| 56 |
dup "o_hostip" eq { pop "network" } if |
|---|
| 57 |
dup "o_netmask" eq { pop "network" } if |
|---|
| 58 |
dup "o_gateway" eq { pop "network" } if |
|---|
| 59 |
dup "o_pci" eq { pop "o_acpi" } if |
|---|
| 60 |
|
|---|
| 61 |
syslinux not { |
|---|
| 62 |
% only help, startup, keytable and option pages |
|---|
| 63 |
dup "o_" strstr 1 ne { |
|---|
| 64 |
dup "help" ne |
|---|
| 65 |
over "startup" ne and |
|---|
| 66 |
over "keytable" ne and |
|---|
| 67 |
over "profile" ne and { pop "opt" } if |
|---|
| 68 |
} if |
|---|
| 69 |
} if |
|---|
| 70 |
} def |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 74 |
% Set help context. |
|---|
| 75 |
% |
|---|
| 76 |
% ( context ) ==> ( ) |
|---|
| 77 |
% |
|---|
| 78 |
/help.setcontext { |
|---|
| 79 |
help.mapcontext /help.context exch def |
|---|
| 80 |
} def |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 84 |
% Find boot option the cursor is positioned at. |
|---|
| 85 |
% |
|---|
| 86 |
% ( ) ==> ( option ) |
|---|
| 87 |
% |
|---|
| 88 |
/findbootoption { |
|---|
| 89 |
/bo.buf boot.ed 3 get def |
|---|
| 90 |
/bo.len boot.ed 4 get def |
|---|
| 91 |
/bo.pos boot.ed 5 get def |
|---|
| 92 |
|
|---|
| 93 |
{ |
|---|
| 94 |
bo.pos 0 eq { exit } if |
|---|
| 95 |
bo.buf bo.pos 1 sub get ' ' le { exit } if |
|---|
| 96 |
/bo.pos bo.pos 1 sub def |
|---|
| 97 |
} loop |
|---|
| 98 |
|
|---|
| 99 |
/bo.buf bo.buf bo.pos add def |
|---|
| 100 |
|
|---|
| 101 |
bo.buf 0 get ' ' le { "" return } if |
|---|
| 102 |
|
|---|
| 103 |
% "o_" + option name is the help text label |
|---|
| 104 |
"o_" 3 bo.opt snprintf |
|---|
| 105 |
|
|---|
| 106 |
0 1 bo.opt.max 1 sub { |
|---|
| 107 |
dup |
|---|
| 108 |
bo.buf exch get |
|---|
| 109 |
dup ' ' le over '=' eq or { pop pop exit } if |
|---|
| 110 |
over bo.opt 2 add exch rot put |
|---|
| 111 |
bo.opt 3 add exch 0 put |
|---|
| 112 |
} for |
|---|
| 113 |
|
|---|
| 114 |
bo.opt |
|---|
| 115 |
|
|---|
| 116 |
} def |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 120 |
% Find help page. |
|---|
| 121 |
% |
|---|
| 122 |
% returns help page or empty string if no page was found |
|---|
| 123 |
% |
|---|
| 124 |
% ( label ) ==> ( help_text ) |
|---|
| 125 |
% |
|---|
| 126 |
/help.findpage { |
|---|
| 127 |
dup length 3 add dup string |
|---|
| 128 |
"\x12%s\x14" |
|---|
| 129 |
3 1 roll dup 5 1 roll snprintf |
|---|
| 130 |
help.getmessages over strstr |
|---|
| 131 |
dup { help.getmessages exch 1 sub add } { pop "" } ifelse |
|---|
| 132 |
exch free |
|---|
| 133 |
} def |
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 137 |
% Find help page. |
|---|
| 138 |
% |
|---|
| 139 |
% returns n-th help page or empty string if no page was found |
|---|
| 140 |
% |
|---|
| 141 |
% ( n ) ==> ( help_text ) |
|---|
| 142 |
% |
|---|
| 143 |
/help.findpagebyindex { |
|---|
| 144 |
help.getmessages exch |
|---|
| 145 |
{ |
|---|
| 146 |
dup "\x04" strstr |
|---|
| 147 |
dup { add } { pop pop "" exit } ifelse |
|---|
| 148 |
} repeat |
|---|
| 149 |
} def |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 153 |
% Init & display help page. |
|---|
| 154 |
% |
|---|
| 155 |
% ( help_text start_row selected_link ) ==> ( ) |
|---|
| 156 |
% |
|---|
| 157 |
/help.initpage { |
|---|
| 158 |
/help.selectedlink exch def |
|---|
| 159 |
/help.startrow exch def |
|---|
| 160 |
|
|---|
| 161 |
/help.currenttext over def |
|---|
| 162 |
|
|---|
| 163 |
title.bg setcolor |
|---|
| 164 |
help.x 1 add help.y 1 add moveto |
|---|
| 165 |
help.width 2 sub help.title.height 1 sub fillrect |
|---|
| 166 |
|
|---|
| 167 |
help.text.x help.text.y moveto |
|---|
| 168 |
currentmaxrows 0 setmaxrows exch formattext setmaxrows |
|---|
| 169 |
|
|---|
| 170 |
white setcolor |
|---|
| 171 |
currenteotchar 16 seteotchar |
|---|
| 172 |
help.title.x help.title.y moveto currenttitle |
|---|
| 173 |
currentfont help.title.font setfont exch show setfont |
|---|
| 174 |
seteotchar |
|---|
| 175 |
|
|---|
| 176 |
getlinks { help.selectedlink setlink } if |
|---|
| 177 |
|
|---|
| 178 |
help.updatepage |
|---|
| 179 |
|
|---|
| 180 |
% 500 0 moveto gettextrows print |
|---|
| 181 |
% 400 0 moveto getlinks print |
|---|
| 182 |
|
|---|
| 183 |
} def |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 187 |
% Redraw help page. |
|---|
| 188 |
% |
|---|
| 189 |
% ( ) ==> ( ) |
|---|
| 190 |
% |
|---|
| 191 |
/help.updatepage { |
|---|
| 192 |
help.normal.bg setcolor |
|---|
| 193 |
help.text.x help.text.y moveto |
|---|
| 194 |
help.text.width help.text.height fillrect |
|---|
| 195 |
|
|---|
| 196 |
help.normal.fg help.highlight.fg help.link.fg help.link.selected.fg settextcolors |
|---|
| 197 |
|
|---|
| 198 |
help.startrow setstartrow |
|---|
| 199 |
|
|---|
| 200 |
help.text.x help.text.y moveto |
|---|
| 201 |
help.currenttext show |
|---|
| 202 |
|
|---|
| 203 |
0 setstartrow |
|---|
| 204 |
|
|---|
| 205 |
true help.selectedlink help.redrawlink |
|---|
| 206 |
|
|---|
| 207 |
} def |
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 211 |
% Used to iterate over all help pages (for debugging). |
|---|
| 212 |
% |
|---|
| 213 |
% get the n-th page starting from current pos |
|---|
| 214 |
% |
|---|
| 215 |
% ( n ) ==> ( help_text ) |
|---|
| 216 |
% |
|---|
| 217 |
/help.test { |
|---|
| 218 |
help.test.cnt add |
|---|
| 219 |
dup 1 lt { pop 1 } if |
|---|
| 220 |
/help.test.cnt over def |
|---|
| 221 |
help.findpagebyindex |
|---|
| 222 |
dup "" eq { |
|---|
| 223 |
% one page back |
|---|
| 224 |
pop help.test.cnt 1 sub /help.test.cnt over def |
|---|
| 225 |
help.findpagebyindex |
|---|
| 226 |
} if |
|---|
| 227 |
} def |
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 231 |
% Redraw link. |
|---|
| 232 |
% |
|---|
| 233 |
% selected: true or false. |
|---|
| 234 |
% |
|---|
| 235 |
% ( selected n ) ==> ( ) |
|---|
| 236 |
% |
|---|
| 237 |
% |
|---|
| 238 |
/help.redrawlink { |
|---|
| 239 |
getlinks 0 eq { pop pop return } if |
|---|
| 240 |
getlink |
|---|
| 241 |
dup help.startrow lt |
|---|
| 242 |
over help.startrow help.text.rows add ge or { |
|---|
| 243 |
5 { pop } repeat return |
|---|
| 244 |
} if |
|---|
| 245 |
help.startrow sub lineheight mul help.text.y add |
|---|
| 246 |
moveto |
|---|
| 247 |
rot |
|---|
| 248 |
|
|---|
| 249 |
16 seteotchar |
|---|
| 250 |
|
|---|
| 251 |
{ |
|---|
| 252 |
currenttextcolors 4 1 roll pop pop pop |
|---|
| 253 |
help.link.selected.bg |
|---|
| 254 |
} { |
|---|
| 255 |
currenttextcolors 4 2 roll pop pop pop |
|---|
| 256 |
help.normal.bg |
|---|
| 257 |
} ifelse |
|---|
| 258 |
|
|---|
| 259 |
setcolor over currentpoint rot strsize fillrect moveto |
|---|
| 260 |
|
|---|
| 261 |
setcolor show |
|---|
| 262 |
|
|---|
| 263 |
4 seteotchar |
|---|
| 264 |
|
|---|
| 265 |
pop |
|---|
| 266 |
} def |
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 270 |
% Select n-th link. |
|---|
| 271 |
% |
|---|
| 272 |
% ( n ) ==> ( ) |
|---|
| 273 |
% |
|---|
| 274 |
/help.selectlink { |
|---|
| 275 |
help.selectedlink over eq { |
|---|
| 276 |
pop |
|---|
| 277 |
} { |
|---|
| 278 |
% deselect old link |
|---|
| 279 |
false help.selectedlink help.redrawlink |
|---|
| 280 |
|
|---|
| 281 |
/help.selectedlink over dup setlink def |
|---|
| 282 |
|
|---|
| 283 |
% select link |
|---|
| 284 |
true exch help.redrawlink |
|---|
| 285 |
} ifelse |
|---|
| 286 |
} def |
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 290 |
% Select first visible link. |
|---|
| 291 |
% |
|---|
| 292 |
% No screen update if 'update' is false. |
|---|
| 293 |
% |
|---|
| 294 |
% ( update ) ==> ( ) |
|---|
| 295 |
% |
|---|
| 296 |
/help.sel.firstlink { |
|---|
| 297 |
getlinks { |
|---|
| 298 |
0 1 getlinks 1 sub { |
|---|
| 299 |
dup |
|---|
| 300 |
getlink 4 1 roll pop pop pop |
|---|
| 301 |
dup help.startrow help.text.rows add ge { |
|---|
| 302 |
pop pop exit |
|---|
| 303 |
} if |
|---|
| 304 |
dup help.startrow ge { |
|---|
| 305 |
pop |
|---|
| 306 |
over { help.selectlink } { /help.selectedlink exch dup setlink def } ifelse |
|---|
| 307 |
exit |
|---|
| 308 |
} if |
|---|
| 309 |
pop pop |
|---|
| 310 |
} for |
|---|
| 311 |
} if |
|---|
| 312 |
pop |
|---|
| 313 |
} def |
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 317 |
% Select last visible link. |
|---|
| 318 |
% |
|---|
| 319 |
% No screen update if 'update' is false. |
|---|
| 320 |
% |
|---|
| 321 |
% ( update ) ==> ( ) |
|---|
| 322 |
% |
|---|
| 323 |
/help.sel.lastlink { |
|---|
| 324 |
getlinks { |
|---|
| 325 |
getlinks 1 sub -1 0 { |
|---|
| 326 |
dup |
|---|
| 327 |
getlink 4 1 roll pop pop pop |
|---|
| 328 |
dup help.startrow lt { |
|---|
| 329 |
pop pop exit |
|---|
| 330 |
} if |
|---|
| 331 |
dup help.startrow help.text.rows add lt { |
|---|
| 332 |
pop |
|---|
| 333 |
over { help.selectlink } { /help.selectedlink exch dup setlink def } ifelse |
|---|
| 334 |
exit |
|---|
| 335 |
} if |
|---|
| 336 |
pop pop |
|---|
| 337 |
} for |
|---|
| 338 |
} if |
|---|
| 339 |
pop |
|---|
| 340 |
} def |
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 344 |
% Push current help context to history. |
|---|
| 345 |
% |
|---|
| 346 |
% ( ) ==> ( ) |
|---|
| 347 |
% |
|---|
| 348 |
/help.add2history { |
|---|
| 349 |
help.hist.index help.hist.page length lt { |
|---|
| 350 |
help.hist.page help.hist.index help.currenttext put |
|---|
| 351 |
help.hist.startrow help.hist.index help.startrow put |
|---|
| 352 |
help.hist.selectedlink help.hist.index help.selectedlink put |
|---|
| 353 |
/help.hist.index help.hist.index 1 add def |
|---|
| 354 |
} if |
|---|
| 355 |
} def |
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 359 |
% Follow currently selected link. |
|---|
| 360 |
% |
|---|
| 361 |
% ( ) ==> ( ) |
|---|
| 362 |
% |
|---|
| 363 |
/help.followlink { |
|---|
| 364 |
getlinks { |
|---|
| 365 |
help.selectedlink getlink pop pop pop |
|---|
| 366 |
help.add2history |
|---|
| 367 |
help.findpage |
|---|
| 368 |
dup "" eq { |
|---|
| 369 |
pop |
|---|
| 370 |
} { |
|---|
| 371 |
0 0 help.initpage |
|---|
| 372 |
} ifelse |
|---|
| 373 |
} if |
|---|
| 374 |
} def |
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 378 |
% Go back to previous page. |
|---|
| 379 |
% |
|---|
| 380 |
% ( ) ==> ( ) |
|---|
| 381 |
% |
|---|
| 382 |
/help.prevlink { |
|---|
| 383 |
help.hist.index 0 gt { |
|---|
| 384 |
/help.hist.index help.hist.index 1 sub def |
|---|
| 385 |
help.hist.page help.hist.index get |
|---|
| 386 |
help.hist.startrow help.hist.index get |
|---|
| 387 |
help.hist.selectedlink help.hist.index get |
|---|
| 388 |
help.initpage |
|---|
| 389 |
} if |
|---|
| 390 |
} def |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 394 |
% Scroll a page down. |
|---|
| 395 |
% |
|---|
| 396 |
% ( ) ==> ( ) |
|---|
| 397 |
% |
|---|
| 398 |
/help.key.pagedown { |
|---|
| 399 |
help.startrow |
|---|
| 400 |
gettextrows help.text.rows gt { |
|---|
| 401 |
pop |
|---|
| 402 |
gettextrows help.text.rows sub |
|---|
| 403 |
help.startrow help.text.rows add |
|---|
| 404 |
min |
|---|
| 405 |
} if |
|---|
| 406 |
|
|---|
| 407 |
dup help.startrow eq { |
|---|
| 408 |
pop |
|---|
| 409 |
true help.sel.lastlink |
|---|
| 410 |
} { |
|---|
| 411 |
/help.startrow exch def |
|---|
| 412 |
false help.sel.firstlink |
|---|
| 413 |
help.updatepage |
|---|
| 414 |
} ifelse |
|---|
| 415 |
} def |
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 419 |
% Scroll a page up. |
|---|
| 420 |
% |
|---|
| 421 |
% ( ) ==> ( ) |
|---|
| 422 |
% |
|---|
| 423 |
/help.key.pageup { |
|---|
| 424 |
help.startrow |
|---|
| 425 |
gettextrows help.text.rows gt { |
|---|
| 426 |
pop |
|---|
| 427 |
0 |
|---|
| 428 |
help.startrow help.text.rows sub |
|---|
| 429 |
max |
|---|
| 430 |
} if |
|---|
| 431 |
|
|---|
| 432 |
dup help.startrow eq { |
|---|
| 433 |
pop |
|---|
| 434 |
true help.sel.firstlink |
|---|
| 435 |
} { |
|---|
| 436 |
/help.startrow exch def |
|---|
| 437 |
false help.sel.firstlink |
|---|
| 438 |
help.updatepage |
|---|
| 439 |
} ifelse |
|---|
| 440 |
} def |
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 444 |
% Go to page start. |
|---|
| 445 |
% |
|---|
| 446 |
% ( ) ==> ( ) |
|---|
| 447 |
% |
|---|
| 448 |
/help.key.home { |
|---|
| 449 |
help.startrow 0 eq { |
|---|
| 450 |
true help.sel.firstlink |
|---|
| 451 |
} { |
|---|
| 452 |
/help.startrow 0 def |
|---|
| 453 |
false help.sel.firstlink |
|---|
| 454 |
help.updatepage |
|---|
| 455 |
} ifelse |
|---|
| 456 |
} def |
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 460 |
% Go to page end. |
|---|
| 461 |
% |
|---|
| 462 |
% ( ) ==> ( ) |
|---|
| 463 |
% |
|---|
| 464 |
/help.key.end { |
|---|
| 465 |
gettextrows help.text.rows sub 0 max |
|---|
| 466 |
dup help.startrow eq { |
|---|
| 467 |
pop |
|---|
| 468 |
true help.sel.lastlink |
|---|
| 469 |
} { |
|---|
| 470 |
/help.startrow exch def |
|---|
| 471 |
false help.sel.lastlink |
|---|
| 472 |
help.updatepage |
|---|
| 473 |
} ifelse |
|---|
| 474 |
} def |
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 478 |
% Next link or scroll down. |
|---|
| 479 |
% |
|---|
| 480 |
% ( ) ==> ( ) |
|---|
| 481 |
% |
|---|
| 482 |
/help.key.down { |
|---|
| 483 |
help.selectedlink getlinks 1 sub lt { |
|---|
| 484 |
help.selectedlink 1 add getlink 4 1 roll pop pop pop |
|---|
| 485 |
dup help.startrow help.text.rows add lt { |
|---|
| 486 |
% link visible |
|---|
| 487 |
pop help.selectedlink 1 add help.selectlink |
|---|
| 488 |
return |
|---|
| 489 |
} { |
|---|
| 490 |
help.startrow help.text.rows add eq { |
|---|
| 491 |
% link visible after scrolling down |
|---|
| 492 |
/help.selectedlink help.selectedlink 1 add dup setlink def |
|---|
| 493 |
} if |
|---|
| 494 |
} ifelse |
|---|
| 495 |
} if |
|---|
| 496 |
|
|---|
| 497 |
% scroll down |
|---|
| 498 |
|
|---|
| 499 |
help.startrow help.text.rows add gettextrows lt { |
|---|
| 500 |
/help.startrow help.startrow 1 add def |
|---|
| 501 |
help.updatepage |
|---|
| 502 |
} if |
|---|
| 503 |
} def |
|---|
| 504 |
|
|---|
| 505 |
|
|---|
| 506 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 507 |
% Previous link or scroll up. |
|---|
| 508 |
% |
|---|
| 509 |
% ( ) ==> ( ) |
|---|
| 510 |
% |
|---|
| 511 |
/help.key.up { |
|---|
| 512 |
help.selectedlink 0 gt { |
|---|
| 513 |
help.selectedlink 1 sub getlink 4 1 roll pop pop pop |
|---|
| 514 |
% row |
|---|
| 515 |
dup help.startrow ge { |
|---|
| 516 |
% link visible |
|---|
| 517 |
pop help.selectedlink 1 sub help.selectlink |
|---|
| 518 |
return |
|---|
| 519 |
} { |
|---|
| 520 |
help.startrow 1 sub eq { |
|---|
| 521 |
% link visible after scrolling up |
|---|
| 522 |
/help.selectedlink help.selectedlink 1 sub dup setlink def |
|---|
| 523 |
} if |
|---|
| 524 |
} ifelse |
|---|
| 525 |
} if |
|---|
| 526 |
|
|---|
| 527 |
% scroll up |
|---|
| 528 |
|
|---|
| 529 |
help.startrow 0 gt { |
|---|
| 530 |
/help.startrow help.startrow 1 sub def |
|---|
| 531 |
help.updatepage |
|---|
| 532 |
} if |
|---|
| 533 |
} def |
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 537 |
% Handle keyboard input. |
|---|
| 538 |
% |
|---|
| 539 |
% ( key_in ) ==> ( key_out ) |
|---|
| 540 |
% |
|---|
| 541 |
/help.input { |
|---|
| 542 |
dup 0 eq { return } if |
|---|
| 543 |
|
|---|
| 544 |
dup keyEsc eq { /window.action actNothing def window.done } if |
|---|
| 545 |
dup keyCtrlDown eq { 1 help.test 0 0 help.initpage } if |
|---|
| 546 |
dup keyCtrlUp eq { -1 help.test 0 0 help.initpage } if |
|---|
| 547 |
dup keyDown eq { help.key.down } if |
|---|
| 548 |
dup keyUp eq { help.key.up } if |
|---|
| 549 |
dup keyPgDown eq { help.key.pagedown } if |
|---|
| 550 |
dup keyPgUp eq { help.key.pageup } if |
|---|
| 551 |
dup keyHome eq { help.key.home } if |
|---|
| 552 |
dup keyEnd eq { help.key.end } if |
|---|
| 553 |
dup keyRight eq { help.followlink } if |
|---|
| 554 |
dup keyEnter eq { help.followlink } if |
|---|
| 555 |
dup 0xff and ' ' eq { help.followlink } if |
|---|
| 556 |
dup keyLeft eq { help.prevlink } if |
|---|
| 557 |
dup 0xff and '\x08' eq { help.prevlink } if |
|---|
| 558 |
dup keyF1 eq { |
|---|
| 559 |
"help" help.findpage |
|---|
| 560 |
dup help.currenttext eq { |
|---|
| 561 |
pop |
|---|
| 562 |
} { |
|---|
| 563 |
help.add2history |
|---|
| 564 |
0 0 help.initpage |
|---|
| 565 |
} ifelse |
|---|
| 566 |
} if |
|---|
| 567 |
% dup keyF9 eq { |
|---|
| 568 |
% /help.font help.font 8 add 10 mod def help.reinit |
|---|
| 569 |
% help.currenttext help.startrow help.selectedlink help.initpage |
|---|
| 570 |
% } if |
|---|
| 571 |
pop 0 |
|---|
| 572 |
} def |
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 576 |
% Recalculate some sizes and redraw help screen. |
|---|
| 577 |
% |
|---|
| 578 |
% ( ) ==> ( ) |
|---|
| 579 |
% |
|---|
| 580 |
/help.reinit { |
|---|
| 581 |
help.normal.bg setcolor |
|---|
| 582 |
help.x help.y moveto |
|---|
| 583 |
help.width help.height fillrect |
|---|
| 584 |
|
|---|
| 585 |
help.x 1 add help.y 1 add help.title.height add moveto |
|---|
| 586 |
help.dark help.light |
|---|
| 587 |
help.width 2 sub help.height 2 sub help.title.height sub |
|---|
| 588 |
drawborder |
|---|
| 589 |
|
|---|
| 590 |
help.font setfont |
|---|
| 591 |
|
|---|
| 592 |
/help.text.rows help.text.height lineheight div def |
|---|
| 593 |
help.text.rows setmaxrows |
|---|
| 594 |
|
|---|
| 595 |
help.text.rightmargin settextwrap |
|---|
| 596 |
} def |
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 600 |
% Initialize help window. |
|---|
| 601 |
% |
|---|
| 602 |
% ( window ) ==> ( ) |
|---|
| 603 |
% |
|---|
| 604 |
/help.init { |
|---|
| 605 |
/help.tmp exch def |
|---|
| 606 |
|
|---|
| 607 |
help.x 1 sub help.y 1 sub moveto |
|---|
| 608 |
help.light help.dark |
|---|
| 609 |
help.width 2 add help.height 2 add |
|---|
| 610 |
over over |
|---|
| 611 |
|
|---|
| 612 |
% just for testing: lilo has enough low memory |
|---|
| 613 |
lilo { savescreen } { xsavescreen } ifelse |
|---|
| 614 |
|
|---|
| 615 |
help.tmp .saved rot put |
|---|
| 616 |
drawborder |
|---|
| 617 |
|
|---|
| 618 |
help.reinit |
|---|
| 619 |
|
|---|
| 620 |
4 seteotchar |
|---|
| 621 |
|
|---|
| 622 |
/help.hist.index 0 def |
|---|
| 623 |
|
|---|
| 624 |
/help.test.cnt 1 def |
|---|
| 625 |
|
|---|
| 626 |
help.context help.findpage 0 0 help.initpage |
|---|
| 627 |
} def |
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 631 |
% Draw help window. |
|---|
| 632 |
% |
|---|
| 633 |
% ( window ) ==> ( ) |
|---|
| 634 |
% |
|---|
| 635 |
/help.show { |
|---|
| 636 |
window.push |
|---|
| 637 |
} def |
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 641 |
% Close current help window. |
|---|
| 642 |
% |
|---|
| 643 |
% ( ) ==> ( ) |
|---|
| 644 |
% |
|---|
| 645 |
/help.done { |
|---|
| 646 |
0 settextwrap |
|---|
| 647 |
0 seteotchar |
|---|
| 648 |
0 setmaxrows |
|---|
| 649 |
} def |
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 |
|
|---|
| 653 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 654 |
% Create new help window. |
|---|
| 655 |
% |
|---|
| 656 |
% ( ) ==> ( window ) |
|---|
| 657 |
% |
|---|
| 658 |
/window.help { |
|---|
| 659 |
widget.size array |
|---|
| 660 |
dup .type t_help put |
|---|
| 661 |
|
|---|
| 662 |
dup .x help.x put |
|---|
| 663 |
dup .y help.y put |
|---|
| 664 |
|
|---|
| 665 |
} def |
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 669 |
% Find help texts. |
|---|
| 670 |
% |
|---|
| 671 |
% ( ) ==> ( start_of_help_messages ) |
|---|
| 672 |
% |
|---|
| 673 |
/help.getmessages { |
|---|
| 674 |
|
|---|
| 675 |
help.messages .undef eq { |
|---|
| 676 |
% find help texts |
|---|
| 677 |
/help.messages |
|---|
| 678 |
16 string dup config.lang "help.%s" 2 index sprintf |
|---|
| 679 |
findfile exch free |
|---|
| 680 |
dup .undef eq { pop "help.en" findfile } if |
|---|
| 681 |
dup .undef eq { pop "" } if |
|---|
| 682 |
cvs |
|---|
| 683 |
def |
|---|
| 684 |
} if |
|---|
| 685 |
|
|---|
| 686 |
help.messages |
|---|
| 687 |
|
|---|
| 688 |
} def |
|---|
| 689 |
|
|---|
| 690 |
|
|---|