add_menu follow-up, part 2 of interface adjustment

Remove menu_color support from the window port side of the interface.
The window port just has to honor the color parameter that was added
to the add_menu() interface definition in June 2022 commit
2770223d10, and let the core-side of
the interface handle things.

To that end, this does the following:

Removes the #define of add_menu() from include/winprocs.h and add a
real core-side add_menu() function to windows.c which acts as a
trampoline to the window port win_add_menu() function, while providing
a single location to adjust the parameters passed to the window port
function. get_menu_coloring() is now called in there.

Moves get_menu_coloring() from options.c into windows.c and makes it
static.

Removes all the calls to get_menu_coloring() from the tty, Qt, X11,
curses, and win32 interfaces and adjusts their code to simply honor
the color parameter in add_menu, similar to what the menu_headings
change from earlier today did.
This commit is contained in:
nhmall
2023-11-13 12:56:38 -05:00
parent 59a74a00fd
commit 4b79baa55b
11 changed files with 72 additions and 78 deletions

View File

@@ -2095,7 +2095,6 @@ extern const char *clr2colorname(int);
extern int match_str2clr(char *);
extern int match_str2attr(const char *, boolean);
extern boolean add_menu_coloring(char *);
extern boolean get_menu_coloring(const char *, int *, int *);
extern void free_menu_coloring(void);
extern boolean msgtype_parse_add(char *);
extern int msgtype_type(const char *, boolean);
@@ -3440,6 +3439,8 @@ extern void genl_putmixed(winid, int, const char *);
extern void genl_display_file(const char *, boolean);
extern boolean menuitem_invert_test(int, unsigned, boolean);
extern const char *mixed_to_glyphinfo(const char *str, glyph_info *gip);
extern void add_menu(winid, const glyph_info *, const ANY_P *,
char, char, int, int, const char *, unsigned int);
/* ### windows.c ### */

View File

@@ -125,7 +125,11 @@ extern
#define putmixed (*windowprocs.win_putmixed)
#define display_file (*windowprocs.win_display_file)
#define start_menu (*windowprocs.win_start_menu)
#define add_menu (*windowprocs.win_add_menu)
/* 3.7: There is a real add_menu() in the core now, which does
* some common activities, such as menu_colors.
* add_menu() is in windows.c
*/
/* #define add_menu (*windowprocs.win_add_menu) */
#define end_menu (*windowprocs.win_end_menu)
#define select_menu (*windowprocs.win_select_menu)
#define message_menu (*windowprocs.win_message_menu)