mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-22 07:12:39 +00:00
The state was 0 - normal or 1 - highlight.
The state is now defined using an enum called color_state.
* stage2/term.h (color_state): New enum.
(COLOR_STATE_STANDARD): Standard color to use when not using user defined.
(COLOR_STATE_NORMAL): User defined normal color.
(COLOR_STATE_HIGHLIGHT): User defined highlight color.
(console_highlight): Renamed to console_setcolorstate.
(serial_highlight): Renamed to serial_setcolorstate.
(hercules_highlight): Renamed to hercules_setcolorstate.
* stage2/hercules.c (herc_highlight_state): Removed.
(herc_standard_color): New variable.
(herc_color_state): Likewise.
(herc_highlight): Renamed to herc_setcolorstate.
(herc_setcolorstate): Added switch to handle new states.
* stage2/console.c (console_highlight_state): Removed.
(console_standard_color): New variable.
(console_color_state): Likewise.
(console_highlight): Renamed to console_setcolorstate.
(console_setcolorstate): Added switch to handle new states.
* stage2/serial.c (serial_highlight): Renamed to serial_setcolorstate.
(serial_setcolorstate): Adjusted 'if' to suit new states.
* grub/asmstub.c (console_highlight): Renamed to console_setcolorstate.
(console_setcolorstate): Adjusted 'if' to suit new states.
* stage2/stage2.c (print_entry): Set color states using new states.
(print_border): Likewise.
* stage2/stage2.c (run_menu): Reverse if (!) to if () for uniformitty.
63 lines
2.0 KiB
C
63 lines
2.0 KiB
C
/* term_console.c - console input and output */
|
|
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 2002 Free Software Foundation, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include <shared.h>
|
|
#include <term.h>
|
|
|
|
/* These functions are defined in asm.S instead of this file:
|
|
console_putchar, console_checkkey, console_getkey, console_getxy,
|
|
console_gotoxy, console_cls, and console_nocursor. */
|
|
|
|
int console_current_color = A_NORMAL;
|
|
static int console_standard_color = A_NORMAL;
|
|
static int console_normal_color = A_NORMAL;
|
|
static int console_highlight_color = A_REVERSE;
|
|
static color_state console_color_state = COLOR_STATE_STANDARD;
|
|
|
|
void
|
|
console_setcolorstate (color_state state)
|
|
{
|
|
switch (state) {
|
|
case COLOR_STATE_STANDARD:
|
|
console_current_color = console_standard_color;
|
|
break;
|
|
case COLOR_STATE_NORMAL:
|
|
console_current_color = console_normal_color;
|
|
break;
|
|
case COLOR_STATE_HIGHLIGHT:
|
|
console_current_color = console_highlight_color;
|
|
break;
|
|
default:
|
|
console_current_color = console_standard_color;
|
|
break;
|
|
}
|
|
|
|
console_color_state = state;
|
|
}
|
|
|
|
void
|
|
console_setcolor (int normal_color, int highlight_color)
|
|
{
|
|
console_normal_color = normal_color;
|
|
console_highlight_color = highlight_color;
|
|
|
|
console_setcolorstate (console_color_state);
|
|
}
|