aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--menu/complex.c2
-rw-r--r--menu/menu.c18
-rw-r--r--menu/menu.h3
-rw-r--r--menu/simple.c2
4 files changed, 22 insertions, 3 deletions
diff --git a/menu/complex.c b/menu/complex.c
index 94963474..dcdba8ab 100644
--- a/menu/complex.c
+++ b/menu/complex.c
@@ -137,9 +137,11 @@ int menumain(char *cmdline)
//set_title_info (-1,-1);
//set_misc_info(-1,-1,-1,-1);
+ // Register the menusystem handler
reg_handler(&msys_handler);
TESTING = add_menu(" Testing ");
+ set_menu_pos(5,60);
add_item("Memory Test","Perform extensive memory testing",OPT_RUN, "memtest",0);
add_item("Exit this menu","Go one level up",OPT_EXITMENU,"exit",0);
diff --git a/menu/menu.c b/menu/menu.c
index 20fb70d9..35288c1a 100644
--- a/menu/menu.c
+++ b/menu/menu.c
@@ -217,7 +217,7 @@ pt_menuitem runmenusystem(char top, char left, pt_menu cmenu)
{
pt_menuitem opt,choice;
int numitems;
- char startopt;
+ char startopt,row,col;
startopt = 0;
if (cmenu == NULL) return NULL;
@@ -245,7 +245,11 @@ startover:
// Call recursively for submenu
// Position the submenu below the current item,
// covering half the current window (horizontally)
- choice = runmenusystem(top+opt->index+2, left+3+(cmenu->menuwidth >> 1), ms->menus[opt->itemdata.submenunum]);
+ row = ms->menus[opt->itemdata.submenunum]->row;
+ col = ms->menus[opt->itemdata.submenunum]->col;
+ if (row == 0xFF) row = top+opt->index+2;
+ if (col == 0xFF) col = left+3+(cmenu->menuwidth >> 1);
+ choice = runmenusystem(row, col, ms->menus[opt->itemdata.submenunum]);
if (choice==NULL) // User hit Esc in submenu
{
// Startover
@@ -402,6 +406,8 @@ char add_menu(const char *title) // Create a new menu and return its position
if (m == NULL) return -1;
ms->menus[num] = m;
m->numitems = 0;
+ m->row = 0xFF;
+ m->col = 0xFF;
for (i=0; i < MAXMENUSIZE; i++) m->items[i] = NULL;
if (title)
@@ -416,6 +422,14 @@ char add_menu(const char *title) // Create a new menu and return its position
return ms->nummenus - 1;
}
+void set_menu_pos(char row,char col) // Set the position of this menu.
+{
+pt_menu m;
+
+ m = ms->menus[ms->nummenus-1];
+ m->row = row;
+ m->col = col;
+}
pt_menuitem add_sep() // Add a separator to current menu
{
diff --git a/menu/menu.h b/menu/menu.h
index dd15320f..291787ae 100644
--- a/menu/menu.h
+++ b/menu/menu.h
@@ -140,6 +140,7 @@ typedef struct s_menu {
const char *title;
char numitems;
char menuwidth;
+ char row,col; // Position where this menu should be displayed
} t_menu;
typedef t_menu *pt_menu; // Pointer to type menu
@@ -208,6 +209,8 @@ char add_menu(const char *title); // This pointer value is stored internally
// Add item to the "current" menu // pointer values are stored internally
pt_menuitem add_item(const char *item, const char *status, t_action action, const char *data, char itemdata);
+void set_menu_pos(char row,char col); // Set the position of this menu.
+
// Add a separator to the "current" menu
pt_menuitem add_sep();
diff --git a/menu/simple.c b/menu/simple.c
index aeaa6b73..b23da429 100644
--- a/menu/simple.c
+++ b/menu/simple.c
@@ -49,6 +49,7 @@ int menumain(char *cmdline)
// unused otherwise.
TESTING = add_menu(" Testing ");
+ add_item("Self Loop","Go to testing",OPT_SUBMENU,NULL,TESTING);
add_item("Memory Test","Perform extensive memory testing",OPT_RUN, "memtest",0);
add_item("Exit this menu","Go one level up",OPT_EXITMENU,"exit",0);
@@ -78,4 +79,3 @@ int menumain(char *cmdline)
}
return 0;
}
-