interface groundwork for core-side color decisions

(user-side decisions really, but as it stands right now
user-side decisions/options are made and processed by the core)

add a parameter to add_menu so color can be passed
This commit is contained in:
nhmall
2022-06-25 13:21:51 -04:00
parent b60dae1706
commit 2770223d10
44 changed files with 437 additions and 306 deletions

View File

@@ -686,6 +686,7 @@ curses_character_dialog(const char **choices, const char *prompt)
anything identifier;
menu_item *selected = NULL;
winid wid = curses_get_wid(NHW_MENU);
int clr = 0;
identifier.a_void = 0;
curses_start_menu(wid, MENU_BEHAVE_STANDARD);
@@ -700,19 +701,19 @@ curses_character_dialog(const char **choices, const char *prompt)
identifier.a_int = (count + 1); /* Must be non-zero */
curses_add_menu(wid, &nul_glyphinfo, &identifier, curletter, 0,
A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE);
A_NORMAL, clr, choices[count], MENU_ITEMFLAGS_NONE);
used_letters[count] = curletter;
}
/* Random Selection */
identifier.a_int = ROLE_RANDOM;
curses_add_menu(wid, &nul_glyphinfo, &identifier, '*', 0,
A_NORMAL, "Random", MENU_ITEMFLAGS_NONE);
A_NORMAL, clr, "Random", MENU_ITEMFLAGS_NONE);
/* Quit prompt */
identifier.a_int = ROLE_NONE;
curses_add_menu(wid, &nul_glyphinfo, &identifier, 'q', 0,
A_NORMAL, "Quit", MENU_ITEMFLAGS_NONE);
A_NORMAL, clr, "Quit", MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, prompt);
ret = curses_select_menu(wid, PICK_ONE, &selected);
if (ret == 1) {

View File

@@ -557,7 +557,8 @@ curses_start_menu(winid wid, unsigned long mbehavior)
add_menu(winid wid, const glyph_info *glyphinfo,
const anything identifier,
char accelerator, char groupacc,
int attr, char *str, unsigned int itemflags)
int attr, int color,
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
@@ -590,7 +591,7 @@ void
curses_add_menu(winid wid, const glyph_info *glyphinfo,
const ANY_P *identifier,
char accelerator, char group_accel, int attr,
const char *str, unsigned itemflags)
int clr UNUSED, const char *str, unsigned itemflags)
{
int curses_attr;

View File

@@ -373,6 +373,7 @@ curses_prev_mesg(void)
boolean do_lifo = (iflags.prevmsg_window != 'f');
#ifdef DEBUG
static int showturn = 0; /* 1: show hero_seq value in separators */
int clr = 0;
/*
* Set DEBUGFILES=MesgTurn in environment or sysconf to decorate
@@ -400,16 +401,16 @@ curses_prev_mesg(void)
(mesg->turn >> 3), (mesg->turn & 7L));
#endif
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
A_NORMAL, sepbuf, MENU_ITEMFLAGS_NONE);
A_NORMAL, clr, sepbuf, MENU_ITEMFLAGS_NONE);
}
turn = mesg->turn;
}
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
A_NORMAL, mesg->str, MENU_ITEMFLAGS_NONE);
A_NORMAL, clr, mesg->str, MENU_ITEMFLAGS_NONE);
}
if (!count)
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
A_NORMAL, "[No past messages available.]",
A_NORMAL, clr, "[No past messages available.]",
MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, "");

View File

@@ -650,6 +650,7 @@ curses_view_file(const char *filename, boolean must_exist)
char buf[BUFSZ];
menu_item *selected = NULL;
dlb *fp = dlb_fopen(filename, "r");
int clr = 0;
if (fp == NULL) {
if (must_exist)
@@ -663,7 +664,7 @@ curses_view_file(const char *filename, boolean must_exist)
while (dlb_fgets(buf, BUFSZ, fp) != NULL) {
curses_add_menu(wid, &nul_glyphinfo, &Id, 0, 0,
A_NORMAL, buf, FALSE);
A_NORMAL, clr, buf, FALSE);
}
dlb_fclose(fp);