diff options
Diffstat (limited to 'themes/openSUSE/src')
-rw-r--r-- | themes/openSUSE/src/bsplash.inc | 196 | ||||
-rw-r--r-- | themes/openSUSE/src/common.inc | 256 | ||||
-rw-r--r-- | themes/openSUSE/src/dia_extralang.inc | 85 | ||||
-rw-r--r-- | themes/openSUSE/src/dia_install.inc | 92 | ||||
-rw-r--r-- | themes/openSUSE/src/dia_lang.inc | 65 | ||||
-rw-r--r-- | themes/openSUSE/src/dia_net.inc | 6 | ||||
-rw-r--r-- | themes/openSUSE/src/dia_video.inc | 565 | ||||
-rw-r--r-- | themes/openSUSE/src/gfxboot.cfg | 19 | ||||
-rw-r--r-- | themes/openSUSE/src/keytables.inc | 56 | ||||
-rw-r--r-- | themes/openSUSE/src/main.bc | 2 | ||||
-rw-r--r-- | themes/openSUSE/src/menu.inc | 107 | ||||
-rw-r--r-- | themes/openSUSE/src/panel.inc | 1 | ||||
-rw-r--r-- | themes/openSUSE/src/serial.inc | 3 | ||||
-rw-r--r-- | themes/openSUSE/src/speech.inc | 5 | ||||
-rw-r--r-- | themes/openSUSE/src/submenu.inc | 134 | ||||
-rw-r--r-- | themes/openSUSE/src/xmenu.inc | 253 |
16 files changed, 1439 insertions, 406 deletions
diff --git a/themes/openSUSE/src/bsplash.inc b/themes/openSUSE/src/bsplash.inc index bdf9abd..62c0f75 100644 --- a/themes/openSUSE/src/bsplash.inc +++ b/themes/openSUSE/src/bsplash.inc @@ -2,6 +2,12 @@ % % Boot loader splash code. % +% config.welcome: type of welcome animation +% 0: no splash +% 1: 'welcome' texts fade-in +% 2: rolling cd +% 3: light bulb fade-in +% % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -12,6 +18,8 @@ /.b_done 1 def /.b_run 2 def +/burn time 16 shl 1193180 div 60 div 60 mod { false } { true } ifelse def + % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Init splash. % @@ -19,8 +27,14 @@ % /bsplash.init { /bsplash.list [ - config.welcome 2 eq { [ /b1.init /b1.done /b1.run ] } if - [ /b2.init /b2.done /b2.run ] + config.welcome 2 le { + config.welcome 2 eq { [ /b1.init /b1.done /b1.run ] } if + [ /b2.init /b2.done /b2.run ] + } if + config.welcome 3 eq { + [ /b3.init /b3.done /b3.run ] + burn { [ /b4.init /b4.done /b4.run ] } if + } if ] def bsplash.list { dup .b_init get exec } forall @@ -47,7 +61,7 @@ % "/boot/i386/loader/xxx" chdir - "welcome.jpg" findfile /splash.file over def setimage + config.welcome 3 eq { "off.jpg" } { "welcome.jpg" } ifelse findfile /splash.file over def setimage 0 0 moveto 0 0 image.size image @@ -92,7 +106,7 @@ % /bsplash.done { bsplash.skip not { - 1500000 usleep + config.welcome 2 le { 1500000 usleep } if } if } def @@ -216,12 +230,10 @@ /b2_ok false def /b2_text "text.jpg" readimage def - % /b2_spot "spotlite.jpg" readimage def b2_text .undef eq { return } if /b2_text_tmp b2_text imgsize 0 0 moveto savescreen def - % /b2_spot_tmp b2_spot imgsize 0 0 moveto savescreen def 560 120 moveto /b2_orig b2_text imgsize savescreen def @@ -274,17 +286,11 @@ b2_idx b2_start lt { false return } if b2_buf b2_orig over length memcpy - b2_text_tmp b2_text over length memcpy - 0 255 b2_idx b2_start sub 20 mul sub 0 max b2_text_tmp blend - - % b2_spot_tmp b2_spot over length memcpy - % 0 255 b2_idx b2_start sub 20 mul sub 0 max b2_spot_tmp blend - % 0 0 moveto - % 0x80ff80 b2_spot_tmp b2_buf blend + % blend b2_text_tmp over b2_buf, store result in b2_buf 0 0 moveto - 0xffffff b2_text_tmp b2_buf blend + b2_text_tmp b2_idx b2_start sub 20 mul 255 min b2_buf blend 560 120 moveto b2_buf restorescreen @@ -293,3 +299,165 @@ } def +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Init. +% +% ( array ) ==> ( ) +% +/b3.init { + pop + + /b3_ok false def + + /b3_on "on.jpg" + findfile dup .undef ne { + dup setimage 200 0 400 600 unpackimage exch free + } if + def + + /b3_off "off.jpg" + findfile dup .undef ne { + dup setimage 200 0 400 600 unpackimage exch free + } if + def + + b3_on .undef eq { return } if + b3_off .undef eq { return } if + + /b3_tmp b3_on imgsize 0 0 moveto savescreen def + + /b3_idx 0 def + /b3_start 0 def + /b3_steps 30 def + + /b3_ok true def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Cleanup. +% +% ( array ) ==> ( ) +% +/b3.done { + pop + + b3_ok not { return } if + + /b3_on xfree + /b3_off xfree + /b3_tmp xfree + + /b3_ok false def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Run animation. +% +% Return true when finished. +% +% ( array ) ==> ( true|false ) +% +/b3.run { + pop + + b3_ok not { true return } if + + /b3_idx inc + + b3_idx b3_start b3_steps add gt { true return } if + + b3_idx b3_start lt { false return } if + + b3_tmp b3_off over length memcpy + 0 0 moveto + b3_on b3_idx b3_start sub 15 mul 255 min b3_tmp blend + + 200 0 moveto b3_tmp restorescreen + + false + +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Init. +% +% ( array ) ==> ( ) +% +/b4.init { + pop + + /b4_ok false def + + /b4_glow "glow.jpg" + findfile dup .undef ne { + dup setimage 200 0 400 600 unpackimage exch free + } if + def + + b4_glow .undef eq { return } if + + /b4_tmp b4_glow imgsize 0 0 moveto savescreen def + + /b4_idx 0 def + /b4_start 40 def + /b4_steps 30 def + + /b4_ok true def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Cleanup. +% +% ( array ) ==> ( ) +% +/b4.done { + pop + + b4_ok not { return } if + + /b4_glow xfree + /b4_tmp xfree + + /b4_ok false def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Run animation. +% +% Return true when finished. +% +% ( array ) ==> ( true|false ) +% +/b4.run { + pop + + b4_ok not { true return } if + + /b4_idx inc + + b4_idx b4_start b4_steps add gt { true return } if + + b4_idx b4_start lt { false return } if + + /b4_val b4_idx b4_start sub 20 mul 255 min def + + b4_val 255 lt { + b4_tmp b3_on over length memcpy + 0 0 moveto + b4_glow b4_val b4_tmp blend + } { + b4_tmp b3_off over length memcpy + } ifelse + + 200 0 moveto b4_tmp restorescreen + + false + +} def + + diff --git a/themes/openSUSE/src/common.inc b/themes/openSUSE/src/common.inc index d9fa9aa..5a2d541 100644 --- a/themes/openSUSE/src/common.inc +++ b/themes/openSUSE/src/common.inc @@ -138,7 +138,7 @@ % print keycode somewhere -1 settransparentcolor white setcolor - 500 0 moveto dup print " " print + 456 0 moveto "key code: " print dup print " " print } if dup 0xff00 and 16 shl over 0xff and dup 0xe0 eq { pop 0 } if add /key exch def @@ -156,7 +156,13 @@ % print mapped key somewhere -1 settransparentcolor white setcolor - 500 20 moveto dup print " " print + 500 20 moveto "key: " print dup print " " print + + % print current gfx mode & framebuffer address + -1 settransparentcolor + white setcolor + 454 40 moveto "gfx mode: " print currentmode print + 443 60 moveto "fb address: " print screen.framebuffer cvn print } if ptheme { @@ -187,6 +193,30 @@ window.action actExit eq { /window.action actNothing def + + % select link to submenu we just left + submenu.leave dup { + submenu.build + % kill trailing space + dup dup length 1 sub 0 max 0 put + menu.args length { + 0 1 menu.args length 1 sub { + menu.args over get + 2 index eq + { + /menu.entry exch def + } { + pop + } ifelse + } for + } if + pop + + main.recalc + true main.redraw + + "" -1 0 return + } if "" -1 1 return } if @@ -229,6 +259,21 @@ } if } if + % activate submenu + menu.args menu.entry get submenu.tag strstr 1 eq { + menu.args menu.entry get submenu.enter + submenu.build + menu.args length { + /menu.entry 0 def + main.recalc + true main.redraw + } { + submenu.leave submenu.build + } ifelse + + "" -1 0 return + } if + % some tricks to make it possible to review the complete command line debug 3 ge xxx.cmdline .undef eq and { /window.action actNothing def @@ -264,13 +309,13 @@ } { boot.ed.list buildcmdline } ifelse - 2 return + submenu.menuidx 2 return } ifelse } if window.action actRedraw eq { /window.action actNothing def - main.redraw + false main.redraw } if window.action actRedrawPanel eq { @@ -421,9 +466,6 @@ /splash_file xfree syslinux { - video.modes.list xmenu.video .xm_current get get .vm_options get - "%s " bc.cmd dup length add sprintf - v_impaired 1 ge { "braille=1 " bc.cmd dup length add sprintf } if @@ -449,6 +491,38 @@ } if } if + xmenu.video { + video.textmode.current dup { + "%s " bc.cmd dup length add sprintf + } { + pop + } ifelse + + video.kms.current dup { + "%s " bc.cmd dup length add sprintf + } { + pop + } ifelse + + video.installer_size.current dup { + "%s " bc.cmd dup length add sprintf + } { + pop + } ifelse + + video.vbe.current dup { + "%s " bc.cmd dup length add sprintf + } { + pop + } ifelse + + video.hc.current dup { + "%s " bc.cmd dup length add sprintf + } { + pop + } ifelse + } if + xmenu.dud { xmenu.dud .xm_current get .dud_url eq { input.edit.dud_url 0 get dup "" ne { @@ -487,27 +561,20 @@ xmenu.net { xmenu.install { net.config_type .undef ne { - xmenu.install .xm_current get dup .inst_cdrom eq exch .inst_hd eq or { - % TODO: add netsetup=XXX - } { - net.config_type .net_static eq { - input.net.static 0 get dup "" ne { - "hostip=%s " bc.cmd dup length add sprintf - } { pop } ifelse - input.net.static 1 get dup "" ne { - "netmask=%s " bc.cmd dup length add sprintf - } { pop } ifelse - input.net.static 2 get dup "" ne { - "gateway=%s " bc.cmd dup length add sprintf - } { pop } ifelse - input.net.static 3 get dup "" ne { - "nameserver=%s " bc.cmd dup length add sprintf - } { pop } ifelse - input.net.static 4 get dup "" ne { - "domain=%s " bc.cmd dup length add sprintf - } { pop } ifelse - } if - } ifelse + net.config_type .net_static eq { + input.net.static 0 get dup "" ne { + "hostip=\"%s\" " bc.cmd dup length add sprintf + } { pop } ifelse + input.net.static 1 get dup "" ne { + "gateway=\"%s\" " bc.cmd dup length add sprintf + } { pop } ifelse + input.net.static 2 get dup "" ne { + "nameserver=\"%s\" " bc.cmd dup length add sprintf + } { pop } ifelse + input.net.static 3 get dup "" ne { + "domain=\"%s\" " bc.cmd dup length add sprintf + } { pop } ifelse + } if } if } if } if @@ -580,7 +647,7 @@ syslinux { % find out initrd sizes for kernel loading progress bar - /progress_extra 0 def + /progress_extra config.initrd.size sectorsize div 1 add def bc.cmd "initrd" bootopt.find dup .undef ne { "initrd=" length add dup dup skipnonspaces @@ -694,6 +761,11 @@ } if } if + /orig.menu.texts menu.texts def + /orig.menu.args menu.args def + + submenu.build + window.main dup window.init window.show @@ -1039,6 +1111,8 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % ( text ) == > ( new_text ) /menuitemmap { + submenu.skip_prefix + translate config._2space { /mmm.tmp xfree @@ -1053,11 +1127,14 @@ dup "firmware" eq { pop txt_firmware return } if mode.install { dup "linux" eq { pop txt_install return } if + dup "upgrade" eq { pop txt_upgrade return } if dup "repair" eq { pop txt_repain_system return } if dup "rescue" eq { pop txt_rescue return } if dup "harddisk" eq { pop txt_boot_harddisk return } if dup "mediachk" eq { pop txt_mediacheck return } if dup "mediacheck" eq { pop txt_mediacheck return } if + dup "systemboot" eq { pop txt_systemboot return } if + dup "expert" eq { pop txt_expert return } if } { dup "failsafe" eq { pop txt_safe_linux return } if dup "linux" eq { pop "Linux" return } if @@ -1228,7 +1305,7 @@ moveto setcolor } if - dup keyF8 eq syslinux and { + dup keyF11 eq syslinux and { kroete.file .undef eq { /kroete.file "kroete.dat" findfile def } if kroete.file kroete.dir idle /kroete.dir kroete.dir 1 xor def @@ -1245,12 +1322,6 @@ sound.getsamplerate { sound.getsamplerate sound.setsamplerate } if } ifelse - xmenu.video .xm_current config.livecd { 1 } { 0 } ifelse put % 0 = text mode, 1 = VESA - % redraw unless another menu is still open - window.current { - window.current .xmenu get .undef eq { video.update } if - } if - .undef 0 idle kroete.file free /kroete.file .undef def pop 0 @@ -1270,7 +1341,7 @@ moveto setcolor } if - dup keyShiftF8 eq debug 3 ge and { + dup keyShiftF11 eq debug 3 ge and { currentcolor debug 1 and { white } { black } ifelse setcolor currentpoint 300 0 moveto @@ -1304,10 +1375,6 @@ /debug debug 1 add def } if - dup keyShiftF11 eq { - 400 0 moveto "ani_%04d.jpg" play_movie - } if - dup keyShiftF1 eq { /transp transp 0x10 sub 0 max def @@ -1344,47 +1411,6 @@ } if - dup keyF11 eq debug 1 ge and { - - /dit { - dup 0xff and rand 0xff and gt { 0xff add } if - 8 shr - } def - - /c13.r rand 0x7f00 and def - /c02_13.r rand 0x7f00 and c13.r sub def - /c23.r rand 0x7f00 and def - /c01_23.r rand 0x7f00 and c23.r sub def - /c13.g rand 0x7f00 and def - /c02_13.g rand 0x7f00 and c13.g sub def - /c23.g rand 0x7f00 and def - /c01_23.g rand 0x7f00 and c23.g sub def - /c13.b rand 0x7f00 and def - /c02_13.b rand 0x7f00 and c13.b sub def - /c23.b rand 0x7f00 and def - /c01_23.b rand 0x7f00 and c23.b sub def - - screen.size /h exch def /w exch def - - 0 1 screen.size exch pop { - 0 1 screen.size pop { - over moveto - - currentpoint c01_23.r mul h div exch c02_13.r mul w div add c13.r add c23.r add - dit 0 max 0xff min 16 shl - currentpoint c01_23.g mul h div exch c02_13.g mul w div add c13.g add c23.g add - dit 0 max 0xff min 8 shl - currentpoint c01_23.b mul h div exch c02_13.b mul w div add c13.b add c23.b add - dit 0 max 0xff min add add - - setcolor putpixel - } for - pop - } for - - pop 0 - } if - dup keyF12 eq debug 6 ge and { % mouse support testing @@ -1534,6 +1560,47 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Set video mode. +% +% Prefer 32 bit mode with fallback to 16 bit. +% +% ( width height -- true|false ) +% +/set_videomode { + over over + 32 findmode setmode { + pop pop true + } { + 16 findmode setmode + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Find fallback video mode. +% +% Pick first mode that is at least 640x480. +% +% Return 0 0 if no mode found. +% +% ( -- width height ) +% +/fallback_videomode { + 0 1 videomodes { + videomodeinfo .undef eq { + pop + } { + pop + over 640 ge over 480 ge and { return } if + } ifelse + pop pop + } for + + 0 0 +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Set global config variables. % @@ -1553,20 +1620,17 @@ /screen.fallback false def -config.screen.width config.screen.height 32 findmode setmode not { - config.screen.width config.screen.height 16 findmode setmode not { - /screen.fallback true def - 640 480 16 findmode setmode not { - 640 480 32 findmode setmode not { - false .end - } if - } if - } if +config.screen.width config.screen.height set_videomode not { + fallback_videomode dup 0 eq { pop pop false .end } if + set_videomode not { false .end } if + /screen.fallback true def } if % prepend fallback section to layout section list screen.fallback { - /gfxconfig.layout [ "640x480" gfxconfig.layout { } forall ] gfxconfig.layout free def + /fb_tmp_buf 64 string def + screen.size exch "%dx%d" fb_tmp_buf sprintf + /gfxconfig.layout [ fb_tmp_buf gfxconfig.layout { } forall ] gfxconfig.layout free def } if @@ -1653,6 +1717,10 @@ config.livecd { /menu.start.x /menu.start.y "mainmenu.pos" 253 170 gfxconfig.set.int2 /menu.max.entries "mainmenu.entries" 8 gfxconfig.set.int +/menu.title "mainmenu.title" "" gfxconfig.set.str +/menu.title.color "mainmenu.title.color" white gfxconfig.set.int +/menu.title.pos.x +/menu.title.pos.y "mainmenu.title.pos" -1 40 gfxconfig.set.int2 /boot.pos.x /boot.pos.y "bootopt.pos" 263 480 gfxconfig.set.int2 /panel.normal.fg "panel.normal.fg" white gfxconfig.set.int @@ -1662,6 +1730,10 @@ config.livecd { /keymap.default "keymap" "" gfxconfig.set.str /config.addopt.lang "addopt.lang" false gfxconfig.set.bool /config.addopt.keytable "addopt.keytable" false gfxconfig.set.bool +/config.extralang.locales "extralang.locales" [ ] gfxconfig.set.array_str + +% default value for initrd size (in bytes) +/config.initrd.size "initrd.size" 0 gfxconfig.set.int /install.install "install" "" gfxconfig.set.str /install.http.server "install.http.server" "" gfxconfig.set.str diff --git a/themes/openSUSE/src/dia_extralang.inc b/themes/openSUSE/src/dia_extralang.inc new file mode 100644 index 0000000..f083d8c --- /dev/null +++ b/themes/openSUSE/src/dia_extralang.inc @@ -0,0 +1,85 @@ +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% +% extra language switch button +% +% Iterate through the locales in config.extralang.locales array. +% +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Initialize. +% +% ( ) ==> ( ) +% +/extralang.init { + /extralang.current 0 def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get index in language menu. +% +% ( ) ==> ( ) +% +/extralang.index { + 0 1 lang.items length 1 sub { + lang.items over get config.extralang.locales extralang.current get eq { return } { pop } ifelse + } for + 0 +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get language name. +% +% ( ) ==> ( ) +% +/extralang.name { + config.extralang.locales extralang.current get lang.getdefname +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Set a new language. +% +% ( ) ==> ( ) +% +/extralang.update { + xmenu.lang .xm_current extralang.index put + lang.update +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Activate selected language. +% +% And also move to next language in list. +% +% ( ) => ( ) +% +/panel.extralang { + extralang.update + % go to next language + /extralang.current extralang.current 1 add config.extralang.locales length mod def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Return width of panel entry. +% +% ( ) => ( width ) +% +/panel.extralang.width { + extralang.name strsize pop +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Redraw panel entry. +% +% ( panel ) => ( ) +% +/panel.extralang.update { + panel.text.moveto + extralang.name show.rtl +} def diff --git a/themes/openSUSE/src/dia_install.inc b/themes/openSUSE/src/dia_install.inc index 69ccb34..304e78a 100644 --- a/themes/openSUSE/src/dia_install.inc +++ b/themes/openSUSE/src/dia_install.inc @@ -12,22 +12,19 @@ /proxy.option 255 string def % install types -/.inst_cdrom 0 def -/.inst_hd 1 def -/.inst_slp 2 def -/.inst_ftp 3 def -/.inst_http 4 def -/.inst_nfs 5 def -/.inst_smb 6 def -/.inst_net_setup 7 def -/.inst_net_proxy 8 def - -/install.default .inst_cdrom def - -% isohybrid image booted as disk -sectorsize 0x200 eq bootdrive 0x80 eq or { - /install.default .inst_hd def -} if +/.inst_default 0 def +/.inst_cdrom 1 def +/.inst_hd 2 def +/.inst_slp 3 def +/.inst_ftp 4 def +/.inst_http 5 def +/.inst_https 6 def +/.inst_nfs 7 def +/.inst_smb 8 def +/.inst_net_setup 9 def +/.inst_net_proxy 10 def + +/install.default .inst_default def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Build install mode list. @@ -52,17 +49,32 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { % see install types (.inst_*) xmenu .xm_list [ + /txt_kernel_default is_dvd { "DVD" } { "CD-ROM" } ifelse /txt_harddisk - "\x09SLP" + "SLP" "FTP" "HTTP" + "HTTPS" "NFS" "SMB / CIFS" - /install.submenu.net + /txt_network_config /txt_http_proxy ] put + % As we have submenus and separation lines, attach empty arrays to menu + % structure to be filled later. + % + % Arrays must have as many entries as there are menu items. + xmenu .xm_submenus xmenu .xm_list get length array put + xmenu .xm_attr xmenu .xm_list get length array put + + % separation line above cdrom entry and net setup entry + xmenu .xm_attr get dup .inst_cdrom 1 put .inst_net_setup 1 put + + % attach network config menu to net setup entry + xmenu .xm_submenus get .inst_net_setup xmenu.net put + xmenu .xm_title /txt_install_source put install.set.install.option @@ -72,13 +84,6 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { } def -/install.submenu.net.buf 64 string def -/install.submenu.net { - /txt_network_config exec "\x09\x09%s" install.submenu.net.buf sprintf - install.submenu.net.buf -} def - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Update install mode. % @@ -91,7 +96,7 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { xmenu .xm_current over .xm_last get put panel.net } { - xmenu .xm_current get dup .inst_cdrom eq exch .inst_slp eq or { + xmenu .xm_current get dup .inst_default eq exch dup .inst_cdrom eq exch .inst_slp eq or or { install.set.install.option /window.action actRedrawPanel def } { @@ -179,6 +184,16 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { } if + dup .inst_https eq { + dia .title txt_https_title put + + % Must all be of same size! + dia .ed.list 2 array put + dia .ed.buffer.list input.edit.http put + dia .ed.text.list [ txt_server txt_directory ] put + + } if + dup .inst_nfs eq { dia .title txt_nfs_title put @@ -276,7 +291,7 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { xmenu .xm_current get dup .inst_net_proxy ne { - % default: .inst_cdrom + % default: .inst_default install.option "" strcpy pop } if @@ -308,6 +323,13 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { "install=http://%s/%s" install.option sprintf } if + dup .inst_https eq { + input.edit.http + dup 1 get dup 0 get '/' eq { 1 add } if + exch 0 get + "install=https://%s/%s" install.option sprintf + } if + dup .inst_nfs eq { input.edit.nfs dup 1 get dup 0 get '/' eq { 1 add } if @@ -346,6 +368,10 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { "install=hd://%s/%s" install.option sprintf } if + dup .inst_cdrom eq { + install.option "install=cd:/" strcpy pop + } if + dup .inst_net_proxy eq { input.edit.proxy dup 0 get "" ne { @@ -378,12 +404,21 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { /install.read.config { install.install dup "cdrom" eq { /install.default .inst_cdrom def } if + dup "hd" eq { /install.default .inst_hd def } if + dup "disk" eq { + % isohybrid image may be cdrom or hard disk + sectorsize 0x200 eq bootdrive 0x80 eq or { + /install.default .inst_hd def + } { + /install.default .inst_cdrom def + } ifelse + } if dup "slp" eq { /install.default .inst_slp def } if dup "ftp" eq { /install.default .inst_ftp def } if dup "http" eq { /install.default .inst_http def } if + dup "https" eq { /install.default .inst_https def } if dup "nfs" eq { /install.default .inst_nfs def } if dup "smb" eq { /install.default .inst_smb def } if - dup "hd" eq { /install.default .inst_hd def } if pop input.edit.http 0 get install.http.server strcpy pop @@ -440,4 +475,3 @@ sectorsize 0x200 eq bootdrive 0x80 eq or { /url_esc_buf 256 string def - diff --git a/themes/openSUSE/src/dia_lang.inc b/themes/openSUSE/src/dia_lang.inc index 6f42f11..0c94ec5 100644 --- a/themes/openSUSE/src/dia_lang.inc +++ b/themes/openSUSE/src/dia_lang.inc @@ -27,59 +27,60 @@ [ "bn_BD" "us" false "\u09ac\u09be\u0982\u09b2\u09be" ] % Bengali [ "bs_BA" "us" false "Bosanski" ] % Bosnian [ "ca_ES" "es" false "Català" ] % Catalan - [ "cs_CZ" "cz-us-qwertz" false "Čeština" ] % Czech + [ "cs_CZ" "cz" false "Čeština" ] % Czech [ "cy_GB" "us" false "Cymraeg" ] % Welsh [ "da_DK" "dk" false "Dansk" ] % Danish - [ "de_DE" "de-latin1-nodeadkeys" false "Deutsch" ] % German + [ "de_DE" "de-nodeadkeys" false "Deutsch" ] % German [ "el_GR" "gr" false "Ελληνικά" ] % Greek [ "en_GB" "uk" false "English (UK)" ] % English [ "en_US" "us" false "English (US)" ] % English [ "es_ES" "es" false "Español" ] % Spanish [ "et_EE" "et" false "Eesti" ] % Estonian [ "fa_IR" "us" true "\ufbfd\ufeb4\u0631\ufe8e\ufed3" ] % Farsi - [ "fi_FI" "fi-latin1" false "Suomi" ] % Finnish - [ "fr_FR" "fr-latin1" false "Français" ] % French + [ "fi_FI" "fi" false "Suomi" ] % Finnish + [ "fr_FR" "fr" false "Français" ] % French [ "gl_ES" "es" false "Galego" ] % Galician [ "ka_GE" "us" false "ქართული" ] % Kartuli [ "gu_IN" "us" false "\u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0" ] % Gujarati [ "he_IL" "us" false "תירבע" ] % Hebrew % [ "hi_IN" "us" false "\u0939\u093f\u0928\u094d\u0926\u0940" ] % Hindi [ "hi_IN" "us" false "\u0939\u093f\u0902\u0926\u0940" ] % Hindi - [ "hr_HR" "croat" false "Hrvatski" ] % Croatian + [ "hr_HR" "hr" false "Hrvatski" ] % Croatian [ "hu_HU" "hu" false "Magyar" ] % Hungarian [ "id_ID" "us" false "Bahasa Indonesia" ] % Indonesian [ "it_IT" "it" false "Italiano" ] % Italian - [ "ja_JP" "jp106" false "日本語" ] % Japanese + [ "ja_JP" "jp" false "日本語" ] % Japanese [ "jv_ID" "us" false "Basa Jawa" ] % Javanese + [ "kk_KZ" "us" false "Қазақша" ] % Kazakh % [ "km_KH" "khmer" false "\u1781\u17d2\u1798\u17c2\u179a" ] % Khmer [ "km_KH" "khmer" false "Khmer" ] % Khmer - [ "ko_KR" "korean" false "한글" ] % Korean + [ "ko_KR" "kr" false "한글" ] % Korean [ "ky_KG" "us" false "Кыргызча" ] % Kirghiz [ "lo_LA" "us" false "\u0e9e\u0eb2\u0eaa\u0eb2\u0ea5\u0eb2\u0ea7" ] % Lao - [ "lt_LT" "lt.baltic" false "Lietuvių" ] % Lithuanian + [ "lt_LT" "lt" false "Lietuvių" ] % Lithuanian [ "mk_MK" "us" false "Македонски" ] % Macedonian [ "mr_IN" "us" false "\u092e\u0930\u093e\u0920\u0940" ] % Marathi - [ "nb_NO" "no-latin1" false "Norsk" ] % Norwegian + [ "nb_NO" "no" false "Norsk" ] % Norwegian [ "nl_NL" "us" false "Nederlands" ] % Dutch - [ "nn_NO" "no-latin1" false "Nynorsk" ] % Nynorsk + [ "nn_NO" "no" false "Nynorsk" ] % Nynorsk [ "pa_IN" "us" false "\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40" ] % Punjabi - [ "pl_PL" "Pl02" false "Polski" ] % Polish - [ "pt_BR" "br-abnt2" false "Português (Brasil)" ] % Portuguese (Brazilian) - [ "pt_PT" "pt-latin1" false "Português" ] % Portuguese + [ "pl_PL" "pl" false "Polski" ] % Polish + [ "pt_BR" "br" false "Português (Brasil)" ] % Portuguese (Brazilian) + [ "pt_PT" "pt" false "Português" ] % Portuguese [ "ro_RO" "us" false "Română" ] % Romanian [ "ru_RU" "ruwin_alt-UTF-8" false "Русский" ] % Russian [ "si_LK" "us" false "\u0dc3\u0dd2\u0d82\u0dc4\u0dbd" ] % Sinhala - [ "sk_SK" "sk-qwertz" false "Slovenčina" ] % Slovak - [ "sl_SI" "slovene" false "Slovenščina" ] % Slovenian + [ "sk_SK" "sk" false "Slovenčina" ] % Slovak + [ "sl_SI" "si" false "Slovenščina" ] % Slovenian [ "sr_RS" "sr-cy" false "Srpski" ] % Serbian - [ "sv_SE" "sv-latin1" false "Svenska" ] % Swedish + [ "sv_SE" "se" false "Svenska" ] % Swedish [ "ta_IN" "us" false "\u0ba4\u0bae\u0bbf\u0bb4\u0bcd" ] % Tamil - [ "tg_TJ" "tj" false "тоҷикӣ" ] % Tadjik + [ "tg_TJ" "tj_alt-UTF8" false "тоҷикӣ" ] % Tadjik [ "th_TH" "us" false "\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22" ] % Thai - [ "tr_TR" "trq" false "Türkçe" ] % Turkish - [ "uk_UA" "ua" false "Українська" ] % Ukrainian + [ "tr_TR" "tr" false "Türkçe" ] % Turkish + [ "uk_UA" "ua-urf" false "Українська" ] % Ukrainian [ "vi_VN" "us" false "Tiếng Việt" ] % Vietnamese - [ "wa_BE" "be-latin1" false "Walon" ] % Walloon + [ "wa_BE" "be" false "Walon" ] % Walloon [ "xh_ZA" "us" false "isiXhosa" ] % Xhosa [ "zh_CN" "us" false "简体中文" ] % Simplified Chinese [ "zh_TW" "us" false "繁體中文 (台灣)" ] % Traditional Chinese @@ -188,7 +189,7 @@ } forall keymap.submenu { - /lang.submenu.keyboard + /txt_keyboard } if ] def @@ -200,13 +201,6 @@ } def -/lang.submenu.keyboard.buf 64 string def -/lang.submenu.keyboard { - /txt_keyboard exec "\x09\x09%s" lang.submenu.keyboard.buf sprintf - lang.submenu.keyboard.buf -} def - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Build language list. % @@ -221,6 +215,13 @@ xmenu .xm_current lang.default put xmenu .xm_list lang.names put + % As we have submenus and separation lines, attach empty arrays to menu + % structure to be filled later. + % + % Arrays must have as many entries as there are menu items. + xmenu .xm_submenus lang.names length array put + xmenu .xm_attr lang.names length array put + xmenu .xm_title /txt_language put % make menu smaller if there are more than 19 language entries @@ -244,6 +245,14 @@ % needed in case menu is only attached to lang menu keymap.init + + % Attach keyboard menu to last entry (lang.submenu.idx). + % This is controllable via gfxboot.cfg setting (keymap.submenu var). + keymap.submenu { + xmenu.lang .xm_submenus get lang.submenu.idx xmenu.keymap put + % add separation line + xmenu.lang .xm_attr get lang.submenu.idx 1 put + } if } def diff --git a/themes/openSUSE/src/dia_net.inc b/themes/openSUSE/src/dia_net.inc index a192cfa..6456443 100644 --- a/themes/openSUSE/src/dia_net.inc +++ b/themes/openSUSE/src/dia_net.inc @@ -32,7 +32,7 @@ xmenu .xm_current net.default put - /input.net.static [ 5 { 127 string } repeat ] def + /input.net.static [ 4 { 127 string } repeat ] def % just once (see install.init) /net.init { } def @@ -108,9 +108,9 @@ % ip, netmask, gateway, dns nameserver, domain % Must all be of same size! - dia .ed.list 5 array put + dia .ed.list 4 array put dia .ed.buffer.list input.net.static put - dia .ed.text.list [ txt_host_ip txt_netmask txt_gateway_ip txt_nameservers txt_domain_name ] put + dia .ed.text.list [ txt_host_ip txt_gateway_ip txt_nameservers txt_domain_name ] put dia .ed.focus 0 put dia .ed.width 300 put diff --git a/themes/openSUSE/src/dia_video.inc b/themes/openSUSE/src/dia_video.inc index d566e33..f6e6054 100644 --- a/themes/openSUSE/src/dia_video.inc +++ b/themes/openSUSE/src/dia_video.inc @@ -15,6 +15,7 @@ /.vm_label 3 def /.vm_width 4 def /.vm_height 5 def +/.vm_bits 6 def % .vm_flags: % @@ -22,32 +23,35 @@ % 1: supported display res % -% We have kernel splash images for at least these sizes. -/video.splashsizes [ - 0 0 % special: for text mode - 1 0 % special: for VESA mode - 800 600 - 1024 600 - 1024 768 - 1280 800 - 1280 1024 - 1400 1050 - 1600 1200 - 1680 1050 - 1920 1200 -] def - - % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% Create sort key for video modes. +% Compare two video modes. +% +% ( vm_index_1 vm_index_2 -- bool ) +% +% Returns true if vm_index_1 refers to a 'bigger' mode - that is: larger +% width, larger height, *less* color bits. % -% ( vm_index ) ==> ( sort_index ) +% Note that for color bits the sorting order is reversed (it's needed that +% way because we later keep only the first mode with a given resolution). % -/vmsortindex { - video.modes.list exch get - dup - .vm_width get 16 shl - exch .vm_height get add +/vmcmp { + % first look up video mode arrays (see .vm_mode etc.) + video.modes.list exch get exch + video.modes.list exch get exch + + % compare elements + over .vm_width get over .vm_width get ne { + over .vm_width get over .vm_width get gt + } { + over .vm_height get over .vm_height get ne { + over .vm_height get over .vm_height get gt + } { + over .vm_bits get over .vm_bits get lt + } ifelse + } ifelse + + % clean up stack + exch pop exch pop } def @@ -55,7 +59,7 @@ % Swap video mode entries. % (Helper for video mode sorting.) % -% ( vm_index_1 vm_index_2 ) ==> ( ) +% ( vm_index_1 vm_index_2 -- ) % /vmsortexch { over video.modes.list exch get @@ -67,63 +71,104 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% Check if we have a splash in that resolution. +% for dump_modes_* below +/tmp_mode 64 string def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% debug code (will be optimized out when unused) % -% ( video_mode_list_entry ) ==> ( true|false ) +% Print video mode list as we get it from Video BIOS. % -/video.havesplash { - false exch - - 0 2 video.splashsizes length 1 sub { - over over over - .vm_height get rot .vm_width get rot video.splashsizes exch get eq - rot 1 add video.splashsizes exch get rot eq and - { exch pop true exch exit } if +% ( string -- ) +% +/dump_modes_initial { + 0 0 moveto + 0xf0f0f0 setcolor + 800 600 fillrect + 0xf00000 setcolor + "=== Press ESC to continue ===\n" show + 0x0000f0 setcolor + show + black setcolor + 0 1 videomodes { + videomodeinfo dup .undef eq { + pop pop pop pop + } { + 4 1 roll rot rot exch 4 -1 roll "0x%x: %d x %d @%d\n" tmp_mode sprintf + tmp_mode show + currentpoint exch pop 582 gt { currentpoint pop 270 add 36 moveto } if + } ifelse } for - - pop - + trace } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% Check if display supports that resolution. +% debug code (will be optimized out when unused) % -% ( video_mode_list_entry ) ==> ( true|false ) +% ( string -- ) % -/video.resok { - false exch - - 0 2 video.res length 1 sub { - over over over - .vm_height get rot .vm_width get rot video.res exch get eq - rot 1 add video.res exch get rot eq and - { exch pop true exch exit } if - } for - - pop - +% Print internal video mode list ('video.modes.list' variable). +% +/dump_modes { + 0 0 moveto + 0xf0f0f0 setcolor + 800 600 fillrect + 0xf00000 setcolor + "=== Press ESC to continue ===\n" show + 0x0000f0 setcolor + show + black setcolor + video.modes.list { + dup .vm_bits get over .vm_height get 2 index .vm_width get 3 index .vm_mode get + "0x%x: %d x %d @%d\n" tmp_mode sprintf + pop + tmp_mode show + currentpoint exch pop 582 gt { currentpoint pop 270 add 36 moveto } if + } forall + trace } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -% Build video mode list. +% Initialize video mode menu and its submenus. % -% ( ) ==> ( ) +% ( -- ) % /video.init { /xmenu.video .xm_size array def /xmenu xmenu.video def + % for testing, you can inject a DDC data blob "ddc" findfile test1 - /video.res [ displaysizes ] def - % build list of video modes + % Display resolutions that should be offered besides those the VESA BIOS knows. + % + % The reason is that the VESA BIOS list is often rather limited and e.g. omits + % 16:10 or 16:9 modes. + % + % You can add whatever you want here; duplicates will be removed later. + /video.res [ + % the actually detected display size(s) + displaysizes + + % add anything that crosses your mind + 1024 768 + 1680 1050 + 1920 1080 + 1920 1200 + ] def + + % "-- initial --\n" dump_modes_initial + + % Build list of VESA BIOS modes. + % + % Each mode is an array with .vm_* entries (see top of file). /video.modes.list [ - [ -1 0 "textmode=1" /txt_text_mode 0 0 ] % special: text mode - [ -2 0 "nomodeset" "No KMS" 1 0 ] % special: no KMS (width = 1 to make it sort) - [ -3 0 "" "Default" 2 0 ] % special: no video options (width = 2 to make it sort) + + % add VBE modes >= 1024 x 576 % first, try 16 bit /vm_color_bits 16 def @@ -136,40 +181,42 @@ [ over 0xbfff and 6 2 roll 0x4000 and % fb support - exch vm_color_bits eq and % color bits - over 576 ge and % height >= 576 - 2 index 1024 ge and % width >= 1024 - { 1 "" "" 5 -2 roll ] } { pop pop pop pop } ifelse + over vm_color_bits ge and % color bits + 2 index 576 ge and % height >= 576 + 3 index 1024 ge and % width >= 1024 + { 1 "" "" 6 -3 roll ] } { pop pop pop pop pop } ifelse } ifelse } for % no modes added? -> try 8 bit - dup .vm_mode get -2 eq vm_color_bits 8 ne and { + dup [ eq vm_color_bits 8 ne and { /vm_color_bits 8 def } { exit } ifelse } loop - % add display sizes + % add any extra modes video.res length { 0 2 video.res length 1 sub { [ exch 0 2 "" "" 5 -1 roll video.res over get exch video.res exch 1 add get + 0 ] } for } if - ] def - % sort video.modes.list + % "-- raw --\n" dump_modes + + % sort video mode list (by display width, then height) video.modes.list length 3 gt { 0 1 video.modes.list length 2 sub { dup 1 add 1 video.modes.list length 1 sub { - over vmsortindex over vmsortindex gt { + over over vmcmp { over over vmsortexch } if pop @@ -178,126 +225,184 @@ } for } if + % "-- sorted --\n" dump_modes + % remove duplicates - % (assumes text or vesa entry to be first) /video.modes.list [ + /tmp_is_first true def video.modes.list { - dup .vm_mode get 0 ge { % ensure it's not the first entry + % if it's the 1st entry, just keep it + % else, add a new entry only if different + tmp_is_first { + /tmp_is_first false def + } { over .vm_width get over .vm_width get eq 2 index .vm_height get 2 index .vm_height get eq and { - over .vm_mode get over .vm_mode get max 2 index .vm_mode rot put - over .vm_flags get over .vm_flags get or 2 index .vm_flags rot put + % same display resolution - remove from list free } if - } if + } ifelse } forall ] video.modes.list free def - % create mode strings & menu labels + % "-- dups removed --\n" dump_modes - true + % create menu labels ("width x height") video.modes.list { - dup .vm_flags get 3 and { - dup .vm_options 64 string put - dup .vm_label 32 string put - - % add separating line before first entry - over { - dup .vm_label get "\x09" exch sprintf - exch pop false exch - } if + dup .vm_label 32 string put + dup .vm_height get over .vm_width get 2 index .vm_label get "%d x %d" exch dup length add sprintf - dup .vm_flags get 1 and { - dup .vm_mode get 0x200 add over .vm_options get "vga=0x%x " exch sprintf - } if + pop + } forall - dup .vm_flags get 2 and { - dup .vm_height get over .vm_width get 2 index .vm_options get "video=%dx%d " exch dup length add sprintf - } if + % build submenus - dup .vm_flags get 2 and 0 eq { - dup .vm_label get "\x01" exch dup length add sprintf - } if + % installer resolutions (set via 'xmode' option) + /video.modes.installer [ + [ -1 0 "" /txt_kernel_default 0 0 0 ] - dup .vm_height get over .vm_width get 2 index .vm_label get "%d x %d" exch dup length add sprintf - } if + video.modes.list { } forall + ] def - pop - } forall + % kms text console resolutions (set via 'video' option) + /video.modes.console [ + [ -1 0 "" /txt_kernel_default 0 0 0 ] + [ -2 0 "nomodeset" /txt_video_no_kms 0 0 0 ] - pop + video.modes.list { } forall + ] def - % create menu + % VESA BIOS framebuffer mode (set via 'VGA' option) + % + % Not every mode is a VESA BIOS mode - see video.res comment above. + /video.modes.bios [ + [ -1 0 "" /txt_kernel_default 0 0 0 ] - /video.modes.text [ - video.modes.list { .vm_label get } forall + video.modes.list { + % keep only modes with VBE mode number + dup .vm_mode get 0 eq { pop } if + } forall ] def - % add to menu + % construct the 3 screen size submenus + + % Note: as we have separation lines, attach empty arrays to .xm_attr field. + + /xmenu.video.installer .xm_size array def + /xmenu.video.console .xm_size array def + /xmenu.video.bios .xm_size array def + + xmenu.video.installer .xm_list [ video.modes.installer { .vm_label get } forall ] put + xmenu.video.installer .xm_attr xmenu.video.installer .xm_list get length array put + % line above 2nd entry + xmenu.video.installer .xm_attr get 1 1 put + xmenu.video.installer .xm_title /txt_installer_size put + xmenu.video.installer .xm_current 0 put + + xmenu.video.console .xm_list [ video.modes.console { .vm_label get } forall ] put + xmenu.video.console .xm_attr xmenu.video.console .xm_list get length array put + % line above 3rd entry + xmenu.video.console .xm_attr get 2 1 put + xmenu.video.console .xm_title /txt_console_size put + xmenu.video.console .xm_current 0 put + + xmenu.video.bios .xm_list [ video.modes.bios { .vm_label get } forall ] put + xmenu.video.bios .xm_attr xmenu.video.bios .xm_list get length array put + % line above 2nd entry + % note: .xm_attr list might only have length 1 + xmenu.video.bios .xm_attr get dup length 1 gt { 1 1 put } { pop } ifelse + xmenu.video.bios .xm_title /txt_video_bios_size put + xmenu.video.bios .xm_current 0 put + + % create screen mode submenu + + /xmenu.video.hc .xm_size array def + xmenu.video.hc .xm_list [ /txt_kernel_default /txt_high_contrast /txt_white_on_black /txt_cyan_on_black ] put + xmenu.video.hc .xm_title /txt_color_mode put + xmenu.video.hc .xm_current 0 put + + % now build the video mode menu out of the submenus above + + /video.submenu.list [ + xmenu.video.installer + xmenu.video.console + xmenu.video.bios + .undef + xmenu.video.hc + .undef + ] def - xmenu .xm_list video.modes.text put - xmenu .xm_title /txt_video_mode put + xmenu .xm_list [ + /txt_installer_size + /txt_console_size + /txt_video_bios_size + /txt_text_mode + /txt_color_mode + /txt_screen_reader + ] put - % select largest mode the monitor supports + % As we have checkmarks, attach empty array to menu to hold checkmark states. + /video.checkmarks xmenu .xm_list get length array def - boot_failsafe 4 and { 0 0 } { monitorsize } ifelse - exch 1024 max exch 768 max % at least 1024x768 + % keep track where checkmarks are + /vm.text_mode.idx 3 def + /vm.screen_reader.idx 5 def - % ATI quirk: avoid 1280x1024, older chips (<= 8MB, max res 1280x1024) use - % interlaced there + % set initial values + video.checkmarks vm.text_mode.idx false put + video.checkmarks vm.screen_reader.idx false put - video.modes.list dup length 1 sub get - dup .vm_width get 1280 eq exch .vm_height get 1024 eq and { - video.memory 0x2000 le { - video.oem "ATI " strstr 1 eq { - exch 1024 min exch 768 min % down to 1024x768 - } if - } if - } if + % attach checkmark array to menu + xmenu .xm_checkmarks video.checkmarks put - % 'default' entry - xmenu .xm_current 2 put + % attach submenu array to menu + xmenu .xm_submenus video.submenu.list put - -1 - video.modes.list { - exch 1 add exch + % we also need an array for separation line positions... + xmenu .xm_attr xmenu .xm_list get length array put - dup .vm_width get 4 index le - exch .vm_height get 3 index le and { - xmenu .xm_current 2 index put - } if + % line before 4th entry ("text mode") + xmenu .xm_attr get 3 1 put - } forall - pop + % screen reader entry needs a callback when state is changed + % (will call video.speak) + xmenu .xm_attr get vm.screen_reader.idx 0x100 put - % FIXME: force 'default' entry - xmenu .xm_current 2 put + xmenu .xm_title /txt_video_mode put - pop pop + % 'default' entry + xmenu .xm_current 0 put } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Update video mode. % -% ( ) ==> ( ) +% Called when a video mode entry is selected. +% +% ( -- ) % /video.update { /xmenu xmenu.video def - /window.action actRedrawPanel def + video.submenu.list xmenu .xm_current get get dup { + video.submenu + /window.action actRedrawPanel def + } { + pop + } ifelse } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Show video menu. % -% ( ) => ( ) +% ( -- ) % /panel.video { "videomode" help.setcontext @@ -313,24 +418,210 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Return width of video entry. % -% ( ) => ( width ) +% Called to calulate panel layout. +% +% ( -- width ) +% +% Note: we need to do some tricks here as we want to show the 'installer +% size' in the panel. So we switch to the xmenu.video.installer menu +% temporarily. But we need to keep the original menu title. % /panel.video.width { - /xmenu xmenu.video def + /tmp_title xmenu.video.installer .xm_title get def + xmenu.video.installer .xm_title xmenu.video .xm_title get put + + /xmenu xmenu.video.installer def pmenu.width + + xmenu.video.installer .xm_title tmp_title put + + /xmenu xmenu.video def } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Redraw panel entry. % -% ( panel ) => ( ) +% ( panel -- ) +% +% Note: we need to do some tricks here as we want to show the 'installer +% size' in the panel. So we switch to the xmenu.video.installer menu +% temporarily. But we need to keep the original menu title. % /panel.video.update { - /xmenu xmenu.video def + /tmp_title xmenu.video.installer .xm_title get def + xmenu.video.installer .xm_title xmenu.video .xm_title get put + + /xmenu xmenu.video.installer def pmenu.panel.update + + xmenu.video .xm_panel_x xmenu.video.installer .xm_panel_x get put + + xmenu.video.installer .xm_title tmp_title put + + /xmenu xmenu.video def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Switch to submenu. +% +% ( submenu -- ) +% +/video.submenu { + % set location of submenu to that of main menu + dup .xm_panel_x xmenu.video .xm_panel_x get put + + % we don't have anything better yet + "videomode" help.setcontext + + window.xmenu + dup .xmenu 4 -1 roll put + dup .xmenu.update /video.submenu.update put + dup window.init + window.show } def +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% What to do when submenu is closed. +% +% ( -- ) +% +/video.submenu.update { + /window.action actRedrawPanel def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get current high contrast setting. +% +% This returns the string to add to the boot options (or .undef if nothing +% should be added). +% +% ( -- string ) +% +/video.hc.current { + xmenu.video.hc .xm_current get + % 0 = default + dup 0 gt { + [ "" "highcontrast" "white-black" "cyan-black" ] exch get "screenmode=%s" video.hc.current.buf sprintf + video.hc.current.buf + } { + pop .undef + } ifelse +} def +% static buffer for return value +/video.hc.current.buf 64 string def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get current text mode setting. +% +% This returns the string to add to the boot options (or .undef if nothing +% should be added). +% +% ( -- string ) +% +/video.textmode.current { + video.checkmarks vm.text_mode.idx get { + "textmode=1" + } { + .undef + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get current kms setting. +% +% This returns the string to add to the boot options (or .undef if nothing +% should be added). +% +% ( -- string ) +% +/video.kms.current { + xmenu.video.console .xm_current get + % 0 = default + dup 0 eq { + pop .undef + } { + video.modes.console exch get + dup .vm_options get "" ne { + .vm_options get + } { + dup .vm_height get exch .vm_width get "video=%dx%d" video.kms.current.buf sprintf + video.kms.current.buf + } ifelse + } ifelse +} def +% static buffer for return value +/video.kms.current.buf 64 string def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get current installer size setting. +% +% This returns the string to add to the boot options (or .undef if nothing +% should be added). +% +% ( -- string ) +% +/video.installer_size.current { + xmenu.video.installer .xm_current get + % 0 = default + dup 0 eq { + pop .undef + } { + video.modes.installer exch get + dup .vm_height get exch .vm_width get "xvideo=%dx%d" video.installer_size.current.buf sprintf + video.installer_size.current.buf + } ifelse +} def +% static buffer for return value +/video.installer_size.current.buf 64 string def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get current VESA BIOS setting. +% +% This returns the string to add to the boot options (or .undef if nothing +% should be added). +% +% ( -- string ) +% +/video.vbe.current { + xmenu.video.bios .xm_current get + % 0 = default + dup 0 eq { + pop .undef + } { + video.modes.bios exch get + .vm_mode get 0x200 add "vga=0x%x" video.vbe.current.buf sprintf + video.vbe.current.buf + } ifelse +} def +% static buffer for return value +/video.vbe.current.buf 64 string def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Callback function when screen reader entry is selected. +% +% Reads the current screen reader state and either activates or deactivates +% the reader. +% +% ( -- ) +/video.speak { + video.checkmarks vm.screen_reader.idx get { + /v_impaired 1 def + /config.talk true def + load_talk_dialog + } { + /v_impaired 0 def + /config.talk false def + } ifelse +} def + diff --git a/themes/openSUSE/src/gfxboot.cfg b/themes/openSUSE/src/gfxboot.cfg index 1fa96c3..d89d3ac 100644 --- a/themes/openSUSE/src/gfxboot.cfg +++ b/themes/openSUSE/src/gfxboot.cfg @@ -44,6 +44,11 @@ mainmenu.bar.transparency=150 mainmenu.bar.color=0xffffff mainmenu.normal.fg=0xffffff mainmenu.selected.fg=0x000000 +; main menu title +mainmenu.title= +mainmenu.title.color=0xffffff +; if x = -1, center horizontally +mainmenu.title.pos=-1,40 ; boot option colors bootopt.label.fg=0xffffff bootopt.text.fg=0xffffff @@ -112,7 +117,10 @@ mediacheck=mediachk nobootoptions=harddisk,memtest ; main menu items that are not passed an 'install' parameter noinstallopt=harddisk,firmware,memtest -; default install method (one of: cdrom, slp, ftp, http, nfs, smb, hd; default: cdrom) +; install method (one of: <empty> (== default), cdrom, hd, disk, slp, ftp, http, +; https, nfs, smb) +; - disk: auto-detect between cdrom or hd depending on how the image was booted +; - https & http share the same server/path components install= ; default repo location install.http.server= @@ -161,7 +169,7 @@ spl=1 autodown=1 ; F-key assignments ; value can be one of: lang, video, install, kernelopts, dud, bits, keymap, -; profile, restore, otheropts +; profile, restore, otheropts, extralang ; note1: 'bits' is only shown on x86_64, 'profile' only when a file 'profile' ; exists, 'restore' only when there is a boot entry 'restore' ; note2: F1 is always help, F9 enables speech output, F10 exits gfxboot @@ -171,11 +179,16 @@ key.F4=install key.F5=kernelopts key.F6=dud key.F7=bits +key.F8=extralang ; add 'lang' option with current locale addopt.lang=1 ; add 'keytable' option with current keymap addopt.keytable=1 - +; initrd size in bytes (fallback for progress bar) +initrd.size=0 +; languages to use for extralang option +; use locale in long form (e.g. en_US) +extralang.locales=zh_CN,en_US [boot] ; show welcome animation diff --git a/themes/openSUSE/src/keytables.inc b/themes/openSUSE/src/keytables.inc index ac19bd6..c27508e 100644 --- a/themes/openSUSE/src/keytables.inc +++ b/themes/openSUSE/src/keytables.inc @@ -55,45 +55,45 @@ % array must not be empty /keymaps [ [ "Arabic" "arabic" .undef ] - [ "Belgian" "be-latin1" keymap.be-latin1 ] - [ "Canadian (Multilingual)" "cn-latin1" keymap.cn-latin1 ] - [ "Croatian" "croat" keymap.croat ] - [ "Czech" "cz-us-qwertz" keymap.cz-us-qwertz ] - [ "Czech (qwerty)" "cz-lat2-us" keymap.cz-lat2-us ] + [ "Belgian" "be" keymap.be-latin1 ] + [ "Canadian (Multilingual)" "ca-multix" keymap.cn-latin1 ] + [ "Croatian" "hr" keymap.croat ] + [ "Czech" "cz" keymap.cz-us-qwertz ] + [ "Czech (qwerty)" "cz-querty" keymap.cz-lat2-us ] [ "Danish" "dk" keymap.dk ] [ "Dutch" "nl" keymap.nl ] - [ "Dvorak" "dvorak" keymap.dvorak ] + [ "Dvorak" "us-dvorak" keymap.dvorak ] [ "English (UK)" "uk" keymap.uk ] [ "English (US)" "us" .undef ] - [ "Estonian" "et" keymap.et ] - [ "Finnish" "fi-latin1" keymap.fi-latin1 ] - [ "French" "fr-latin1" keymap.fr-latin1 ] - [ "French (Canada)" "cf" keymap.cf ] - [ "French (Switzerland)" "fr_CH-latin1" keymap.fr_CH-latin1 ] - [ "German" "de-latin1-nodeadkeys" keymap.de-latin1-nodeadkeys ] - [ "German (Switzerland)" "sg-latin1" keymap.sg-latin1 ] + [ "Estonian" "ee" keymap.et ] + [ "Finnish" "fi" keymap.fi-latin1 ] + [ "French" "fr" keymap.fr-latin1 ] + [ "French (Canada)" "ca" keymap.cf ] + [ "French (Switzerland)" "ch-fr" keymap.fr_CH-latin1 ] + [ "German" "de-nodeadkeys" keymap.de-latin1-nodeadkeys ] + [ "German (Switzerland)" "ch-de_nodeadkeys" keymap.sg-latin1 ] [ "Greek" "gr" keymap.gr ] [ "Hungarian" "hu" keymap.hu ] - [ "Icelandic" "is-latin1" keymap.is-latin1 ] + [ "Icelandic" "is" keymap.is-latin1 ] [ "Italian" "it" keymap.it ] - [ "Japanese" "jp106" keymap.jp106 ] + [ "Japanese" "jp" keymap.jp106 ] [ "Khmer" "khmer" .undef ] - [ "Korean" "korean" .undef ] - [ "Lithuanian" "lt.baltic" keymap.lt.baltic ] - [ "Norwegian" "no-latin1" keymap.no-latin1 ] - [ "Polish" "Pl02" keymap.Pl02 ] - [ "Portuguese" "pt-latin1" keymap.pt-latin1 ] - [ "Portuguese (Brazil)" "br-abnt2" keymap.br-abnt2 ] + [ "Korean" "kr" .undef ] + [ "Lithuanian" "lt" keymap.lt.baltic ] + [ "Norwegian" "no" keymap.no-latin1 ] + [ "Polish" "pl" keymap.Pl02 ] + [ "Portuguese" "pt" keymap.pt-latin1 ] + [ "Portuguese (Brazil)" "br" keymap.br-abnt2 ] [ "Russian" "ruwin_alt-UTF-8" keymap.ruwin_alt-UTF-8 ] [ "Serbian" "sr-cy" keymap.sr-cy ] - [ "Slovak" "sk-qwertz" keymap.sk-qwertz ] + [ "Slovak" "sk" keymap.sk-qwertz ] [ "Slovak (qwerty)" "sk-qwerty" keymap.sk-qwerty ] - [ "Slovene" "slovene" keymap.slovene ] + [ "Slovene" "si" keymap.slovene ] [ "Spanish" "es" keymap.es ] - [ "Spanish (Latin America)" "la-latin1" keymap.la-latin1 ] - [ "Swedish" "sv-latin1" keymap.sv-latin1 ] - [ "Tajik" "tj" keymap.tj ] - [ "Turkish" "trq" keymap.trq ] - [ "Ukrainian" "ua" keymap.ua ] + [ "Spanish (Latin America)" "latam" keymap.la-latin1 ] + [ "Swedish" "se" keymap.sv-latin1 ] + [ "Tajik" "tj_alt-UTF8" keymap.tj ] + [ "Turkish" "tr" keymap.trq ] + [ "Ukrainian" "ua-utf" keymap.ua ] ] def diff --git a/themes/openSUSE/src/main.bc b/themes/openSUSE/src/main.bc index e1698b9..c47a839 100644 --- a/themes/openSUSE/src/main.bc +++ b/themes/openSUSE/src/main.bc @@ -11,6 +11,7 @@ %% include help.inc %% include menu.inc %% include xmenu.inc +%% include submenu.inc %% include dia_video.inc %% include dia_lang.inc %% include dia_dud.inc @@ -24,6 +25,7 @@ %% include dia_restore.inc %% include dia_net.inc %% include dia_otheropts.inc +%% include dia_extralang.inc %% include panel.inc %% include keytables.inc %% include locale.inc diff --git a/themes/openSUSE/src/menu.inc b/themes/openSUSE/src/menu.inc index add7612..3fc6fac 100644 --- a/themes/openSUSE/src/menu.inc +++ b/themes/openSUSE/src/menu.inc @@ -11,6 +11,8 @@ /boot.splitchar 1 def /boot.splitstr 1 string dup 0 boot.splitchar put def +/boot.update_options true def + % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Create new main window. % @@ -40,16 +42,19 @@ % Redraw main window. % (E.g. after selecting a new language.) % -% ( window ) ==> ( ) +% ( redraw_boot_options ) ==> ( ) +% +% redraw_boot_options: true|false +% redraw boot option line if true % /main.redraw { % boot.drawlabels main.drawmenu - /keepbootoptions 1 def + /boot.update_options exch def menu.entry true MenuSelect - /keepbootoptions .undef def + /boot.update_options true def panel.show } def @@ -126,7 +131,10 @@ free - config.nobootoptions menu.texts menu.entry get iselement { + config.nobootoptions menu.texts menu.entry get submenu.skip_prefix iselement + menu.args menu.entry get submenu.tag strstr 1 eq + or + { boot.ed.list 0 get .inp_show false put } if @@ -204,6 +212,19 @@ % ( ) == > ( ) % /main.drawmenu { + % center menu title if x == -1 + /menu.title.pos.x_aligned + menu.title.pos.x -1 eq { + clip.size pop menu.title strsize pop sub 2 div 0 max + } { + menu.title.pos.x + } ifelse + def + + menu.title.pos.x_aligned menu.title.pos.y moveto + menu.title.color setcolor + menu.title show + menu.text.normal setcolor /menu.bar.width.old menu.bar.width def @@ -223,14 +244,25 @@ /y menu.start.y def 0 1 menu.visible.entries 1 sub { - x y moveto currentpoint menu.bar.width.old menu.bar.height image - x config.rtl { menu.bar.width menu.text.xofs sub } { menu.text.xofs } ifelse add - y menu.text.yofs add moveto - menu.texts exch menu.shift add get menuitemmap - currentfont exch font.large setfont show.rtl setfont - /y y menu.item.height add def + /idx_tmp1 over def + x y moveto currentpoint menu.bar.width.old menu.bar.height image + x config.rtl { menu.bar.width menu.text.xofs sub } { menu.text.xofs } ifelse add + y menu.text.yofs add moveto + menu.texts exch menu.shift add get menuitemmap + currentfont exch font.large setfont show.rtl setfont + + x y moveto idx_tmp1 menu.shift add show.submenu.tag + + /y y menu.item.height add def } for + menu.visible.entries menu.max.entries lt { + menu.visible.entries 1 menu.max.entries 1 sub { + pop + x y moveto currentpoint menu.bar.width.old menu.bar.height image + /y y menu.item.height add def + } for + } if } def @@ -271,6 +303,7 @@ } ifelse moveto + currentpoint config.rtl { menu.bar.width menu.text.xofs sub } { menu.text.xofs } ifelse menu.text.yofs rmoveto menu.status { @@ -282,10 +315,13 @@ menu.texts menu.idx get menuitemmap menu.status { config.talk { dup speak } if } if currentfont exch font.large setfont show.rtl setfont + moveto + + menu.idx show.submenu.tag menu.status { % init boot options - keepbootoptions .undef eq { + boot.update_options { boot.input.preinit @@ -317,6 +353,25 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Show little arrow symbol indicating a submenu entry. +% +% ( menu_idx ) ==> ( ) +/show.submenu.tag { + menu.args exch get submenu.tag strstr 1 eq { + config.rtl { + menu.text.xofs menu.text.yofs rmoveto + "\u25c0" + } { + menu.bar.width menu.text.xofs sub "\u25b6" strsize pop sub + menu.text.yofs rmoveto + "\u25b6" + } ifelse + show + } if +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Draw main window. % % ( window ) ==> ( ) @@ -324,8 +379,7 @@ /main.show { window.push - /menu.shift 0 def - /menu.visible.entries menu.texts length menu.max.entries min def + main.recalc % get index of default entry /menu.entry 0 def @@ -333,10 +387,6 @@ 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 - boot.text.options setcolor window.current .font get setfont @@ -390,6 +440,20 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Re-calculate basic menu layout data. +% +% ( ) ==> ( ) +/main.recalc { + /menu.shift 0 def + + /menu.visible.entries menu.texts length menu.max.entries min def + + menu.entry menu.visible.entries sub 0 ge { + /menu.shift menu.entry menu.texts length menu.visible.entries sub min def + } if +} def + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Split command line into hidden and normal part. % % ( edit_object ) == > ( ) @@ -428,7 +492,14 @@ pop 0 } if - dup keyEsc eq { exit_popup pop 0 } if + dup keyEsc eq { + submenu.current { + /window.action actExit def + } { + exit_popup + } ifelse + pop 0 + } if dup keyEnter eq { /window.action actStart def diff --git a/themes/openSUSE/src/panel.inc b/themes/openSUSE/src/panel.inc index 9a611b3..ea7670a 100644 --- a/themes/openSUSE/src/panel.inc +++ b/themes/openSUSE/src/panel.inc @@ -170,6 +170,7 @@ dup "otheropts" eq { pop [ /panel.otheropts /panel.otheropts.width /panel.otheropts.update /otheropts.init ] return } if dup "dud" eq { pop [ /panel.dud /panel.dud.width /panel.dud.update /dud.init ] return } if dup "keymap" eq { pop [ /panel.keymap /panel.keymap.width /panel.keymap.update /keymap.init ] return } if + dup "extralang" eq { pop [ /panel.extralang /panel.extralang.width /panel.extralang.update /extralang.init ] return } if dup "bits" eq { pop .undef diff --git a/themes/openSUSE/src/serial.inc b/themes/openSUSE/src/serial.inc index eac5466..0aaa06b 100644 --- a/themes/openSUSE/src/serial.inc +++ b/themes/openSUSE/src/serial.inc @@ -202,7 +202,8 @@ smenu.main .xm_current menu.entry put smenu.main .xm_title "Main Menu" put smenu.main .xm_text "Select a boot entry." put - smenu.main .xm_list [ menu.texts { menuitemmap } forall ] put + % careful: menuitemmap returns a static buffer + smenu.main .xm_list [ menu.texts { menuitemmap strdup } forall ] put } if /smenu smenu.main def diff --git a/themes/openSUSE/src/speech.inc b/themes/openSUSE/src/speech.inc index ee06708..87ba56d 100644 --- a/themes/openSUSE/src/speech.inc +++ b/themes/openSUSE/src/speech.inc @@ -15,7 +15,7 @@ % /speak { % skip leading TABs - { dup 0 get '\x09' eq { 1 add } { exit } ifelse } loop + { dup 0 get '\x09' le { 1 add } { exit } ifelse } loop /last.spoken xfree /last.spoken over strdup def @@ -92,6 +92,9 @@ config.volume sound.setvolume window.done + + % do it only once + /load_talk_dialog { } def } def diff --git a/themes/openSUSE/src/submenu.inc b/themes/openSUSE/src/submenu.inc new file mode 100644 index 0000000..9fe6e8b --- /dev/null +++ b/themes/openSUSE/src/submenu.inc @@ -0,0 +1,134 @@ +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% +% Submenu handling. +% +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +% submenu entries are entries that have a label starting with '->FOO ' (note +% the space) where FOO is an arbitrary string identifying the submenu. +% +% Menu entries that have an 'append' entry '->BAR' link to submenu BAR. +% +% As there are spaces in labels required to make this work, use the 'menu +% label' statement in syslinux. + +% submenu entries must start with this string, followed by an arbitrary identifier +/submenu.tag "->" def + +% submenus are stacked here +/submenu.list 16 array def +/submenu.list.index 0 def + +% the current submenu +/submenu.current .undef def + +% array mapping submenu indices to global menu indices +/submenu.menuidx.list [ ] def + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Enter submenu. +% +% ( submenu_label ) ==> ( ) +% +/submenu.enter { + submenu.list.index submenu.list length ge { pop return } if + + % append space + dup length 1 add string exch "%s " 2 index sprintf + + /submenu.current over def + submenu.list submenu.list.index rot put + /submenu.list.index submenu.list.index 1 add def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Leave submenu. +% +% ( ) ==> ( submenu_label ) +% +/submenu.leave { + submenu.list.index 0 eq { .undef return } if + /submenu.list.index submenu.list.index 1 sub def + submenu.list submenu.list.index get + submenu.list submenu.list.index .undef put + /submenu.current + submenu.list.index 0 eq { .undef } { submenu.list submenu.list.index 1 sub get } ifelse + def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Create menu.texts and menu.args from orig.menu.texts and orig.menu.args. +% +% ( ) ==> ( ) +% +/submenu.build { + /menu.texts [ + 0 1 orig.menu.texts length 1 sub { + dup submenu.showentry { + orig.menu.texts exch get + } { pop } ifelse + } for + ] def + + /menu.args [ + 0 1 orig.menu.args length 1 sub { + dup submenu.showentry { + orig.menu.args exch get + } { pop } ifelse + } for + ] def + + /submenu.menuidx.list [ + 0 1 orig.menu.texts length 1 sub { + dup submenu.showentry not { pop } if + } for + ] def +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Determine if this entry should be shown (i.e. is in current submenu). +% +% ( entry_idx ) ==> ( true|false ) +% +/submenu.showentry { + /sm_idx exch def + sm_idx orig.menu.texts length lt { + orig.menu.texts sm_idx get + submenu.current { + submenu.current strstr 1 eq + } { + submenu.tag strstr 1 ne + } ifelse + } { + false + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Map current submenu index to global menu index. +% (Needed to tell the bootloader where we are.) +% +% ( submenu_idx ) ==> ( menu_idx ) +% +/submenu.menuidx { + dup submenu.menuidx.list length lt { + submenu.menuidx.list exch get + } if +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Skip submenu prefix, if any. +% +% ( string ) ==> ( string ) +% +/submenu.skip_prefix { + dup submenu.tag strstr 1 eq { + 2 add skipnonspaces skipspaces + } if +} def + diff --git a/themes/openSUSE/src/xmenu.inc b/themes/openSUSE/src/xmenu.inc index 626ccbb..bea2b63 100644 --- a/themes/openSUSE/src/xmenu.inc +++ b/themes/openSUSE/src/xmenu.inc @@ -27,11 +27,25 @@ /.xm_panel_x 6 def % panel entry x pos /.xm_vspace 7 def % vspace per menu /.xm_title 8 def % xmenu title -/.xm_text 9 def % xmenu text -/.xm_last 10 def % last selected entry -/.xm_size 11 def % xmenu size +/.xm_text 9 def % array: menu texts +/.xm_checkmarks 10 def % array: checkmark states +/.xm_submenus 11 def % array: attached submenus +/.xm_attr 12 def % array: text attributes (bitmask) + % bit 0: horizontal line above + % bit 1: alternate text color (light gray) +/.xm_last 13 def % last selected entry +/.xm_size 14 def % xmenu size +% special chars used in menu drawing +% +% right arrow indicating submenu +/label.submenu.right "\u25b6" def +% left arrow indicating submenu in RTL layout +/label.submenu.left "\u25c0" def +% checkmark indicating selected entry +/label.checkmark "\u2714" def + % short hands /xmenu.x { xmenu .xm_x get } def /xmenu.y { xmenu .xm_y get } def @@ -45,7 +59,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Create new xmenu. % -% ( ) ==> ( window ) +% ( -- window ) % /window.xmenu { widget.size array @@ -54,9 +68,39 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Check if currently selected menu entry has a checkmark. +% +% ( -- bool ) +% +/xmenu.current_has_checkmark { + xmenu .xm_checkmarks get dup { + xmenu .xm_current get get .undef eq { false } { true } ifelse + } { + pop + false + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Invert current checkmark state. +% +% Does nothing is current menu entry does not have a checkmark. +% +% ( -- ) +% +/xmenu.invert_checkmark { + xmenu.current_has_checkmark { + xmenu .xm_checkmarks get xmenu .xm_current get + over over get not put + } if +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Handle keyboad input. % -% ( key_in ) ==> ( key_out ) +% ( key_in -- key_out ) % /xmenu.input { dup 0 eq { return } if @@ -68,9 +112,17 @@ } if dup keyEnter eq { - window.current .xmenu.update get - window.done - exec + % if it's a checkmark, just invert state, else run update function + xmenu.current_has_checkmark { + xmenu.invert_checkmark + % Special stuff: run video callback if attribute bit 8 is set. + xmenu .xm_current get xmenu.attr 0x100 and { video.speak } if + xmenu .xm_current get xmenu.select + } { + window.current .xmenu.update get + window.done + exec + } ifelse pop 0 } if @@ -141,7 +193,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Calculate menu sizes. % -% ( ) ==> ( ) +% ( -- ) % /xmenu.sizes { /xmenu.lheight xmenu.font setfont fontheight xmenu.vspace dup add add def @@ -163,12 +215,13 @@ xmenu .xm_width 0 xmenu .xm_list get { exec - 0 - over 0 get '\x09' eq { - over 1 get '\x09' eq { pop "xx\u25b6" strsize pop } if - } if - exch strsize pop add max + strsize pop + max } forall xmenu.hspace 2 mul add + + xmenu .xm_submenus get { label.submenu.right strsize pop "xx" strsize pop add add } if + + xmenu .xm_checkmarks get { label.checkmark strsize pop add } if put xmenu .xm_y panel.text.y 1 sub xmenu.height sub put @@ -181,7 +234,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Init and show menu. % -% ( window ) ==> ( ) +% ( window -- ) % % xmenu: [ selected_entry [ text0 text1 ... ] x y ] % @@ -224,7 +277,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Close menu. % -% ( ) ==> ( ) +% ( -- ) % /xmenu.done { /xmenu.tmpbuf xmenu.tmpbuf free .undef def @@ -237,7 +290,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Draw xmenu. % -% ( window ) ==> ( ) +% ( window -- ) % /xmenu.show { window.push @@ -253,7 +306,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Draw single entry. % -% ( entry ) ==> ( ) +% ( entry -- ) % /xmenu.viewentry { dup xmenu .xm_current get eq { true } { false } ifelse /xmenu.is_selected exch def @@ -313,50 +366,146 @@ } ifelse xmenu .xm_list get over get exec - dup 0 get '\x09' eq { - 1 add - currentpoint - currentcolor - xmenu.dark setcolor - xmenu.pos.x xmenu.pos.y moveto - xmenu.pos.x xmenu.width add xmenu.pos.y lineto - xmenu.light setcolor - xmenu.pos.x xmenu.pos.y 1 add moveto - xmenu.pos.x xmenu.width add xmenu.pos.y 1 add lineto - - setcolor - moveto - - dup 0 get '\x01' eq xmenu.is_selected not and { 1 add xmenu.normal.alt.fg setcolor } if - - dup 0 get '\x09' eq { - 1 add - show.rtl - config.rtl { - xmenu.pos.x 8 add xmenu.pos.y 2 add moveto "\u25c0" show - } { - xmenu.pos.x xmenu.width add 8 sub xmenu.pos.y 2 add moveto "\u25b6" showright1 - } ifelse - } { - show.rtl - } ifelse + over xmenu.attr.line { + currentpoint + currentcolor - } { - dup 0 get '\x01' eq xmenu.is_selected not and { 1 add xmenu.normal.alt.fg setcolor } if + xmenu.dark setcolor + xmenu.pos.x xmenu.pos.y moveto + xmenu.pos.x xmenu.width add xmenu.pos.y lineto + xmenu.light setcolor + xmenu.pos.x xmenu.pos.y 1 add moveto + xmenu.pos.x xmenu.width add xmenu.pos.y 1 add lineto - show.rtl + setcolor + moveto + } if + + over xmenu.attr.alt_color { + xmenu.is_selected not { xmenu.normal.alt.fg setcolor } if + } if + + over xmenu.checkmark_state xmenu.checkmark_show + + over xmenu.has_submenu { + show.rtl + config.rtl { + xmenu.pos.x 8 add xmenu.pos.y 2 add moveto label.submenu.left show + } { + xmenu.pos.x xmenu.width add 8 sub xmenu.pos.y 2 add moveto label.submenu.right showright1 } ifelse + } { + show.rtl + } ifelse + + pop + +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Get menu entry attribute. +% +% Returns 0 if no attribute is available. +% +% ( entry -- int ) +% +/xmenu.attr { + xmenu .xm_attr get dup { + exch get dup .undef eq { pop 0 } if + } { + pop pop 0 + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Check for separation line menu entry attribute. +% +% If true, a line should be drawn above the entry. +% +% ( entry -- boot ) +% +/xmenu.attr.line { + xmenu.attr 1 and { true } { false } ifelse +} def + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Check for alternate color menu entry attribute. +% +% If true, text should be rendered in a different color (light gray, atm). +% +% ( entry -- boot ) +% +/xmenu.attr.alt_color { + xmenu.attr 2 and { true } { false } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Check if menu entry is a submenu. +% +% ( entry -- boot ) +% +/xmenu.has_submenu { + xmenu .xm_submenus get dup { + exch get .undef ne + } { + pop pop false + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Calculate checkmark type (0..3). +% +% 0: menu has no checkmarks at all (no .xm_checkmarks array attached) +% 1: entry is not a checkmark +% 2: checkmark state is 'no' +% 3: checkmark state is 'yes' +% +% ( entry -- int ) +% +/xmenu.checkmark_state { + xmenu .xm_checkmarks get dup { + exch get + dup .undef eq { pop 1 } { { 3 } { 2 } ifelse } ifelse + } { + pop pop 0 + } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Render checkmark. +% +% For type see comment to xmenu.checkmark_state. +% +% ( type -- ) +% +/xmenu.checkmark_show { + dup 0 eq { pop return } if + + currentpoint + + rot + dup 1 eq { } if + dup 2 eq { "" show.rtl } if + dup 3 eq { label.checkmark show.rtl } if pop + moveto + + "m" strsize pop config.rtl { neg } if 0 rmoveto } def % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Select menu entry. % -% ( new_entry ) ==> ( ) +% ( new_entry -- ) % /xmenu.select { dup 0 lt { v_impaired { 1 } { xmenu .xm_list get length } ifelse add } if @@ -375,7 +524,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Panel/xmenu helper function. % -% ( ) => ( ) +% ( -- ) % /pmenu.panel.update { panel.text.moveto @@ -389,7 +538,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Panel/xmenu helper function. % -% ( ) => ( width ) +% ( -- width ) % /pmenu.width { 0 @@ -405,7 +554,7 @@ % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % Panel/xmenu helper function. % -% ( ) => ( ) +% ( -- ) % /pmenu.update { % note: we're always redrawing the whole panel |