From c7d9ee8f4552a62962dae614d5dcb3ef7dd9ce0e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 19 Feb 2008 18:34:14 -0800 Subject: [PATCH] Make sure color directives get attached to the proper menu. Color directives would always end up attached to the root menu, no matter what menu declaration they where actually located in. --- com32/menu/colors.c | 1 + com32/menu/menu.h | 2 +- com32/menu/menumain.c | 2 +- com32/menu/readconfig.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/com32/menu/colors.c b/com32/menu/colors.c index 9b1a19a..cfd91f1 100644 --- a/com32/menu/colors.c +++ b/com32/menu/colors.c @@ -62,6 +62,7 @@ static const struct color_table default_colors[] = { #define NCOLORS (sizeof default_colors/sizeof default_colors[0]) const int message_base_color = NCOLORS; +const int menu_color_table_size = NCOLORS+256; /* Algorithmically generate the msgXX colors */ void set_msg_colors_global(struct color_table *tbl, diff --git a/com32/menu/menu.h b/com32/menu/menu.h index 5aeb48f..b1a98a2 100644 --- a/com32/menu/menu.h +++ b/com32/menu/menu.h @@ -189,7 +189,7 @@ int menu_main(int argc, char *argv[]); void console_prepare(void); void console_cleanup(void); -extern const int message_base_color; +extern const int message_base_color, menu_color_table_size; int mygetkey(clock_t timeout); int show_message_file(const char *filename, const char *background); diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c index 7304986..59ba32a 100644 --- a/com32/menu/menumain.c +++ b/com32/menu/menumain.c @@ -659,7 +659,7 @@ static void prepare_screen_for_menu(void) { console_color_table = cm->color_table; - console_color_table_size = message_base_color+256; + console_color_table_size = menu_color_table_size; set_background(cm->menu_background); } diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c index 9a0697f..7efee91 100644 --- a/com32/menu/readconfig.c +++ b/com32/menu/readconfig.c @@ -627,8 +627,8 @@ static void parse_config_file(FILE *f) int i; struct color_table *cptr; p = skipspace(ep); - cptr = console_color_table; - for ( i = 0; i < console_color_table_size; i++ ) { + cptr = m->color_table; + for ( i = 0; i < menu_color_table_size; i++ ) { if ( (ep = looking_at(p, cptr->name)) ) { p = skipspace(ep); if (*p) { -- 2.7.4