Update legacy static assignments in old code to support dynamic framing,

plotting, and alignment coinciding with enhancements in SVN r242667.
This commit is contained in:
Devin Teske 2013-08-08 22:34:00 +00:00
parent 14bf23ce31
commit 5b502b3b4c
2 changed files with 96 additions and 16 deletions

View File

@ -35,6 +35,8 @@ f_double \ Set frames to double (see frames.4th). Replace with
\ f_single if you want single frames.
46 constant dot \ ASCII definition of a period (in decimal)
5 constant menu_default_x \ default column position of timeout
10 constant menu_default_y \ default row position of timeout msg
4 constant menu_timeout_default_x \ default column position of timeout
23 constant menu_timeout_default_y \ default row position of timeout msg
10 constant menu_timeout_default \ default timeout (in seconds)
@ -128,7 +130,11 @@ create init_text8 255 allot
: cycle_stateN ( N -- ADDR ) s" cycle_stateN" 11 +c! evaluate ;
: init_textN ( N -- C-ADDR ) s" init_textN" 9 +c! evaluate ;
: str_loader_menu_frame ( -- C-ADDR/U ) s" loader_menu_frame" ;
: str_loader_menu_title ( -- C-ADDR/U ) s" loader_menu_title" ;
: str_loader_menu_title_align ( -- C-ADDR/U ) s" loader_menu_title_align" ;
: str_loader_menu_x ( -- C-ADDR/U ) s" loader_menu_x" ;
: str_loader_menu_y ( -- C-ADDR/U ) s" loader_menu_y" ;
: str_loader_menu_timeout_x ( -- C-ADDR/U ) s" loader_menu_timeout_x" ;
: str_loader_menu_timeout_y ( -- C-ADDR/U ) s" loader_menu_timeout_y" ;
: str_menu_init ( -- C-ADDR/U ) s" menu_init" ;
@ -441,7 +447,24 @@ create init_text8 255 allot
str_loader_menu_title getenv dup -1 = if
drop s" Welcome to FreeBSD"
then
24 over 2 / - 9 at-xy type
TRUE ( use default alignment )
str_loader_menu_title_align getenv dup -1 <> if
2dup s" left" compare-insensitive 0= if ( 1 )
2drop ( c-addr/u ) drop ( bool )
menuX @ menuY @ 1-
FALSE ( don't use default alignment )
else ( 1 ) 2dup s" right" compare-insensitive 0= if ( 2 )
2drop ( c-addr/u ) drop ( bool )
menuX @ 42 + 4 - over - menuY @ 1-
FALSE ( don't use default alignment )
else ( 2 ) 2drop ( c-addr/u ) then ( 1 ) then
else
drop ( getenv cruft )
then
if ( use default center alignement? )
menuX @ 19 + over 2 / - menuY @ 1-
then
at-xy type
\ If $menu_init is set, evaluate it (allowing for whole menus to be
\ constructed dynamically -- as this function could conceivably set
@ -733,7 +756,44 @@ create init_text8 255 allot
menu_start
1- menuidx ! \ Initialize the starting index for the menu
0 menurow ! \ Initialize the starting position for the menu
42 13 2 9 box \ Draw frame (w,h,x,y)
\ Assign configuration values
str_loader_menu_y getenv dup -1 = if
drop \ no custom row position
menu_default_y
else
\ make sure custom position is a number
?number 0= if
menu_default_y \ or use default
then
then
menuY !
str_loader_menu_x getenv dup -1 = if
drop \ no custom column position
menu_default_x
else
\ make sure custom position is a number
?number 0= if
menu_default_x \ or use default
then
then
menuX !
\ Interpret a custom frame type for the menu
TRUE ( draw a box? default yes, but might be altered below )
str_loader_menu_frame getenv dup -1 = if ( 1 )
drop \ no custom frame type
else ( 1 ) 2dup s" single" compare-insensitive 0= if ( 2 )
f_single ( see frames.4th )
else ( 2 ) 2dup s" double" compare-insensitive 0= if ( 3 )
f_double ( see frames.4th )
else ( 3 ) s" none" compare-insensitive 0= if ( 4 )
drop FALSE \ don't draw a box
( 4 ) then ( 3 ) then ( 2 ) then ( 1 ) then
if
42 13 menuX @ 3 - menuY @ 1- box \ Draw frame (w,h,x,y)
then
0 25 at-xy \ Move cursor to the bottom for output
;
@ -965,10 +1025,7 @@ create init_text8 255 allot
menu-erase
;
\ Assign configuration values
bullet menubllt !
10 menuY !
5 menuX !
\ Initialize our menu initialization state variables
0 init_state1 !

View File

@ -123,6 +123,14 @@ The command to be executed after
seconds if a key is not pressed.
The default is
.Ic boot .
.It Va loader_menu_frame
Sets the desired box style to draw around the boot menu.
Possible values are:
.Dq Li single
.Pq the default ,
.Dq Li double ,
and
.Dq Li none .
.It Va loader_menu_timeout_x
Sets the desired column position of the timeout countdown text.
Default is 4.
@ -130,9 +138,24 @@ Default is 4.
Sets the desired row position of the timeout countdown text.
Default is 23.
.It Va loader_menu_title
The text to display centered above the menu.
The text to display above the menu.
Default is
.Dq Li "Welcome to FreeBSD" .
.It Va loader_menu_title_align
Default is to align
.Ic loader_menu_title
centered above the menu. This can be set to
.Dq Li left
or
.Dq Li right
to instead display the title left-or-right justified
.Pq respectively .
.It Va loader_menu_x
Sets the desired column position of the boot menu.
Default is 5.
.It Va loader_menu_y
Sets the desired row position of the boot menu.
Default is 10.
.It Va menu_caption[x]
The text to be displayed for the numbered menuitem
.Dq Li x .