groundwork for window port interface change to add_menu
groundwork only - window port interface change This changes the last parameter for add_menu() from a boolean to an unsigned int, to allow additional itemflags in future beyond just the "preselected" that the original boolean offered. There shouldn't be any functionality changes with this groundwork-only change, and if there are it is unintentional and should be reported.
This commit is contained in:
@@ -376,8 +376,9 @@ void NetHackQtBind::qt_start_menu(winid wid)
|
||||
|
||||
void NetHackQtBind::qt_add_menu(winid wid, int glyph,
|
||||
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
|
||||
const char *str, BOOLEAN_P presel)
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
NetHackQtWindow* window=id_to_window[(int)wid];
|
||||
window->AddMenu(glyph, identifier, ch, gch, attr,
|
||||
QString::fromLatin1(str),
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
static void qt_start_menu(winid wid);
|
||||
static void qt_add_menu(winid wid, int glyph,
|
||||
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
|
||||
const char *str, BOOLEAN_P presel);
|
||||
const char *str, unsigned int itemflags);
|
||||
static void qt_end_menu(winid wid, const char *prompt);
|
||||
static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
|
||||
static void qt_update_inventory();
|
||||
|
||||
@@ -4817,8 +4817,9 @@ void NetHackQtBind::qt_start_menu(winid wid)
|
||||
|
||||
void NetHackQtBind::qt_add_menu(winid wid, int glyph,
|
||||
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
|
||||
const char *str, BOOLEAN_P presel)
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
NetHackQtWindow* window=id_to_window[wid];
|
||||
window->AddMenu(glyph, identifier, ch, gch, attr, str, presel);
|
||||
}
|
||||
|
||||
@@ -854,7 +854,7 @@ class NetHackQtBind : NetHackQtBindBase
|
||||
static void qt_start_menu(winid wid);
|
||||
static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P ch, CHAR_P gch, int attr, const char *str,
|
||||
BOOLEAN_P presel);
|
||||
unsigned int itemflags);
|
||||
static void qt_end_menu(winid wid, const char *prompt);
|
||||
static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
|
||||
static void qt_update_inventory();
|
||||
|
||||
@@ -182,7 +182,7 @@ winid window;
|
||||
}
|
||||
|
||||
void
|
||||
chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
|
||||
chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph; /* glyph to display with item (unused) */
|
||||
const anything *identifier; /* what to return if selected */
|
||||
@@ -190,10 +190,11 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like tty_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* flags such as item is marked as selected
|
||||
MENU_ITEMFLAGS_SELECTED */
|
||||
{
|
||||
(*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier,
|
||||
ch, gch, attr, str, preselected);
|
||||
ch, gch, attr, str, itemflags);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -224,7 +224,7 @@ winid window;
|
||||
|
||||
void
|
||||
chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str,
|
||||
preselected)
|
||||
itemflags)
|
||||
void *vp;
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph; /* glyph to display with item (unused) */
|
||||
@@ -233,12 +233,12 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like tty_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* itemflags such as marked as selected */
|
||||
{
|
||||
struct chainout_data *tdp = vp;
|
||||
|
||||
(*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr,
|
||||
str, preselected);
|
||||
str, itemflags);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -370,7 +370,7 @@ winid window;
|
||||
}
|
||||
|
||||
void
|
||||
trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, preselected)
|
||||
trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, itemflags)
|
||||
void *vp;
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph; /* glyph to display with item (unused) */
|
||||
@@ -379,7 +379,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like tty_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* itemflags such as marked as selected */
|
||||
{
|
||||
struct trace_data *tdp = vp;
|
||||
|
||||
@@ -400,19 +400,19 @@ boolean preselected; /* item is marked as selected */
|
||||
|
||||
if (str) {
|
||||
fprintf(wc_tracelogf,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %d)\n", INDENT,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
|
||||
window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
|
||||
str, (int) strlen(str), preselected);
|
||||
str, (int) strlen(str), itemflags);
|
||||
} else {
|
||||
fprintf(wc_tracelogf,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %d)\n", INDENT,
|
||||
"%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %u)\n", INDENT,
|
||||
window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
|
||||
preselected);
|
||||
itemflags);
|
||||
}
|
||||
|
||||
PRE;
|
||||
(*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch,
|
||||
gch, attr, str, preselected);
|
||||
gch, attr, str, itemflags);
|
||||
POST;
|
||||
}
|
||||
|
||||
|
||||
@@ -744,19 +744,19 @@ curses_character_dialog(const char **choices, const char *prompt)
|
||||
|
||||
identifier.a_int = (count + 1); /* Must be non-zero */
|
||||
curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0,
|
||||
A_NORMAL, choices[count], FALSE);
|
||||
A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE);
|
||||
used_letters[count] = curletter;
|
||||
}
|
||||
|
||||
/* Random Selection */
|
||||
identifier.a_int = ROLE_RANDOM;
|
||||
curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random",
|
||||
FALSE);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
|
||||
/* Quit prompt */
|
||||
identifier.a_int = ROLE_NONE;
|
||||
curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit",
|
||||
FALSE);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
curses_end_menu(wid, prompt);
|
||||
ret = curses_select_menu(wid, PICK_ONE, &selected);
|
||||
if (ret == 1) {
|
||||
|
||||
@@ -491,7 +491,7 @@ curses_start_menu(winid wid)
|
||||
/*
|
||||
add_menu(winid wid, int glyph, const anything identifier,
|
||||
char accelerator, char groupacc,
|
||||
int attr, char *str, boolean preselected)
|
||||
int attr, char *str, unsigned int itemflags)
|
||||
-- Add a text line str to the given menu window. If identifier
|
||||
is 0, then the line cannot be selected (e.g. a title).
|
||||
Otherwise, identifier is the value returned if the line is
|
||||
@@ -517,14 +517,15 @@ add_menu(winid wid, int glyph, const anything identifier,
|
||||
The menu commands and aliases take care not to interfere
|
||||
with the default object class symbols.
|
||||
-- If you want this choice to be preselected when the
|
||||
menu is displayed, set preselected to TRUE.
|
||||
menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
|
||||
*/
|
||||
void
|
||||
curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
const char *str, BOOLEAN_P presel)
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
int curses_attr;
|
||||
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
|
||||
attr &= ~(ATR_URGENT | ATR_NOHISTORY);
|
||||
curses_attr = curses_convert_attr(attr);
|
||||
|
||||
@@ -373,14 +373,17 @@ curses_prev_mesg()
|
||||
for (count = 0; count < num_messages; ++count) {
|
||||
mesg = get_msg_line(do_lifo, count);
|
||||
if (turn != mesg->turn && count != 0) {
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE);
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE);
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str,
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
turn = mesg->turn;
|
||||
}
|
||||
if (!count)
|
||||
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL,
|
||||
"[No past messages available.]", FALSE);
|
||||
"[No past messages available.]",
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
|
||||
curses_end_menu(wid, "");
|
||||
if (!do_lifo)
|
||||
|
||||
@@ -251,7 +251,7 @@ Gem_player_selection()
|
||||
if (currch == lastch)
|
||||
currch = highc(currch);
|
||||
add_menu(win, roles[i].malenum, &any, currch, 0, ATR_NONE,
|
||||
an(roles[i].name.m), MENU_UNSELECTED);
|
||||
an(roles[i].name.m), MENU_ITEMFLAGS_NONE);
|
||||
lastch = currch;
|
||||
}
|
||||
}
|
||||
@@ -260,10 +260,10 @@ Gem_player_selection()
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrole(FALSE) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
end_menu(win, "Pick a role");
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
destroy_nhwindow(win);
|
||||
@@ -320,17 +320,17 @@ Gem_player_selection()
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
|
||||
ATR_NONE, races[i].noun, MENU_UNSELECTED);
|
||||
ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_race(flags.initrole, flags.initgend,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrace(flags.initrole) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the race of your %s",
|
||||
roles[flags.initrole].name.m);
|
||||
end_menu(win, pbuf);
|
||||
@@ -389,17 +389,17 @@ Gem_player_selection()
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
|
||||
ATR_NONE, genders[i].adj, MENU_UNSELECTED);
|
||||
ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_gend(flags.initrole, flags.initrace,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randgend(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the gender of your %s %s",
|
||||
races[flags.initrace].adj,
|
||||
roles[flags.initrole].name.m);
|
||||
@@ -458,17 +458,17 @@ Gem_player_selection()
|
||||
flags.initgend, i)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
|
||||
ATR_NONE, aligns[i].adj, MENU_UNSELECTED);
|
||||
ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_align(flags.initrole, flags.initrace,
|
||||
flags.initgend, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randalign(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the alignment of your %s %s %s",
|
||||
genders[flags.initgend].adj,
|
||||
races[flags.initrace].adj,
|
||||
@@ -754,7 +754,7 @@ boolean complain;
|
||||
* later.
|
||||
*/
|
||||
void
|
||||
Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
|
||||
Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph; /* glyph to display with item (unused) */
|
||||
const anything *identifier; /* what to return if selected */
|
||||
@@ -762,8 +762,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like Gem_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* itemflags such as marked as selected */
|
||||
{
|
||||
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
Gem_menu_item *G_item;
|
||||
const char *newstr;
|
||||
char buf[QBUFSZ];
|
||||
@@ -1014,7 +1015,7 @@ Gem_get_ext_cmd()
|
||||
too_much = FALSE;
|
||||
tmp_acc = *ptr;
|
||||
Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr,
|
||||
FALSE);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
Gem_end_menu(wind, "What extended command?");
|
||||
count = Gem_select_menu(wind, PICK_ONE, &selected);
|
||||
|
||||
@@ -681,10 +681,9 @@ gnome_start_menu(winid wid)
|
||||
/*
|
||||
add_menu(windid window, int glyph, const anything identifier,
|
||||
char accelerator, char groupacc,
|
||||
int attr, char *str, boolean preselected)
|
||||
int attr, char *str, unsigned int itemflags)
|
||||
-- Add a text line str to the given menu window. If
|
||||
identifier
|
||||
is 0, then the line cannot be selected (e.g. a title).
|
||||
identifier is 0, then the line cannot be selected (e.g. a title).
|
||||
Otherwise, identifier is the value returned if the line is
|
||||
selected. Accelerator is a keyboard key that can be used
|
||||
to select the line. If the accelerator of a selectable
|
||||
@@ -708,13 +707,14 @@ identifier
|
||||
The menu commands and aliases take care not to interfere
|
||||
with the default object class symbols.
|
||||
-- If you want this choice to be preselected when the
|
||||
menu is displayed, set preselected to TRUE.
|
||||
menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
|
||||
*/
|
||||
void
|
||||
gnome_add_menu(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
const char *str, BOOLEAN_P presel)
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
GHackMenuItem item;
|
||||
item.glyph = glyph;
|
||||
item.identifier = identifier;
|
||||
|
||||
@@ -242,7 +242,7 @@ winid window;
|
||||
* later.
|
||||
*/
|
||||
void
|
||||
safe_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
|
||||
safe_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph UNUSED; /* glyph to display with item (not used) */
|
||||
const anything *identifier; /* what to return if selected */
|
||||
@@ -250,7 +250,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like safe_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* itemflags such as marked as selected */
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ tty_player_selection()
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any = cg.zeroany; /* separator, not a choice */
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -677,7 +677,7 @@ tty_player_selection()
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -770,7 +770,7 @@ tty_player_selection()
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_ALGNMNT, win, FALSE);
|
||||
@@ -859,7 +859,7 @@ tty_player_selection()
|
||||
role_menu_extra(ROLE_RANDOM, win, TRUE);
|
||||
any.a_int = 0; /* separator, not a choice */
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
role_menu_extra(RS_ROLE, win, FALSE);
|
||||
role_menu_extra(RS_RACE, win, FALSE);
|
||||
role_menu_extra(RS_GENDER, win, FALSE);
|
||||
@@ -947,25 +947,25 @@ tty_player_selection()
|
||||
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
|
||||
: roles[ROLE].name.m);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, pbuf,
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
/* blank separator */
|
||||
any.a_int = 0;
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
/* [ynaq] menu choices */
|
||||
any.a_int = 1;
|
||||
add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game",
|
||||
MENU_SELECTED);
|
||||
MENU_ITEMFLAGS_SELECTED);
|
||||
any.a_int = 2;
|
||||
add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE,
|
||||
"No; choose role again", MENU_UNSELECTED);
|
||||
"No; choose role again", MENU_ITEMFLAGS_NONE);
|
||||
if (iflags.renameallowed) {
|
||||
any.a_int = 3;
|
||||
add_menu(win, NO_GLYPH, &any, 'a', 0, ATR_NONE,
|
||||
"Not yet; choose another name", MENU_UNSELECTED);
|
||||
"Not yet; choose another name", MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = -1;
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : "");
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -1040,22 +1040,22 @@ reset_role_filtering()
|
||||
|
||||
/* no extra blank line preceding this entry; end_menu supplies one */
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable roles", MENU_UNSELECTED);
|
||||
"Unacceptable roles", MENU_ITEMFLAGS_NONE);
|
||||
setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
|
||||
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable races", MENU_UNSELECTED);
|
||||
"Unacceptable races", MENU_ITEMFLAGS_NONE);
|
||||
setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
|
||||
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable genders", MENU_UNSELECTED);
|
||||
"Unacceptable genders", MENU_ITEMFLAGS_NONE);
|
||||
setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
|
||||
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
|
||||
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"Unacceptable alignments", MENU_UNSELECTED);
|
||||
"Unacceptable alignments", MENU_ITEMFLAGS_NONE);
|
||||
setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
|
||||
|
||||
end_menu(win, "Pick all that apply");
|
||||
@@ -1118,7 +1118,8 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */
|
||||
/* !filtering implies reset_role_filtering() where we want to
|
||||
mark this role as preseleted if current filter excludes it */
|
||||
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, an(rolenamebuf),
|
||||
(!filtering && !role_ok) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
(!filtering && !role_ok)
|
||||
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
|
||||
lastch = thisch;
|
||||
}
|
||||
}
|
||||
@@ -1152,7 +1153,8 @@ int role, gend, algn;
|
||||
filtering ? this_ch : highc(this_ch),
|
||||
filtering ? highc(this_ch) : 0,
|
||||
ATR_NONE, races[i].noun,
|
||||
(!filtering && !race_ok) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
(!filtering && !race_ok)
|
||||
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1183,7 +1185,8 @@ int role, race, algn;
|
||||
filtering ? this_ch : highc(this_ch),
|
||||
filtering ? highc(this_ch) : 0,
|
||||
ATR_NONE, genders[i].adj,
|
||||
(!filtering && !gend_ok) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
(!filtering && !gend_ok)
|
||||
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,7 +1217,8 @@ int role, race, gend;
|
||||
filtering ? this_ch : highc(this_ch),
|
||||
filtering ? highc(this_ch) : 0,
|
||||
ATR_NONE, aligns[i].adj,
|
||||
(!filtering && !algn_ok) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
(!filtering && !algn_ok)
|
||||
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2900,7 +2904,7 @@ winid window;
|
||||
* later.
|
||||
*/
|
||||
void
|
||||
tty_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
|
||||
tty_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
|
||||
winid window; /* window to use, must be of type NHW_MENU */
|
||||
int glyph UNUSED; /* glyph to display with item (not used) */
|
||||
const anything *identifier; /* what to return if selected */
|
||||
@@ -2908,8 +2912,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */
|
||||
char gch; /* group accelerator (0 = no group) */
|
||||
int attr; /* attribute for string (like tty_putstr()) */
|
||||
const char *str; /* menu string */
|
||||
boolean preselected; /* item is marked as selected */
|
||||
unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */
|
||||
{
|
||||
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
register struct WinDesc *cw = 0;
|
||||
tty_menu_item *item;
|
||||
const char *newstr;
|
||||
@@ -2944,6 +2949,7 @@ boolean preselected; /* item is marked as selected */
|
||||
item->identifier = *identifier;
|
||||
item->count = -1L;
|
||||
item->selected = preselected;
|
||||
item->itemflags = itemflags;
|
||||
item->selector = ch;
|
||||
item->gselector = gch;
|
||||
item->attr = attr;
|
||||
@@ -2999,9 +3005,9 @@ const char *prompt; /* prompt to for menu */
|
||||
|
||||
any = cg.zeroany; /* not selectable */
|
||||
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt,
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
|
||||
/* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */
|
||||
|
||||
@@ -34,6 +34,7 @@ typedef struct mswin_menu_item {
|
||||
int attr;
|
||||
char str[NHMENU_STR_SIZE];
|
||||
BOOLEAN_P presel;
|
||||
unsigned int itemflags;
|
||||
int count;
|
||||
BOOL has_focus;
|
||||
} NHMenuItem, *PNHMenuItem;
|
||||
@@ -627,6 +628,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
/* prevent & being interpreted as a mnemonic start */
|
||||
strNsubst(data->menu.items[new_item].str, "&", "&&", 0);
|
||||
data->menu.items[new_item].presel = msg_data->presel;
|
||||
data->menu.items[new_item].itemflags = msg_data->itemflags;
|
||||
|
||||
/* calculate tabstop size */
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct mswin_nhmsg_add_menu {
|
||||
int attr;
|
||||
const char *str;
|
||||
BOOLEAN_P presel;
|
||||
unsigned int itemflags;
|
||||
} MSNHMsgAddMenu, *PMSNHMsgAddMenu;
|
||||
|
||||
typedef struct mswin_nhmsg_cursor {
|
||||
|
||||
@@ -429,7 +429,7 @@ prompt_for_player_selection(void)
|
||||
Strcpy(rolenamebuf, roles[i].name.m);
|
||||
}
|
||||
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE,
|
||||
an(rolenamebuf), MENU_UNSELECTED);
|
||||
an(rolenamebuf), MENU_ITEMFLAGS_NONE);
|
||||
lastch = thisch;
|
||||
}
|
||||
}
|
||||
@@ -438,10 +438,10 @@ prompt_for_player_selection(void)
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrole(FALSE) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick a role for your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -504,17 +504,17 @@ prompt_for_player_selection(void)
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
|
||||
ATR_NONE, races[i].noun, MENU_UNSELECTED);
|
||||
ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_race(flags.initrole, flags.initgend,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randrace(flags.initrole) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the race of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -578,17 +578,17 @@ prompt_for_player_selection(void)
|
||||
flags.initalign)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
|
||||
ATR_NONE, genders[i].adj, MENU_UNSELECTED);
|
||||
ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_gend(flags.initrole, flags.initrace,
|
||||
flags.initalign, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randgend(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the gender of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -651,17 +651,17 @@ prompt_for_player_selection(void)
|
||||
flags.initgend, i)) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
|
||||
ATR_NONE, aligns[i].adj, MENU_UNSELECTED);
|
||||
ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
any.a_int = pick_align(flags.initrole, flags.initrace,
|
||||
flags.initgend, PICK_RANDOM) + 1;
|
||||
if (any.a_int == 0) /* must be non-zero */
|
||||
any.a_int = randalign(flags.initrole, flags.initrace) + 1;
|
||||
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
any.a_int = i + 1; /* must be non-zero */
|
||||
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
|
||||
MENU_UNSELECTED);
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
|
||||
end_menu(win, pbuf);
|
||||
n = select_menu(win, PICK_ONE, &selected);
|
||||
@@ -1095,7 +1095,7 @@ mswin_start_menu(winid wid)
|
||||
/*
|
||||
add_menu(windid window, int glyph, const anything identifier,
|
||||
char accelerator, char groupacc,
|
||||
int attr, char *str, boolean preselected)
|
||||
int attr, char *str, unsigned int itemflags)
|
||||
-- Add a text line str to the given menu window. If
|
||||
identifier
|
||||
is 0, then the line cannot be selected (e.g. a title).
|
||||
@@ -1127,11 +1127,12 @@ identifier
|
||||
void
|
||||
mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
const char *str, BOOLEAN_P presel)
|
||||
const char *str, unsigned int itemflags)
|
||||
{
|
||||
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", wid, glyph,
|
||||
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
|
||||
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph,
|
||||
identifier, (char) accelerator, (char) group_accel, attr, str,
|
||||
presel);
|
||||
itemflags);
|
||||
if ((wid >= 0) && (wid < MAXWINDOWS)
|
||||
&& (GetNHApp()->windowlist[wid].win != NULL)) {
|
||||
MSNHMsgAddMenu data;
|
||||
@@ -1143,6 +1144,7 @@ mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
|
||||
data.attr = attr;
|
||||
data.str = str;
|
||||
data.presel = presel;
|
||||
data.itemflags = itemflags;
|
||||
|
||||
SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
|
||||
(WPARAM) MSNH_MSG_ADDMENU, (LPARAM) &data);
|
||||
|
||||
@@ -155,7 +155,7 @@ void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
|
||||
void mswin_start_menu(winid wid);
|
||||
void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
|
||||
CHAR_P accelerator, CHAR_P group_accel, int attr,
|
||||
const char *str, BOOLEAN_P presel);
|
||||
const char *str, unsigned int itemflags);
|
||||
void mswin_end_menu(winid wid, const char *prompt);
|
||||
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
|
||||
void mswin_update_inventory(void);
|
||||
|
||||
Reference in New Issue
Block a user