merge new use_menu_glyphs option with menu_objsyms
The two options are very similar but probably mutually exclusive except when using look-here and look-into-container (both via ':') with the default setting for 'sortloot', or with inventory when 'sortpack' has been toggled off. This removes 'use_menu_glyphs' and changes 'menu_objsyms' from a boolean to a compound taking six possible values: | 0: no object symbols in menus, | 1: append object class symbol to object header lines (same as old |menu_objsyms boolean), | 2: include object symbol in menu entry lines for objects (same as |recently added use_menu_glyphs), | 3: both 1 and 2, | 4: display as #2 but only if the menu lacks class header lines, | 5: if header lines are present, display as #1; if headers are not |present, then display as #4 (which will implicitly be #2). Default is #4. Effectively replaces the options portion of pull request #1406 and retains the functionality, but not as default for normal menus. Guidebook.tex is only partially updated. Someone else will need to finish that.
This commit is contained in:
@@ -1330,7 +1330,8 @@ process_menu_window(winid window, struct WinDesc *cw)
|
||||
tty_menu_item *page_start, *page_end, *curr;
|
||||
long count;
|
||||
int n, attr_n, curr_page, page_lines, resp_len, previous_page_lines;
|
||||
boolean finished, counting, reset_count;
|
||||
boolean finished, counting, reset_count, show_obj_syms,
|
||||
only_if_no_headers = (iflags.menuobjsyms & 4) != 0;
|
||||
char *cp, *rp, resp[QBUFSZ], gacc[QBUFSZ], *msave, *morestr, really_morc;
|
||||
#define MENU_EXPLICIT_CHOICE 0x7f /* pseudo menu manipulation char */
|
||||
|
||||
@@ -1378,6 +1379,15 @@ process_menu_window(winid window, struct WinDesc *cw)
|
||||
}
|
||||
resp_len = 0; /* lint suppression */
|
||||
|
||||
show_obj_syms = iflags.use_menu_glyphs;
|
||||
if (only_if_no_headers) {
|
||||
for (curr = cw->mlist; curr; curr = curr->next)
|
||||
if (curr->identifier.a_void == 0) {
|
||||
show_obj_syms = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* loop until finished */
|
||||
while (!finished) {
|
||||
HUPSKIP();
|
||||
@@ -1432,7 +1442,7 @@ process_menu_window(winid window, struct WinDesc *cw)
|
||||
if (curr->str[0] && curr->str[1] == ' '
|
||||
&& curr->str[2] && strchr("-+#", curr->str[2])
|
||||
&& curr->str[3] == ' ')
|
||||
/* [0]=letter, [1]==space, [2]=[-+#], [3]=space */
|
||||
/* [0]=letter, [1]=space, [2]=[-+#], [3]=space */
|
||||
attr_n = 4; /* [4:N]=entry description */
|
||||
|
||||
/*
|
||||
@@ -1454,15 +1464,14 @@ process_menu_window(winid window, struct WinDesc *cw)
|
||||
if (n == attr_n && (color != NO_COLOR
|
||||
|| attr != ATR_NONE))
|
||||
toggle_menu_attr(TRUE, color, attr);
|
||||
if (n == 2
|
||||
&& curr->identifier.a_void != 0
|
||||
if (n == 2 && curr->identifier.a_void != 0
|
||||
&& curr->selected) {
|
||||
if (curr->count == -1L)
|
||||
(void) putchar('+'); /* all selected */
|
||||
else
|
||||
(void) putchar('#'); /* count selected */
|
||||
} else if (iflags.use_menu_glyphs && n == 2
|
||||
&& curr->identifier.a_void != 0
|
||||
char c = (curr->count == -1L) ? '*' : '#';
|
||||
|
||||
/* all selected: '*' vs count selected: '#' */
|
||||
(void) putchar(c);
|
||||
} else if (n == 2 && curr->identifier.a_void != 0
|
||||
&& show_obj_syms
|
||||
&& curr->glyphinfo.glyph != NO_GLYPH) {
|
||||
int gcolor = curr->glyphinfo.gm.sym.color;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user