summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <sven.eden@gmx.de>2013-02-01 22:13:34 +0100
committerSven Eden <sven.eden@gmx.de>2013-02-01 22:13:34 +0100
commit8b70cd015e891fcca7c2478f45e730223a54f97b (patch)
tree341816291e218d68095ebc8e23acaae3bee7c6d5 /ufed-curses-checklist.c
parentAdded a new Char to show local Masked/Forced status. (diff)
downloadufed-8b70cd015e891fcca7c2478f45e730223a54f97b.tar.gz
ufed-8b70cd015e891fcca7c2478f45e730223a54f97b.tar.bz2
ufed-8b70cd015e891fcca7c2478f45e730223a54f97b.zip
Unified display of masked and forced flags. Only flags that are fully forced or masked are bracketed now. This should clarify some confusion about what can be changed and what can't.
Diffstat (limited to 'ufed-curses-checklist.c')
-rw-r--r--ufed-curses-checklist.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 31a2294..f8a5ec4 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -236,19 +236,17 @@ static int drawflag(sFlag* flag, bool highlight)
int lHeight = wHeight(List);
int descLen = wWidth(List) - (minwidth + 9);
bool hasHead = false;
- char special = ' ';
- char *p;
+ char *p, special;
+
for( ; (idx < flag->ndesc) && (line < lHeight); ++idx) {
// Continue if any of the filters apply:
if (!isDescLegal(flag, idx))
continue;
// Set special character if needed:
- if ( (flag->globalForced && ('-' != flag->desc[idx].stateForced))
- || isDescForced(flag, idx))
+ if (isDescForced(flag, idx))
special = 'F';
- else if ( (flag->globalMasked && ('-' != flag->desc[idx].stateMasked))
- || isDescMasked(flag, idx))
+ else if (isDescMasked(flag, idx))
special = 'M';
else
special = ' ';
@@ -259,27 +257,19 @@ static int drawflag(sFlag* flag, bool highlight)
*p = ' ';
} else {
/* print the selection, name and state of the flag */
- char prefix[2] = { 0, 0 };
- char postfix[2] = { 0, 0 };
- int postlen = 5;
- if (isDescForced(flag, idx)) {
- prefix[0] = '+';
- postfix[0] = '+';
- postlen = 3;
- } else if (isDescMasked(flag, idx)) {
- prefix[0] = '(';
- postfix[0] = ')';
- postlen = 3;
- }
sprintf(buf, " %c%c%c %s%s%s%-*s ",
/* State of selection */
flag->stateConf == ' ' ? '(' : '[',
flag->stateConf,
flag->stateConf == ' ' ? ')' : ']',
/* name */
- prefix, flag->name, postfix,
+ flag->globalForced ? "(+" : flag->globalMasked ? "(" : "",
+ flag->name,
+ (flag->globalForced || flag->globalMasked) ? ")" : "",
/* distance */
- (int)(minwidth - postlen - strlen(flag->name)), " ");
+ (int)(minwidth
+ - (flag->globalForced ? 2 : flag->globalMasked ? 3 : 5)
+ - strlen(flag->name)), " ");
// At this point buf is filled up to minwidth
hasHead = true;
} // End of generating left side mask display