| 1 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 2 |
% |
|---|
| 3 |
% Main part. |
|---|
| 4 |
% |
|---|
| 5 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 9 |
% |
|---|
| 10 |
% look if we've been started from dvd side 2 |
|---|
| 11 |
% |
|---|
| 12 |
% ( ) ==> ( true|false ) |
|---|
| 13 |
% |
|---|
| 14 |
/is_second_side { |
|---|
| 15 |
syslinux usernote 1 and 0 ne and |
|---|
| 16 |
} def |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 20 |
% |
|---|
| 21 |
% Should we check for 64bit? |
|---|
| 22 |
% |
|---|
| 23 |
% ( ) ==> ( true|false ) |
|---|
| 24 |
% |
|---|
| 25 |
/do_64bit_check { |
|---|
| 26 |
syslinux usernote 2 and 0 ne and |
|---|
| 27 |
} def |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 31 |
% |
|---|
| 32 |
% Install source is 64bit? |
|---|
| 33 |
% |
|---|
| 34 |
% ( ) ==> ( true|false ) |
|---|
| 35 |
% |
|---|
| 36 |
/64bit_source { |
|---|
| 37 |
syslinux usernote 4 and 0 ne and |
|---|
| 38 |
} def |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 42 |
% |
|---|
| 43 |
% Are we a dvd? |
|---|
| 44 |
% |
|---|
| 45 |
% ( ) ==> ( true|false ) |
|---|
| 46 |
% |
|---|
| 47 |
/is_dvd { |
|---|
| 48 |
syslinux usernote 8 and 0 ne and |
|---|
| 49 |
} def |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 53 |
% |
|---|
| 54 |
% input event handling |
|---|
| 55 |
% |
|---|
| 56 |
% ( key ) ==> ( input_buffer menu_entry action ) |
|---|
| 57 |
% |
|---|
| 58 |
% key |
|---|
| 59 |
% bit 0-7 ascii |
|---|
| 60 |
% bit 8-15 scan code |
|---|
| 61 |
% bit 16-32 status bits (ctrl, shift...) |
|---|
| 62 |
% |
|---|
| 63 |
% action |
|---|
| 64 |
% 0: ok, stay in input loop |
|---|
| 65 |
% 1: switch to text mode |
|---|
| 66 |
% >=2: start linux |
|---|
| 67 |
% |
|---|
| 68 |
/KeyEvent { |
|---|
| 69 |
% timeout |
|---|
| 70 |
|
|---|
| 71 |
dup 0 eq { boot.buf buildcmdline 2 return } if |
|---|
| 72 |
|
|---|
| 73 |
debug 4 ge { |
|---|
| 74 |
% print keycode somewhere |
|---|
| 75 |
-1 settransparentcolor |
|---|
| 76 |
black setcolor |
|---|
| 77 |
500 0 moveto dup print " " print |
|---|
| 78 |
} if |
|---|
| 79 |
|
|---|
| 80 |
dup 0xff00 and 16 shl over 0xff and dup 0xe0 eq { pop 0 } if add /key exch def |
|---|
| 81 |
16 shr 0xffff and /keystat exch def |
|---|
| 82 |
|
|---|
| 83 |
key keyTab eq keyStatus statusShift and 0 ne and { |
|---|
| 84 |
/key keyShiftTab def |
|---|
| 85 |
} if |
|---|
| 86 |
|
|---|
| 87 |
key |
|---|
| 88 |
|
|---|
| 89 |
config.keymap { mapkey } if |
|---|
| 90 |
|
|---|
| 91 |
dup 0xffffff and dup { exch } if pop |
|---|
| 92 |
|
|---|
| 93 |
debug 4 ge { |
|---|
| 94 |
% print mapped key somewhere |
|---|
| 95 |
-1 settransparentcolor |
|---|
| 96 |
black setcolor |
|---|
| 97 |
500 20 moveto dup print " " print |
|---|
| 98 |
} if |
|---|
| 99 |
|
|---|
| 100 |
% some special keys |
|---|
| 101 |
debug.input |
|---|
| 102 |
|
|---|
| 103 |
% put key through normal input queue |
|---|
| 104 |
window.input |
|---|
| 105 |
|
|---|
| 106 |
pop |
|---|
| 107 |
|
|---|
| 108 |
window.action actExit eq { |
|---|
| 109 |
/window.action actNothing def |
|---|
| 110 |
"" -1 1 return |
|---|
| 111 |
} if |
|---|
| 112 |
|
|---|
| 113 |
window.action actCloseInfo eq { |
|---|
| 114 |
/window.action actNothing def |
|---|
| 115 |
"" -1 3 return |
|---|
| 116 |
} if |
|---|
| 117 |
|
|---|
| 118 |
window.action actPassword eq { |
|---|
| 119 |
/window.action actNothing def |
|---|
| 120 |
password.dialog { |
|---|
| 121 |
password.dialog .ed.buffer.list get 0 get |
|---|
| 122 |
} { "" } ifelse |
|---|
| 123 |
-1 3 return |
|---|
| 124 |
} if |
|---|
| 125 |
|
|---|
| 126 |
window.action actStart eq { |
|---|
| 127 |
/window.action actNothing def |
|---|
| 128 |
boot.buf buildcmdline 2 return |
|---|
| 129 |
} if |
|---|
| 130 |
|
|---|
| 131 |
window.action actRedraw eq { |
|---|
| 132 |
/window.action actNothing def |
|---|
| 133 |
main.redraw |
|---|
| 134 |
} if |
|---|
| 135 |
|
|---|
| 136 |
window.action actRedrawPanel eq { |
|---|
| 137 |
/window.action actNothing def |
|---|
| 138 |
panel.show |
|---|
| 139 |
} if |
|---|
| 140 |
|
|---|
| 141 |
window.action actInstallOK eq { |
|---|
| 142 |
/window.action actNothing def |
|---|
| 143 |
install.ok |
|---|
| 144 |
} if |
|---|
| 145 |
|
|---|
| 146 |
window.action actInstallCancel eq { |
|---|
| 147 |
/window.action actNothing def |
|---|
| 148 |
install.cancel |
|---|
| 149 |
} if |
|---|
| 150 |
|
|---|
| 151 |
boot.buf menu.entry 0 |
|---|
| 152 |
} def |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
/bc.cmd 256 string def |
|---|
| 156 |
|
|---|
| 157 |
% ( option_string ) ==> ( cmdline menu_entry ) |
|---|
| 158 |
% |
|---|
| 159 |
% grub: |
|---|
| 160 |
% just return |
|---|
| 161 |
% |
|---|
| 162 |
% syslinux & lilo: |
|---|
| 163 |
% check if the commmand line starts with the current kernel name or |
|---|
| 164 |
% "linux"; if not, put the kernel name in front of the command line. (This |
|---|
| 165 |
% is to keep compatibility with the old scheme requiring the user to write |
|---|
| 166 |
% the kernel name explicitly.) |
|---|
| 167 |
% |
|---|
| 168 |
/buildcmdline { |
|---|
| 169 |
menu.entry 0 lt { -1 return } if |
|---|
| 170 |
menu.entry menu.texts length ge { -1 return } if |
|---|
| 171 |
|
|---|
| 172 |
/bc.opts exch def |
|---|
| 173 |
/bc.kernel menu.texts menu.entry get def |
|---|
| 174 |
|
|---|
| 175 |
grub { |
|---|
| 176 |
|
|---|
| 177 |
/bc.addkernel false def |
|---|
| 178 |
|
|---|
| 179 |
} { |
|---|
| 180 |
|
|---|
| 181 |
/bc.addkernel true def |
|---|
| 182 |
|
|---|
| 183 |
[ bc.kernel "linux" ] 0 over length 1 sub 1 exch { |
|---|
| 184 |
over exch get |
|---|
| 185 |
|
|---|
| 186 |
bc.opts over eq { |
|---|
| 187 |
/bc.addkernel false def |
|---|
| 188 |
} { |
|---|
| 189 |
bc.opts over strstr 1 eq { |
|---|
| 190 |
bc.opts over length get ' ' eq { |
|---|
| 191 |
/bc.addkernel false def |
|---|
| 192 |
} if |
|---|
| 193 |
} if |
|---|
| 194 |
} ifelse |
|---|
| 195 |
|
|---|
| 196 |
pop |
|---|
| 197 |
|
|---|
| 198 |
bc.addkernel not { exit } if |
|---|
| 199 |
|
|---|
| 200 |
} for |
|---|
| 201 |
|
|---|
| 202 |
pop |
|---|
| 203 |
|
|---|
| 204 |
% special case: option is identical to label |
|---|
| 205 |
bc.kernel "apic" eq { /bc.addkernel true def } if |
|---|
| 206 |
|
|---|
| 207 |
} ifelse |
|---|
| 208 |
|
|---|
| 209 |
bc.addkernel { |
|---|
| 210 |
alt.kernel "" ne { alt.kernel } { bc.kernel } ifelse |
|---|
| 211 |
"%s " bc.cmd sprintf |
|---|
| 212 |
} { |
|---|
| 213 |
bc.cmd 0 0 put |
|---|
| 214 |
} ifelse |
|---|
| 215 |
|
|---|
| 216 |
cmdline.hidden "" ne { |
|---|
| 217 |
cmdline.hidden "%s " bc.cmd dup length add sprintf |
|---|
| 218 |
} if |
|---|
| 219 |
|
|---|
| 220 |
% syslinux { |
|---|
| 221 |
% xmenu.video 0 get 0 eq { |
|---|
| 222 |
% "textmode=1 " bc.cmd dup length add sprintf |
|---|
| 223 |
% } if |
|---|
| 224 |
video.modes.list xmenu.video 0 get get 0 get dup { |
|---|
| 225 |
"vga=0x%x " bc.cmd dup length add sprintf |
|---|
| 226 |
} { |
|---|
| 227 |
pop |
|---|
| 228 |
} ifelse |
|---|
| 229 |
|
|---|
| 230 |
config.lang { |
|---|
| 231 |
config.lang "en" ne { |
|---|
| 232 |
config.lang "lang=%s " bc.cmd dup length add sprintf |
|---|
| 233 |
} if |
|---|
| 234 |
} if |
|---|
| 235 |
|
|---|
| 236 |
% } if |
|---|
| 237 |
|
|---|
| 238 |
do_driverupdate { |
|---|
| 239 |
"dud=1 " bc.cmd dup length add sprintf |
|---|
| 240 |
} if |
|---|
| 241 |
|
|---|
| 242 |
% add splash only if an entry already exists |
|---|
| 243 |
bc.cmd "splash" bootopt.find dup .undef ne { |
|---|
| 244 |
% remove existing entry |
|---|
| 245 |
dup skipnonspaces skipspaces strcpy pop |
|---|
| 246 |
|
|---|
| 247 |
% append new entry |
|---|
| 248 |
xmenu.splash .xm_current get splash.options exch get |
|---|
| 249 |
"%s " bc.cmd dup length add sprintf |
|---|
| 250 |
} { |
|---|
| 251 |
pop |
|---|
| 252 |
} ifelse |
|---|
| 253 |
|
|---|
| 254 |
xmenu.profile { |
|---|
| 255 |
profile.options xmenu.profile .xm_current get get dup "" ne { |
|---|
| 256 |
"%s " bc.cmd dup length add sprintf |
|---|
| 257 |
} { pop } ifelse |
|---|
| 258 |
} if |
|---|
| 259 |
|
|---|
| 260 |
xmenu.install { |
|---|
| 261 |
install.option "" ne { |
|---|
| 262 |
install.option "%s " bc.cmd dup length add sprintf |
|---|
| 263 |
} if |
|---|
| 264 |
} if |
|---|
| 265 |
|
|---|
| 266 |
bc.opts "%s " bc.cmd dup length add sprintf |
|---|
| 267 |
|
|---|
| 268 |
bc.cmd dropspaces |
|---|
| 269 |
|
|---|
| 270 |
debug 3 ge { |
|---|
| 271 |
0 0 moveto black setcolor |
|---|
| 272 |
bc.cmd print "<< (press ESC) " print trace |
|---|
| 273 |
} if |
|---|
| 274 |
|
|---|
| 275 |
bc.cmd menu.entry |
|---|
| 276 |
} def |
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 280 |
% ( menu_entries_array cmdline_args_array defaultentry ) == > ( ) |
|---|
| 281 |
/MenuInit { |
|---|
| 282 |
bsplash.done |
|---|
| 283 |
|
|---|
| 284 |
0 setcolor 0 0 moveto screen.size fillrect loadpalette |
|---|
| 285 |
init |
|---|
| 286 |
|
|---|
| 287 |
/menu.entry -1 def |
|---|
| 288 |
|
|---|
| 289 |
/menu.dentry exch def |
|---|
| 290 |
/menu.args exch def |
|---|
| 291 |
/menu.texts exch def |
|---|
| 292 |
|
|---|
| 293 |
window.main |
|---|
| 294 |
dup window.init |
|---|
| 295 |
window.show |
|---|
| 296 |
|
|---|
| 297 |
% fadein_logo |
|---|
| 298 |
|
|---|
| 299 |
is_second_side { |
|---|
| 300 |
|
|---|
| 301 |
notimeout dvd_popup |
|---|
| 302 |
|
|---|
| 303 |
} { |
|---|
| 304 |
|
|---|
| 305 |
do_64bit_check { |
|---|
| 306 |
64bit { |
|---|
| 307 |
64bit_source not { notimeout 32bit_popup } if |
|---|
| 308 |
} { |
|---|
| 309 |
64bit_source { notimeout 64bit_popup } if |
|---|
| 310 |
} ifelse |
|---|
| 311 |
} if |
|---|
| 312 |
|
|---|
| 313 |
} ifelse |
|---|
| 314 |
|
|---|
| 315 |
} def |
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 319 |
% Setup boot option input field. |
|---|
| 320 |
% |
|---|
| 321 |
% ( ) == > ( ) |
|---|
| 322 |
% |
|---|
| 323 |
/bootoptions.init { |
|---|
| 324 |
window.current .color.fg get setcolor |
|---|
| 325 |
window.current .ed.font get setfont |
|---|
| 326 |
boot.ed edit.hidecursor |
|---|
| 327 |
menu.args menu.entry get |
|---|
| 328 |
menu.texts menu.entry get |
|---|
| 329 |
bootpromptmap |
|---|
| 330 |
dup |
|---|
| 331 |
boot.ed exch edit.init |
|---|
| 332 |
"" ne { boot.ed ' ' edit.input } if |
|---|
| 333 |
} def |
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 337 |
% Split command line into hidden and normal part. |
|---|
| 338 |
% |
|---|
| 339 |
% ( cmdline_args menu_text ) == > ( new_cmdline_args ) |
|---|
| 340 |
% |
|---|
| 341 |
% alt.kernel is set if a different kernel should be used (this feature should |
|---|
| 342 |
% no longer be needed). |
|---|
| 343 |
% |
|---|
| 344 |
/bootpromptmap { |
|---|
| 345 |
/alt.kernel "" def |
|---|
| 346 |
|
|---|
| 347 |
% syslinux { |
|---|
| 348 |
% dup "apic" eq { pop pop "apic" /alt.kernel "linux" def return } if |
|---|
| 349 |
% } if |
|---|
| 350 |
pop |
|---|
| 351 |
|
|---|
| 352 |
/cmdline exch def |
|---|
| 353 |
|
|---|
| 354 |
cmdline "showopts" getoption |
|---|
| 355 |
dup "" eq { |
|---|
| 356 |
cmdline.shown 0 0 put |
|---|
| 357 |
pop cmdline "%s" 256 cmdline.shown snprintf |
|---|
| 358 |
cmdline.hidden 0 0 put |
|---|
| 359 |
} { |
|---|
| 360 |
"showoptso" length add skipspaces |
|---|
| 361 |
"%s" 256 cmdline.shown snprintf |
|---|
| 362 |
cmdline "%s" 256 cmdline.hidden snprintf |
|---|
| 363 |
cmdline.hidden "showopts" getoption 0 0 put |
|---|
| 364 |
} ifelse |
|---|
| 365 |
|
|---|
| 366 |
cmdline.shown dropspaces |
|---|
| 367 |
cmdline.hidden dropspaces |
|---|
| 368 |
|
|---|
| 369 |
cmdline.shown |
|---|
| 370 |
} def |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 374 |
% Skip leading non-spaces. |
|---|
| 375 |
% |
|---|
| 376 |
% ( string ) ==> ( string ) |
|---|
| 377 |
% |
|---|
| 378 |
/skipnonspaces { |
|---|
| 379 |
{ dup 0 get dup 0 ne exch ' ' ne and { 1 add } { exit } ifelse } loop |
|---|
| 380 |
} def |
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 384 |
% Skip leading spaces. |
|---|
| 385 |
% |
|---|
| 386 |
% ( string ) ==> ( string ) |
|---|
| 387 |
% |
|---|
| 388 |
/skipspaces { |
|---|
| 389 |
{ dup 0 get ' ' eq { 1 add } { exit } ifelse } loop |
|---|
| 390 |
} def |
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 394 |
% Drop spaces at string end. |
|---|
| 395 |
% Modifies string! |
|---|
| 396 |
% |
|---|
| 397 |
% ( string ) ==> ( ) |
|---|
| 398 |
% |
|---|
| 399 |
/dropspaces { |
|---|
| 400 |
dup length |
|---|
| 401 |
dup 0 eq { |
|---|
| 402 |
pop pop |
|---|
| 403 |
} { |
|---|
| 404 |
1 sub |
|---|
| 405 |
-1 0 { |
|---|
| 406 |
over over get ' ' eq { over exch 0 put } { pop exit } ifelse |
|---|
| 407 |
} for |
|---|
| 408 |
pop |
|---|
| 409 |
} ifelse |
|---|
| 410 |
} def |
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 414 |
% Test if string[ofs-1]/string[ofs] is a word boundary. |
|---|
| 415 |
% |
|---|
| 416 |
% ( string ofs ) ==> ( true|false ) |
|---|
| 417 |
% |
|---|
| 418 |
% boundary is either space/non-space or non-space/(space|'=') |
|---|
| 419 |
% |
|---|
| 420 |
/iswordboundary { |
|---|
| 421 |
dup 0 eq { pop pop true return } if |
|---|
| 422 |
|
|---|
| 423 |
add dup 1 sub 0 get exch 0 get |
|---|
| 424 |
|
|---|
| 425 |
over ' ' eq over ' ' gt and { pop pop true return } if |
|---|
| 426 |
over ' ' gt over dup ' ' eq exch dup '=' eq exch 0 eq or or and { pop pop true return } if |
|---|
| 427 |
|
|---|
| 428 |
pop pop false |
|---|
| 429 |
} def |
|---|
| 430 |
|
|---|
| 431 |
|
|---|
| 432 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 433 |
% Get boot option. |
|---|
| 434 |
% |
|---|
| 435 |
% ( cmdline option_name ) ==> ( option_start ) |
|---|
| 436 |
% |
|---|
| 437 |
/getoption { |
|---|
| 438 |
/go.name exch def |
|---|
| 439 |
/go.cmdline exch def |
|---|
| 440 |
/go.pos 0 def |
|---|
| 441 |
{ |
|---|
| 442 |
go.cmdline go.pos add go.name strstr dup { |
|---|
| 443 |
1 sub /go.pos exch def |
|---|
| 444 |
|
|---|
| 445 |
go.cmdline go.pos iswordboundary |
|---|
| 446 |
go.cmdline go.pos go.name length add iswordboundary |
|---|
| 447 |
and { |
|---|
| 448 |
go.cmdline go.pos add exit |
|---|
| 449 |
} { |
|---|
| 450 |
/go.pos go.pos 1 add def |
|---|
| 451 |
} ifelse |
|---|
| 452 |
} { |
|---|
| 453 |
pop "" exit |
|---|
| 454 |
} ifelse |
|---|
| 455 |
} loop |
|---|
| 456 |
} def |
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 460 |
/redrawmenu { |
|---|
| 461 |
menu.visible.entries menu.texts length lt menu.scrollbar and { |
|---|
| 462 |
/menu.vsb.height1 |
|---|
| 463 |
menu.shift |
|---|
| 464 |
menu.sb.height mul menu.texts length div |
|---|
| 465 |
def |
|---|
| 466 |
|
|---|
| 467 |
/menu.vsb.height3 |
|---|
| 468 |
menu.texts length menu.visible.entries menu.shift add sub |
|---|
| 469 |
menu.sb.height mul menu.texts length div |
|---|
| 470 |
def |
|---|
| 471 |
|
|---|
| 472 |
lightgray setcolor |
|---|
| 473 |
menu.sb.x menu.sb.y menu.vsb.height1 add moveto |
|---|
| 474 |
menu.sb.width menu.sb.height menu.vsb.height1 menu.vsb.height3 add sub |
|---|
| 475 |
fillrect |
|---|
| 476 |
|
|---|
| 477 |
menu.vsb.height1 0 ne { |
|---|
| 478 |
menu.sb.x menu.sb.y moveto |
|---|
| 479 |
currentpoint menu.sb.width menu.vsb.height1 image |
|---|
| 480 |
} if |
|---|
| 481 |
|
|---|
| 482 |
menu.vsb.height3 0 ne { |
|---|
| 483 |
menu.sb.x menu.sb.y menu.sb.height menu.vsb.height3 sub add moveto |
|---|
| 484 |
currentpoint menu.sb.width menu.vsb.height3 image |
|---|
| 485 |
} if |
|---|
| 486 |
|
|---|
| 487 |
} if |
|---|
| 488 |
|
|---|
| 489 |
menu.text.normal setcolor |
|---|
| 490 |
|
|---|
| 491 |
/x menu.start.x def |
|---|
| 492 |
/y menu.start.y def |
|---|
| 493 |
|
|---|
| 494 |
0 1 menu.visible.entries 1 sub { |
|---|
| 495 |
x y moveto currentpoint menu.bar.width menu.bar.height image |
|---|
| 496 |
x menu.text.xofs add y menu.text.yofs add moveto |
|---|
| 497 |
menu.texts exch menu.shift add get menuitemmap |
|---|
| 498 |
currentfont exch font.large setfont show setfont |
|---|
| 499 |
/y y menu.item.height add def |
|---|
| 500 |
} for |
|---|
| 501 |
|
|---|
| 502 |
} def |
|---|
| 503 |
|
|---|
| 504 |
|
|---|
| 505 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 506 |
% ( entry status ) ==> ( ) |
|---|
| 507 |
% |
|---|
| 508 |
% status: |
|---|
| 509 |
% false not selected |
|---|
| 510 |
% true selected |
|---|
| 511 |
% |
|---|
| 512 |
/MenuSelect { |
|---|
| 513 |
/menu.status exch def |
|---|
| 514 |
|
|---|
| 515 |
/menu.idx over def |
|---|
| 516 |
|
|---|
| 517 |
menu.shift sub |
|---|
| 518 |
menu.item.height mul menu.start.y add |
|---|
| 519 |
menu.start.x exch |
|---|
| 520 |
moveto |
|---|
| 521 |
|
|---|
| 522 |
currentpoint |
|---|
| 523 |
menu.status { |
|---|
| 524 |
menu.bar.color |
|---|
| 525 |
setcolor menu.bar.width menu.bar.height fillrect |
|---|
| 526 |
} { |
|---|
| 527 |
currentpoint menu.bar.width menu.bar.height image |
|---|
| 528 |
} ifelse |
|---|
| 529 |
moveto |
|---|
| 530 |
|
|---|
| 531 |
menu.text.xofs menu.text.yofs rmoveto |
|---|
| 532 |
menu.status { |
|---|
| 533 |
menu.text.select |
|---|
| 534 |
} { |
|---|
| 535 |
menu.text.normal |
|---|
| 536 |
} ifelse |
|---|
| 537 |
setcolor |
|---|
| 538 |
menu.texts menu.idx get menuitemmap |
|---|
| 539 |
currentfont exch font.large setfont show setfont |
|---|
| 540 |
|
|---|
| 541 |
menu.status { |
|---|
| 542 |
% init boot options |
|---|
| 543 |
keepbootoptions .undef eq { bootoptions.init } if |
|---|
| 544 |
|
|---|
| 545 |
% set help context |
|---|
| 546 |
"main" help.setcontext |
|---|
| 547 |
menu.texts menu.idx get |
|---|
| 548 |
dup help.findpage "" eq { |
|---|
| 549 |
pop |
|---|
| 550 |
} { |
|---|
| 551 |
help.setcontext |
|---|
| 552 |
} ifelse |
|---|
| 553 |
} if |
|---|
| 554 |
|
|---|
| 555 |
} def |
|---|
| 556 |
|
|---|
| 557 |
|
|---|
| 558 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 559 |
% ( text errorcode ) ==> ( ) |
|---|
| 560 |
% errorcode: |
|---|
| 561 |
% 0 normal info |
|---|
| 562 |
% 1 fatal error |
|---|
| 563 |
% 2 missing kernel |
|---|
| 564 |
% 3 disk change |
|---|
| 565 |
% 4 disk change failed |
|---|
| 566 |
% |
|---|
| 567 |
|
|---|
| 568 |
/info.tmpmsg 127 string def |
|---|
| 569 |
|
|---|
| 570 |
/InfoBoxInit { |
|---|
| 571 |
/info.type exch def |
|---|
| 572 |
/info.msg exch def |
|---|
| 573 |
|
|---|
| 574 |
window.dialog |
|---|
| 575 |
|
|---|
| 576 |
info.type 1 eq { |
|---|
| 577 |
dup .title.bg red put |
|---|
| 578 |
dup .title txt_error_title put |
|---|
| 579 |
dup .buttons |
|---|
| 580 |
[ |
|---|
| 581 |
button.reboot button.default actCloseInfo button.setaction |
|---|
| 582 |
] put |
|---|
| 583 |
} { |
|---|
| 584 |
dup .title txt_info_title put |
|---|
| 585 |
dup .buttons |
|---|
| 586 |
[ |
|---|
| 587 |
button.ok button.default actCloseInfo button.setaction |
|---|
| 588 |
% button.cancel button.notdefault actCloseInfo button.setaction |
|---|
| 589 |
] put |
|---|
| 590 |
} ifelse |
|---|
| 591 |
|
|---|
| 592 |
info.type 2 eq |
|---|
| 593 |
is_second_side and { |
|---|
| 594 |
txt_dvd_warning info.msg |
|---|
| 595 |
over length info.msg length 1 add add "%s%s" exch |
|---|
| 596 |
dup string dup /info.msg exch def snprintf |
|---|
| 597 |
} if |
|---|
| 598 |
|
|---|
| 599 |
syslinux info.type 3 eq and { |
|---|
| 600 |
dup .title txt_change_disk_title put |
|---|
| 601 |
0 getinfo 1 add txt_insert_disk info.tmpmsg sprintf |
|---|
| 602 |
/info.msg info.tmpmsg def |
|---|
| 603 |
} if |
|---|
| 604 |
|
|---|
| 605 |
syslinux info.type 4 eq and { |
|---|
| 606 |
dup .title txt_change_disk_title put |
|---|
| 607 |
1 getinfo 15 not and { |
|---|
| 608 |
0 getinfo 1 add |
|---|
| 609 |
txt_insert_disk3 info.tmpmsg sprintf |
|---|
| 610 |
} { |
|---|
| 611 |
0 getinfo 1 add 1 getinfo 1 add |
|---|
| 612 |
txt_insert_disk2 info.tmpmsg sprintf |
|---|
| 613 |
} ifelse |
|---|
| 614 |
/info.msg info.tmpmsg def |
|---|
| 615 |
} if |
|---|
| 616 |
|
|---|
| 617 |
dup .text info.msg put |
|---|
| 618 |
|
|---|
| 619 |
dup window.init |
|---|
| 620 |
window.show |
|---|
| 621 |
|
|---|
| 622 |
} def |
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 627 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 628 |
|
|---|
| 629 |
% progress bar code |
|---|
| 630 |
|
|---|
| 631 |
|
|---|
| 632 |
% Show percentage of progress bar. |
|---|
| 633 |
% |
|---|
| 634 |
% ( percentage ) ==> ( ) |
|---|
| 635 |
% |
|---|
| 636 |
/progress.percent { |
|---|
| 637 |
0 max 100 min % so people don't ask silly questions... |
|---|
| 638 |
"100%" strsize over neg progress.text.x add progress.text.y moveto |
|---|
| 639 |
window.current .color.bg get setcolor |
|---|
| 640 |
fillrect |
|---|
| 641 |
|
|---|
| 642 |
"%3u%%" 8 dup string dup 5 1 roll snprintf |
|---|
| 643 |
|
|---|
| 644 |
dup strsize pop neg progress.text.x add progress.text.y moveto |
|---|
| 645 |
window.current .color.fg get setcolor |
|---|
| 646 |
dup show |
|---|
| 647 |
free |
|---|
| 648 |
|
|---|
| 649 |
} def |
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 |
% Show n-th progress bar symbol. |
|---|
| 653 |
% |
|---|
| 654 |
% ( n ) ==> ( ) |
|---|
| 655 |
% |
|---|
| 656 |
/progress.sym.show { |
|---|
| 657 |
/progress.sym.current exch def |
|---|
| 658 |
|
|---|
| 659 |
progress.bar.x progress.bar.y moveto |
|---|
| 660 |
progress.sym.width progress.sym.current 1 sub mul 1 add 1 rmoveto |
|---|
| 661 |
progress.sym.width 2 sub |
|---|
| 662 |
progress.bar.height 2 sub |
|---|
| 663 |
loading_color setcolor |
|---|
| 664 |
fillrect |
|---|
| 665 |
|
|---|
| 666 |
} def |
|---|
| 667 |
|
|---|
| 668 |
|
|---|
| 669 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 670 |
% ( kernel_name ) ==> ( ) |
|---|
| 671 |
/ProgressInit { |
|---|
| 672 |
/progress.kname exch def |
|---|
| 673 |
|
|---|
| 674 |
boot.ed edit.hidecursor |
|---|
| 675 |
|
|---|
| 676 |
/dia window.dialog def |
|---|
| 677 |
|
|---|
| 678 |
dia .width.min 330 put |
|---|
| 679 |
dia .position 10 put |
|---|
| 680 |
|
|---|
| 681 |
dia .title txt_load_kernel_title put |
|---|
| 682 |
dia .text |
|---|
| 683 |
progress.kname "memtest" eq { |
|---|
| 684 |
txt_load_memtest |
|---|
| 685 |
} { |
|---|
| 686 |
txt_load_kernel |
|---|
| 687 |
} ifelse |
|---|
| 688 |
put |
|---|
| 689 |
|
|---|
| 690 |
dia window.init |
|---|
| 691 |
dia window.show |
|---|
| 692 |
|
|---|
| 693 |
% now add progress bar |
|---|
| 694 |
|
|---|
| 695 |
dia .x get dia .y get moveto |
|---|
| 696 |
dia .text.x get dia .text.y get 28 add rmoveto |
|---|
| 697 |
|
|---|
| 698 |
/progress.bar.height 19 def |
|---|
| 699 |
/progress.bar.width dia .width get 60 sub def |
|---|
| 700 |
|
|---|
| 701 |
/progress.sym.width 10 def |
|---|
| 702 |
/progress.bar.width |
|---|
| 703 |
progress.bar.width progress.sym.width div |
|---|
| 704 |
/progress.syms over def progress.sym.width mul |
|---|
| 705 |
def |
|---|
| 706 |
|
|---|
| 707 |
currentpoint over 1 sub over 2 sub moveto |
|---|
| 708 |
white white progress.bar.width 2 add progress.bar.height 4 add drawborder |
|---|
| 709 |
|
|---|
| 710 |
/progress.bar.y exch def |
|---|
| 711 |
/progress.bar.x exch def |
|---|
| 712 |
|
|---|
| 713 |
/progress.text.x progress.bar.x progress.bar.width 37 add add def |
|---|
| 714 |
/progress.text.y progress.bar.y progress.bar.height fontheight sub 2 div add def |
|---|
| 715 |
|
|---|
| 716 |
/progress.sym.current 0 def |
|---|
| 717 |
|
|---|
| 718 |
0 progress.percent |
|---|
| 719 |
|
|---|
| 720 |
} def |
|---|
| 721 |
|
|---|
| 722 |
|
|---|
| 723 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 724 |
% ( ) ==> ( ) |
|---|
| 725 |
/ProgressDone { |
|---|
| 726 |
window.done |
|---|
| 727 |
} def |
|---|
| 728 |
|
|---|
| 729 |
|
|---|
| 730 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 731 |
% ( max current ) ==> ( ) |
|---|
| 732 |
/ProgressUpdate { |
|---|
| 733 |
over over 100 mul exch 1 max div progress.percent |
|---|
| 734 |
|
|---|
| 735 |
progress.syms mul progress.syms 2 div add exch 1 max div |
|---|
| 736 |
|
|---|
| 737 |
0 max progress.syms min |
|---|
| 738 |
|
|---|
| 739 |
dup progress.sym.current gt { |
|---|
| 740 |
progress.sym.current 1 add over 1 exch { |
|---|
| 741 |
progress.sym.show |
|---|
| 742 |
} for |
|---|
| 743 |
} if |
|---|
| 744 |
pop |
|---|
| 745 |
|
|---|
| 746 |
} def |
|---|
| 747 |
|
|---|
| 748 |
|
|---|
| 749 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 750 |
% ( timeout time ) ==> ( ) |
|---|
| 751 |
/Timeout { |
|---|
| 752 |
% first time |
|---|
| 753 |
timeout.time .undef eq { timeout.init } if |
|---|
| 754 |
|
|---|
| 755 |
dup /timeout.time exch def |
|---|
| 756 |
|
|---|
| 757 |
over sub neg timeout.symbols mul exch div |
|---|
| 758 |
|
|---|
| 759 |
dup timeout.current eq { pop return } if |
|---|
| 760 |
|
|---|
| 761 |
/timeout.last timeout.current def |
|---|
| 762 |
/timeout.current exch def |
|---|
| 763 |
|
|---|
| 764 |
timeout.current timeout.symbols ge { |
|---|
| 765 |
timeout.x timeout.time.y moveto |
|---|
| 766 |
currentpoint timeout.dx timeout.symbols mul fontheight image |
|---|
| 767 |
0 1 timeout.symbols 1 sub { |
|---|
| 768 |
timeout.clear { 2 } { 1 } ifelse drawtsymbol |
|---|
| 769 |
} for |
|---|
| 770 |
} { |
|---|
| 771 |
timeout.time.x timeout.time.y moveto |
|---|
| 772 |
currentpoint currentpoint 100 fontheight image |
|---|
| 773 |
moveto |
|---|
| 774 |
white setcolor |
|---|
| 775 |
timeout.time 10 mul 150 add 182 div "%ds" 64 timeout.buf snprintf timeout.buf show |
|---|
| 776 |
timeout.last 1 timeout.current { |
|---|
| 777 |
1 sub dup 0 ge { |
|---|
| 778 |
1 drawtsymbol |
|---|
| 779 |
} if |
|---|
| 780 |
} for |
|---|
| 781 |
} ifelse |
|---|
| 782 |
} def |
|---|
| 783 |
|
|---|
| 784 |
|
|---|
| 785 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 786 |
% draw a timeout symbol |
|---|
| 787 |
% ( index status ) ==> () |
|---|
| 788 |
% |
|---|
| 789 |
% status: 0: init, 1: clear, 2: set |
|---|
| 790 |
% |
|---|
| 791 |
/drawtsymbol { |
|---|
| 792 |
/timeout.status exch def |
|---|
| 793 |
dup timeout.dx mul timeout.x add exch |
|---|
| 794 |
timeout.dy mul timeout.y add |
|---|
| 795 |
moveto currentpoint |
|---|
| 796 |
timeout.status 2 eq { |
|---|
| 797 |
currentpoint timeout.size image |
|---|
| 798 |
} { |
|---|
| 799 |
timeout.status 0 eq { |
|---|
| 800 |
pop pop |
|---|
| 801 |
} { |
|---|
| 802 |
0 462 timeout.size image |
|---|
| 803 |
} ifelse |
|---|
| 804 |
} ifelse |
|---|
| 805 |
} def |
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 809 |
% ( time ) ==> ( ) |
|---|
| 810 |
% /Timer { pop } def |
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 814 |
% ( label correct_password ) ==> ( ) |
|---|
| 815 |
% |
|---|
| 816 |
/PasswordInit { |
|---|
| 817 |
/password.key exch def pop |
|---|
| 818 |
|
|---|
| 819 |
/dia window.dialog def |
|---|
| 820 |
|
|---|
| 821 |
/password.dialog dia def |
|---|
| 822 |
|
|---|
| 823 |
dia .title txt_password_title put |
|---|
| 824 |
dia .text "" put |
|---|
| 825 |
|
|---|
| 826 |
% Must all be of same size! |
|---|
| 827 |
dia .ed.list 1 array put |
|---|
| 828 |
dia .ed.buffer.list [ 31 string ] put |
|---|
| 829 |
dia .ed.text.list [ txt_password ] put |
|---|
| 830 |
|
|---|
| 831 |
dia .ed.focus 0 put |
|---|
| 832 |
|
|---|
| 833 |
dia .ed.width 200 put |
|---|
| 834 |
|
|---|
| 835 |
dia .buttons |
|---|
| 836 |
[ button.ok button.default actPassword button.setaction ] |
|---|
| 837 |
put |
|---|
| 838 |
|
|---|
| 839 |
dia window.init |
|---|
| 840 |
dia window.show |
|---|
| 841 |
|
|---|
| 842 |
} def |
|---|
| 843 |
|
|---|
| 844 |
|
|---|
| 845 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 846 |
% ( password ) ==> ( error ) |
|---|
| 847 |
% |
|---|
| 848 |
% error: |
|---|
| 849 |
% true password ok |
|---|
| 850 |
% false wrong password |
|---|
| 851 |
% |
|---|
| 852 |
% ****** FIXME: test result seems to be unused |
|---|
| 853 |
% |
|---|
| 854 |
/PasswordDone { |
|---|
| 855 |
|
|---|
| 856 |
password.key eq |
|---|
| 857 |
} def |
|---|
| 858 |
|
|---|
| 859 |
|
|---|
| 860 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 861 |
% ( text ) == > ( new_text ) |
|---|
| 862 |
/menuitemmap { |
|---|
| 863 |
translate |
|---|
| 864 |
dup "memtest" eq over "memtest86" eq or { pop txt_memtest return } if |
|---|
| 865 |
syslinux { |
|---|
| 866 |
dup "linux" eq { pop txt_install return } if |
|---|
| 867 |
dup "failsafe" eq { pop txt_safe_install return } if |
|---|
| 868 |
dup "noacpi" eq { pop txt_noacpi_install return } if |
|---|
| 869 |
dup "manual" eq { pop txt_manual_install return } if |
|---|
| 870 |
dup "rescue" eq { pop txt_rescue return } if |
|---|
| 871 |
dup "hwcheck" eq { pop "Hardware Check" return } if |
|---|
| 872 |
dup "harddisk" eq { pop txt_boot_harddisk return } if |
|---|
| 873 |
dup "eval" eq { pop "LiveEval" return } if |
|---|
| 874 |
} { |
|---|
| 875 |
dup "linux" eq { pop "Linux" return } if |
|---|
| 876 |
dup "failsafe" eq { pop txt_safe_linux return } if |
|---|
| 877 |
dup "windows" eq { pop "Windows" return } if |
|---|
| 878 |
} ifelse |
|---|
| 879 |
} def |
|---|
| 880 |
|
|---|
| 881 |
|
|---|
| 882 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 883 |
% ( color0 color1 width height ) ==> ( ) |
|---|
| 884 |
/drawborder { |
|---|
| 885 |
currentpoint /db.y0 exch def /db.x0 exch def |
|---|
| 886 |
|
|---|
| 887 |
/db.y1 exch 1 sub db.y0 add def |
|---|
| 888 |
/db.x1 exch 1 sub db.x0 add def |
|---|
| 889 |
/db.col1 exch def |
|---|
| 890 |
/db.col0 exch def |
|---|
| 891 |
|
|---|
| 892 |
db.x0 db.y1 moveto |
|---|
| 893 |
|
|---|
| 894 |
db.col0 setcolor |
|---|
| 895 |
db.x0 db.y0 lineto db.x1 db.y0 lineto |
|---|
| 896 |
|
|---|
| 897 |
db.col1 setcolor |
|---|
| 898 |
db.x1 db.y1 lineto db.x0 db.y1 lineto |
|---|
| 899 |
} def |
|---|
| 900 |
|
|---|
| 901 |
|
|---|
| 902 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 903 |
% ( color0 color1 color2 width height ) ==> ( ) |
|---|
| 904 |
% draw frame with shadow |
|---|
| 905 |
% color0: upper left, color1: lower right, color2: shadow |
|---|
| 906 |
/drawborder3 { |
|---|
| 907 |
currentpoint /db.y0 exch def /db.x0 exch def |
|---|
| 908 |
|
|---|
| 909 |
/db.y1 exch 1 sub db.y0 add def |
|---|
| 910 |
/db.x1 exch 1 sub db.x0 add def |
|---|
| 911 |
/db.col2 exch def |
|---|
| 912 |
/db.col1 exch def |
|---|
| 913 |
/db.col0 exch def |
|---|
| 914 |
|
|---|
| 915 |
db.x0 db.y1 moveto |
|---|
| 916 |
|
|---|
| 917 |
db.col0 setcolor |
|---|
| 918 |
db.x0 db.y0 lineto db.x1 db.y0 lineto |
|---|
| 919 |
|
|---|
| 920 |
db.col1 setcolor |
|---|
| 921 |
db.x1 db.y1 lineto db.x0 db.y1 lineto |
|---|
| 922 |
|
|---|
| 923 |
db.col2 -1 ne { |
|---|
| 924 |
db.col2 setcolor |
|---|
| 925 |
1 1 rmoveto |
|---|
| 926 |
db.x1 1 add db.y1 1 add lineto |
|---|
| 927 |
db.x1 1 add db.y0 1 add lineto |
|---|
| 928 |
} if |
|---|
| 929 |
} def |
|---|
| 930 |
|
|---|
| 931 |
|
|---|
| 932 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 933 |
% ( color0 color1 width height ) ==> ( ) |
|---|
| 934 |
/drawborder4 { |
|---|
| 935 |
3 index 4 1 roll rot dup 3 index 3 index |
|---|
| 936 |
currentpoint 6 2 roll |
|---|
| 937 |
1 1 rmoveto drawborder |
|---|
| 938 |
moveto drawborder |
|---|
| 939 |
} def |
|---|
| 940 |
|
|---|
| 941 |
|
|---|
| 942 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 943 |
% center text |
|---|
| 944 |
% ( text width height ) ==> ( ) |
|---|
| 945 |
/centertext { |
|---|
| 946 |
3 -1 roll strsize |
|---|
| 947 |
4 2 roll |
|---|
| 948 |
4 1 roll exch 4 1 roll sub 2 div neg 3 1 roll sub 2 div neg |
|---|
| 949 |
} def |
|---|
| 950 |
|
|---|
| 951 |
|
|---|
| 952 |
/fadeout_logo { |
|---|
| 953 |
/cols 256 malloc def |
|---|
| 954 |
|
|---|
| 955 |
0 1 255 { cols exch 0 put } for |
|---|
| 956 |
|
|---|
| 957 |
10 1 150 { |
|---|
| 958 |
10 1 100 { |
|---|
| 959 |
over exch moveto getpixel |
|---|
| 960 |
cols exch 1 put |
|---|
| 961 |
} for |
|---|
| 962 |
pop |
|---|
| 963 |
} for |
|---|
| 964 |
cols 10 10 moveto getpixel 0 fade |
|---|
| 965 |
} def |
|---|
| 966 |
|
|---|
| 967 |
/fadein_logo { |
|---|
| 968 |
cols 10 10 moveto getpixel fadein |
|---|
| 969 |
} def |
|---|
| 970 |
|
|---|
| 971 |
|
|---|
| 972 |
% Allocate and define a new color. |
|---|
| 973 |
% |
|---|
| 974 |
% ( palette ) ==> ( color ) |
|---|
| 975 |
% |
|---|
| 976 |
/newcolor { |
|---|
| 977 |
colorbits 8 le { |
|---|
| 978 |
newcolor.count .undef eq { /newcolor.count 0 def } if |
|---|
| 979 |
max_image_colors newcolor.count add |
|---|
| 980 |
dup rot setpalette |
|---|
| 981 |
/newcolor.count newcolor.count 1 add def |
|---|
| 982 |
} if |
|---|
| 983 |
def |
|---|
| 984 |
} def |
|---|
| 985 |
|
|---|
| 986 |
|
|---|
| 987 |
/init { |
|---|
| 988 |
0 0 moveto currentpoint clip.size image |
|---|
| 989 |
|
|---|
| 990 |
% set default language |
|---|
| 991 |
"lang" findfile dup { |
|---|
| 992 |
/tmp over length 1 add 2 max string def |
|---|
| 993 |
tmp exch { |
|---|
| 994 |
dup ' ' eq over '\n' eq or { pop pop exit } if |
|---|
| 995 |
over exch 0 exch put |
|---|
| 996 |
1 add |
|---|
| 997 |
} forall |
|---|
| 998 |
tmp 2 0 put % only short locale name |
|---|
| 999 |
tmp dup setlang pop setkeymap |
|---|
| 1000 |
} { |
|---|
| 1001 |
pop |
|---|
| 1002 |
"en" dup setlang pop setkeymap |
|---|
| 1003 |
} ifelse |
|---|
| 1004 |
|
|---|
| 1005 |
font.large setfont |
|---|
| 1006 |
|
|---|
| 1007 |
/menu.text.xofs 10 def |
|---|
| 1008 |
/menu.text.yofs 2 def |
|---|
| 1009 |
/menu.item.height fontheight dup 3 div add def |
|---|
| 1010 |
/menu.bar.height fontheight menu.text.yofs dup add add def |
|---|
| 1011 |
|
|---|
| 1012 |
font.normal setfont |
|---|
| 1013 |
|
|---|
| 1014 |
/menu.text.normal white def |
|---|
| 1015 |
/menu.text.select white def |
|---|
| 1016 |
/boot.text.options black def |
|---|
| 1017 |
/boot.text.normal black def |
|---|
| 1018 |
/infobox.bg lightgray def |
|---|
| 1019 |
/infobox.text.normal black def |
|---|
| 1020 |
|
|---|
| 1021 |
/menu.bar.color fn_color def |
|---|
| 1022 |
|
|---|
| 1023 |
/frame1.pos { 190 50 } def |
|---|
| 1024 |
/frame1.size { 350 280 } def |
|---|
| 1025 |
/frame2.pos { 24 410 } def |
|---|
| 1026 |
/frame2.size { 582 25 } def |
|---|
| 1027 |
/frame3.pos { 24 386 } def |
|---|
| 1028 |
/frame3.size { 124 25 } def |
|---|
| 1029 |
/frame4.pos { 560 62 } def |
|---|
| 1030 |
/frame4.size { 22 264 } def |
|---|
| 1031 |
|
|---|
| 1032 |
/menu.start.x frame1.pos pop 10 add def |
|---|
| 1033 |
/menu.start.y frame1.pos exch pop 13 add def |
|---|
| 1034 |
|
|---|
| 1035 |
/menu.bar.width frame1.size pop 20 sub def |
|---|
| 1036 |
/menu.max.entries 12 def |
|---|
| 1037 |
/menu.scrollbar true def |
|---|
| 1038 |
|
|---|
| 1039 |
/boot.buf.size 256 def |
|---|
| 1040 |
/boot.buf boot.buf.size string def |
|---|
| 1041 |
|
|---|
| 1042 |
/ms.size { 22 22 } def |
|---|
| 1043 |
/ms.up { 0 480 } def |
|---|
| 1044 |
/ms.down { 23 480 } def |
|---|
| 1045 |
|
|---|
| 1046 |
/update.pos { clip.size pop txt_dud_ready strsize pop sub 26 sub 360 } def |
|---|
| 1047 |
|
|---|
| 1048 |
% frame1.pos moveto frame_color dup dark_frame_color frame1.size drawborder3 |
|---|
| 1049 |
% frame1.pos moveto frame_color dark_frame_color frame1.size drawborder4 |
|---|
| 1050 |
|
|---|
| 1051 |
/framex.pos { 48 263 } def |
|---|
| 1052 |
/framex.size { 74 104 } def |
|---|
| 1053 |
framex.pos moveto black black framex.size drawborder |
|---|
| 1054 |
|
|---|
| 1055 |
} def |
|---|
| 1056 |
|
|---|
| 1057 |
|
|---|
| 1058 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1059 |
% Some special debug & test keys. |
|---|
| 1060 |
% |
|---|
| 1061 |
% ( key_in ) ==> ( key_out ) |
|---|
| 1062 |
% |
|---|
| 1063 |
/debug.input { |
|---|
| 1064 |
% dup keyShiftF4 eq { |
|---|
| 1065 |
% 0 0 moveto |
|---|
| 1066 |
% 16 string dup dup "1234" ">%s<" 2 index sprintf show free |
|---|
| 1067 |
% pop 0 |
|---|
| 1068 |
% } if |
|---|
| 1069 |
|
|---|
| 1070 |
dup keyF7 eq syslinux and { |
|---|
| 1071 |
"kroete.data" findfile kroete.dir idle |
|---|
| 1072 |
/kroete.dir kroete.dir 1 xor def |
|---|
| 1073 |
pop 0 |
|---|
| 1074 |
} if |
|---|
| 1075 |
|
|---|
| 1076 |
dup keyF8 eq syslinux and { |
|---|
| 1077 |
.undef 0 idle |
|---|
| 1078 |
pop 0 |
|---|
| 1079 |
} if |
|---|
| 1080 |
|
|---|
| 1081 |
dup keyShiftF3 eq syslinux and debug 3 ge and { |
|---|
| 1082 |
currentcolor black setcolor |
|---|
| 1083 |
currentpoint 0 0 moveto |
|---|
| 1084 |
"eject " print bootdrive eject print |
|---|
| 1085 |
moveto setcolor |
|---|
| 1086 |
pop 0 |
|---|
| 1087 |
} if |
|---|
| 1088 |
|
|---|
| 1089 |
dup keyShiftF5 eq syslinux and debug 3 ge and { |
|---|
| 1090 |
currentcolor black setcolor |
|---|
| 1091 |
currentpoint 100 0 moveto |
|---|
| 1092 |
bootdrive print |
|---|
| 1093 |
moveto setcolor |
|---|
| 1094 |
pop 0 |
|---|
| 1095 |
} if |
|---|
| 1096 |
|
|---|
| 1097 |
dup keyShiftF8 eq debug 3 ge and { |
|---|
| 1098 |
currentcolor black setcolor currentpoint 300 0 moveto |
|---|
| 1099 |
memsize print "/" print print " " print |
|---|
| 1100 |
moveto setcolor |
|---|
| 1101 |
pop 0 |
|---|
| 1102 |
} if |
|---|
| 1103 |
|
|---|
| 1104 |
dup keyShiftF9 eq debug 3 ge and { |
|---|
| 1105 |
pop 0 |
|---|
| 1106 |
} if |
|---|
| 1107 |
|
|---|
| 1108 |
dup keyShiftF10 eq { |
|---|
| 1109 |
/debug debug 1 add def "" |
|---|
| 1110 |
pop 0 |
|---|
| 1111 |
} if |
|---|
| 1112 |
|
|---|
| 1113 |
dup keyShiftF11 eq { |
|---|
| 1114 |
currenttransparency 0x10 sub 0 max settransparency |
|---|
| 1115 |
pop 0 |
|---|
| 1116 |
} if |
|---|
| 1117 |
|
|---|
| 1118 |
dup keyF11 eq { |
|---|
| 1119 |
|
|---|
| 1120 |
0 1 479 { |
|---|
| 1121 |
0 1 639 { |
|---|
| 1122 |
over moveto |
|---|
| 1123 |
currentpoint 3 div 8 shl exch 3 div add setcolor |
|---|
| 1124 |
putpixel |
|---|
| 1125 |
} for |
|---|
| 1126 |
pop |
|---|
| 1127 |
} for |
|---|
| 1128 |
|
|---|
| 1129 |
pop 0 |
|---|
| 1130 |
} if |
|---|
| 1131 |
|
|---|
| 1132 |
dup keyShiftF12 eq { |
|---|
| 1133 |
currenttransparency 0x10 add 0x100 min settransparency |
|---|
| 1134 |
pop 0 |
|---|
| 1135 |
} if |
|---|
| 1136 |
|
|---|
| 1137 |
} def |
|---|
| 1138 |
|
|---|
| 1139 |
|
|---|
| 1140 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1141 |
% Show exit popup. |
|---|
| 1142 |
% |
|---|
| 1143 |
% ( ) ==> ( ) |
|---|
| 1144 |
% |
|---|
| 1145 |
/exit_popup { |
|---|
| 1146 |
window.dialog |
|---|
| 1147 |
|
|---|
| 1148 |
dup .title txt_exit_title put |
|---|
| 1149 |
dup .text txt_exit_dialog put |
|---|
| 1150 |
dup .buttons [ |
|---|
| 1151 |
button.ok button.default actExit button.setaction |
|---|
| 1152 |
button.cancel button.notdefault actNothing button.setaction |
|---|
| 1153 |
] put |
|---|
| 1154 |
dup window.init |
|---|
| 1155 |
window.show |
|---|
| 1156 |
|
|---|
| 1157 |
} def |
|---|
| 1158 |
|
|---|
| 1159 |
|
|---|
| 1160 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1161 |
% Show help window. |
|---|
| 1162 |
% |
|---|
| 1163 |
% ( ) ==> ( ) |
|---|
| 1164 |
% |
|---|
| 1165 |
/show_help { |
|---|
| 1166 |
window.help |
|---|
| 1167 |
|
|---|
| 1168 |
dup window.init |
|---|
| 1169 |
window.show |
|---|
| 1170 |
|
|---|
| 1171 |
} def |
|---|
| 1172 |
|
|---|
| 1173 |
|
|---|
| 1174 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1175 |
% Show dvd popup. |
|---|
| 1176 |
% |
|---|
| 1177 |
% ( ) ==> ( ) |
|---|
| 1178 |
% |
|---|
| 1179 |
/dvd_popup { |
|---|
| 1180 |
window.dialog |
|---|
| 1181 |
|
|---|
| 1182 |
dup .title txt_dvd_warning_title put |
|---|
| 1183 |
dup .text txt_dvd_warning2 put |
|---|
| 1184 |
dup .buttons [ |
|---|
| 1185 |
% button.eject button.default actEject actNoClose or button.setaction |
|---|
| 1186 |
button.continue button.default actNothing button.setaction |
|---|
| 1187 |
] put |
|---|
| 1188 |
dup window.init |
|---|
| 1189 |
window.show |
|---|
| 1190 |
|
|---|
| 1191 |
} def |
|---|
| 1192 |
|
|---|
| 1193 |
|
|---|
| 1194 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1195 |
% Warn that we are about to install 32bit software on a 64bit system. |
|---|
| 1196 |
% |
|---|
| 1197 |
% ( ) ==> ( ) |
|---|
| 1198 |
% |
|---|
| 1199 |
/32bit_popup { |
|---|
| 1200 |
window.dialog |
|---|
| 1201 |
|
|---|
| 1202 |
dup .title "Cool computer, but..." put |
|---|
| 1203 |
dup .text "You are about to install 32-bit software on a 64-bit computer." put |
|---|
| 1204 |
dup .buttons [ |
|---|
| 1205 |
button.continue button.default actNothing button.setaction |
|---|
| 1206 |
] put |
|---|
| 1207 |
dup window.init |
|---|
| 1208 |
window.show |
|---|
| 1209 |
|
|---|
| 1210 |
} def |
|---|
| 1211 |
|
|---|
| 1212 |
|
|---|
| 1213 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1214 |
% Warn that we are about to install 64bit software on a 32bit system. |
|---|
| 1215 |
% |
|---|
| 1216 |
% ( ) ==> ( ) |
|---|
| 1217 |
% |
|---|
| 1218 |
/64bit_popup { |
|---|
| 1219 |
window.dialog |
|---|
| 1220 |
|
|---|
| 1221 |
dup .title "Cool software, but..." put |
|---|
| 1222 |
dup .text "This is a 32-bit computer. You cannot use 64-bit software on it." put |
|---|
| 1223 |
dup .buttons [ |
|---|
| 1224 |
button.reboot button.default actReboot actNoClose or button.setaction |
|---|
| 1225 |
] put |
|---|
| 1226 |
dup window.init |
|---|
| 1227 |
window.show |
|---|
| 1228 |
|
|---|
| 1229 |
} def |
|---|
| 1230 |
|
|---|
| 1231 |
|
|---|
| 1232 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1233 |
% Show "power off" popup. |
|---|
| 1234 |
% |
|---|
| 1235 |
% ( ) ==> ( ) |
|---|
| 1236 |
% |
|---|
| 1237 |
/power_off { |
|---|
| 1238 |
window.dialog |
|---|
| 1239 |
|
|---|
| 1240 |
dup .title txt_power_off_title put |
|---|
| 1241 |
dup .text txt_power_off put |
|---|
| 1242 |
dup .buttons [ |
|---|
| 1243 |
button.ok button.notdefault actPowerOff actNoClose or button.setaction |
|---|
| 1244 |
button.cancel button.default actNothing button.setaction |
|---|
| 1245 |
] put |
|---|
| 1246 |
dup window.init |
|---|
| 1247 |
window.show |
|---|
| 1248 |
|
|---|
| 1249 |
} def |
|---|
| 1250 |
|
|---|
| 1251 |
|
|---|
| 1252 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1253 |
% Initialize timeout indicator. |
|---|
| 1254 |
% |
|---|
| 1255 |
% ( ) ==> ( ) |
|---|
| 1256 |
% |
|---|
| 1257 |
/timeout.init { |
|---|
| 1258 |
/timeout.current -1 def |
|---|
| 1259 |
/timeout.x 50 def |
|---|
| 1260 |
/timeout.y 363 def |
|---|
| 1261 |
/timeout.dx 0 def |
|---|
| 1262 |
/timeout.dy -1 def |
|---|
| 1263 |
/timeout.symbols 100 def |
|---|
| 1264 |
/timeout.clear true def |
|---|
| 1265 |
/timeout.size { 70 1 } def |
|---|
| 1266 |
/timeout.buf 64 string def |
|---|
| 1267 |
|
|---|
| 1268 |
timeout.x timeout.y moveto |
|---|
| 1269 |
frame_color dup |
|---|
| 1270 |
timeout.dx timeout.symbols mul timeout.size exch pop |
|---|
| 1271 |
drawborder |
|---|
| 1272 |
|
|---|
| 1273 |
timeout.x timeout.y 120 sub moveto |
|---|
| 1274 |
white setcolor |
|---|
| 1275 |
"Booting in " show |
|---|
| 1276 |
currentpoint /timeout.time.y exch def /timeout.time.x exch def |
|---|
| 1277 |
} def |
|---|
| 1278 |
|
|---|
| 1279 |
|
|---|
| 1280 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1281 |
% Search for option in cmdline. |
|---|
| 1282 |
% Returns .undef if not found. |
|---|
| 1283 |
% |
|---|
| 1284 |
% ( cmdline option_name ) ==> ( option_start ) |
|---|
| 1285 |
% |
|---|
| 1286 |
/bootopt.find { |
|---|
| 1287 |
/bo.opt exch def |
|---|
| 1288 |
/bo.cmdline exch def |
|---|
| 1289 |
|
|---|
| 1290 |
{ |
|---|
| 1291 |
bo.cmdline bo.opt strstr |
|---|
| 1292 |
dup { |
|---|
| 1293 |
dup 1 eq { |
|---|
| 1294 |
true |
|---|
| 1295 |
} { |
|---|
| 1296 |
dup 2 sub bo.cmdline exch get ' ' eq |
|---|
| 1297 |
} ifelse |
|---|
| 1298 |
|
|---|
| 1299 |
{ |
|---|
| 1300 |
bo.cmdline over bo.opt length add 1 sub get |
|---|
| 1301 |
dup '=' eq |
|---|
| 1302 |
over ' ' eq or |
|---|
| 1303 |
exch 0 eq or |
|---|
| 1304 |
} { |
|---|
| 1305 |
false |
|---|
| 1306 |
} ifelse |
|---|
| 1307 |
|
|---|
| 1308 |
bo.cmdline rot add exch |
|---|
| 1309 |
|
|---|
| 1310 |
{ |
|---|
| 1311 |
1 sub exit |
|---|
| 1312 |
} { |
|---|
| 1313 |
/bo.cmdline exch def |
|---|
| 1314 |
} ifelse |
|---|
| 1315 |
} { |
|---|
| 1316 |
pop |
|---|
| 1317 |
.undef exit |
|---|
| 1318 |
} ifelse |
|---|
| 1319 |
} loop |
|---|
| 1320 |
|
|---|
| 1321 |
} def |
|---|
| 1322 |
|
|---|
| 1323 |
|
|---|
| 1324 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1325 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1326 |
|
|---|
| 1327 |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|---|
| 1328 |
% Global variables. |
|---|
| 1329 |
% |
|---|
| 1330 |
|
|---|
| 1331 |
/clip.size { 640 480 } def |
|---|
| 1332 |
|
|---|
| 1333 |
640 480 8 findmode setmode not { false .end } if |
|---|
| 1334 |
% 800 600 8 findmode setmode not { false .end } if |
|---|
| 1335 |
|
|---|
| 1336 |
"background.pcx" findfile setimage loadpalette |
|---|
| 1337 |
/max_image_colors image.colors def |
|---|
| 1338 |
|
|---|
| 1339 |
% 7 dup 0xffffff setpalette setcolor |
|---|
| 1340 |
|
|---|
| 1341 |
bsplash.show |
|---|
| 1342 |
|
|---|
| 1343 |
% color & font definitions must be global |
|---|
| 1344 |
|
|---|
| 1345 |
/black 0x000000 newcolor |
|---|
| 1346 |
/white 0xffffff newcolor |
|---|
| 1347 |
/blue 0x0000a0 newcolor |
|---|
| 1348 |
/red 0xc00000 newcolor |
|---|
| 1349 |
/green 0x009000 newcolor |
|---|
| 1350 |
/yellow 0xffff20 newcolor |
|---|
| 1351 |
/lightgray 0xececf4 newcolor |
|---|
| 1352 |
|
|---|
| 1353 |
%% include theme_colors.inc |
|---|
| 1354 |
|
|---|
| 1355 |
/font.normal "16x16.font" findfile def |
|---|
| 1356 |
/font.large font.normal def |
|---|
| 1357 |
|
|---|
| 1358 |
/cmdline.hidden 256 string def |
|---|
| 1359 |
/cmdline.shown 256 string def |
|---|
| 1360 |
|
|---|
| 1361 |
/kroete.dir 0 def |
|---|
| 1362 |
|
|---|
| 1363 |
/debug 0 def |
|---|
| 1364 |
|
|---|
| 1365 |
|
|---|