Get a extended command in windowport specific way. returns index of the ext_cmd or -1. called after '#'. It's a menu with all the possibilities. */
| 977 | called after '#'. |
| 978 | It's a menu with all the possibilities. */ |
| 979 | int |
| 980 | Gem_get_ext_cmd() |
| 981 | { |
| 982 | winid wind; |
| 983 | int i, count, what, too_much = FALSE; |
| 984 | menu_item *selected = NULL; |
| 985 | anything any; |
| 986 | char accelerator = 0, tmp_acc = 0; |
| 987 | const char *ptr; |
| 988 | |
| 989 | wind = Gem_create_nhwindow(NHW_MENU); |
| 990 | Gem_start_menu(wind, MENU_BEHAVE_STANDARD); |
| 991 | for (i = 0; (ptr = extcmdlist[i].ef_txt); i++) { |
| 992 | any.a_int = i; |
| 993 | accelerator = *ptr; |
| 994 | if (tmp_acc == accelerator) { |
| 995 | if (too_much) |
| 996 | accelerator = '&'; /* MAR -- poor choice, anyone? */ |
| 997 | else |
| 998 | accelerator += 'A' - 'a'; |
| 999 | too_much = TRUE; |
| 1000 | } else |
| 1001 | too_much = FALSE; |
| 1002 | tmp_acc = *ptr; |
| 1003 | Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr, |
| 1004 | MENU_ITEMFLAGS_NONE); |
| 1005 | } |
| 1006 | Gem_end_menu(wind, "What extended command?"); |
| 1007 | count = Gem_select_menu(wind, PICK_ONE, &selected); |
| 1008 | what = count ? selected->item.a_int : -1; |
| 1009 | if (selected) |
| 1010 | free(selected); |
| 1011 | Gem_destroy_nhwindow(wind); |
| 1012 | return (what); |
| 1013 | } |
| 1014 | |
| 1015 | void |
| 1016 | Gem_number_pad(state) |
nothing calls this directly
no test coverage detected