///////////////////////// 以下为眼晕区,晃晃就行,目的是对比grub4dos之强大 /////////////////////////////////////////////////////
#123456789ABCDEF1123456789ABCDEF2123456789ABCDEF3123456789ABCDEF4123456789ABCDEF5123456789ABCDEF6123456789ABCDEF7123456789ABCDEF8123456789ABCDEF9123456789ABCDEFA123456789ABCDEFB123456789ABCDEFC123456789ABCDEFD123456789ABCDEFE123456789ABCDEFF123456789ABCDE
set DefaultTime=30
set DefaultTitle=" Boot from hard disk ... "
set DefaultOffsetX=26
set MenuTitle1="Main Menu"
set MenuLen1=8
set MenuText11="MenuItemTextfff" ;set MenuItemType11=2 ;Set MenuInfoA11="Info11A"; Set MenuInfoB11="Info11B";Set MenuInfoC11="Info11C"
set MenuText12="memdisk ggg.img" ;set MenuCommand12="memdisk ggg.img"
set MenuText13="MenuItemText13"
set MenuText14="MenuItemText14"
set MenuLen2=6
set MenuCommand21="part" ;set MenuItemType21=-1
set MenuItemType22=0
set MenuLen3=7
set MenuItemType13=3
Set ColorOf_UpperBar = "white on brightgrey"
Set ColorOf_TitleBar = "brightgrey on blue"
Set ColorOf_WindowBody = "black on white"
Set ColorOf_MenuOption = "white on brightgrey"
Set ColorOf_MenuHighlight = "white on red"
Set ColorOf_HelpHighlight = "brightblue on white"
Set ColorOf_MenuShadow = "grey on white"
Set ColorOf_WindowShadow = "grey on green"
Set ColorOf_Background = "white on grey"
#Do not change the below
set DefCnt=0
set SmIdx=0
set MenuNO=1
set MenuNOLast=0
set MenuLen=0
set iTmp=0
set strTmp=""
set MenuBK=" "
set InfoBK=" "
Set C_UB = color[$ColorOf_UpperBar]
Set C_TB = color[$ColorOf_TitleBar]
Set C_WB = color[$ColorOf_WindowBody]
Set C_SD = color[$ColorOf_WindowShadow]
Set C_HH = color[$ColorOf_HelpHighlight]
Set C_MO = color[$ColorOf_MenuOption]
Set C_MH = color[$ColorOf_MenuHighlight]
Set C_SW = color[$ColorOf_MenuShadow]
Set C_BG = color[$ColorOf_Background]
goto GotoMenu
end
##############
# ReadMe #
##############
MenuItemRoutine21:
call DefSrn
print "readme"
print "\nPress any key to continue"
getkey
set MenuNOLast=0
goto GotoMenu
end
##############
# GotoMenu#
##############
GotoMenu:
if $MenuNOLast<$MenuNO
then call ClrSrn
call SmPush
goto MenuCtrl
end
##############
# SmPush #
##############
SmPush:
set SmIdx=$SmIdx+1
set SmNo$SmIdx=$MenuNO
return
##############
# SmPop #
##############
SmPop:
set MenuNO=$SmNo$SmIdx
set MenuLen=$MenuLen$MenuNO
set SmIdx=$SmIdx-1
return
##############
# SmGetTop#
##############
SmGetTop:
set MenuNO=$SmNo$SmIdx
set MenuLen=$MenuLen$MenuNO
return
##############
# CurText #
##############
CurText:
set textCursorY = ($CurSel-1)*2+3
set f=$MenuNO*10+$CurSel
set textColor=$C_MH
set textCursorX = 25
print " "
set strTmp="$MenuText$f"
set textCursorX = 26
print "$CurSel"
print ". "
print "$strTmp"
return
##############
# LastText #
##############
LastText:
set textCursorY = ($LastSel-1)*2+3
set f=$MenuNO*10+$LastSel
set textColor=$C_MO
set textCursorX = 25
print " "
set textCursorX = 26
set strTmp="$MenuText$f"
print "$LastSel"
print ". "
print "$strTmp"
return
##############
# iTmpText #
##############
iTmpText:
set textCursorY = ($iTmp-1)*2+3
set f=$MenuNO*10+$iTmp
set textColor=$C_MO
set textCursorX = 25
print " "
set textCursorX = 26
set strTmp="$MenuText$f"
print "$iTmp"
print ". "
print "$strTmp"
return
##############
# CurInfo #
##############
CurInfo:
call InfoBK
set f=$MenuNO*10+$CurSel
set textCursorX=3
if defined[MenuInfoA$f]
then set textCursorX=3
then set textCursorY=21
then print "$MenuInfoA$f"
if defined[MenuInfoB$f]
then set textCursorX=3
then set textCursorY=22
then print "$MenuInfoB$f"
if defined[MenuInfoC$f]
then set textCursorX=3
then set textCursorY=23
then print "$MenuInfoC$f"
return
##############
# InfoBK #
##############
InfoBK:
set textColor=$C_WB
set iTmp=0
_IBK:
if $iTmp<3
then set textCursorX=3
then set textCursorY=21+$iTmp
then print "$InfoBK"
then set iTmp=$iTmp+1
then goto _IBK
return
##############
# CntBk #
##############
CntBk:
set textColor=$C_BG
set textCursorX=0
set textCursorY=24
if $DefaultTime<=0
then return
set textCursorX=0
print "$DefaultTitle"
set textCursorX=$DefaultOffsetX
print "$DefaultTime"
return
##############
# DefSrn #
##############
DefSrn:
set textColor=color[brightgrey on black] # Clearn screen to system default,called by customer
cls
return
##############
# ClrSrn #
##############
ClrSrn:
set textColor=$C_BG # Clearn screen
cls
return
##############
# MenuCtrl#
##############
MenuCtrl:
call SmGetTop # Get the current menu
set iTmp=1 # Draw menuitem background
set textColor=$C_WB
set textCursorY=2
set textCursorX=0
_MBK:
if $iTmp<$MenuLen*2+2
then print "\ac$MenuBK"
then set iTmp=$iTmp+1
then goto _MBK
call InfoBK # Draw Infomation background
set textColor=$C_TB # Draw menu title background
set textCursorX=0
set textCursorY=1
print "\ac$MenuBK" # $MenuBK is combined with some spaces ,whick fill the background of menutitle
set textCursorX=0 # Draw menu title
print "\ac$MenuTitle$MenuNO"
set textCursorX=3 # Draw "INFORMATION:"
set textCursorY=20
print "INFORMATION: "
set CurSel=1 # CurSel must be great 0 (begining with 1)
set LastSel=0 # LastSel,to check whether to be redraw
call CurText # Draw the first menuitem
set iTmp=2
_DIs: # Draw menuitems' text (do not include item1)
if $iTmp<=$MenuLen
then call iTmpText
then set iTmp=$iTmp+1;
then goto _DIs
call CurInfo
_Con: # capture keyboard input
call CntBk
set LastSel=$CurSel
if $DefaultTime>0
then goto _DT1
getkey
goto _Key
_DT1:
set DefCnt=0 # clear default count
set textColor=$C_BG
set textCursorY=24
_DT1Lp:
getkey 1 goto _Def
_Key:
if $lastKey==key[esc]; then goto _UpLvl
if $lastKey==key[down]; then set CurSel=$CurSel+1;then goto _UpDown
if $lastKey==key[up]; then set CurSel=$CurSel-1;then goto _UpDown
if $lastKey==key[enter];then goto _Sel
if $lastKey>=48 && $lastKey<= 48+$MenuLen;then set CurSel=$lastKey-48;then goto _Sel
goto _Con
_UpDown:
if $CurSel<=0; then set CurSel=1;then goto _Con
if $CurSel>$MenuLen; then set CurSel=$MenuLen;then goto _Con
if $CurSel==$LastSel;then goto _Con
call LastText
call CurText
call CurInfo
goto _Con
_UpLvl:
if $SmIdx<=1;then goto _Con # Only one menu in the stack
call SmPop # Popup Menu and goto it
goto MenuCtrl
_Sel: # Menuitem had been pressed
set f=$MenuNO*10+$CurSel
if defined[MenuItemType$f];then goto _TDd;else goto _UTDd
_TDd:
if $MenuItemType$f==$MenuNO || $MenuItemType$f==0; then goto _UpLvl
if $MenuItemType$f>0 && $MenuItemType$f<=32767; then set MenuNOLast=$MenuNO;then set MenuNO=$MenuItemType$f;then goto GotoMenu
if $MenuItemType$f<0;goto MenuItemRoutine$f
goto _Con
_UTDd:
call DefSrn
$MenuCommand$f
_Def:
set DefCnt=$DefCnt+1
# print "******* $DefCnt $DefaultTime"
if $DefCnt<=$DefaultTime
then set textCursorX=$DefaultOffsetX
then set iTmp=$DefaultTime-$DefCnt
then print " "
then set textCursorX=$DefaultOffsetX
then print "$iTmp"
then goto _DT1Lp
else call DefSrn
else boot $hda