Change menu_headings to accept color and attribute
Instead of just accepting an attribute, it's now possible to use a color, or both color and attribute, for example: OPTIONS=menu_headings:inverse OPTIONS=menu_headings:red OPTIONS=menu_headings:red&underline Default is still just inverse. This lets the player change the menu heading color without needing to use menu colors for them. Also makes it so the core uses NO_COLOR instead of 0, for all the menu lines which don't have any prefedefined color. Tested for tty, curses, x11, qt, and win32
This commit is contained in:
@@ -2090,6 +2090,7 @@ extern void set_playmode(void);
|
||||
extern int sym_val(const char *);
|
||||
extern int query_color(const char *);
|
||||
extern int query_attr(const char *);
|
||||
extern boolean query_color_attr(color_attr *, const char *);
|
||||
extern const char *clr2colorname(int);
|
||||
extern int match_str2clr(char *);
|
||||
extern int match_str2attr(const char *, boolean);
|
||||
|
||||
@@ -186,6 +186,10 @@ struct debug_flags {
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct color_and_attr {
|
||||
int color, attr;
|
||||
} color_attr;
|
||||
|
||||
/*
|
||||
* Stuff that really isn't option or platform related and does not
|
||||
* get saved and restored. They are set and cleared during the game
|
||||
@@ -251,7 +255,7 @@ struct instance_flags {
|
||||
int getpos_coords; /* show coordinates when getting cursor position */
|
||||
int menuinvertmode; /* 0 = invert toggles every item;
|
||||
1 = invert skips 'all items' item */
|
||||
int menu_headings; /* ATR for menu headings */
|
||||
color_attr menu_headings; /* ATR for menu headings */
|
||||
uint32_t colorcount; /* store how many colors terminal is capable of */
|
||||
boolean use_truecolor; /* force use of truecolor */
|
||||
#ifdef ALTMETA
|
||||
|
||||
@@ -157,6 +157,7 @@ typedef struct x11_mi {
|
||||
long pick_count; /* specific selection count; -1 if none */
|
||||
char *str; /* The text of the item. */
|
||||
int attr; /* Attribute for the line. */
|
||||
int color; /* Color for the line. */
|
||||
boolean selected; /* Been selected? */
|
||||
boolean preselected; /* in advance? */
|
||||
unsigned itemflags; /* MENU_ITEMFLAGS_foo */
|
||||
|
||||
@@ -188,7 +188,7 @@ extern int curses_ext_cmd(void);
|
||||
extern void curses_create_nhmenu(winid wid, unsigned long);
|
||||
extern void curses_add_nhmenu_item(winid wid, const glyph_info *,
|
||||
const ANY_P *identifier, char accelerator,
|
||||
char group_accel, int attr,
|
||||
char group_accel, int attr, int clr,
|
||||
const char *str, unsigned itemflags);
|
||||
extern void curs_menu_set_bottom_heavy(winid);
|
||||
extern void curses_finalize_nhmenu(winid wid, const char *prompt);
|
||||
@@ -207,7 +207,7 @@ extern void curses_status_update(int, genericptr_t, int, int, int,
|
||||
|
||||
extern void curs_purge_perminv_data(boolean);
|
||||
extern void curs_update_invt(int);
|
||||
extern void curs_add_invt(int, char, attr_t, const char *);
|
||||
extern void curs_add_invt(int, char, attr_t, int, const char *);
|
||||
|
||||
/* cursinit.c */
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ typedef struct tty_mi {
|
||||
long count; /* user count */
|
||||
char *str; /* description string (including accelerator) */
|
||||
int attr; /* string attribute */
|
||||
int color; /* string color */
|
||||
boolean selected; /* TRUE if selected by user */
|
||||
unsigned itemflags; /* item flags */
|
||||
char selector; /* keyboard accelerator */
|
||||
|
||||
Reference in New Issue
Block a user