Lines Matching +full:2 +full:d

2  * SPDX-License-Identifier: BSD-2-Clause
11 * 2. Redistributions in binary form must reproduce the above copyright
44 int margin; /* 2 with multicolumn char, 0 otherwise */
45 int printrows; /* d.h - BORDERS - HBUTTONS */
48 static void updateborders(struct dialog *d, struct scrolltext *st) in updateborders() argument
53 if (d->conf->no_lines) in updateborders()
55 else if (d->conf->ascii_lines) in updateborders()
61 arrowch = LARROW(d->conf) | t.dialog.arrowcolor; in updateborders()
62 mvwvline(d->widget, (d->h / 2) - 2, 0, arrowch, 4); in updateborders()
64 wattron(d->widget, t.dialog.lineraisecolor); in updateborders()
65 mvwvline_set(d->widget, (d->h / 2) - 2, 0, &borderch, 4); in updateborders()
66 wattroff(d->widget, t.dialog.lineraisecolor); in updateborders()
69 if (st->xpad + d->w - 2 - st->margin < st->wpad) { in updateborders()
70 arrowch = RARROW(d->conf) | t.dialog.arrowcolor; in updateborders()
71 mvwvline(d->widget, (d->h / 2) - 2, d->w - 1, arrowch, 4); in updateborders()
73 wattron(d->widget, t.dialog.linelowercolor); in updateborders()
74 mvwvline_set(d->widget, (d->h / 2) - 2, d->w - 1, &borderch, 4); in updateborders()
75 wattroff(d->widget, t.dialog.linelowercolor); in updateborders()
78 if (st->hpad > d->h - 4) { in updateborders()
79 wattron(d->widget, t.dialog.arrowcolor); in updateborders()
80 mvwprintw(d->widget, d->h - 3, d->w - 6, in updateborders()
81 "%3d%%", 100 * (st->ypad + d->h - 4) / st->hpad); in updateborders()
82 wattroff(d->widget, t.dialog.arrowcolor); in updateborders()
86 static int textbox_size_position(struct dialog *d, struct scrolltext *st) in textbox_size_position() argument
90 if (set_widget_size(d->conf, d->rows, d->cols, &d->h, &d->w) != 0) in textbox_size_position()
92 if (set_widget_autosize(d->conf, d->rows, d->cols, &d->h, &d->w, in textbox_size_position()
93 d->text, NULL, &d->bs, st->hpad, st->wpad + st->margin) != 0) in textbox_size_position()
95 minw = (st->wpad > 0) ? 2 /*multicolumn char*/ + st->margin : 0 ; in textbox_size_position()
96 if (widget_checksize(d->h, d->w, &d->bs, MIN(st->hpad, 1), minw) != 0) in textbox_size_position()
98 if (set_widget_position(d->conf, &d->y, &d->x, d->h, d->w) != 0) in textbox_size_position()
104 static int textbox_draw(struct dialog *d, struct scrolltext *st) in textbox_draw() argument
106 if (d->built) { in textbox_draw()
107 hide_dialog(d); in textbox_draw()
110 if (textbox_size_position(d, st) != 0) in textbox_draw()
112 if (draw_dialog(d) != 0) in textbox_draw()
114 if (d->built) in textbox_draw()
117 st->ys = d->y + 1; in textbox_draw()
118 st->xs = (st->margin == 0) ? d->x + 1 : d->x + 2; in textbox_draw()
119 st->ye = st->ys + d->h - 5; in textbox_draw()
120 st->xe = st->xs + d->w - 3 - st->margin; in textbox_draw()
122 st->printrows = d->h-4; in textbox_draw()
139 struct dialog d; in bsddialog_textbox() local
146 if (prepare_dialog(conf, "" /* fake */, rows, cols, &d) != 0) in bsddialog_textbox()
148 set_buttons(&d, true, "EXIT", NULL); in bsddialog_textbox()
173 st.margin = 2; in bsddialog_textbox()
178 if (textbox_draw(&d, &st) != 0) in bsddialog_textbox()
183 updateborders(&d, &st); in bsddialog_textbox()
190 wrefresh(d.widget); in bsddialog_textbox()
194 if (shortcut_buttons(input, &d.bs)) { in bsddialog_textbox()
195 DRAW_BUTTONS(d); in bsddialog_textbox()
197 retval = BUTTONVALUE(d.bs); in bsddialog_textbox()
203 retval = BUTTONVALUE(d.bs); in bsddialog_textbox()
213 d.bs.curr = (d.bs.curr + 1) % d.bs.nbuttons; in bsddialog_textbox()
214 DRAW_BUTTONS(d); in bsddialog_textbox()
239 if (st.xpad + d.w - 2 - st.margin < st.wpad) in bsddialog_textbox()
257 if (textbox_draw(&d, &st) != 0) in bsddialog_textbox()
262 if (textbox_draw(&d, &st) != 0) in bsddialog_textbox()
269 end_dialog(&d); in bsddialog_textbox()