aboutsummaryrefslogtreecommitdiff
path: root/mixedgauge.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixedgauge.c')
-rw-r--r--mixedgauge.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/mixedgauge.c b/mixedgauge.c
index b300e078a62a..30f0b69a1219 100644
--- a/mixedgauge.c
+++ b/mixedgauge.c
@@ -1,9 +1,9 @@
/*
- * $Id: mixedgauge.c,v 1.30 2012/11/18 16:30:20 tom Exp $
+ * $Id: mixedgauge.c,v 1.34 2018/06/18 22:09:31 tom Exp $
*
* mixedgauge.c -- implements the mixedgauge dialog
*
- * Copyright 2007-2011,2012 Thomas E. Dickey
+ * Copyright 2007-2012,2018 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@@ -89,7 +89,7 @@ status_string(char *given, char **freeMe)
break;
}
} else if (*given == '-') {
- size_t need = strlen(++given);
+ size_t need = strlen(++given) + 4;
char *temp = dlg_malloc(char, need);
*freeMe = temp;
sprintf(temp, "%3s%%", given);
@@ -135,6 +135,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg)
continue;
(void) wmove(win, y, 2 * MARGIN);
+ dlg_attrset(win, dialog_attr);
dlg_print_text(win, dlg->list[item].name, lm, &attr);
(void) wmove(win, y, lm);
@@ -142,7 +143,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg)
(void) wmove(win, y, lm + (cells - (int) strlen(status)) / 2);
if (freeMe) {
(void) wmove(win, y, lm + 1);
- (void) wattrset(win, title_attr);
+ dlg_attrset(win, title_attr);
for (j = 0; j < cells; j++)
(void) waddch(win, ' ');
@@ -150,9 +151,9 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg)
(void) waddstr(win, status);
if ((title_attr & A_REVERSE) != 0) {
- wattroff(win, A_REVERSE);
+ dlg_attroff(win, A_REVERSE);
} else {
- (void) wattrset(win, A_REVERSE);
+ dlg_attrset(win, A_REVERSE);
}
(void) wmove(win, y, lm + 1);
@@ -173,6 +174,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg)
(void) waddstr(win, status);
}
(void) wmove(win, y, limit_x - 3);
+ dlg_attrset(win, dialog_attr);
(void) waddch(win, ']');
(void) wnoutrefresh(win);
}
@@ -189,10 +191,10 @@ mydraw_mixed_box(WINDOW *win, int y, int x, int height, int width,
chtype attr = A_NORMAL;
const char *message = _("Overall Progress");
chtype save2 = dlg_get_attrs(win);
- (void) wattrset(win, title_attr);
+ dlg_attrset(win, title_attr);
(void) wmove(win, y, x + 2);
dlg_print_text(win, message, width, &attr);
- (void) wattrset(win, save2);
+ dlg_attrset(win, save2);
}
}
@@ -220,7 +222,7 @@ dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent)
* attribute.
*/
(void) wmove(dlg->dialog, dlg->height - 3, 4);
- (void) wattrset(dlg->dialog, gauge_attr);
+ dlg_attrset(dlg->dialog, gauge_attr);
for (i = 0; i < (dlg->width - 2 * (3 + MARGIN)); i++)
(void) waddch(dlg->dialog, ' ');
@@ -235,9 +237,9 @@ dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent)
*/
x = (percent * (dlg->width - 2 * (3 + MARGIN))) / 100;
if ((title_attr & A_REVERSE) != 0) {
- wattroff(dlg->dialog, A_REVERSE);
+ dlg_attroff(dlg->dialog, A_REVERSE);
} else {
- (void) wattrset(dlg->dialog, A_REVERSE);
+ dlg_attrset(dlg->dialog, A_REVERSE);
}
(void) wmove(dlg->dialog, dlg->height - 3, 4);
for (i = 0; i < x; i++) {
@@ -338,7 +340,7 @@ dlg_begin_mixedgauge(DIALOG_MIXEDGAUGE * dlg,
dlg->width,
y + dlg->item_no + (2 * MARGIN),
x);
- (void) wattrset(dlg->caption, dialog_attr);
+ dlg_attrset(dlg->caption, dialog_attr);
dlg_print_autowrap(dlg->caption, dlg->prompt, dlg->height, dlg->width);
}
@@ -383,6 +385,15 @@ dialog_mixedgauge(const char *title,
DIALOG_MIXEDGAUGE dlg;
int began = 0;
+ DLG_TRACE(("# mixedgauge args:\n"));
+ DLG_TRACE2S("title", title);
+ DLG_TRACE2S("message", cprompt);
+ DLG_TRACE2N("height", height);
+ DLG_TRACE2N("width", width);
+ DLG_TRACE2N("percent", percent);
+ DLG_TRACE2N("llength", item_no);
+ /* FIXME dump the items[][] too */
+
dlg_begin_mixedgauge(&dlg, &began, title, cprompt, height,
width, item_no, items);