24 static void back_lines(
int n);
26 update_text,
void *
data);
28 static char *get_line(
void);
39 static void refresh_text_box(
WINDOW *dialog,
WINDOW *box,
int boxh,
int boxw,
43 print_page(box, boxh, boxw, update_text, data);
44 print_position(dialog);
45 wmove(dialog, cur_y, cur_x);
57 int initial_width,
int *keys,
int *_vscroll,
int *_hscroll,
60 int i,
x,
y, cur_x, cur_y,
key = 0;
72 if (_vscroll && *_vscroll) {
75 for (i = 0; i < *_vscroll; i++)
82 getmaxyx(stdscr, height, width);
83 if (height < 8 || width < 8)
85 if (initial_height != 0)
86 height = initial_height;
92 if (initial_width != 0)
93 width = initial_width;
106 dialog = newwin(height, width, y, x);
107 keypad(dialog,
TRUE);
112 box = subwin(dialog, boxh, boxw, y + 1, x + 1);
113 wattrset(box,
dlg.dialog.atr);
114 wbkgdset(box,
dlg.dialog.atr & A_COLOR);
119 draw_box(dialog, 0, 0, height, width,
120 dlg.dialog.atr,
dlg.border.atr);
122 wattrset(dialog,
dlg.border.atr);
123 mvwaddch(dialog, height - 3, 0,
ACS_LTEE);
124 for (i = 0; i < width - 2; i++)
126 wattrset(dialog,
dlg.dialog.atr);
127 wbkgdset(dialog,
dlg.dialog.atr & A_COLOR);
133 wnoutrefresh(dialog);
134 getyx(dialog, cur_y, cur_x);
138 refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text,
142 key = wgetch(dialog);
154 if (!begin_reached) {
157 refresh_text_box(dialog, box, boxh, boxw,
158 cur_y, cur_x, update_text,
169 refresh_text_box(dialog, box, boxh, boxw, cur_y,
170 cur_x, update_text, data);
179 refresh_text_box(dialog, box, boxh, boxw, cur_y,
180 cur_x, update_text, data);
189 refresh_text_box(dialog, box, boxh, boxw, cur_y,
190 cur_x, update_text, data);
199 refresh_text_box(dialog, box, boxh, boxw, cur_y,
200 cur_x, update_text, data);
209 refresh_text_box(dialog, box, boxh, boxw, cur_y,
210 cur_x, update_text, data);
225 refresh_text_box(dialog, box, boxh, boxw, cur_y,
226 cur_x, update_text, data);
236 refresh_text_box(dialog, box, boxh, boxw, cur_y,
237 cur_x, update_text, data);
250 for (i = 0; keys[
i]; i++) {
251 if (key == keys[i]) {
280 static void back_lines(
int n)
286 for (i = 0; i <
n; i++) {
304 }
while (*
page !=
'\n');
313 update_text,
void *
data)
315 int i, passed_end = 0;
320 for (i = 0; i <
height; i++)
328 for (i = 0; i <
height; i++) {
329 print_line(win, i, width);
332 if (end_reached && !passed_end)
341 static void print_line(
WINDOW * win,
int row,
int width)
349 waddnstr(win, line,
MIN(
strlen(line), width - 2));
354 int x = getcurx(win);
356 for (i = 0; i < width -
x; i++)
369 static char *get_line(
void)
375 while (*
page !=
'\n') {
380 line[i++] = *(
page++);
399 static void print_position(
WINDOW * win)
403 wattrset(win,
dlg.position_indicator.atr);
404 wbkgdset(win,
dlg.position_indicator.atr & A_COLOR);
406 wmove(win, getmaxy(win) - 3, getmaxx(win) - 9);
407 wprintw(win,
"(%3d%%)", percent);