color menu support
This commit is contained in:
parent
d2b9bc0db8
commit
01997403fe
8 changed files with 245 additions and 14 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
1999-06-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
Color-menu support based on Peter Astrand
|
||||||
|
<altic@lysator.liu.se>'s patch.
|
||||||
|
|
||||||
|
* shared_src/asm.S (nocursor): New function.
|
||||||
|
* shared_src/cmdline.c (normal_color): New variable.
|
||||||
|
(highlight_color): Likewise.
|
||||||
|
(commands): Added "color" command.
|
||||||
|
(enter_cmdline): Handle the color command.
|
||||||
|
* shared_src/shared.h (normal_color): Declared.
|
||||||
|
(highlight_color): Likewise.
|
||||||
|
[!GRUB_UTIL] (nocursor): Likewise.
|
||||||
|
* shared_src/stage2.c (print_border) [!GRUB_UTIL]: Color the
|
||||||
|
menu.
|
||||||
|
(run_menu) [!GRUB_UTIL]: Call nocursor, and call set_line with
|
||||||
|
the second argument HIGHLIGHT_COLOR when highlighting a line,
|
||||||
|
and NORMAL_COLOR when drawing a normal line.
|
||||||
|
(cmain): Initialize normal_color and highlight_color. Handle
|
||||||
|
the color command in the same way as the command-line
|
||||||
|
interface.
|
||||||
|
|
||||||
1999-06-07 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-06-07 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
* e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 31744.
|
* e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 31744.
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ New:
|
||||||
characters.
|
characters.
|
||||||
* stage2_debug is removed, and the debugging features are added into
|
* stage2_debug is removed, and the debugging features are added into
|
||||||
stage2.
|
stage2.
|
||||||
|
* Color menu support.
|
||||||
|
|
||||||
New in 0.5.91 - 1999-03-14, Gordon Matzigkeit:
|
New in 0.5.91 - 1999-03-14, Gordon Matzigkeit:
|
||||||
* LBA and preliminary AWARD BIOS disk extension support.
|
* LBA and preliminary AWARD BIOS disk extension support.
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -16,4 +16,5 @@ Kunihiro Ishiguro <kunihiro@zebra.org>
|
||||||
Miles Bader <miles@gnu.org>
|
Miles Bader <miles@gnu.org>
|
||||||
OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
Pavel Roskin <pavel_roskin@geocities.com>
|
Pavel Roskin <pavel_roskin@geocities.com>
|
||||||
|
Peter Astrand <altic@lysator.liu.se>
|
||||||
VaX#n8 <vax@linkdead.paranoia.com>
|
VaX#n8 <vax@linkdead.paranoia.com>
|
||||||
|
|
|
@ -745,12 +745,87 @@ PC partitions.
|
||||||
This boots the OS/chain-loader which has been loaded. Only necessary if
|
This boots the OS/chain-loader which has been loaded. Only necessary if
|
||||||
running the fully interactive command-line (it is implicit at the end of
|
running the fully interactive command-line (it is implicit at the end of
|
||||||
a config-file entry).
|
a config-file entry).
|
||||||
|
|
||||||
|
@item color= @var{normal} [@var{highlight}]
|
||||||
|
Change the menu colors. The color @var{normal} is used for the normal
|
||||||
|
line in the menu, and the color @var{highlight} is used to highlight the
|
||||||
|
line where the cursor points to. If you omit @var{highlight}, then the
|
||||||
|
inverted color of @var{normal} is used for the highlighted line. You
|
||||||
|
must specify an integer for a color value, and the 0-3 bits represents
|
||||||
|
the foreground color, the 4-6 bits represents the background color, and
|
||||||
|
the 7 bit represents that the foreground blinks.
|
||||||
|
|
||||||
|
These are the possible values and the meanings:
|
||||||
|
|
||||||
|
@table @asis
|
||||||
|
@item 0
|
||||||
|
black
|
||||||
|
|
||||||
|
@item 1
|
||||||
|
blue
|
||||||
|
|
||||||
|
@item 2
|
||||||
|
green
|
||||||
|
|
||||||
|
@item 3
|
||||||
|
cyan
|
||||||
|
|
||||||
|
@item 4
|
||||||
|
red
|
||||||
|
|
||||||
|
@item 5
|
||||||
|
magenta
|
||||||
|
|
||||||
|
@item 6
|
||||||
|
brown
|
||||||
|
|
||||||
|
@item 7
|
||||||
|
light gray
|
||||||
|
|
||||||
|
@item
|
||||||
|
@strong{These below can be specified only for the foreground.}
|
||||||
|
|
||||||
|
@item 8
|
||||||
|
dark gray
|
||||||
|
|
||||||
|
@item 9
|
||||||
|
light blue
|
||||||
|
|
||||||
|
@item A
|
||||||
|
light green
|
||||||
|
|
||||||
|
@item B
|
||||||
|
light cyan
|
||||||
|
|
||||||
|
@item C
|
||||||
|
light red
|
||||||
|
|
||||||
|
@item D
|
||||||
|
light magenta
|
||||||
|
|
||||||
|
@item E
|
||||||
|
yellow
|
||||||
|
|
||||||
|
@item F
|
||||||
|
white
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Commands usable in configuration files and interactively which are only
|
The background is represented by 3 bits, so you cannot specify more than
|
||||||
available in the debug version of the GRUB Stage 2.
|
7 for it.
|
||||||
|
|
||||||
|
This command can be used in the configuration file and on the
|
||||||
|
command-line, so you may write something like this in your configuration
|
||||||
|
file:
|
||||||
|
|
||||||
|
@example
|
||||||
|
# the default colors (light gray / blue, black / light gray)
|
||||||
|
color= 0x17 0x70
|
||||||
|
|
||||||
|
# change the colors
|
||||||
|
title= OS-BS like
|
||||||
|
color= 0x16 0x60
|
||||||
|
@end example
|
||||||
|
|
||||||
@table @code
|
|
||||||
@item testload= @var{file}
|
@item testload= @var{file}
|
||||||
Read the entire contents of @var{file} in several different ways and
|
Read the entire contents of @var{file} in several different ways and
|
||||||
compares them, to test the filesystem code. The output is somewhat
|
compares them, to test the filesystem code. The output is somewhat
|
||||||
|
|
|
@ -1134,6 +1134,38 @@ ENTRY(cls)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nocursor()
|
||||||
|
* BIOS call "INT 10H Function 01h" to set cursor type
|
||||||
|
* Call with %ah = 0x01
|
||||||
|
* %ch = cursor starting scanline
|
||||||
|
* %cl = cursor ending scanline
|
||||||
|
*/
|
||||||
|
|
||||||
|
ENTRY(nocursor)
|
||||||
|
push %ebp
|
||||||
|
push %eax
|
||||||
|
push %ebx /* save EBX */
|
||||||
|
push %edx
|
||||||
|
|
||||||
|
call EXT_C(prot_to_real)
|
||||||
|
.code16
|
||||||
|
|
||||||
|
movw $0x2000, %cx
|
||||||
|
movb $0x1, %ah
|
||||||
|
int $0x10
|
||||||
|
|
||||||
|
data32
|
||||||
|
call EXT_C(real_to_prot)
|
||||||
|
.code32
|
||||||
|
|
||||||
|
pop %edx
|
||||||
|
pop %ebx
|
||||||
|
pop %eax
|
||||||
|
pop %ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getxy()
|
* getxy()
|
||||||
* BIOS call "INT 10H Function 03h" to get cursor position
|
* BIOS call "INT 10H Function 03h" to get cursor position
|
||||||
|
|
|
@ -78,6 +78,10 @@ char *password;
|
||||||
/* True when the debug mode is turned on, and false when it is turned off. */
|
/* True when the debug mode is turned on, and false when it is turned off. */
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
|
|
||||||
|
/* Color settings */
|
||||||
|
int normal_color;
|
||||||
|
int highlight_color;
|
||||||
|
|
||||||
char *
|
char *
|
||||||
skip_to(int after_equal, char *cmdline)
|
skip_to(int after_equal, char *cmdline)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +111,7 @@ char commands[] =
|
||||||
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\",
|
\"rootnoverify= <device>\", \"chainloader= <file>\", \"kernel= <file> ...\",
|
||||||
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
|
\"testload= <file>\", \"read= <addr>\", \"displaymem\", \"impsprobe\",
|
||||||
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
|
\"fstest\", \"debug\", \"module= <file> ...\", \"modulenounzip= <file> ...\",
|
||||||
\"makeactive\", \"boot\", and
|
\"color= <normal> [<highlight>]\", \"makeactive\", \"boot\", and
|
||||||
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
|
\"install= <stage1_file> [d] <dest_dev> <file> <addr> [p] [<config_file>]\"\n";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -632,6 +636,24 @@ returnit:
|
||||||
grub_printf (" Debug mode is turned on\n");
|
grub_printf (" Debug mode is turned on\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (substring ("color", cur_heap) < 1)
|
||||||
|
{
|
||||||
|
char *normal;
|
||||||
|
char *highlight;
|
||||||
|
|
||||||
|
normal = cur_cmdline;
|
||||||
|
highlight = skip_to (0, normal);
|
||||||
|
|
||||||
|
if (safe_parse_maxint (&normal, &normal_color))
|
||||||
|
{
|
||||||
|
/* The second argument is optional, so set highlight_color
|
||||||
|
to inverted NORMAL_COLOR. */
|
||||||
|
if (*highlight == 0
|
||||||
|
|| ! safe_parse_maxint (&highlight, &highlight_color))
|
||||||
|
highlight_color = ((normal_color >> 4)
|
||||||
|
| ((normal_color & 0xf) << 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (*cur_heap && *cur_heap != ' ')
|
else if (*cur_heap && *cur_heap != ' ')
|
||||||
errnum = ERR_UNRECOGNIZED;
|
errnum = ERR_UNRECOGNIZED;
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,8 @@ extern void (*debug_fs) (int);
|
||||||
extern void (*debug_fs_func) (int);
|
extern void (*debug_fs_func) (int);
|
||||||
/* The flag for debug mode. */
|
/* The flag for debug mode. */
|
||||||
extern int debug;
|
extern int debug;
|
||||||
|
/* Color settings */
|
||||||
|
extern int normal_color, highlight_color;
|
||||||
#endif /* STAGE1_5 */
|
#endif /* STAGE1_5 */
|
||||||
|
|
||||||
extern unsigned long current_drive;
|
extern unsigned long current_drive;
|
||||||
|
@ -425,6 +427,11 @@ int getrtsecs (void);
|
||||||
/* Clear the screen. */
|
/* Clear the screen. */
|
||||||
void cls (void);
|
void cls (void);
|
||||||
|
|
||||||
|
#ifndef GRUB_UTIL
|
||||||
|
/* Turn off cursor. */
|
||||||
|
void nocursor (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the current cursor position (where 0,0 is the top left hand
|
/* Get the current cursor position (where 0,0 is the top left hand
|
||||||
corner of the screen). Returns packed values, (RET >> 8) is x,
|
corner of the screen). Returns packed values, (RET >> 8) is x,
|
||||||
(RET & 0xff) is y. */
|
(RET & 0xff) is y. */
|
||||||
|
|
|
@ -89,6 +89,19 @@ print_border(int y, int size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifndef GRUB_UTIL
|
||||||
|
/* Color the menu. The menu is 75 * 14 characters. */
|
||||||
|
for (i = 0; i < 14; i++)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < 75; j++)
|
||||||
|
{
|
||||||
|
gotoxy (j + 1, i + y);
|
||||||
|
set_attrib (normal_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gotoxy(1, y);
|
gotoxy(1, y);
|
||||||
|
|
||||||
putchar(DISP_UL);
|
putchar(DISP_UL);
|
||||||
|
@ -152,6 +165,9 @@ restart:
|
||||||
}
|
}
|
||||||
|
|
||||||
init_page();
|
init_page();
|
||||||
|
#ifndef GRUB_UTIL
|
||||||
|
nocursor();
|
||||||
|
#endif
|
||||||
|
|
||||||
print_border(3, 12);
|
print_border(3, 12);
|
||||||
|
|
||||||
|
@ -178,8 +194,13 @@ restart:
|
||||||
|
|
||||||
print_entries(3, 12, first_entry, menu_entries);
|
print_entries(3, 12, first_entry, menu_entries);
|
||||||
|
|
||||||
/* invert initial line */
|
/* highlight initial line */
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_REVERSE);
|
set_line (4 + entryno, A_REVERSE);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, highlight_color);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* XX using RT clock now, need to initialize value */
|
/* XX using RT clock now, need to initialize value */
|
||||||
while ((time1 = getrtsecs()) == 0xFF);
|
while ((time1 = getrtsecs()) == 0xFF);
|
||||||
|
@ -222,15 +243,27 @@ restart:
|
||||||
{
|
{
|
||||||
if (entryno > 0)
|
if (entryno > 0)
|
||||||
{
|
{
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_NORMAL);
|
set_line (4 + entryno, A_NORMAL);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, normal_color);
|
||||||
|
#endif
|
||||||
entryno --;
|
entryno --;
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_REVERSE);
|
set_line (4 + entryno, A_REVERSE);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, highlight_color);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (first_entry > 0)
|
else if (first_entry > 0)
|
||||||
{
|
{
|
||||||
first_entry --;
|
first_entry --;
|
||||||
print_entries(3, 12, first_entry, menu_entries);
|
print_entries(3, 12, first_entry, menu_entries);
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4, A_REVERSE);
|
set_line (4, A_REVERSE);
|
||||||
|
#else
|
||||||
|
set_line (4, highlight_color);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((c == KEY_DOWN) || (ASCII_CHAR(c) == 14))
|
if (((c == KEY_DOWN) || (ASCII_CHAR(c) == 14))
|
||||||
|
@ -238,15 +271,27 @@ restart:
|
||||||
{
|
{
|
||||||
if (entryno < 11)
|
if (entryno < 11)
|
||||||
{
|
{
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_NORMAL);
|
set_line (4 + entryno, A_NORMAL);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, normal_color);
|
||||||
|
#endif
|
||||||
entryno ++;
|
entryno ++;
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_REVERSE);
|
set_line (4 + entryno, A_REVERSE);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, highlight_color);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (num_entries > 12+first_entry)
|
else if (num_entries > 12+first_entry)
|
||||||
{
|
{
|
||||||
first_entry ++;
|
first_entry ++;
|
||||||
print_entries (3, 12, first_entry, menu_entries);
|
print_entries (3, 12, first_entry, menu_entries);
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (15, A_REVERSE);
|
set_line (15, A_REVERSE);
|
||||||
|
#else
|
||||||
|
set_line (15, highlight_color);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +306,11 @@ restart:
|
||||||
{
|
{
|
||||||
if ((c == 'd') || (c == 'o') || (c == 'O'))
|
if ((c == 'd') || (c == 'o') || (c == 'O'))
|
||||||
{
|
{
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
set_line (4 + entryno, A_NORMAL);
|
set_line (4 + entryno, A_NORMAL);
|
||||||
|
#else
|
||||||
|
set_line (4 + entryno, normal_color);
|
||||||
|
#endif
|
||||||
/* insert after is almost exactly like insert before */
|
/* insert after is almost exactly like insert before */
|
||||||
if (c == 'o')
|
if (c == 'o')
|
||||||
{
|
{
|
||||||
|
@ -518,7 +567,12 @@ cmain(void)
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
config_len = 0; menu_len = 0; num_entries = 0; default_entry = 0;
|
config_len = 0;
|
||||||
|
menu_len = 0;
|
||||||
|
num_entries = 0;
|
||||||
|
default_entry = 0;
|
||||||
|
normal_color = A_NORMAL;
|
||||||
|
highlight_color = A_REVERSE;
|
||||||
config_entries = (char *)(mbi.mmap_addr + mbi.mmap_length);
|
config_entries = (char *)(mbi.mmap_addr + mbi.mmap_length);
|
||||||
menu_entries = (char *)(BUFFERADDR + (32 * 1024));
|
menu_entries = (char *)(BUFFERADDR + (32 * 1024));
|
||||||
password = NULL; fallback = -1; grub_timeout = -1;
|
password = NULL; fallback = -1; grub_timeout = -1;
|
||||||
|
@ -564,11 +618,28 @@ cmain(void)
|
||||||
{
|
{
|
||||||
if (substring ("timeout", cmdline) < 1)
|
if (substring ("timeout", cmdline) < 1)
|
||||||
safe_parse_maxint (&ptr, &grub_timeout);
|
safe_parse_maxint (&ptr, &grub_timeout);
|
||||||
if (substring("fallback", cmdline) < 1)
|
else if (substring ("fallback", cmdline) < 1)
|
||||||
safe_parse_maxint (&ptr, &fallback);
|
safe_parse_maxint (&ptr, &fallback);
|
||||||
if (substring("default", cmdline) < 1)
|
else if (substring ("default", cmdline) < 1)
|
||||||
safe_parse_maxint (&ptr, &default_entry);
|
safe_parse_maxint (&ptr, &default_entry);
|
||||||
if (substring("password", cmdline) < 1)
|
else if (substring ("color", cmdline) < 1)
|
||||||
|
{
|
||||||
|
char *normal;
|
||||||
|
char *highlight;
|
||||||
|
|
||||||
|
normal = ptr;
|
||||||
|
highlight = skip_to (0, normal);
|
||||||
|
|
||||||
|
if (safe_parse_maxint (&normal, &normal_color))
|
||||||
|
{
|
||||||
|
if (*highlight == 0
|
||||||
|
|| ! safe_parse_maxint (&highlight,
|
||||||
|
&highlight_color))
|
||||||
|
highlight_color = ((normal_color >> 4)
|
||||||
|
| ((normal_color & 0xf) << 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (substring ("password", cmdline) < 1)
|
||||||
{
|
{
|
||||||
password = config_entries;
|
password = config_entries;
|
||||||
while ((*(config_entries++) = *(ptr++)) != 0);
|
while ((*(config_entries++) = *(ptr++)) != 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue