[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

View File

@@ -32,12 +32,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/settings.h>
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/ansicol.h>
#include <ipxe/login_ui.h>
#include <config/colour.h>
/* Colour pairs */
#define CPAIR_NORMAL 1
#define CPAIR_EDIT 2
/* Screen layout */
#define USERNAME_LABEL_ROW ( ( LINES / 2U ) - 4U )
@@ -66,8 +62,6 @@ int login_ui ( void ) {
/* Initialise UI */
initscr();
start_color();
init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
init_pair ( CPAIR_EDIT, COLOR_EDIT_FG, COLOR_EDIT_BG );
init_editbox ( &username_box, username, sizeof ( username ), NULL,
USERNAME_ROW, EDITBOX_COL, EDITBOX_WIDTH, 0 );
init_editbox ( &password_box, password, sizeof ( password ), NULL,

View File

@@ -31,13 +31,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/keys.h>
#include <ipxe/timer.h>
#include <ipxe/console.h>
#include <ipxe/ansicol.h>
#include <ipxe/menu.h>
#include <config/colour.h>
/* Colour pairs */
#define CPAIR_NORMAL 1
#define CPAIR_SELECT 2
#define CPAIR_SEPARATOR 3
/* Screen layout */
#define TITLE_ROW 1U
@@ -345,9 +340,6 @@ int show_menu ( struct menu *menu, unsigned long timeout,
/* Initialise screen */
initscr();
start_color();
init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
init_pair ( CPAIR_SELECT, COLOR_SELECT_FG, COLOR_SELECT_BG );
init_pair ( CPAIR_SEPARATOR, COLOR_SEPARATOR_FG, COLOR_SEPARATOR_BG );
color_set ( CPAIR_NORMAL, NULL );
curs_set ( 0 );
erase();

View File

@@ -28,8 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/settings.h>
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/ansicol.h>
#include <ipxe/settings_ui.h>
#include <config/colour.h>
/** @file
*
@@ -37,13 +37,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
/* Colour pairs */
#define CPAIR_NORMAL 1
#define CPAIR_SELECT 2
#define CPAIR_EDIT 3
#define CPAIR_ALERT 4
#define CPAIR_URL 5
/* Screen layout */
#define TITLE_ROW 1U
#define SETTINGS_LIST_ROW 3U
@@ -598,11 +591,6 @@ int settings_ui ( struct settings *settings ) {
initscr();
start_color();
init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
init_pair ( CPAIR_SELECT, COLOR_SELECT_FG, COLOR_SELECT_BG );
init_pair ( CPAIR_EDIT, COLOR_EDIT_FG, COLOR_EDIT_BG );
init_pair ( CPAIR_ALERT, COLOR_ALERT_FG, COLOR_ALERT_BG );
init_pair ( CPAIR_URL, COLOR_URL_FG, COLOR_URL_BG );
color_set ( CPAIR_NORMAL, NULL );
curs_set ( 0 );
erase();