uses a menu (with no selectors specified) rather than a text window to allow previous_page and first_menu actions to move backwards */
| 2068 | /* uses a menu (with no selectors specified) rather than a text window |
| 2069 | to allow previous_page and first_menu actions to move backwards */ |
| 2070 | void |
| 2071 | X11_display_file(const char *str, boolean complain) |
| 2072 | { |
| 2073 | dlb *fp; |
| 2074 | winid newwin; |
| 2075 | struct xwindow *wp; |
| 2076 | anything any; |
| 2077 | menu_item *menu_list; |
| 2078 | #define LLEN 128 |
| 2079 | char line[LLEN]; |
| 2080 | int clr = 0; |
| 2081 | |
| 2082 | /* Use the port-independent file opener to see if the file exists. */ |
| 2083 | fp = dlb_fopen(str, RDTMODE); |
| 2084 | if (!fp) { |
| 2085 | if (complain) |
| 2086 | pline("Cannot open %s. Sorry.", str); |
| 2087 | return; /* it doesn't exist, ignore */ |
| 2088 | } |
| 2089 | |
| 2090 | newwin = X11_create_nhwindow(NHW_MENU); |
| 2091 | wp = &window_list[newwin]; |
| 2092 | X11_start_menu(newwin, MENU_BEHAVE_STANDARD); |
| 2093 | |
| 2094 | any = cg.zeroany; |
| 2095 | while (dlb_fgets(line, LLEN, fp)) { |
| 2096 | X11_add_menu(newwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, |
| 2097 | clr, line, MENU_ITEMFLAGS_NONE); |
| 2098 | } |
| 2099 | (void) dlb_fclose(fp); |
| 2100 | |
| 2101 | /* show file name as the window title */ |
| 2102 | if (str) |
| 2103 | wp->title = dupstr(str); |
| 2104 | |
| 2105 | wp->menu_information->permi = FALSE; |
| 2106 | wp->menu_information->disable_mcolors = TRUE; |
| 2107 | (void) X11_select_menu(newwin, PICK_NONE, &menu_list); |
| 2108 | X11_destroy_nhwindow(newwin); |
| 2109 | } |
| 2110 | |
| 2111 | /* yn_function ------------------------------------------------------------ */ |
| 2112 | /* (not threaded) */ |
nothing calls this directly
no test coverage detected