Lines Matching +full:d +full:-

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2021-2024 Alfonso Sabato Siciliano
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()
60 if (st->xpad > 0) { 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()
121 st->ypad = st->xpad = 0; 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()
151 if (conf->text.tablen > 0) in bsddialog_textbox()
152 set_tabsize(conf->text.tablen); in bsddialog_textbox()
166 if (i > st.hpad-1) { 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()
207 if (conf->key.enable_esc) { in bsddialog_textbox()
213 d.bs.curr = (d.bs.curr + 1) % d.bs.nbuttons; in bsddialog_textbox()
214 DRAW_BUTTONS(d); in bsddialog_textbox()
220 st.ypad = MAX(st.hpad - st.printrows, 0); in bsddialog_textbox()
223 st.ypad = MAX(st.ypad - st.printrows, 0); in bsddialog_textbox()
228 st.ypad = st.hpad - st.printrows; in bsddialog_textbox()
235 st.xpad = MAX(st.xpad - 1, 0); in bsddialog_textbox()
239 if (st.xpad + d.w - 2 - st.margin < st.wpad) in bsddialog_textbox()
244 st.ypad = MAX(st.ypad - 1, 0); in bsddialog_textbox()
248 if (st.ypad + st.printrows <= st.hpad -1) in bsddialog_textbox()
252 if (conf->key.f1_file == NULL && in bsddialog_textbox()
253 conf->key.f1_message == NULL) 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()