Lines Matching +full:spin +full:- +full:up
1 /*-
2 * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
62 int pbar_size = PBAR_SIZE_DEFAULT; /* Mini-progressbar size */
71 static char spin[SPIN_SIZE + 1] = "/-\\|"; variable
73 static char *spin_cp = spin;
81 * Returns a pointer to the current spin character in the spin string and
90 spin_cp = spin; in spin_char()
94 if (++spin_cp >= (spin + SPIN_SIZE)) in spin_char()
95 spin_cp = spin; in spin_char()
127 /* Calculate width of dialog(3) or [X]dialog(1) --gauge box */ in dprompt_init()
131 * Calculate height of dialog(3) or [X]dialog(1) --gauge box in dprompt_init()
137 max_rows -= use_shadow ? 3 : 2; in dprompt_init()
139 max_rows -= 2; in dprompt_init()
140 /* add lines for `-p text' */ in dprompt_init()
143 warnx("`-p text' is %i line%s long", numlines, in dprompt_init()
148 dheight -= dialog_prompt_nlstate(pprompt); in dprompt_init()
155 dheight--; in dprompt_init()
161 for (; display_limit > 0; display_limit--) { in dprompt_init()
166 curfile = curfile->next) { in dprompt_init()
168 numlines += dialog_prompt_numlines(curfile->name, nls); in dprompt_init()
178 (int)dialog_prompt_numlines(aprompt, use_dialog) - in dprompt_init()
184 if ((max_rows - (use_shadow ? 5 : 4)) >= fheight) in dprompt_init()
188 /* add lines for `-a text' */ in dprompt_init()
191 warnx("`-a text' is %i line%s long", numlines, in dprompt_init()
216 if (pbar_size > dwidth - 9) { in dprompt_init()
217 pbar_size = dwidth - 9; in dprompt_init()
219 /* -9 = "| - [" ... "] |" */ in dprompt_init()
222 label_size = dwidth - 8; in dprompt_init()
223 /* -8 = "| " ... " - |" */ in dprompt_init()
224 else if (label_size > (dwidth - pbar_size - 9) || wide) in dprompt_init()
225 label_size = no_labels ? 0 : dwidth - pbar_size - 9; in dprompt_init()
226 /* -9 = "| " ... " - [" ... "] |" */ in dprompt_init()
232 /* Touch up the height (now that we know dwidth) */ in dprompt_init()
233 dheight += dialog_prompt_wrappedlines(pprompt, dwidth - 4, 0); in dprompt_init()
234 dheight += dialog_prompt_wrappedlines(aprompt, dwidth - 4, 1); in dprompt_init()
241 pct_lsize = (pbar_size - 4) / 2; /* -4 == printf("%-3s%%", pct) */ in dprompt_init()
243 /* If not evenly divisible by 2, increment the right-side */ in dprompt_init()
264 /* Calculate left/right portions for mini-progressbar */ in dprompt_init()
265 done_lsize = (pbar_size - done_size) / 2; in dprompt_init()
267 /* If not evenly divisible by 2, increment the right-side */ in dprompt_init()
289 /* Calculate left/right portions for mini-progressbar */ in dprompt_init()
290 fail_lsize = (pbar_size - fail_size) / 2; in dprompt_init()
292 /* If not evenly divisible by 2, increment the right-side */ in dprompt_init()
314 /* Calculate left/right portions for mini-progressbar */ in dprompt_init()
315 pend_lsize = (pbar_size - pend_size) / 2; in dprompt_init()
317 /* If not evenly divisible by 2, increment the right-side */ in dprompt_init()
329 * Clear the [X]dialog(1) `--gauge' prompt buffer.
340 * Append to the [X]dialog(1) `--gauge' prompt buffer. Syntax is like printf(3)
353 len = vsnprintf(dprompt_pos, (size_t)(PROMPT_MAX - in dprompt_add()
354 (dprompt_pos - dprompt)), format, ap); in dprompt_add()
356 if (len == -1) in dprompt_add()
369 * Append active files to the [X]dialog(1) `--gauge' prompt buffer. Syntax
370 * requires a pointer to the head of the dpv_file_node linked-list. Returns the
414 * Create mini-progressbar for current file (if applicable) in dprompt_add_files()
418 (curfile->length >= 0 || dialog_test)) { in dprompt_add_files()
422 /* Calculate the fill-width of progressbar */ in dprompt_add_files()
424 /* Round up based on one-tenth of a percent */ in dprompt_add_files()
446 for (fp = file_list; fp != NULL; fp = fp->next) { in dprompt_add_files()
448 name = fp->name; in dprompt_add_files()
453 * the last line and the text leading up to the last line can in dprompt_add_files()
483 /* If no mini-progressbar, increase label width */ in dprompt_add_files()
484 if (pbar_size < 0 && flabel_size <= FLABEL_MAX - 2 && in dprompt_add_files()
490 flabel_size) sprintf(flabel + flabel_size - 3, "..."); in dprompt_add_files()
503 snprintf(cp, flabel_size - in dprompt_add_files()
504 (cp - flabel) + 1, "..."); in dprompt_add_files()
507 dprompt_add("%s%-*s%s %c", use_color ? "\\Zb" : "", in dprompt_add_files()
511 dprompt_add("%-*s%s %s", flabel_size, in dprompt_add_files()
518 if (fp->msg != NULL) in dprompt_add_files()
528 if (fp->length < 0) in dprompt_add_files()
530 else if (fp->status == DPV_STATUS_RUNNING) in dprompt_add_files()
538 else if (fp->status == DPV_STATUS_RUNNING) in dprompt_add_files()
539 dstate = fp->length < 0 ? in dprompt_add_files()
542 dstate = fp->length < 0 ? in dprompt_add_files()
548 dstate = fp->length < 0 ? in dprompt_add_files()
552 " [\\Z%c%s%-*s%s%-*s\\Zn]\\n" : in dprompt_add_files()
553 " [%-*s%s%-*s]\\n"; in dprompt_add_files()
554 if (fp->status == DPV_STATUS_FAILED) { in dprompt_add_files()
567 dprompt_add(" [%-*s%s%-*s]\\n", in dprompt_add_files()
584 humanize_number(human, pbar_size + 2, fp->read, "", in dprompt_add_files()
589 lsize = (pbar_size - hlen) / 2; in dprompt_add_files()
601 case DPROMPT_CUSTOM_MSG: /* File-specific message override */ in dprompt_add_files()
602 snprintf(msg, PROMPT_MAX + 1, "%s", fp->msg); in dprompt_add_files()
608 mesg_lsize = (pbar_size - mesg_size) / 2; in dprompt_add_files()
651 * the `-a text' always appears in the same spot. in dprompt_add_files()
654 * maximum height required to display the set of items (broken up into in dprompt_add_files()
667 * Process the dpv_file_node linked-list of named files, re-generating the
668 * [X]dialog(1) `--gauge' prompt text for the current state of transfers.
677 * Re-Build the prompt text in dprompt_recreate()
699 * Print the [X]dialog(1) `--gauge' prompt text to a buffer.
710 * Print the [X]dialog(1) `--gauge' prompt text to file descriptor fd (could