this function assumes reset_menu has been called before */
| 1023 | |
| 1024 | /* this function assumes reset_menu has been called before */ |
| 1025 | static void show_menu(const char *prompt, const char *instructions, |
| 1026 | int selected_index, int *last_top_row) |
| 1027 | { |
| 1028 | int maxx, maxy; |
| 1029 | WINDOW *menu_window; |
| 1030 | |
| 1031 | current_instructions = instructions; |
| 1032 | |
| 1033 | clear(); |
| 1034 | print_in_middle(stdscr, 1, getmaxx(stdscr), |
| 1035 | menu_backtitle, |
| 1036 | attr_main_heading); |
| 1037 | |
| 1038 | wattrset(main_window, attr_main_menu_box); |
| 1039 | box(main_window, 0, 0); |
| 1040 | wattrset(main_window, attr_main_menu_heading); |
| 1041 | mvwprintw(main_window, 0, 3, " %s ", prompt); |
| 1042 | wattrset(main_window, attr_normal); |
| 1043 | |
| 1044 | set_menu_items(curses_menu, curses_menu_items); |
| 1045 | |
| 1046 | /* position the menu at the middle of the screen */ |
| 1047 | scale_menu(curses_menu, &maxy, &maxx); |
| 1048 | maxx = min(maxx, mwin_max_cols-2); |
| 1049 | maxy = mwin_max_lines; |
| 1050 | menu_window = derwin(main_window, |
| 1051 | maxy, |
| 1052 | maxx, |
| 1053 | 2, |
| 1054 | (mwin_max_cols-maxx)/2); |
| 1055 | keypad(menu_window, TRUE); |
| 1056 | set_menu_win(curses_menu, menu_window); |
| 1057 | set_menu_sub(curses_menu, menu_window); |
| 1058 | |
| 1059 | /* must reassert this after changing items, otherwise returns to a |
| 1060 | * default of 16 |
| 1061 | */ |
| 1062 | set_menu_format(curses_menu, maxy, 1); |
| 1063 | center_item(selected_index, last_top_row); |
| 1064 | set_menu_format(curses_menu, maxy, 1); |
| 1065 | |
| 1066 | print_function_line(); |
| 1067 | |
| 1068 | /* Post the menu */ |
| 1069 | post_menu(curses_menu); |
| 1070 | refresh_all_windows(main_window); |
| 1071 | } |
| 1072 | |
| 1073 | static void adj_match_dir(match_f *match_direction) |
| 1074 | { |
no test coverage detected