curses: implement a dialog for the windowborders option

This commit is contained in:
Patric Mueller
2022-08-24 21:03:36 +02:00
parent 2da4d92751
commit 2deb119ee0
3 changed files with 41 additions and 7 deletions
+1
View File
@@ -1823,6 +1823,7 @@ curses: 'windowborders' can be set to 3 or 4 to suppress perm_invent borders
curses: if panictrace is triggered, reset the terminal before giving backtrace curses: if panictrace is triggered, reset the terminal before giving backtrace
curses: if a message is marked urgent, override message suppression initiated curses: if a message is marked urgent, override message suppression initiated
by user having typed ESC at previous More>> prompt by user having typed ESC at previous More>> prompt
curses: implement a dialog for the windowborders option
Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings" Qt: the "paper doll" inventory subset can be controlled via the "Qt Settings"
dialog box ("Preferences..." on OSX) dialog box ("Preferences..." on OSX)
Qt: draw a border around each tile in the paper doll inventory; when BUC is Qt: draw a border around each tile in the paper doll inventory; when BUC is
+1 -1
View File
@@ -642,7 +642,7 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTB(whatis_moveskip, Advanced, 0, opt_in, set_in_game, NHOPTB(whatis_moveskip, Advanced, 0, opt_in, set_in_game,
Off, Yes, No, No, NoAlias, &iflags.getloc_moveskip) Off, Yes, No, No, NoAlias, &iflags.getloc_moveskip)
NHOPTC(windowborders, Advanced, 9, opt_in, set_in_game, NHOPTC(windowborders, Advanced, 9, opt_in, set_in_game,
Yes, Yes, No, No, NoAlias, "0 (off), 1 (on), 2 (auto)") Yes, Yes, No, Yes, NoAlias, "0 (off), 1 (on), 2 (auto)")
#ifdef WINCHAIN #ifdef WINCHAIN
NHOPTC(windowchain, Advanced, WINTYPELEN, opt_in, set_in_sysconf, NHOPTC(windowchain, Advanced, WINTYPELEN, opt_in, set_in_sysconf,
No, Yes, No, No, NoAlias, "window processor to use") No, Yes, No, No, NoAlias, "window processor to use")
+39 -6
View File
@@ -332,6 +332,7 @@ static int handler_msgtype(void);
#ifndef NO_VERBOSE_GRANULARITY #ifndef NO_VERBOSE_GRANULARITY
static int handler_verbose(int optidx); static int handler_verbose(int optidx);
#endif #endif
static int handler_windowborders(void);
static boolean is_wc_option(const char *); static boolean is_wc_option(const char *);
static boolean wc_supported(const char *); static boolean wc_supported(const char *);
@@ -4069,11 +4070,8 @@ optfn_windowborders(
} }
return retval; return retval;
} }
if (req == get_cnf_val) { if (req == do_handler) {
if (!opts) return handler_windowborders();
return optn_err;
Sprintf(opts, "%i", iflags.wc2_windowborders);
return optn_ok;
} }
if (req == get_val) { if (req == get_val) {
if (!opts) if (!opts)
@@ -5728,6 +5726,41 @@ RESTORE_WARNING_FORMAT_NONLITERAL
#endif #endif
static int
handler_windowborders(void)
{
winid tmpwin;
anything any;
int i;
const char *mode_name;
menu_item *mode_pick = (menu_item *) 0;
int clr = 0;
static const char *windowborders_text[] = {
"Off, never show borders",
"On, always show borders",
"Auto, on if display is at least (24+2)x(80+2)",
"On, except forced off for perm_invent",
"Auto, except forced off for perm_invent"
};
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin, MENU_BEHAVE_STANDARD);
any = cg.zeroany;
for (i = 0; i < SIZE(windowborders_text); i++) {
mode_name = windowborders_text[i];
any.a_int = i + 1;
add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i,
0, ATR_NONE, clr, mode_name, MENU_ITEMFLAGS_NONE);
}
end_menu(tmpwin, "Select window borders mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
iflags.wc2_windowborders = mode_pick->item.a_int - 1;
free((genericptr_t) mode_pick);
}
destroy_nhwindow(tmpwin);
return optn_ok;
}
/* /*
********************************** **********************************
* *
@@ -6657,7 +6690,7 @@ parsebindings(char *bindings)
if (!parsebindings(bind)) if (!parsebindings(bind))
ret = FALSE; ret = FALSE;
} }
/* parse a single binding: first split around : */ /* parse a single binding: first split around : */
if (! (bind = index(bindings, ':'))) if (! (bind = index(bindings, ':')))
return FALSE; /* it's not a binding */ return FALSE; /* it's not a binding */