Lines Matching refs:obj
43 DIALOG_CALLBACK obj; member
56 free_obj(MY_OBJ * obj) in free_obj() argument
58 dlg_del_window(obj->obj.win); in free_obj()
59 free(obj->prompt); in free_obj()
61 while (obj->wrote) { in free_obj()
62 WROTE *wrote = obj->wrote; in free_obj()
63 obj->wrote = wrote->link; in free_obj()
68 free(obj); in free_obj()
73 restart_obj(MY_OBJ * obj) in restart_obj() argument
75 free(obj->prompt); in restart_obj()
76 obj->high = obj->old_high; in restart_obj()
77 obj->wide = obj->old_wide; in restart_obj()
79 dlg_del_window(obj->obj.win); in restart_obj()
84 start_obj(MY_OBJ * obj, const char *title, const char *cprompt) in start_obj() argument
88 obj->prompt = dlg_strclone(cprompt); in start_obj()
89 dlg_tab_correct_str(obj->prompt); in start_obj()
90 dlg_auto_size(title, obj->prompt, &obj->high, &obj->wide, MIN_HIGH, MIN_WIDE); in start_obj()
92 dlg_print_size(obj->high, obj->wide); in start_obj()
93 dlg_ctl_size(obj->high, obj->wide); in start_obj()
95 x = dlg_box_x_ordinate(obj->wide); in start_obj()
96 y = dlg_box_y_ordinate(obj->high); in start_obj()
97 thigh = obj->high - (2 * MARGIN); in start_obj()
99 obj->obj.win = dlg_new_window(obj->high, obj->wide, y, x); in start_obj()
101 dlg_draw_box2(obj->obj.win, in start_obj()
103 obj->high, obj->wide, in start_obj()
107 dlg_draw_title(obj->obj.win, title); in start_obj()
108 dlg_draw_helpline(obj->obj.win, FALSE); in start_obj()
110 if (obj->prompt[0] != '\0') { in start_obj()
114 dlg_attrset(obj->obj.win, dialog_attr); in start_obj()
115 dlg_print_autowrap(obj->obj.win, obj->prompt, obj->high, obj->wide); in start_obj()
116 getyx(obj->obj.win, y2, x2); in start_obj()
119 wmove(obj->obj.win, y2, MARGIN); in start_obj()
120 for (i = 0; i < getmaxx(obj->obj.win) - 2 * MARGIN; i++) in start_obj()
121 (void) waddch(obj->obj.win, dlg_boxchar(ACS_HLINE)); in start_obj()
127 obj->text = dlg_sub_window(obj->obj.win, in start_obj()
129 obj->wide - (2 * MARGIN), in start_obj()
133 (void) wrefresh(obj->obj.win); in start_obj()
135 (void) wmove(obj->obj.win, getmaxy(obj->text), (MARGIN + 1)); in start_obj()
136 (void) wnoutrefresh(obj->obj.win); in start_obj()
138 dlg_attr_clear(obj->text, getmaxy(obj->text), getmaxx(obj->text), dialog_attr); in start_obj()
145 get_line(MY_OBJ * obj, int *restart) in get_line() argument
147 FILE *fp = obj->obj.input; in get_line()
150 char *result = obj->line; in get_line()
168 obj->is_eof = 1; in get_line()
185 obj->line[col] = ' '; in get_line()
192 obj->line[col] = (char) ch; in get_line()
197 obj->line[col] = '\0'; in get_line()
201 WINDOW *win = obj->text; in get_line()
205 wrote->text = dlg_strclone(obj->line); in get_line()
206 wrote->link = obj->wrote; in get_line()
207 obj->wrote = wrote; in get_line()
224 print_line(MY_OBJ * obj, const char *line, int row) in print_line() argument
226 int width = obj->wide - (2 * MARGIN); in print_line()
229 (void) wmove(obj->text, row, 0); /* move cursor to correct line */ in print_line()
230 wprintw(obj->text, " %.*s", limit, line); in print_line()
232 waddch(obj->text, ' '); in print_line()
238 wrote_size(MY_OBJ * obj, int want) in wrote_size() argument
241 WROTE *wrote = obj->wrote; in wrote_size()
251 wrote_data(MY_OBJ * obj, int want) in wrote_data() argument
254 WROTE *wrote = obj->wrote; in wrote_data()
264 reprint_lines(MY_OBJ * obj, int buttons) in reprint_lines() argument
266 int want = getmaxy(obj->text) - (buttons ? 2 : 0); in reprint_lines()
267 int have = wrote_size(obj, want); in reprint_lines()
270 print_line(obj, wrote_data(obj, have - n), n); in reprint_lines()
272 (void) wrefresh(obj->text); in reprint_lines()
278 pause_for_ok(MY_OBJ * obj, const char *title, const char *cprompt) in pause_for_ok() argument
306 dlg_register_window(obj->obj.win, "progressbox", binding); in pause_for_ok()
307 dlg_register_buttons(obj->obj.win, "progressbox", buttons); in pause_for_ok()
309 dlg_draw_bottom_box2(obj->obj.win, border_attr, border2_attr, dialog_attr); in pause_for_ok()
318 dlg_draw_buttons(obj->obj.win, in pause_for_ok()
319 obj->high - 2, 0, in pause_for_ok()
321 FALSE, obj->wide); in pause_for_ok()
324 key = dlg_mouse_wgetch(obj->obj.win, &fkey); in pause_for_ok()
350 dlg_will_resize(obj->obj.win); in pause_for_ok()
351 restart_obj(obj); in pause_for_ok()
352 start_obj(obj, title, cprompt); in pause_for_ok()
353 reprint_lines(obj, TRUE); in pause_for_ok()
375 dlg_unregister_window(obj->obj.win); in pause_for_ok()
390 MY_OBJ *obj; in dlg_progressbox() local
403 obj = dlg_calloc(MY_OBJ, 1); in dlg_progressbox()
404 assert_ptr(obj, "dlg_progressbox"); in dlg_progressbox()
405 obj->obj.input = fp; in dlg_progressbox()
407 obj->high = height; in dlg_progressbox()
408 obj->wide = width; in dlg_progressbox()
411 obj->old_high = height; in dlg_progressbox()
412 obj->old_wide = width; in dlg_progressbox()
418 start_obj(obj, title, cprompt); in dlg_progressbox()
421 toprow = reprint_lines(obj, FALSE); in dlg_progressbox()
425 for (i = toprow; get_line(obj, &again); i++) { in dlg_progressbox()
428 dlg_will_resize(obj->obj.win); in dlg_progressbox()
429 restart_obj(obj); in dlg_progressbox()
433 if (i < getmaxy(obj->text)) { in dlg_progressbox()
434 print_line(obj, obj->line, i); in dlg_progressbox()
436 scrollok(obj->text, TRUE); in dlg_progressbox()
437 scroll(obj->text); in dlg_progressbox()
438 scrollok(obj->text, FALSE); in dlg_progressbox()
439 print_line(obj, obj->line, getmaxy(obj->text) - 1); in dlg_progressbox()
441 (void) wrefresh(obj->text); in dlg_progressbox()
442 if (obj->is_eof) in dlg_progressbox()
446 dlg_trace_win(obj->obj.win); in dlg_progressbox()
451 int base = getmaxy(obj->text) - need; in dlg_progressbox()
457 scrollok(obj->text, TRUE); in dlg_progressbox()
459 wscrl(obj->text, i); in dlg_progressbox()
461 (void) wrefresh(obj->text); in dlg_progressbox()
462 result = pause_for_ok(obj, title, cprompt); in dlg_progressbox()
464 wrefresh(obj->obj.win); in dlg_progressbox()
468 free_obj(obj); in dlg_progressbox()