Permalink
Browse files

. 增加 setmenu --triangle-on --triangle-off 参数,打开/关闭菜单三角形指示器。默认打开。(iss…

…ues #179)

  撤销当菜单边框线宽为零时,不显示三角形及菜单项目自动编号。
  • Loading branch information...
yaya
yaya committed Jul 1, 2018
1 parent 3b3bf0d commit b519902005d1b2cdb5ea2a1ac00cf2e96d0f36a9
Showing with 36 additions and 12 deletions.
  1. +4 −2 ChangeLog_chenall.txt
  2. +15 −1 stage2/builtins.c
  3. +17 −9 stage2/stage2.c
@@ -1,8 +1,10 @@
更新说明:
2018-7-1(yaya)
增加 setmenu --triangle-on --triangle-off 参数,打开/关闭菜单三角形指示器。默认打开。
2018-6-29(yaya)
1. 增加 setmenu --middle-align 参数。菜单项目及菜单项目帮助居中。(issues #179)
2. 当菜单边框线宽为零时,不显示三角形及菜单项目自动编号。
3. 修正光标尺寸,随点阵字符尺寸而变。(issues #180)
2. 修正光标尺寸,随点阵字符尺寸而变。(issues #180)
2018-6-12(yaya)
1. 增加 beep 函数,播放音乐。(issues #175)(issues #176)
@@ -16465,6 +16465,7 @@ setmenu_func(char *arg, int flags)
current_term->chars_per_line = current_x_resolution / font_w;
}
*(unsigned char *)0x8274 = 0;
*(unsigned short *)0x8308 = 0x1110;
memmove ((char *)&menu_border,(char *)&tmp_broder,sizeof(tmp_broder));
graphic_type = 0;
for (i=0; i<16; i++)
@@ -16494,18 +16495,30 @@ setmenu_func(char *arg, int flags)
else if (grub_memcmp (arg, "--left-align", 12) == 0)
{
menu_tab &= 0xbf;
menu_tab &= 0xf7;
arg += 12;
}
else if (grub_memcmp (arg, "--right-align", 13) == 0)
{
menu_tab |= 0x40;
menu_tab &= 0xf7;
arg += 13;
}
else if (grub_memcmp (arg, "--middle-align", 14) == 0)
{
menu_tab |= 8;
arg += 14;
}
else if (grub_memcmp (arg, "--triangle-on", 13) == 0)
{
*(unsigned short *)0x8308 = 0x1110;
arg += 13;
}
else if (grub_memcmp (arg, "--triangle-off", 14) == 0)
{
*(unsigned short *)0x8308 = 0;
arg += 14;
}
else if (grub_memcmp (arg, "--highlight-short", 17) == 0)
{
menu_tab &= 0xef;
@@ -16653,7 +16666,8 @@ static struct builtin builtin_setmenu =
BUILTIN_CMDLINE | BUILTIN_SCRIPT | BUILTIN_MENU | BUILTIN_HELP_LIST,
"setmenu --parameter | --parameter | ... ",
"--ver-on* --ver-off --lang=en* --lang=zh --u\n"
"--left-align* --right-align --middle-align --auto-num-off* --auto-num-on\n"
"--left-align* --right-align --middle-align\n"
"--auto-num-off* --auto-num-on --triangle-on* --triangle-off\n"
"--highlight-short* --highlight-full\n"
"--font-spacing=FONT:LINE. default 0\n"
"--string=[X]=[-]Y=COLOR=\"STRING\" max 16 commands.\n"
@@ -379,19 +379,19 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
}
gotoxy (MENU_BOX_X, y);
if (menu_border.border_w)
if(menu_tab & 0x40)
end_offcet = 1;
if (*(unsigned short *)0x8308 == 0x1110)
{
if(!(menu_tab & 0x40))
{
gotoxy (MENU_BOX_X - 1, y);
grub_putchar(highlight ? (menu_num_ctrl[2] = entryno,menu_cfg[0]) : ' ', 255);
grub_putchar(highlight ? (/*menu_num_ctrl[2] = entryno,*/menu_cfg[0]) : ' ', 255);
}
else
{
gotoxy (MENU_BOX_E - 1, y);
grub_putchar(highlight ? (menu_num_ctrl[2] = entryno,menu_cfg[1]) : ' ', 255);
end_offcet = 1;
gotoxy (MENU_BOX_E - 4, y);
grub_putchar(highlight ? (/*menu_num_ctrl[2] = entryno,*/menu_cfg[1]) : ' ', 255);
}
}
@@ -402,10 +402,13 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
c = *entry++;
expand_var (entry, (char *)SCRATCHADDR, 0x400);
entry = (char *)SCRATCHADDR;
if (menu_num_ctrl[0] && menu_border.border_w)
if (menu_num_ctrl[0])
{
if(menu_tab & 0x40)
{
gotoxy (MENU_BOX_E - 4, y);
end_offcet = 4;
}
if (!(c & menu_num_ctrl[0]) || !*entry || *entry == '\n')
printf(" ");
@@ -427,10 +430,15 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
if(entry)
{
if(menu_tab & 8)
start_offcet = MENU_BOX_X + ((MENU_BOX_W - num_text_char(entry)) >> 1);
{
if(!(menu_tab & 0x40))
start_offcet = MENU_BOX_X + ((MENU_BOX_W - num_text_char(entry) + (menu_num_ctrl[0]?3:0)) >> 1);
else
start_offcet = MENU_BOX_X + ((MENU_BOX_W - num_text_char(entry) - end_offcet) >> 1);
}
else if((menu_tab & 0x40))
{
start_offcet = MENU_BOX_E - num_text_char(entry);
start_offcet = MENU_BOX_E - num_text_char(entry) - end_offcet;
if(start_offcet < MENU_BOX_X)
start_offcet = MENU_BOX_X;
}
@@ -441,7 +449,7 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
unsigned int ret;
ret = MENU_BOX_E - x - end_offcet;
if (c && c != '\n' /* && x <= MENU_BOX_W*/ && x >= start_offcet - end_offcet)
if (c && c != '\n' /* && x <= MENU_BOX_W*/ && x >= start_offcet)
{
ret = grub_putchar ((unsigned char)c, ret);

0 comments on commit b519902

Please sign in to comment.