Permalink
Browse files

. 增加 setmenu --middle-align 参数。菜单项目及菜单项目帮助居中。(issues #179) (issues #180

)

  当菜单边框线宽为零时,不显示三角形及菜单项目自动编号。
  修正光标尺寸,随点阵字符尺寸而变。
  • Loading branch information...
yaya
yaya committed Jun 29, 2018
1 parent f4c9146 commit 3b3bf0dcf1ee0a78606723af823ea9282022bc42
Showing with 33 additions and 14 deletions.
  1. +5 −0 ChangeLog_chenall.txt
  2. +6 −1 stage2/builtins.c
  3. +1 −1 stage2/graphics.c
  4. +21 −12 stage2/stage2.c
@@ -1,4 +1,9 @@
更新说明:
2018-6-29(yaya)
1. 增加 setmenu --middle-align 参数。菜单项目及菜单项目帮助居中。(issues #179)
2. 当菜单边框线宽为零时,不显示三角形及菜单项目自动编号。
3. 修正光标尺寸,随点阵字符尺寸而变。(issues #180)
2018-6-12(yaya)
1. 增加 beep 函数,播放音乐。(issues #175)(issues #176)
beep [--start|--mid|--end] [--play=N] [--nowait] 频率 持续时间 ...
@@ -16501,6 +16501,11 @@ setmenu_func(char *arg, int flags)
menu_tab |= 0x40;
arg += 13;
}
else if (grub_memcmp (arg, "--middle-align", 14) == 0)
{
menu_tab |= 8;
arg += 14;
}
else if (grub_memcmp (arg, "--highlight-short", 17) == 0)
{
menu_tab &= 0xef;
@@ -16648,7 +16653,7 @@ 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 --auto-num-off* --auto-num-on\n"
"--left-align* --right-align --middle-align --auto-num-off* --auto-num-on\n"
"--highlight-short* --highlight-full\n"
"--font-spacing=FONT:LINE. default 0\n"
"--string=[X]=[-]Y=COLOR=\"STRING\" max 16 commands.\n"
@@ -2507,7 +2507,7 @@ vbe_cursor (int set)
y = fonty * (font_h+line_spacing);
y += line_spacing>>1;
/* invert the beginning 1 vertical lines of the char */
for (j = 2; j < 14; ++j)
for (j = 2; j < font_h - 2; ++j)
{
XorPixel (x, y + j, -1);
}
@@ -154,7 +154,9 @@ static void print_help_message (const char *message,int flags)
if (c == '\n')
c = *(++message);
if((menu_tab & 0x40))
if((menu_tab & 8) && flags==1)
start_offcet = MENU_HELP_X + ((MENU_HELP_E - MENU_HELP_X - num_text_char((char *)message))>>1);
else if((menu_tab & 0x40) && flags==1)
{
// start_offcet = current_term->chars_per_line - MENU_HELP_X - num_text_char((char *)message);
start_offcet = MENU_HELP_E - num_text_char((char *)message);
@@ -376,6 +378,9 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
goto graphic_end;
}
gotoxy (MENU_BOX_X, y);
if (menu_border.border_w)
{
if(!(menu_tab & 0x40))
{
gotoxy (MENU_BOX_X - 1, y);
@@ -388,6 +393,7 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
end_offcet = 1;
gotoxy (MENU_BOX_E - 4, y);
}
}
if (entry)
{
@@ -396,33 +402,39 @@ 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])
if (menu_num_ctrl[0] && menu_border.border_w)
{
if(menu_tab & 0x40)
end_offcet = 4;
if (!(c & menu_num_ctrl[0]) || !*entry || *entry == '\n')
printf(" ");
else
{
if(!(menu_tab & 0x40))
printf("%2d%c",(menu_num_ctrl[0] > 1)?entryno:title_boot[entryno],menu_num_ctrl[1]);
else
{
printf("%c%2d",menu_num_ctrl[1],(menu_num_ctrl[0] > 1)?entryno:title_boot[entryno]);
end_offcet = 4;
}
}
}
}
c = *entry;
}
if((menu_tab & 0x40))
if(menu_tab & 0x40)
gotoxy (MENU_BOX_X, y);
if(entry)
{
if(menu_tab & 8)
start_offcet = MENU_BOX_X + ((MENU_BOX_W - num_text_char(entry)) >> 1);
else if((menu_tab & 0x40))
{
if(entry)
start_offcet = MENU_BOX_E - num_text_char(entry);
start_offcet = MENU_BOX_E - num_text_char(entry);
if(start_offcet < MENU_BOX_X)
start_offcet = MENU_BOX_X;
gotoxy (MENU_BOX_X, y);
}
}
for (x = fontx; x < MENU_BOX_E - end_offcet; x = fontx)
{
@@ -879,9 +891,6 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h
for (j=0; j<i; j++)
{
if((menu_tab & 0x40))
start_offcet = current_term->chars_per_line - strings[j].start_x - num_text_char((char *)strings[j].addr);
else
start_offcet = strings[j].start_x;
gotoxy (start_offcet, strings[j].start_y);
current_term->setcolorstate (COLOR_STATE_NORMAL);

0 comments on commit 3b3bf0d

Please sign in to comment.