Lines Matching +full:button +full:- +full:enter

4  *  dlg_keys.c -- runtime binding support for dialog
6 * Copyright 2006-2019,2020 Thomas E. Dickey
53 for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) { in dlg_register_window()
54 if (p->win == win && !strcmp(p->name, name)) { in dlg_register_window()
55 p->binding = binding; in dlg_register_window()
59 /* add built-in bindings at the end of the list (see compare_bindings). */ in dlg_register_window()
61 p->win = win; in dlg_register_window()
62 p->name = name; in dlg_register_window()
63 p->binding = binding; in dlg_register_window()
65 q->link = p; in dlg_register_window()
74 * longer. Since compiled-in bindings are only visible when the widget is in dlg_register_window()
86 * Unlike dlg_lookup_key(), this looks for either widget-builtin or rc-file
94 for (p = all_bindings; p != 0; p = p->link) { in key_is_bound()
95 if (p->win == win && !dlg_strcmp(p->name, name)) { in key_is_bound()
97 for (n = 0; p->binding[n].is_function_key >= 0; ++n) { in key_is_bound()
98 if (p->binding[n].curses_key == curses_key in key_is_bound()
99 && p->binding[n].is_function_key == function_key) { in key_is_bound()
109 * Call this function after dlg_register_window(), for the list of button
113 * we would like to use for a button abbreviation to some other key, e.g.,
145 /* if it is bound in the rc-file, skip it */ in dlg_register_buttons()
157 p->win = win; in dlg_register_buttons()
158 p->name = name; in dlg_register_buttons()
159 p->buttons = TRUE; in dlg_register_buttons()
160 p->binding = q; in dlg_register_buttons()
163 p->link = all_bindings; in dlg_register_buttons()
180 for (p = all_bindings, q = 0; p != 0; p = p->link) { in dlg_unregister_window()
181 if (p->win == win) { in dlg_unregister_window()
183 q->link = p->link; in dlg_unregister_window()
185 all_bindings = p->link; in dlg_unregister_window()
187 /* the user-defined and buttons-bindings all are length=1 */ in dlg_unregister_window()
188 if (p->binding[1].is_function_key < 0) in dlg_unregister_window()
189 free(p->binding); in dlg_unregister_window()
200 * the curses-key.
203 * the given curses-key.
236 for (p = all_bindings; p != 0; p = p->link) { in dlg_lookup_key()
237 if (p->win == win) { in dlg_lookup_key()
238 name = p->name; in dlg_lookup_key()
243 for (p = all_bindings; p != 0; p = p->link) { in dlg_lookup_key()
244 if (p->win == win || in dlg_lookup_key()
245 (p->win == 0 && in dlg_lookup_key()
246 (!strcmp(p->name, name) || !strcmp(p->name, WILDNAME)))) { in dlg_lookup_key()
248 for (q = p->binding; q->is_function_key >= 0; ++q) { in dlg_lookup_key()
249 if (p->buttons in dlg_lookup_key()
251 && q->curses_key == (int) dlg_toupper(curses_key)) { in dlg_lookup_key()
253 return q->dialog_key; in dlg_lookup_key()
255 if (q->curses_key == curses_key in dlg_lookup_key()
256 && q->is_function_key == function_key) { in dlg_lookup_key()
257 *fkey = q->dialog_key; in dlg_lookup_key()
271 * This is only useful if there are user-defined key bindings, since there are
272 * no built-in bindings that map directly to DLGK_OK, etc.
341 * If a key was bound to one of the button-codes in dlg_result_key(), fake
342 * a button-value and an "Enter" key to cause the calling widget to return
345 * See dlg_ok_buttoncode(), which maps settings for ok/extra/help and button
346 * number into exit-code.
349 dlg_button_key(int exit_code, int *button, int *dialog_key, int *fkey) in dlg_button_key() argument
355 *button = 0; in dlg_button_key()
361 *button = dialog_vars.nook ? 0 : 1; in dlg_button_key()
367 *button = dialog_vars.nook ? 1 : 2; in dlg_button_key()
376 *button = okay + extra + cancel; in dlg_button_key()
382 DLG_TRACE(("# dlg_button_key(%d:%s) button %d\n", in dlg_button_key()
383 exit_code, dlg_exitcode2s(exit_code), *button)); in dlg_button_key()
390 dlg_ok_button_key(int exit_code, int *button, int *dialog_key, int *fkey) in dlg_ok_button_key() argument
398 result = dlg_button_key(exit_code, button, dialog_key, fkey); in dlg_ok_button_key()
444 CURSES_NAME(ENTER),
542 DIALOG_NAME(ENTER),
588 * Find a user-defined binding, given the curses key code.
596 for (p = all_bindings; p != 0; p = p->link) { in find_binding()
597 if (p->win == 0 in find_binding()
598 && !dlg_strcmp(p->name, widget) in find_binding()
599 && p->binding->curses_key == curses_key) { in find_binding()
600 result = p->binding; in find_binding()
608 * Built-in bindings have a nonzero "win" member, and the associated binding
610 * find the user-defined bindings first and use those.
612 * Sort "*" (all-widgets) entries past named widgets, since those are less
619 if (a->win == b->win) { in compare_bindings()
620 if (!strcmp(a->name, b->name)) { in compare_bindings()
621 result = a->binding[0].curses_key - b->binding[0].curses_key; in compare_bindings()
622 } else if (!strcmp(b->name, WILDNAME)) { in compare_bindings()
623 result = -1; in compare_bindings()
624 } else if (!strcmp(a->name, WILDNAME)) { in compare_bindings()
627 result = dlg_strcmp(a->name, b->name); in compare_bindings()
629 } else if (b->win) { in compare_bindings()
630 result = -1; in compare_bindings()
638 * Find a user-defined binding, given the curses key code. If it does not
640 * sorted to simplify lookups for user-defined bindings that can override
641 * the built-in bindings.
657 entry->name = name; in make_binding()
658 entry->binding = data; in make_binding()
666 for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) { in make_binding()
672 q->link = entry; in make_binding()
677 entry->link = p; in make_binding()
696 while (limit-- > 0 && IsOctal(**string)) { in decode_escaped()
699 result = (result << 3) | (ch - '0'); in decode_escaped()
735 * Parse the parameters of the "bindkey" configuration-file entry. This
755 curses_key = -1; in dlg_parse_bindkey()
756 dialog_key = -1; in dlg_parse_bindkey()
853 fprintf(fp, "MOUSE-"); in dump_curses_key()
854 dump_curses_key(fp, curses_key - M_EVENT); in dump_curses_key()
858 fprintf(fp, "F%d", curses_key - KEY_F(0)); in dump_curses_key()
868 fprintf(fp, "~%c", curses_key - 64); in dump_curses_key()
904 int fkey = (binding->curses_key > 255); in dump_one_binding()
907 dump_curses_key(fp, binding->curses_key); in dump_one_binding()
909 dump_dialog_key(fp, binding->dialog_key); in dump_one_binding()
910 actual = dlg_lookup_key(win, binding->curses_key, &fkey); in dump_one_binding()
912 if (is_DLGK_MOUSE(binding->curses_key) && is_DLGK_MOUSE(actual)) { in dump_one_binding()
916 if (actual != binding->dialog_key) { in dump_one_binding()
925 * initial bindings which were loaded from the rc-file that are used as
936 for (p = all_bindings; p != 0; p = p->link) { in dlg_dump_window_keys()
937 if (p->win == win) { in dlg_dump_window_keys()
938 if (dlg_strcmp(last, p->name)) { in dlg_dump_window_keys()
940 !strcmp(p->name, WILDNAME) ? "all" : p->name, in dlg_dump_window_keys()
941 win == 0 ? " (user-defined)" : ""); in dlg_dump_window_keys()
942 last = p->name; in dlg_dump_window_keys()
944 for (q = p->binding; q->is_function_key >= 0; ++q) { in dlg_dump_window_keys()
945 dump_one_binding(fp, win, p->name, q); in dlg_dump_window_keys()
963 for (p = all_bindings; p != 0; p = p->link) { in dlg_dump_keys()
964 if (p->win == 0) { in dlg_dump_keys()