this function assumes reset_menu has been called before */
| 969 | |
| 970 | /* this function assumes reset_menu has been called before */ |
| 971 | static void show_menu(const char *prompt, const char *instructions, |
| 972 | int selected_index, int *last_top_row) |
| 973 | { |
| 974 | int maxx, maxy; |
| 975 | WINDOW *menu_window; |
| 976 | |
| 977 | current_instructions = instructions; |
| 978 | |
| 979 | clear(); |
| 980 | print_in_middle(stdscr, 1, getmaxx(stdscr), |
| 981 | menu_backtitle, |
| 982 | attr_main_heading); |
| 983 | |
| 984 | wattrset(main_window, attr_main_menu_box); |
| 985 | box(main_window, 0, 0); |
| 986 | wattrset(main_window, attr_main_menu_heading); |
| 987 | mvwprintw(main_window, 0, 3, " %s ", prompt); |
| 988 | wattrset(main_window, attr_normal); |
| 989 | |
| 990 | set_menu_items(curses_menu, curses_menu_items); |
| 991 | |
| 992 | /* position the menu at the middle of the screen */ |
| 993 | scale_menu(curses_menu, &maxy, &maxx); |
| 994 | maxx = min(maxx, mwin_max_cols-2); |
| 995 | maxy = mwin_max_lines; |
| 996 | menu_window = derwin(main_window, |
| 997 | maxy, |
| 998 | maxx, |
| 999 | 2, |
| 1000 | (mwin_max_cols-maxx)/2); |
| 1001 | keypad(menu_window, TRUE); |
| 1002 | set_menu_win(curses_menu, menu_window); |
| 1003 | set_menu_sub(curses_menu, menu_window); |
| 1004 | |
| 1005 | /* must reassert this after changing items, otherwise returns to a |
| 1006 | * default of 16 |
| 1007 | */ |
| 1008 | set_menu_format(curses_menu, maxy, 1); |
| 1009 | center_item(selected_index, last_top_row); |
| 1010 | set_menu_format(curses_menu, maxy, 1); |
| 1011 | |
| 1012 | print_function_line(); |
| 1013 | |
| 1014 | /* Post the menu */ |
| 1015 | post_menu(curses_menu); |
| 1016 | refresh_all_windows(main_window); |
| 1017 | } |
| 1018 | |
| 1019 | static void adj_match_dir(match_f *match_direction) |
| 1020 | { |
no test coverage detected