timeout_msg Timeout message
timeout Timeout counter
help Help text
+ msgXX Message (F-key) file attribute XX
+ ... where XX is two hexadecimal digits (the "plain text" is 07).
"ansi" is a sequence of semicolon-separated ECMA-48 Set
Graphics Rendition (<ESC>[m) sequences:
These are used (a) in text mode, and (b) on the serial
console.
-
"foreground" and "background" are color codes in #AARRGGBB
notation, where AA RR GG BB are hexadecimal digits for alpha
(opacity), red, green and blue, respectively. #00000000
represents fully transparent, and #ffffffff represents opaque
white.
-
"shadow" controls the handling of the graphical console text
shadow. Permitted values are "none" (no shadowing), "std" or
"standard" (standard shadowing - foreground pixels are
raised), "all" (both background and foreground raised), and
"rev" or "reverse" (background pixels are raised.)
-
If any field is set to "*" or omitted (at the end of the line)
then that field is left unchanged.
menu color timeout_msg 37;40 #80ffffff #00000000 std
menu color timeout 1;37;40 #c0ffffff #00000000 std
menu color help 37;40 #c0ffffff #00000000 std
+ menu color msg07 37;40 #c0ffffff #40000000 std
MENU WIDTH 80
screen (25 for text mode, 28 for VESA graphics mode.)
+F1 textfile background
+...
+F12 textfile background
+
+ Displays full-screen help (also available at the command line.)
+ The same control code sequences as in the command line
+ interface are supported, although some are ignored.
+
+ Additionally, a second argument allows a different background
+ image to be displayed.
+
+
The menu system honours the TIMEOUT command; if TIMEOUT is specified
it will execute the ONTIMEOUT command if one exists, otherwise it will
pick the default menu option.
};
#define NCOLORS (sizeof default_color_table/sizeof(struct color_table))
+const int message_base_color = NCOLORS;
struct menu_parameter mparm[] = {
{ "width", 80 },
#define HSHIFT mparm[11].value
#define VSHIFT mparm[12].value
+void set_msg_colors_global(unsigned int fg, unsigned int bg,
+ enum color_table_shadow shadow)
+{
+ struct color_table *cp = console_color_table+message_base_color;
+ unsigned int i;
+ unsigned int fgh, bgh;
+
+ static const unsigned int pc2rgb[8] =
+ { 0x000000, 0x0000ff, 0x00ff00, 0x00ffff, 0xff0000, 0xff00ff, 0xffff00,
+ 0xffffff };
+
+ fg &= 0xff000000; /* Alpha only */
+ bg &= 0xff000000; /* Alpha only */
+
+ fgh = (0x80000000+(fg >> 1)) & 0xff000000;
+ bgh = (0x80000000+(bg >> 1)) & 0xff000000;
+
+ for (i = 0; i < 256; i++) {
+ cp->argb_fg = pc2rgb[i & 7] | ((i & 0x08) ? fgh : fg);
+ cp->argb_bg = pc2rgb[(i >> 4) & 7] | ((i & 0x80) ? bgh : bg);
+ cp->shadow = shadow;
+ cp++;
+ }
+}
+
static void
install_default_color_table(void)
{
unsigned int i;
const struct color_table *dp;
struct color_table *cp;
- static struct color_table color_table[NCOLORS];
+ static struct color_table color_table[NCOLORS+256];
+ static const int pc2ansi[8] = {0, 4, 2, 6, 1, 5, 3, 7};
dp = default_color_table;
cp = color_table;
dp++;
}
+ for (i = 0; i < 256; i++) {
+ if (!cp->name)
+ asprintf((char **)&cp->name, "msg%02x", i);
+
+ if (cp->ansi)
+ free((void *)cp->ansi);
+
+ asprintf((char **)&cp->ansi, "%s3%d;4%d", (i & 8) ? "1;" : "",
+ pc2ansi[i & 7], pc2ansi[(i >> 4) & 7]);
+
+ cp++;
+ }
+
console_color_table = color_table;
- console_color_table_size = NCOLORS;
+ console_color_table_size = NCOLORS+256;
+
+ set_msg_colors_global(0xc0000000, 0x40000000, SHADOW_NORMAL);
}
static char *
static jmp_buf timeout_jump;
-static int mygetkey(clock_t timeout)
+int mygetkey(clock_t timeout)
{
clock_t t0, t;
clock_t tto, to;
}
}
+static void show_fkey(int key)
+{
+ int fkey;
+
+ while (1) {
+ switch (key) {
+ case KEY_F1: fkey = 0; break;
+ case KEY_F2: fkey = 1; break;
+ case KEY_F3: fkey = 2; break;
+ case KEY_F4: fkey = 3; break;
+ case KEY_F5: fkey = 4; break;
+ case KEY_F6: fkey = 5; break;
+ case KEY_F7: fkey = 6; break;
+ case KEY_F8: fkey = 7; break;
+ case KEY_F9: fkey = 8; break;
+ case KEY_F10: fkey = 9; break;
+ case KEY_F11: fkey = 10; break;
+ case KEY_F12: fkey = 11; break;
+ default: fkey = -1; break;
+ }
+
+ if (fkey == -1)
+ break;
+
+ if (fkeyhelp[fkey].textname)
+ key = show_message_file(fkeyhelp[fkey].textname,
+ fkeyhelp[fkey].background);
+ else
+ break;
+ }
+}
+
static const char *
edit_cmdline(char *input, int top)
{
}
break;
+ case KEY_F1:
+ case KEY_F2:
+ case KEY_F3:
+ case KEY_F4:
+ case KEY_F5:
+ case KEY_F6:
+ case KEY_F7:
+ case KEY_F8:
+ case KEY_F9:
+ case KEY_F10:
+ case KEY_F11:
+ case KEY_F12:
+ show_fkey(key);
+ redraw = 1;
+ break;
+
default:
if ( key >= ' ' && key <= 0xFF && len < MAX_CMDLINE_LEN-1 ) {
if ( cursor == len ) {
top = max(0, nentries-MENU_ROWS);
break;
+ case KEY_F1:
+ case KEY_F2:
+ case KEY_F3:
+ case KEY_F4:
+ case KEY_F5:
+ case KEY_F6:
+ case KEY_F7:
+ case KEY_F8:
+ case KEY_F9:
+ case KEY_F10:
+ case KEY_F11:
+ case KEY_F12:
+ show_fkey(key);
+ clear = 1;
+ break;
+
case KEY_TAB:
if ( allowedit ) {
int ok = 1;