Lines Matching +full:y +full:- +full:min

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2021-2024 Alfonso Sabato Siciliano
46 #define WBOX(d) ((d)->w - BORDERS - BARPADDING - BARPADDING)
47 #define WBAR(d) (WBOX(d) - BOXBORDERS)
54 " Succeeded ", /* -1 */
55 " Failed ", /* -2 */
56 " Passed ", /* -3 */
57 " Completed ", /* -4 */
58 " Checked ", /* -5 */
59 " Done ", /* -6 */
60 " Skipped ", /* -7 */
61 " In Progress ", /* -8 */
62 "(blank) ", /* -9 */
63 " N/A ", /* -10 */
64 " Pending ", /* -11 */
65 " UNKNOWN ", /* < -11, no API */
71 int y; /* bar y in win */
85 barlen = b->perc > 0 ? (b->perc * b->w) / 100 : 0;
88 mvwhline(b->win, b->y, b->x, ch, barlen);
90 mvwhline(b->win, b->y, b->x + barlen, ch, b->w - barlen);
92 sprintf(label, b->fmt, b->label);
93 xlabel = b->x + b->w/2 - (int)strlen(label)/2; /* 1-byte-char string */
94 wattron(b->win, t.bar.color); /* x+barlen < xlabel */
95 mvwaddstr(b->win, b->y, xlabel, label);
96 wattroff(b->win, t.bar.color);
97 wattron(b->win, t.bar.f_color); /* x+barlen >= xlabel */
98 mvwaddnstr(b->win, b->y, xlabel, label, MAX((b->x+barlen) - xlabel, 0));
99 wattroff(b->win, t.bar.f_color);
101 if (b->toupdate)
102 wnoutrefresh(b->win);
103 b->toupdate = false;
108 int y;
110 y = d->y + d->h - BORDER - HBOX;
112 y -= HBUTTONS;
113 update_box(d->conf, b->win, y, d->x + BORDER + BARPADDING, HBOX,
132 b.y = b.x = 1;
145 perc = MIN(perc, 100);
180 perc = MIN(perc, 100);
210 mvwaddcstr(WINDOW *win, int y, int x, const char *mbstring, unsigned int cols)
221 charlen != (size_t)-1 && charlen != (size_t)-2) {
229 mvwaddnstr(win, y, x, mbstring, n);
231 mvwaddstr(win, y, (x + cols) - 3, "...");
247 if (set_widget_size(d->conf, d->rows, d->cols, &d->h, &d->w) != 0)
249 if (set_widget_autosize(d->conf, d->rows, d->cols, &d->h, &d->w,
250 d->text, htext, &d->bs, nminibars + HBOX, max_minibarlen) != 0)
252 if (widget_checksize(d->h, d->w, &d->bs, nminibars + HBOX,
255 if (set_widget_position(d->conf, &d->y, &d->x, d->h, d->w) != 0)
287 b.x = 1 + d.w - 2 - 15;
296 mvwaddcstr(d.widget, i+1, 2, CHECK_STR(minilabels[i]), d.w-20);
302 mvwaddstr(d.widget, i+1, d.w-2-15, "[ ]");
304 b.y = i + 1;
305 b.perc = b.label = MIN(miniperc, 100);
309 miniperc = -12; /* UNKNOWN */
317 mvwaddstr(d.widget, i+1, 1+d.w-2-15, states[miniperc]);
324 ystext = MAX(d.h - BORDERS - htext - HBOX, (int)nminibars);
335 b.y = b.x = 1;
338 b.perc = b.label = MIN(mainperc, 100);
388 refresh = pvconf->refresh == 0 ? 0 : pvconf->refresh - 1;
407 move(SCREENLINES - 1, 2);
409 readforsec = ((tnew - tstart) == 0) ? 0 :
410 bsddialog_total_progview / (float)(tnew - tstart);
411 printw(pvconf->fmtbottomstr, bsddialog_total_progview,
424 perc = pvconf->callback(&minibar[i]);
445 if (d->built) {
453 if (d->built)
457 b->w = WBAR(d);
458 *bigchange = MAX(1, b->w / 10);
460 b->toupdate = true;
467 int cols, int min, int max, int *value)
476 if (min >= max)
477 RETURN_FMTERROR("min (%d) >= max (%d)", min, max);
478 if (*value < min)
479 RETURN_FMTERROR("value (%d) < min (%d)", *value, min);
484 positions = max - min + 1;
491 b.y = b.x = 1;
499 b.perc = ((float)(currvalue - min)*100) / (positions-1);
513 if (conf->key.enable_esc) {
526 d.bs.curr--;
528 d.bs.curr = d.bs.nbuttons - 1;
536 currvalue = min;
540 currvalue -= bigchange;
541 if (currvalue < min)
542 currvalue = min;
551 case '-':
553 if (currvalue > min) {
554 currvalue--;
566 if (conf->key.f1_file == NULL &&
567 conf->key.f1_message == NULL)
599 if (d->built) {
607 if (d->built)
611 b->w = WBAR(d);
613 b->toupdate = true;
634 b.y = b.x = 1;
651 tout--;
668 if (conf->key.enable_esc) {
679 d.bs.curr--;
681 d.bs.curr = d.bs.nbuttons - 1;
685 if (conf->key.f1_file == NULL &&
686 conf->key.f1_message == NULL)