[mucurses] Use centralised concept of colour pairs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-12-07 21:00:09 +00:00
parent 7025f5c648
commit 259858950a
5 changed files with 14 additions and 43 deletions
+3 -8
View File
@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/keys.h>
#include <ipxe/timer.h>
#include <ipxe/uri.h>
#include <ipxe/ansicol.h>
#include <usr/dhcpmgmt.h>
#include <usr/autoboot.h>
@@ -41,10 +42,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
/* Colour pairs */
#define CPAIR_NORMAL 1
#define CPAIR_SELECT 2
/** A PXE boot menu item */
struct pxe_menu_item {
/** Boot Server type */
@@ -204,7 +201,7 @@ static void pxe_menu_draw_item ( struct pxe_menu *menu,
/* Draw row */
row = ( LINES - menu->num_items + index );
color_set ( ( selected ? CPAIR_SELECT : CPAIR_NORMAL ), NULL );
color_set ( ( selected ? CPAIR_PXE : CPAIR_DEFAULT ), NULL );
mvprintw ( row, 0, "%s", buf );
move ( row, 1 );
}
@@ -224,9 +221,7 @@ static int pxe_menu_select ( struct pxe_menu *menu ) {
/* Initialise UI */
initscr();
start_color();
init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLACK );
init_pair ( CPAIR_SELECT, COLOR_BLACK, COLOR_WHITE );
color_set ( CPAIR_NORMAL, NULL );
color_set ( CPAIR_DEFAULT, NULL );
/* Draw initial menu */
for ( i = 0 ; i < menu->num_items ; i++ )