use_menu_glyphs

This commit is contained in:
Kestrel
2025-04-03 19:49:39 -05:00
committed by PatR
parent 31e03f1c68
commit 9e1e032ea8
7 changed files with 21 additions and 9 deletions

View File

@@ -1060,11 +1060,9 @@ menu_win_size(nhmenu *menu)
} else {
/* Add space for accelerator (selector letter) */
curentrywidth += 4;
#if 0 /* FIXME: menu glyphs */
if (menu_item_ptr->glyphinfo.glyph != NO_GLYPH
&& iflags.use_menu_glyphs)
curentrywidth += 2;
#endif
}
if (curentrywidth > maxentrywidth) {
maxentrywidth = curentrywidth;
@@ -1283,19 +1281,16 @@ menu_display_page(
entry_cols -= 4;
start_col += 4;
}
#if 0
/* FIXME: menuglyphs not implemented yet */
if (menu_item_ptr->glyphinfo.glyph != NO_GLYPH
&& iflags.use_menu_glyphs) {
color = (int) menu_item_ptr->glyphinfo.color;
color = menu_item_ptr->glyphinfo.gm.sym.color;
curses_toggle_color_attr(win, color, NONE, ON);
mvwaddch(win, menu_item_ptr->line_num + 1, start_col, curletter);
mvwaddch(win, menu_item_ptr->line_num + 1, start_col, menu_item_ptr->glyphinfo.ttychar);
curses_toggle_color_attr(win, color, NONE, OFF);
mvwaddch(win, menu_item_ptr->line_num + 1, start_col + 1, ' ');
entry_cols -= 2;
start_col += 2;
}
#endif
color = menu_item_ptr->color;
if (color == NO_COLOR)
color = NONE;

View File

@@ -1461,6 +1461,13 @@ process_menu_window(winid window, struct WinDesc *cw)
(void) putchar('+'); /* all selected */
else
(void) putchar('#'); /* count selected */
} else if (iflags.use_menu_glyphs && n == 2
&& curr->identifier.a_void != 0
&& curr->glyphinfo.glyph != NO_GLYPH) {
/* tty_print_glyph could be used, but is overkill and requires referencing the cursor location */
toggle_menu_attr(TRUE, curr->glyphinfo.gm.sym.color, ATR_NONE);
(void) putchar(curr->glyphinfo.ttychar);
toggle_menu_attr(FALSE, curr->glyphinfo.gm.sym.color, ATR_NONE);
} else
(void) putchar(*cp);
} /* for *cp */
@@ -2537,8 +2544,8 @@ tty_start_menu(winid window, unsigned long mbehavior)
void
tty_add_menu(
winid window, /* window to use, must be of type NHW_MENU */
const glyph_info *glyphinfo UNUSED, /* glyph info with glyph to
* display with item */
const glyph_info *glyphinfo, /* glyph info with glyph to
* display with item */
const anything *identifier, /* what to return if selected */
char ch, /* selector letter (0 = pick our own) */
char gch, /* group accelerator (0 = no group) */
@@ -2595,6 +2602,7 @@ tty_add_menu(
item->attr = attr;
item->color = clr;
item->str = dupstr(newstr);
item->glyphinfo = *glyphinfo;
item->next = cw->mlist;
cw->mlist = item;