top: extend 'Ctrl' bottom window for 'memu' selections

This commit adds a prototype for a potential extension
of that tabbed bottom window capability. It introduces
a 'menu' which then provides for users' selections. It
does not actually do anything meaningful and will only
be enabled with the new #define called 'BOT_PICK_YES'.

[ since it's just a proof of concept, no attempt has ]
[ been made to add the usual NLS translation support ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-05-12 00:00:00 -05:00 committed by Craig Small
parent de22afc4c2
commit 659590b068
2 changed files with 56 additions and 3 deletions

View File

@ -109,6 +109,9 @@ static int Screen_cols, Screen_rows, Max_lines;
#define BOT_UNFOCUS -1 // tab focus not established
#define BOT_TAB_YES -1 // tab focus could be active
#define BOT_MISC_NS +1 // data for namespaces req'd
#ifdef BOT_MENU_YES
# define BOT_MENU_ON -2 // in menu, tab focus active
#endif
// 1 for horizontal separator
#define BOT_RSVD 1
#define BOT_KEEP Bot_func = NULL
@ -5093,6 +5096,36 @@ static void bot_misc_toggle (int what, char sep) {
Bot_task = PID_VAL(EU_PID, s_int, Curwin->ppt[Curwin->begtask]);
}
} // end: bot_misc_toggle
#ifdef BOT_MENU_YES
/*
* This guy manages that bottom margin window |
* when it is used as a menu of user choices. | */
static void bot_pick_show (void) {
bot_focus(Bot_name, "selection #1\t selection #2\t selecttion #3");
BOT_KEEP;
} // end: bot_pick_show
/*
* This guy can toggle between displaying the |
* bottom window or arranging to turn it off. | */
static void bot_pick_toggle (void) {
// if already in menu mode, assume user wants to exit ...
if (Bot_what == BOT_MENU_ON) {
BOT_TOSS;
} else {
Bot_sep = '\t';
Bot_what = BOT_MENU_ON;
Bot_indx = 0;
Bot_item[0] = BOT_DELIMIT;
Bot_name = (char*)"a menu, please choose among the following ...";
Bot_func = bot_pick_show;
Bot_task = PID_VAL(EU_PID, s_int, Curwin->ppt[Curwin->begtask]);
}
} // end: bot_pick_toggle
#endif
/*###### Interactive Input Tertiary support ############################*/
@ -5471,6 +5504,11 @@ static void keys_global (int ch) {
case kbd_CtrlG:
bot_item_toggle(EU_CGR, "control groups", '/');
break;
#ifdef BOT_MENU_YES
case kbd_CtrlH:
bot_pick_toggle();
break;
#endif
case kbd_CtrlI:
if (Bot_what) {
++Bot_indx;
@ -5516,11 +5554,15 @@ static void keys_global (int ch) {
case kbd_CtrlU:
bot_item_toggle(EU_SGN, "supplementary groups", ',');
break;
case kbd_ENTER: // these two have the effect of waking us
case kbd_ENTER: // fall through
#ifdef BOT_MENU_YES
if (Bot_what == BOT_MENU_ON && Bot_indx != BOT_UNFOCUS)
show_msg(fmtmk("thanks for selecting menu item #%d", Bot_indx + 1));
#endif // the enter plus space keys will wake us
case kbd_SPACE: // from 'pselect', refreshing the display
break; // and updating any hot-plugged resources
default: // keep gcc happy
break;
default:
break; // keep gcc happy
}
} // end: keys_global
@ -6357,6 +6399,9 @@ static void do_key (int ch) {
{ '?', 'B', 'd', 'E', 'e', 'f', 'g', 'H', 'h'
, 'I', 'k', 'r', 's', 'X', 'Y', 'Z', '0'
, kbd_CtrlE, kbd_CtrlG, kbd_CtrlI, kbd_CtrlK, kbd_CtrlN, kbd_CtrlP, kbd_CtrlR, kbd_CtrlU
#ifdef BOT_MENU_YES
, kbd_CtrlH
#endif
, kbd_ENTER, kbd_SPACE, '\0' } },
{ keys_summary,
{ '!', '1', '2', '3', '4', 'C', 'l', 'm', 't', '\0' } },

View File

@ -27,6 +27,7 @@
/* Development/Debugging defines ----------------------------------- */
//#define ATEOJ_RPTSTD /* report on some miscellany at end-of-job */
//#define BOT_DEAD_ZAP /* zap Ctrl bottom window when target dies */
//#define BOT_MENU_YES /* enable bottom window for menu prototype */
//#define CASEUP_HEXES /* show all those hex values in upper case */
//#define CASEUP_SUFIX /* show time/mem/cnts suffix in upper case */
//#define EQUCOLHDRYES /* yes, equalize the column header lengths */
@ -173,6 +174,9 @@ char *strcasestr(const char *haystack, const char *needle);
#define kbd_DEL 139
#define kbd_CtrlE '\005'
#define kbd_CtrlG '\007'
#ifdef BOT_MENU_YES
#define kbd_CtrlH '\010'
#endif
#define kbd_CtrlI '\011'
#define kbd_CtrlK '\013'
#define kbd_CtrlN '\016'
@ -743,6 +747,10 @@ typedef struct WIN_t {
//atic char *bot_misc_hlp (struct pids_stack *p);
//atic void bot_misc_show (void);
//atic void bot_misc_toggle (int what, char sep);
#ifdef BOT_MENU_YES
//atic void bot_pick_show (void);
//atic void bot_pick_toggle (void);
#endif
/*------ Interactive Input Tertiary support ----------------------------*/
//atic inline int find_ofs (const WIN_t *q, const char *buf);
//atic void find_string (int ch);