--- dialog4ports.c 2014-08-09 05:41:27.000000000 -0700 +++ dialog4ports.c 2014-08-09 07:45:30.000000000 -0700 @@ -50,11 +50,16 @@ static StringList *enable_items = NULL; /* New items */ static StringList *new_items = NULL; +/* Items set by default */ +static StringList *default_items = NULL; +/* Globally set/unset items */ +static StringList *global_set_items = NULL; +static StringList *global_unset_items = NULL; /* add item to items */ static void add_item(dialog_mixedlist **items, char const *name, char const *text, - bool state, bool new, int type, int grp) + bool state, bool new, bool deft, char global, int type, int grp) { if ((list_no + 1 > items_sz) || *items == NULL) { @@ -71,6 +76,8 @@ (*items)[list_no].type = type; (*items)[list_no].group = grp; (*items)[list_no].new = new; + (*items)[list_no].deft = deft; + (*items)[list_no].global = global; list_no++; } @@ -103,6 +110,22 @@ return (sl_find(new_items, name) != NULL); } +static bool +is_deft(char *name) +{ + return (sl_find(default_items, name) != NULL); +} + +static char +get_global(char *name) +{ + if (sl_find(global_set_items, name) != NULL) + return 'Y'; + if (sl_find(global_unset_items, name) != NULL) + return 'N'; + return ' '; +} + static StringList * parse_env_sl(char const *env_name) { @@ -146,7 +169,7 @@ if (token[0] == '\0') continue; add_item(items, token, get_desc(token, ""), is_enable(token), - is_new(token), type, group); + is_new(token), is_deft(token), get_global(token), type, group); } free(tofree); } else { @@ -155,7 +178,7 @@ if (token[0] == '\0') continue; if (list_no != 0) - add_item(items, get_desc(token, token), "", false, false, + add_item(items, get_desc(token, token), "", false, false, false, ' ', ITEM_SEPARATOR, group); snprintf(buf, sizeof(buf), "%s_%s", env_name, token); @@ -167,7 +190,8 @@ if (token2[0] == '\0') continue; add_item(items, token2, get_desc(token2, ""), - is_enable(token2), is_new(token2), type, group); + is_enable(token2), is_new(token2), is_deft(token2), get_global(token2), + type, group); } free(tofree2); group++; @@ -190,6 +214,9 @@ enable_items = parse_env_sl("PORT_OPTIONS"); new_items = parse_env_sl("NEW_OPTIONS"); + default_items = parse_env_sl("OPTIONS_DEFAULT"); + global_set_items = parse_env_sl("OPTIONS_GLOBAL_SET"); + global_unset_items = parse_env_sl("OPTIONS_GLOBAL_UNSET"); parsing_env(&items, "ALL_OPTIONS", ITEM_CHECK); parsing_env(&items, "OPTIONS_GROUP", ITEM_CHECK); --- mixedlist.c 2014-08-09 05:41:27.000000000 -0700 +++ mixedlist.c 2014-08-09 08:28:04.000000000 -0700 @@ -153,6 +153,9 @@ const int *indx; int limit, itype; char const *states; + char label; + int label_attr; + int x_attr; itype = items->type; /* x for [ ], * for ( ) */ @@ -194,10 +197,24 @@ } } /* No ;) */ else { + if (items->new) { + label = '+'; + label_attr = tag_key_attr; + } else if (items->global != ' ' && items->global != (items->deft ? 'Y' : 'N')) { + label = 'o'; + label_attr = button_label_inactive_attr; + } else { + label = ' '; + label_attr = item_attr; + } + if (items->state != (items->global != ' ' ? items->global == 'Y' : items->deft)) + x_attr = tag_key_attr; + else + x_attr = check_attr; wmove(win, choice, check_x - 1); - wattrset(win, tag_key_attr); - waddch(win, items->new ? '+' : ' '); - wattrset(win, selected ? check_selected_attr : check_attr); + wattrset(win, label_attr); + waddch(win, label); + wattrset(win, x_attr); wprintw(win, itype == ITEM_CHECK ? "[%c]" : "(%c)", states[items->state]); --- mixedlist.h 2014-08-09 05:41:27.000000000 -0700 +++ mixedlist.h 2014-08-09 06:37:40.000000000 -0700 @@ -12,6 +12,8 @@ int group; bool state; bool new; + bool deft; + char global; } dialog_mixedlist; /*