aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2005-08-26 00:51:49 +0000
committerhpa <hpa>2005-08-26 00:51:49 +0000
commitbbe54be15eeab564fa29b2808062e008547c9bb5 (patch)
treed7af6ab0896440b663bd6adf86fd4643d74db142
parentf2374b946f43a25a5a7d600077ba7422a6ca9cb7 (diff)
downloadsyslinux-bbe54be15eeab564fa29b2808062e008547c9bb5.tar.gz
syslinux-bbe54be15eeab564fa29b2808062e008547c9bb5.tar.xz
syslinux-bbe54be15eeab564fa29b2808062e008547c9bb5.zip
Allow customization of the menu layout.
-rw-r--r--README.menu13
-rw-r--r--com32/modules/menu.c28
-rw-r--r--com32/modules/menu.h9
-rw-r--r--com32/modules/readconfig.c12
4 files changed, 51 insertions, 11 deletions
diff --git a/README.menu b/README.menu
index 26a07b16..30561b42 100644
--- a/README.menu
+++ b/README.menu
@@ -108,6 +108,19 @@ MENU MASTER PASSWD passwd
work.
+MENU WIDTH 80
+MENU MARGIN 10
+MENU PASSWORDMARGIN 3
+MENU ROWS 12
+MENU TABMSGROW 18
+MENU CMDLINEROW 20
+MENU ENDROW 24
+MENU PASSWORDROW 11
+
+ These options control the layout of the menu on the screen.
+ The values above are the defaults.
+
+
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.
diff --git a/com32/modules/menu.c b/com32/modules/menu.c
index c403239b..3b900aca 100644
--- a/com32/modules/menu.c
+++ b/com32/modules/menu.c
@@ -77,14 +77,26 @@ static const struct menu_attrib default_attrib = {
static const struct menu_attrib *menu_attrib = &default_attrib;
-#define WIDTH 80
-#define MARGIN 10
-#define PASSWD_MARGIN 3
-#define MENU_ROWS 12
-#define TABMSG_ROW 18
-#define CMDLINE_ROW 20
-#define END_ROW 24
-#define PASSWD_ROW 11
+struct menu_parameter mparm[] = {
+ { "width", 80 },
+ { "margin", 10 },
+ { "passwordmargin", 3 },
+ { "rows", 12 },
+ { "tabmsgrow", 18 },
+ { "cmdlinerow", 20 },
+ { "endrow", 24 },
+ { "passwordrow", 11 },
+ { NULL, 0 }
+};
+
+#define WIDTH mparm[0].value
+#define MARGIN mparm[1].value
+#define PASSWD_MARGIN mparm[2].value
+#define MENU_ROWS mparm[3].value
+#define TABMSG_ROW mparm[4].value
+#define CMDLINE_ROW mparm[5].value
+#define END_ROW mparm[6].value
+#define PASSWD_ROW mparm[7].value
static char *
pad_line(const char *text, int align, int width)
diff --git a/com32/modules/menu.h b/com32/modules/menu.h
index 02df13ac..091a1337 100644
--- a/com32/modules/menu.h
+++ b/com32/modules/menu.h
@@ -1,7 +1,7 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
*
- * Copyright 2004 H. Peter Anvin - All Rights Reserved
+ * Copyright 2004-2005 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +34,13 @@ struct menu_entry {
extern struct menu_entry menu_entries[];
extern struct menu_entry *menu_hotkeys[256];
+struct menu_parameter {
+ const char *name;
+ int value;
+};
+
+extern struct menu_parameter mparm[];
+
extern int nentries;
extern int defentry;
extern int allowedit;
diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c
index c61a1e5c..c8c57c04 100644
--- a/com32/modules/readconfig.c
+++ b/com32/modules/readconfig.c
@@ -224,11 +224,19 @@ void parse_config(const char *filename)
ld.passwd = strdup(skipspace(p+6));
} else if ( looking_at(p, "master") ) {
p = skipspace(p+6);
- if ( looking_at (p, "passwd") ) {
+ if ( looking_at(p, "passwd") ) {
menu_master_passwd = strdup(skipspace(p+6));
}
} else {
- /* Unknown, ignore for now */
+ /* Unknown, check for parameters */
+ struct menu_parameter *pp;
+ for ( pp = mparm ; pp->name ; pp++ ) {
+ if ( looking_at(p, pp->name) ) {
+ p = skipspace(p+strlen(pp->name));
+ pp->value = atoi(p);
+ break;
+ }
+ }
}
} else if ( looking_at(p, "append") ) {
char *a = strdup(skipspace(p+6));