2008-01-05 Robert Millan <rmh@aybabtu.com>

* include/grub/normal.h (grub_env_write_color_normal): New prototype.
	(grub_env_write_color_highlight): Likewise.
	(grub_wait_after_message): Likewise.

	* normal/color.c: New file.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* normal/menu_entry.c (run): Rely on grub_wait_after_message()
	for waiting after a message is printed.
	* normal/main.c (read_config_file): Likewise.
	(grub_normal_init): Register grub_env_write_color_normal() and
	grub_env_write_color_highlight() hooks.  Mark `color_normal' and
	`color_highlight' variables as global.

	* normal/menu.c (grub_wait_after_message): New function.
	(grub_color_menu_normal): New variable.  Replaces ...
	(GRUB_COLOR_MENU_NORMAL): ... this macro.
	(grub_color_menu_highlight): New variable.  Replaces ...
	(GRUB_COLOR_MENU_HIGHLIGHT): ... this macro.
	(draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of
	`GRUB_TERM_COLOR_STANDARD'.
	(print_message): Use `grub_setcolorstate' to reload colors.  Rename
	`normal_code' and `highlight_code' to `old_color_normal' and
	`old_color_highlight', respectively.
	(grub_menu_init_page): Update colors when drawing the menu, based on
	`menu_color_normal' and `menu_color_highlight' variables.
	(grub_menu_run): Rely on grub_wait_after_message() for waiting after
	a message is printed.
This commit is contained in:
robertmh 2008-01-05 12:10:28 +00:00
parent 182dd4e568
commit 0ece25b1e1
13 changed files with 188 additions and 62 deletions

View file

@ -1,7 +1,7 @@
/* main.c - the normal mode main routine */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2005,2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -268,12 +268,7 @@ read_config_file (const char *config, int nested)
grub_file_close (file);
if (errors > 0)
{
/* Wait until the user pushes any key so that the user can
see what happened. */
grub_printf ("\nPress any key to continue...");
(void) grub_getkey ();
}
grub_wait_after_message ();
return newmenu;
}
@ -527,6 +522,14 @@ GRUB_MOD_INIT(normal)
grub_rescue_register_command ("normal", grub_rescue_cmd_normal,
"enter normal mode");
/* Reload terminal colors when these variables are written to. */
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);
grub_register_variable_hook ("color_highlight", NULL, grub_env_write_color_highlight);
/* Preserve hooks after context changes. */
grub_env_export ("color_normal");
grub_env_export ("color_highlight");
/* This registers some built-in commands. */
grub_command_init ();
}