* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
+2007-12-25 Robert Millan <rmh@aybabtu.com>
+
+ * include/grub/term.h (struct grub_term): Add `getcolor' function.
+ (grub_getcolor): New function.
+
+ * kern/term.c (grub_getcolor): New function.
+ * normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
+ (GRUB_COLOR_MENU_HIGHLIGHT): New macro.
+ (print_entry): Set normal and highlight colors to
+ `GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
+ respectively, before printing and restore them to old
+ values afterwards.
+ (grub_menu_init_page): Likewise. Fill an additional colored space
+ that would otherwise be left blank.
+
+ * term/efi/console.c (grub_console_getcolor): New function.
+ (struct grub_console_term.getcolor): New variable.
+ * term/i386/pc/console.c (grub_console_getcolor): New function.
+ (struct grub_console_term.getcolor): New variable.
+ * term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
+ (struct grub_console_term.getcolor): New variable.
+
+ * term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
+ (struct grub_console_term.setcolor): Remove variable.
+ * term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
+ (struct grub_console_term.setcolor): Remove variable.
+ * term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
+ (struct grub_console_term.setcolor): Remove variable.
+ * term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
+ (struct grub_console_term.setcolor): Remove variable.
+
2007-12-25 Robert Millan <rmh@aybabtu.com>
* configure.ac: Search for possible unifont.hex locations, and
color is VGA's. */
void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color);
+ /* Get the normal color and the highlight color. The format of each
+ color is VGA's. */
+ void (*getcolor) (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
+
/* Turn on/off the cursor. */
void (*setcursor) (int on);
void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state);
void EXPORT_FUNC(grub_setcolor) (grub_uint8_t normal_color,
grub_uint8_t highlight_color);
+void EXPORT_FUNC(grub_getcolor) (grub_uint8_t *normal_color,
+ grub_uint8_t *highlight_color);
int EXPORT_FUNC(grub_setcursor) (int on);
int EXPORT_FUNC(grub_getcursor) (void);
void EXPORT_FUNC(grub_refresh) (void);
(grub_cur_term->setcolor) (normal_color, highlight_color);
}
+void
+grub_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+{
+ if (grub_cur_term->getcolor)
+ (grub_cur_term->getcolor) (normal_color, highlight_color);
+}
+
int
grub_setcursor (int on)
{
#include <grub/env.h>
#include <grub/script.h>
+#define GRUB_COLOR_MENU_NORMAL 0x07
+#define GRUB_COLOR_MENU_HIGHLIGHT 0x70
+
static void
draw_border (void)
{
grub_ssize_t len;
grub_uint32_t *unicode_title;
grub_ssize_t i;
-
+ grub_uint8_t normal_code, highlight_code;
+
title = entry ? entry->title : "";
unicode_title = grub_malloc (grub_strlen (title) * sizeof (*unicode_title));
if (! unicode_title)
return;
}
+ grub_getcolor (&normal_code, &highlight_code);
+ grub_setcolor (GRUB_COLOR_MENU_NORMAL, GRUB_COLOR_MENU_HIGHLIGHT);
grub_setcolorstate (highlight
? GRUB_TERM_COLOR_HIGHLIGHT
: GRUB_TERM_COLOR_NORMAL);
x++;
}
}
+ grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+ grub_putchar (' ');
+
grub_gotoxy (GRUB_TERM_CURSOR_X, y);
+ grub_setcolor (normal_code, highlight_code);
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
grub_free (unicode_title);
}
void
grub_menu_init_page (int nested, int edit)
{
+ grub_uint8_t normal_code, highlight_code;
+ grub_getcolor (&normal_code, &highlight_code);
+ grub_setcolor (GRUB_COLOR_MENU_NORMAL, GRUB_COLOR_MENU_HIGHLIGHT);
+
grub_normal_init_page ();
draw_border ();
print_message (nested, edit);
+
+ grub_setcolor (normal_code, highlight_code);
}
/* Return the current timeout. If the variable "timeout" is not set or
grub_console_highlight_color = highlight_color;
}
+static void
+grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+{
+ *normal_color = grub_console_normal_color;
+ *highlight_color = grub_console_highlight_color;
+}
+
static void
grub_console_setcursor (int on)
{
.cls = grub_console_cls,
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
+ .getcolor = grub_console_getcolor,
.setcursor = grub_console_setcursor,
.flags = 0,
.next = 0
}
}
-static void
-grub_virtual_screen_setcolor (grub_uint8_t normal_color,
- grub_uint8_t highlight_color)
-{
- virtual_screen.fg_color_setting = grub_video_map_color (normal_color);
- virtual_screen.bg_color_setting = grub_video_map_color (highlight_color);
-}
-
static void
grub_gfxterm_setcursor (int on)
{
.gotoxy = grub_gfxterm_gotoxy,
.cls = grub_gfxterm_cls,
.setcolorstate = grub_virtual_screen_setcolorstate,
- .setcolor = grub_virtual_screen_setcolor,
.setcursor = grub_gfxterm_setcursor,
.refresh = grub_gfxterm_refresh,
.flags = 0,
grub_console_highlight_color = highlight_color;
}
+static void
+grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+{
+ *normal_color = grub_console_normal_color;
+ *highlight_color = grub_console_highlight_color;
+}
+
static struct grub_term grub_console_term =
{
.name = "console",
.cls = grub_console_cls,
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
+ .getcolor = grub_console_getcolor,
.setcursor = grub_console_setcursor,
.flags = 0,
.next = 0
keep_track = 1;
}
-static void
-grub_serial_setcolor (grub_uint8_t normal_color __attribute__ ((unused)),
- grub_uint8_t highlight_color __attribute__ ((unused)))
-{
- /* FIXME */
-}
-
static void
grub_serial_setcursor (const int on)
{
.gotoxy = grub_serial_gotoxy,
.cls = grub_serial_cls,
.setcolorstate = grub_serial_setcolorstate,
- .setcolor = grub_serial_setcolor,
.setcursor = grub_serial_setcursor,
.flags = 0,
.next = 0
}
}
-static void
-grub_virtual_screen_setcolor (grub_uint8_t normal_color __attribute__ ((unused)),
- grub_uint8_t highlight_color __attribute__ ((unused)))
-{
- /* FIXME */
-}
-
static void
grub_vesafb_setcursor (int on)
{
.gotoxy = grub_vesafb_gotoxy,
.cls = grub_vesafb_cls,
.setcolorstate = grub_virtual_screen_setcolorstate,
- .setcolor = grub_virtual_screen_setcolor,
.setcursor = grub_vesafb_setcursor,
.flags = 0,
.next = 0
}
}
-static void
-grub_vga_setcolor (grub_uint8_t normal_color __attribute__ ((unused)),
- grub_uint8_t highlight_color __attribute__ ((unused)))
-{
- /* FIXME */
-}
-
static void
grub_vga_setcursor (int on)
{
.gotoxy = grub_vga_gotoxy,
.cls = grub_vga_cls,
.setcolorstate = grub_vga_setcolorstate,
- .setcolor = grub_vga_setcolor,
.setcursor = grub_vga_setcursor,
.flags = 0,
.next = 0
bgcolor = highlight_color;
}
+static void
+grub_ofconsole_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+{
+ *normal_color = fgcolor;
+ *highlight_color = bgcolor;
+}
+
static int
grub_ofconsole_readkey (int *key)
{
.cls = grub_ofconsole_cls,
.setcolorstate = grub_ofconsole_setcolorstate,
.setcolor = grub_ofconsole_setcolor,
+ .getcolor = grub_ofconsole_getcolor,
.setcursor = grub_ofconsole_setcursor,
.refresh = grub_ofconsole_refresh,
.flags = 0,