diff --git a/boot.config b/boot.config index b6ca244..f3fe3d8 100644 --- a/boot.config +++ b/boot.config @@ -19,6 +19,7 @@ %% include dia_bits.inc %% include dia_options.inc %% include dia_fulloptions.inc +%% include dia_videomodes.inc %% include dia_access.inc %% include panel.inc %% include keytables.inc diff --git a/common.inc b/common.inc index da9d195..e7cdc03 100644 --- a/common.inc +++ b/common.inc @@ -385,8 +385,9 @@ } if } if - modes.selected.append .undef ne { - modes.selected.append "%s " bc.cmd dup length add sprintf + video_modes.selected.append .undef ne { + calculate.param + video_modes.selected.append "%s" bc.cmd dup length add sprintf } if modes.selected.replace .undef ne { @@ -737,6 +738,7 @@ % update installation modes menu menu.idx modes.filter + menu.idx video_modes.filter } if } def diff --git a/dia_videomodes.inc b/dia_videomodes.inc new file mode 100644 index 0000000..d620f76 --- /dev/null +++ b/dia_videomodes.inc @@ -0,0 +1,200 @@ +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% +% Panel installation video modes selector. +% +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +/video_modes.selected.append .undef def +/video_modes.selected.replace .undef def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Initialise installation video modes menu. +% +% ( ) ==> ( ) +% +/video_modes.init { + /xmenu.video_modes .xm_size array def + /xmenu xmenu.video_modes def + + xmenu .xm_current 0 put + + /video_modes.gfxconfig listgfxconfig def + + /video_modes.rawlabels [ + video_modes.gfxconfig { + dup 0 get 6 strndup dup "label " eq exch free { 1 get } { pop } ifelse + } forall + /video_modes.submenu.resolution + ] def + /video_modes.append [ + video_modes.gfxconfig { + 0 get /video_modes.tmp.key exch def + video_modes.tmp.key 6 strndup dup "label " eq exch free { + video_modes.tmp.key 6 add dup length 8 add string /video_modes.tmp.str exch def + "append %s" video_modes.tmp.str sprintf + video_modes.tmp.str getgfxconfig + video_modes.tmp.str free + } if + } forall + .undef + ] def + /video_modes.replace [ + video_modes.gfxconfig { + 0 get /video_modes.tmp.key exch def + video_modes.tmp.key 6 strndup dup "label " eq exch free { + video_modes.tmp.key 6 add dup length 9 add string /video_modes.tmp.str exch def + "replace %s" video_modes.tmp.str sprintf + video_modes.tmp.str getgfxconfig + video_modes.tmp.str free + } if + } forall + .undef + ] def + /video_modes.applies [ + video_modes.gfxconfig { + 0 get /video_modes.tmp.key exch def + video_modes.tmp.key 6 strndup dup "label " eq exch free { + video_modes.tmp.key 6 add dup length 9 add string /video_modes.tmp.str exch def + "applies %s" video_modes.tmp.str sprintf + video_modes.tmp.str getgfxconfig + video_modes.tmp.str free + } if + } forall + .undef + ] def + + video_modes.rawlabels length 1 eq { + /video_modes.rawlabels [ /txt_mode_normal /txt_resolution ] def + /video_modes.append [ .undef .undef ] def + /video_modes.replace [ .undef .undef ] def + /video_modes.applies [ .undef .undef ] def + } if + /video_modes.map .undef def + + menu.entry video_modes.filter + + xmenu .xm_title /txt_videodrv put +} def + + +/video_modes.submenu.resolution.buf 64 string def +/video_modes.submenu.resolution { + /txt_resolution exec "\x09%s" video_modes.submenu.resolution.buf sprintf + video_modes.submenu.resolution.buf +} def + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Update installation modes status. +% +% ( ) ==> ( ) +% +/video_modes.update { + /xmenu xmenu.video_modes def + + video_modes.map xmenu .xm_current get get + video_modes.append over get /video_modes.selected.append exch def + video_modes.replace over get /video_modes.selected.replace exch def + + /window.action actRedrawPanel def + + pmenu.update +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Filter displayed modes when a menu item changes. +% +% ( index ) ==> ( ) +% +/video_modes.filter { + video_modes.rawlabels .undef eq { pop return } if + + menu.labels exch get + dup length 3 add string /video_modes.tmp.label exch def + " %s " video_modes.tmp.label sprintf + + xmenu % save + /xmenu xmenu.video_modes def + + video_modes.map { + /video_modes.tmp.oldidx video_modes.map xmenu .xm_current get get def + } { + /video_modes.tmp.oldidx .undef def + } ifelse + + video_modes.map free + % mapping of current menu index to underlying option index + /video_modes.map [ + 0 1 video_modes.rawlabels length 1 sub { + video_modes.applies over get dup .undef ne { + dup length 3 add string /video_modes.tmp.applies exch def + " %s " video_modes.tmp.applies sprintf + video_modes.tmp.applies video_modes.tmp.label strstr 0 eq { pop } if + video_modes.tmp.applies free + } { + pop + } ifelse + } for + ] def + + video_modes.tmp.label free + + xmenu .xm_list get free + xmenu .xm_list [ + video_modes.map { video_modes.rawlabels exch get translate } forall + ] put + + xmenu .xm_current 0 put + 0 1 video_modes.map length 1 sub { + video_modes.map over get video_modes.tmp.oldidx eq { + xmenu .xm_current rot put exit + } { + pop + } ifelse + } for + + pmenu.init + + /xmenu exch def % restore +} def + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Show window. +% +% ( ) ==> ( ) +% +/panel.video_modes { + "video_modes" help.setcontext + + window.xmenu + dup .xmenu xmenu.video_modes put + dup .xmenu.update /video_modes.update put + dup window.init + window.show +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Return width of panel entry. +% +% ( ) => ( width ) +% +/panel.video_modes.width { + /xmenu xmenu.video_modes def + + pmenu.width +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Redraw panel entry. +% +% ( panel ) => ( ) +% +/panel.video_modes.update { + /xmenu xmenu.video_modes def + + pmenu.panel.update +} def diff --git a/install.config b/install.config index f3a6000..251b71a 100644 --- a/install.config +++ b/install.config @@ -20,6 +20,7 @@ %% include dia_options.inc %% include dia_fulloptions.inc %% include dia_access.inc +%% include dia_videomodes.inc %% include panel.inc %% include timezones.inc %% include keytables.inc diff --git a/panel.inc b/panel.inc index 6992089..03f0df6 100644 --- a/panel.inc +++ b/panel.inc @@ -43,8 +43,8 @@ [ .panel.both [ keyF2 0 "F2" /panel.lang /panel.lang.width /panel.lang.update /lang.init ] ] [ .panel.both [ keyF3 0 "F3" /panel.keymap /panel.keymap.width /panel.keymap.update /keymap.init ] ] - [ .panel.both [ keyF4 0 "F4" /panel.modes /panel.modes.width /panel.modes.update /modes.init ] ] - [ .panel.both [ keyF5 0 "F5" /panel.fulloptions /panel.fulloptions.width /panel.fulloptions.update /fulloptions.init ] ] + [ .panel.both [ keyF4 0 "F4" /panel.video_modes /panel.video_modes.width /panel.video_modes.update /video_modes.init ] ] + [ .panel.both [ keyF5 0 "F5" /panel.options /panel.fulloptions.width /panel.fulloptions.update /fulloptions.init ] ] 32+64bit_source { 64bit { diff --git a/xmenu.inc b/xmenu.inc index efad3e3..2765db6 100644 --- a/xmenu.inc +++ b/xmenu.inc @@ -19,9 +19,9 @@ /xmenu.selected.bg 0x6c6c6c newcolor small_layout { - /xmenu.maxlines 19 def + /xmenu.maxlines 20 def } { - /xmenu.maxlines 19 def + /xmenu.maxlines 20 def } ifelse % xmenu layout @@ -189,7 +189,12 @@ small_layout { xmenu .xm_width [ /xmenu.idx 0 def 0 xmenu .xm_list get { - exec strsize pop max + exec + 0 + over 0 get '\x09' eq { + pop "x\u25b6" strsize pop + } if + exch strsize pop add max /xmenu.idx inc xmenu.idx xmenu.maxlines mod 0 eq { xmenu .xm_check get { "x " strsize pop add } if @@ -391,8 +396,12 @@ small_layout { } if xmenu .xm_list get over get exec show - pop + xmenu .xm_list get over get exec + 0 get 9 eq { + xmenu.pos.x xmenu.width xmenu.column get add 8 sub xmenu.pos.y 4 add moveto "\u25b6" showright + } if + pop } def