% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % % Main menu (boot entry + boot options + panel). % % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % max number of boot option input fields /boot.ed.max 2 def % boot option input line separator /boot.splitchar 1 def /boot.splitstr 1 string dup 0 boot.splitchar put def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Create new main window. % % ( ) ==> ( window ) % /window.main { widget.size array dup .type t_main put dup .font font.normal put dup .ed.font font.normal put } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Initialize main window. % % ( window ) ==> ( ) % /main.init { pop } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Redraw main window. % (E.g. after selecting a new language.) % % ( window ) ==> ( ) % /main.redraw { % boot.drawlabels main.drawmenu /keepbootoptions 1 def menu.entry true MenuSelect /keepbootoptions .undef def } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Draw boot menu. % % No entry is marked as selected. % % ( ) == > ( ) % /main.drawmenu { menu.text.normal setcolor /x menu.start.x def /y menu.start.y def /menu.bar.width.old menu.bar.width def /menu.bar.width menu.bar.min.width menu.texts { strsize pop menu.text.xofs 2 mul add 2 add max } forall def 0 1 menu.visible.entries 1 sub { x y moveto currentpoint menu.bar.width.old menu.bar.height image x menu.text.xofs add y menu.text.yofs add moveto menu.texts exch menu.shift add get currentfont exch font.large setfont show setfont /y y menu.item.height add def } for } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Select/deselect menu entry. % % If an entry is selected (status = true), the boot options input field is % initialized. % % ( entry status ) ==> ( ) % % status: % false not selected % true selected % % Note: menu.bar.width must be valid even if status = false. % /MenuSelect { /menu.status exch def /menu.idx over def menu.shift sub menu.item.height mul menu.start.y add menu.start.x exch moveto currentpoint menu.status { menu.bar.color setcolor currenttransparency ptheme { 120 } { 70 } ifelse settransparency menu.bar.width menu.bar.height fillrect settransparency } { currentpoint menu.bar.width menu.bar.height image } ifelse moveto menu.text.xofs menu.text.yofs rmoveto menu.status { menu.text.select } { menu.text.normal } ifelse setcolor menu.texts menu.idx get currentfont exch font.large setfont show setfont menu.status { % init boot options keepbootoptions .undef eq { false boot.ed.list { dup .inp_show get exch .inp_visible get xor or } forall { } if } { } ifelse } if } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Draw main window. % % ( window ) ==> ( ) % /main.show { window.push /menu.shift 0 def /menu.visible.entries menu.texts length menu.max.entries min def % get index of default entry /menu.entry 0 def 0 1 menu.texts length 1 sub { dup menu.texts exch get menu.dentry eq { /menu.entry exch def exit } { pop } ifelse } for menu.entry menu.visible.entries sub 0 ge { /menu.shift menu.entry menu.texts length menu.visible.entries sub min def } if window.current .font get setfont /boot.ed.width screen.size pop boot.pos pop sub ptheme { 60 } { 20 } ifelse sub def /boot.ed.height fontheight 2 add def /boot.window window.current def /boot.ed.list [ 0 1 boot.ed.max 1 sub { [ boot.pos exch 10 add exch 1 sub 4 -1 roll boot.ed.height 5 add mul add over over moveto boot.ed.width boot.ed.height savescreen cmdlinelength string cmdlinelength .undef cmdlinelength string "More Options" false false ] } for ] def boot.window .ed.list boot.ed.list put boot.window .ed.focus 0 put main.drawmenu menu.entry true MenuSelect } def % ( int - ) /boot_item { dup menu.texts length lt { /menu.entry exch def /window.action actStart def } { pop } ifelse } def /disable_num_key 0 "disable_num_key" getgfxnum def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Handle keyboard input. % % ( key_in ) ==> ( key_out ) % /main.input { dup 0 eq { return } if % handle panel entries dup keyEsc eq { exit_popup pop 0 } if dup keyEnter eq { /window.action actStart def pop 0 } if dup keyUp eq { menu.entry 0 gt { menu.entry false MenuSelect menu.entry menu.shift eq { /menu.shift menu.shift 1 sub def main.drawmenu } if /menu.entry menu.entry 1 sub def menu.entry true MenuSelect } if pop 0 } if dup keyDown eq { menu.entry menu.texts length 1 sub lt { menu.entry false MenuSelect menu.visible.entries menu.entry menu.shift sub sub 1 eq { /menu.shift menu.shift 1 add def main.drawmenu } if /menu.entry menu.entry 1 add def menu.entry true MenuSelect } if pop 0 } if dup keyPgUp eq { menu.entry 0 gt { menu.entry false MenuSelect /menu.entry 0 def menu.shift 0 ne { /menu.shift 0 def main.drawmenu } if menu.entry true MenuSelect } if pop 0 } if dup keyPgDown eq { menu.entry menu.texts length 1 sub lt { menu.entry false MenuSelect /menu.entry menu.texts length 1 sub def menu.texts length menu.visible.entries sub dup menu.shift ne { /menu.shift exch def main.drawmenu } { pop } ifelse menu.entry true MenuSelect } if pop 0 } if disable_num_key 0 eq { dup 0x31 ge { dup 0x39 le { 0x31 sub boot_item 0 } if } if } if dup 0 ne { pop 0 } if } def