Make sure color directives get attached to the proper menu.
authorH. Peter Anvin <hpa@zytor.com>
Wed, 20 Feb 2008 02:34:14 +0000 (18:34 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 20 Feb 2008 02:34:14 +0000 (18:34 -0800)
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
com32/menu/menu.h
com32/menu/menumain.c
com32/menu/readconfig.c

index 9b1a19a..cfd91f1 100644 (file)
@@ -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,
index 5aeb48f..b1a98a2 100644 (file)
@@ -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);
 
index 7304986..59ba32a 100644 (file)
@@ -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);
 }
 
index 9a0697f..7efee91 100644 (file)
@@ -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) {