build: scripts/config - update to kconfig-v5.14
Functional Changes ---------- ------- - make 'imply' not impose any restrictions: allow symbols implied by y to become m - change "modules" from sub-option to first-level attribute Bugfixes -------- - nconf: fix core dump when searching in empty menu - nconf: stop endless search loops - xconfig: fix content of the main widget - xconfig: fix support for the split view mode Other Changes ----- ------- - highlight xconfig 'comment' lines with '***' - xconfig: navigate menus on hyperlinks - xconfig: drop support for Qt4 - improve host ncurses detection Update the 'option modules' usage to just 'modules' in Config.in. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
committed by
Petr Štetiar
parent
73ea763c0d
commit
009293c52e
@@ -7,169 +7,120 @@
|
||||
#include "nconf.h"
|
||||
#include "lkc.h"
|
||||
|
||||
/* a list of all the different widgets we use */
|
||||
attributes_t attributes[ATTR_MAX+1] = {0};
|
||||
int attr_normal;
|
||||
int attr_main_heading;
|
||||
int attr_main_menu_box;
|
||||
int attr_main_menu_fore;
|
||||
int attr_main_menu_back;
|
||||
int attr_main_menu_grey;
|
||||
int attr_main_menu_heading;
|
||||
int attr_scrollwin_text;
|
||||
int attr_scrollwin_heading;
|
||||
int attr_scrollwin_box;
|
||||
int attr_dialog_text;
|
||||
int attr_dialog_menu_fore;
|
||||
int attr_dialog_menu_back;
|
||||
int attr_dialog_box;
|
||||
int attr_input_box;
|
||||
int attr_input_heading;
|
||||
int attr_input_text;
|
||||
int attr_input_field;
|
||||
int attr_function_text;
|
||||
int attr_function_highlight;
|
||||
|
||||
/* available colors:
|
||||
COLOR_BLACK 0
|
||||
COLOR_RED 1
|
||||
COLOR_GREEN 2
|
||||
COLOR_YELLOW 3
|
||||
COLOR_BLUE 4
|
||||
COLOR_MAGENTA 5
|
||||
COLOR_CYAN 6
|
||||
COLOR_WHITE 7
|
||||
*/
|
||||
static void set_normal_colors(void)
|
||||
{
|
||||
init_pair(NORMAL, -1, -1);
|
||||
init_pair(MAIN_HEADING, COLOR_MAGENTA, -1);
|
||||
#define COLOR_ATTR(_at, _fg, _bg, _hl) \
|
||||
{ .attr = &(_at), .has_color = true, .color_fg = _fg, .color_bg = _bg, .highlight = _hl }
|
||||
#define NO_COLOR_ATTR(_at, _hl) \
|
||||
{ .attr = &(_at), .has_color = false, .highlight = _hl }
|
||||
#define COLOR_DEFAULT -1
|
||||
|
||||
/* FORE is for the selected item */
|
||||
init_pair(MAIN_MENU_FORE, -1, -1);
|
||||
/* BACK for all the rest */
|
||||
init_pair(MAIN_MENU_BACK, -1, -1);
|
||||
init_pair(MAIN_MENU_GREY, -1, -1);
|
||||
init_pair(MAIN_MENU_HEADING, COLOR_GREEN, -1);
|
||||
init_pair(MAIN_MENU_BOX, COLOR_YELLOW, -1);
|
||||
struct nconf_attr_param {
|
||||
int *attr;
|
||||
bool has_color;
|
||||
int color_fg;
|
||||
int color_bg;
|
||||
int highlight;
|
||||
};
|
||||
|
||||
init_pair(SCROLLWIN_TEXT, -1, -1);
|
||||
init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1);
|
||||
init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1);
|
||||
static const struct nconf_attr_param color_theme_params[] = {
|
||||
COLOR_ATTR(attr_normal, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_main_heading, COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD | A_UNDERLINE),
|
||||
COLOR_ATTR(attr_main_menu_box, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_main_menu_fore, COLOR_DEFAULT, COLOR_DEFAULT, A_REVERSE),
|
||||
COLOR_ATTR(attr_main_menu_back, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_main_menu_grey, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_main_menu_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_scrollwin_text, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_scrollwin_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_scrollwin_box, COLOR_YELLOW, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_dialog_text, COLOR_DEFAULT, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_dialog_menu_fore, COLOR_RED, COLOR_DEFAULT, A_STANDOUT),
|
||||
COLOR_ATTR(attr_dialog_menu_back, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_dialog_box, COLOR_YELLOW, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_input_box, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_input_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD),
|
||||
COLOR_ATTR(attr_input_text, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL),
|
||||
COLOR_ATTR(attr_input_field, COLOR_DEFAULT, COLOR_DEFAULT, A_UNDERLINE),
|
||||
COLOR_ATTR(attr_function_text, COLOR_YELLOW, COLOR_DEFAULT, A_REVERSE),
|
||||
COLOR_ATTR(attr_function_highlight, COLOR_DEFAULT, COLOR_DEFAULT, A_BOLD),
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
init_pair(DIALOG_TEXT, -1, -1);
|
||||
init_pair(DIALOG_BOX, COLOR_YELLOW, -1);
|
||||
init_pair(DIALOG_MENU_BACK, COLOR_YELLOW, -1);
|
||||
init_pair(DIALOG_MENU_FORE, COLOR_RED, -1);
|
||||
|
||||
init_pair(INPUT_BOX, COLOR_YELLOW, -1);
|
||||
init_pair(INPUT_HEADING, COLOR_GREEN, -1);
|
||||
init_pair(INPUT_TEXT, -1, -1);
|
||||
init_pair(INPUT_FIELD, -1, -1);
|
||||
|
||||
init_pair(FUNCTION_HIGHLIGHT, -1, -1);
|
||||
init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
|
||||
}
|
||||
|
||||
/* available attributes:
|
||||
A_NORMAL Normal display (no highlight)
|
||||
A_STANDOUT Best highlighting mode of the terminal.
|
||||
A_UNDERLINE Underlining
|
||||
A_REVERSE Reverse video
|
||||
A_BLINK Blinking
|
||||
A_DIM Half bright
|
||||
A_BOLD Extra bright or bold
|
||||
A_PROTECT Protected mode
|
||||
A_INVIS Invisible or blank mode
|
||||
A_ALTCHARSET Alternate character set
|
||||
A_CHARTEXT Bit-mask to extract a character
|
||||
COLOR_PAIR(n) Color-pair number n
|
||||
*/
|
||||
static void normal_color_theme(void)
|
||||
{
|
||||
/* automatically add color... */
|
||||
#define mkattr(name, attr) do { \
|
||||
attributes[name] = attr | COLOR_PAIR(name); } while (0)
|
||||
mkattr(NORMAL, NORMAL);
|
||||
mkattr(MAIN_HEADING, A_BOLD | A_UNDERLINE);
|
||||
|
||||
mkattr(MAIN_MENU_FORE, A_REVERSE);
|
||||
mkattr(MAIN_MENU_BACK, A_NORMAL);
|
||||
mkattr(MAIN_MENU_GREY, A_NORMAL);
|
||||
mkattr(MAIN_MENU_HEADING, A_BOLD);
|
||||
mkattr(MAIN_MENU_BOX, A_NORMAL);
|
||||
|
||||
mkattr(SCROLLWIN_TEXT, A_NORMAL);
|
||||
mkattr(SCROLLWIN_HEADING, A_BOLD);
|
||||
mkattr(SCROLLWIN_BOX, A_BOLD);
|
||||
|
||||
mkattr(DIALOG_TEXT, A_BOLD);
|
||||
mkattr(DIALOG_BOX, A_BOLD);
|
||||
mkattr(DIALOG_MENU_FORE, A_STANDOUT);
|
||||
mkattr(DIALOG_MENU_BACK, A_NORMAL);
|
||||
|
||||
mkattr(INPUT_BOX, A_NORMAL);
|
||||
mkattr(INPUT_HEADING, A_BOLD);
|
||||
mkattr(INPUT_TEXT, A_NORMAL);
|
||||
mkattr(INPUT_FIELD, A_UNDERLINE);
|
||||
|
||||
mkattr(FUNCTION_HIGHLIGHT, A_BOLD);
|
||||
mkattr(FUNCTION_TEXT, A_REVERSE);
|
||||
}
|
||||
|
||||
static void no_colors_theme(void)
|
||||
{
|
||||
/* automatically add highlight, no color */
|
||||
#define mkattrn(name, attr) { attributes[name] = attr; }
|
||||
|
||||
mkattrn(NORMAL, NORMAL);
|
||||
mkattrn(MAIN_HEADING, A_BOLD | A_UNDERLINE);
|
||||
|
||||
mkattrn(MAIN_MENU_FORE, A_STANDOUT);
|
||||
mkattrn(MAIN_MENU_BACK, A_NORMAL);
|
||||
mkattrn(MAIN_MENU_GREY, A_NORMAL);
|
||||
mkattrn(MAIN_MENU_HEADING, A_BOLD);
|
||||
mkattrn(MAIN_MENU_BOX, A_NORMAL);
|
||||
|
||||
mkattrn(SCROLLWIN_TEXT, A_NORMAL);
|
||||
mkattrn(SCROLLWIN_HEADING, A_BOLD);
|
||||
mkattrn(SCROLLWIN_BOX, A_BOLD);
|
||||
|
||||
mkattrn(DIALOG_TEXT, A_NORMAL);
|
||||
mkattrn(DIALOG_BOX, A_BOLD);
|
||||
mkattrn(DIALOG_MENU_FORE, A_STANDOUT);
|
||||
mkattrn(DIALOG_MENU_BACK, A_NORMAL);
|
||||
|
||||
mkattrn(INPUT_BOX, A_BOLD);
|
||||
mkattrn(INPUT_HEADING, A_BOLD);
|
||||
mkattrn(INPUT_TEXT, A_NORMAL);
|
||||
mkattrn(INPUT_FIELD, A_UNDERLINE);
|
||||
|
||||
mkattrn(FUNCTION_HIGHLIGHT, A_BOLD);
|
||||
mkattrn(FUNCTION_TEXT, A_REVERSE);
|
||||
}
|
||||
static const struct nconf_attr_param no_color_theme_params[] = {
|
||||
NO_COLOR_ATTR(attr_normal, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_main_heading, A_BOLD | A_UNDERLINE),
|
||||
NO_COLOR_ATTR(attr_main_menu_box, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_main_menu_fore, A_STANDOUT),
|
||||
NO_COLOR_ATTR(attr_main_menu_back, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_main_menu_grey, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_main_menu_heading, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_scrollwin_text, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_scrollwin_heading, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_scrollwin_box, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_dialog_text, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_dialog_menu_fore, A_STANDOUT),
|
||||
NO_COLOR_ATTR(attr_dialog_menu_back, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_dialog_box, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_input_box, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_input_heading, A_BOLD),
|
||||
NO_COLOR_ATTR(attr_input_text, A_NORMAL),
|
||||
NO_COLOR_ATTR(attr_input_field, A_UNDERLINE),
|
||||
NO_COLOR_ATTR(attr_function_text, A_REVERSE),
|
||||
NO_COLOR_ATTR(attr_function_highlight, A_BOLD),
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
void set_colors(void)
|
||||
{
|
||||
start_color();
|
||||
use_default_colors();
|
||||
set_normal_colors();
|
||||
const struct nconf_attr_param *p;
|
||||
int pair = 0;
|
||||
|
||||
if (has_colors()) {
|
||||
normal_color_theme();
|
||||
start_color();
|
||||
use_default_colors();
|
||||
p = color_theme_params;
|
||||
} else {
|
||||
/* give defaults */
|
||||
no_colors_theme();
|
||||
p = no_color_theme_params;
|
||||
}
|
||||
|
||||
for (; p->attr; p++) {
|
||||
int attr = p->highlight;
|
||||
|
||||
if (p->has_color) {
|
||||
pair++;
|
||||
init_pair(pair, p->color_fg, p->color_bg);
|
||||
attr |= COLOR_PAIR(pair);
|
||||
}
|
||||
|
||||
*p->attr = attr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* this changes the windows attributes !!! */
|
||||
void print_in_middle(WINDOW *win,
|
||||
int starty,
|
||||
int startx,
|
||||
int width,
|
||||
const char *string,
|
||||
chtype color)
|
||||
{ int length, x, y;
|
||||
float temp;
|
||||
|
||||
|
||||
if (win == NULL)
|
||||
win = stdscr;
|
||||
getyx(win, y, x);
|
||||
if (startx != 0)
|
||||
x = startx;
|
||||
if (starty != 0)
|
||||
y = starty;
|
||||
if (width == 0)
|
||||
width = 80;
|
||||
|
||||
length = strlen(string);
|
||||
temp = (width - length) / 2;
|
||||
x = startx + (int)temp;
|
||||
(void) wattrset(win, color);
|
||||
mvwprintw(win, y, x, "%s", string);
|
||||
refresh();
|
||||
void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs)
|
||||
{
|
||||
wattrset(win, attrs);
|
||||
mvwprintw(win, y, (width - strlen(str)) / 2, "%s", str);
|
||||
}
|
||||
|
||||
int get_line_no(const char *text)
|
||||
@@ -294,14 +245,14 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
|
||||
msg_win = derwin(win, win_rows-2, msg_width, 1,
|
||||
1+(total_width+2-msg_width)/2);
|
||||
|
||||
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
|
||||
set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
|
||||
set_menu_fore(menu, attr_dialog_menu_fore);
|
||||
set_menu_back(menu, attr_dialog_menu_back);
|
||||
|
||||
(void) wattrset(win, attributes[DIALOG_BOX]);
|
||||
wattrset(win, attr_dialog_box);
|
||||
box(win, 0, 0);
|
||||
|
||||
/* print message */
|
||||
(void) wattrset(msg_win, attributes[DIALOG_TEXT]);
|
||||
wattrset(msg_win, attr_dialog_text);
|
||||
fill_window(msg_win, msg);
|
||||
|
||||
set_menu_win(menu, win);
|
||||
@@ -405,16 +356,16 @@ int dialog_inputbox(WINDOW *main_window,
|
||||
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
|
||||
keypad(form_win, TRUE);
|
||||
|
||||
(void) wattrset(form_win, attributes[INPUT_FIELD]);
|
||||
wattrset(form_win, attr_input_field);
|
||||
|
||||
(void) wattrset(win, attributes[INPUT_BOX]);
|
||||
wattrset(win, attr_input_box);
|
||||
box(win, 0, 0);
|
||||
(void) wattrset(win, attributes[INPUT_HEADING]);
|
||||
wattrset(win, attr_input_heading);
|
||||
if (title)
|
||||
mvwprintw(win, 0, 3, "%s", title);
|
||||
|
||||
/* print message */
|
||||
(void) wattrset(prompt_win, attributes[INPUT_TEXT]);
|
||||
wattrset(prompt_win, attr_input_text);
|
||||
fill_window(prompt_win, prompt);
|
||||
|
||||
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
|
||||
@@ -576,7 +527,7 @@ void show_scroll_win(WINDOW *main_window,
|
||||
|
||||
/* create the pad */
|
||||
pad = newpad(total_lines+10, total_cols+10);
|
||||
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
|
||||
wattrset(pad, attr_scrollwin_text);
|
||||
fill_window(pad, text);
|
||||
|
||||
win_lines = min(total_lines+4, lines-2);
|
||||
@@ -591,9 +542,9 @@ void show_scroll_win(WINDOW *main_window,
|
||||
win = newwin(win_lines, win_cols, y, x);
|
||||
keypad(win, TRUE);
|
||||
/* show the help in the help window, and show the help panel */
|
||||
(void) wattrset(win, attributes[SCROLLWIN_BOX]);
|
||||
wattrset(win, attr_scrollwin_box);
|
||||
box(win, 0, 0);
|
||||
(void) wattrset(win, attributes[SCROLLWIN_HEADING]);
|
||||
wattrset(win, attr_scrollwin_heading);
|
||||
mvwprintw(win, 0, 3, " %s ", title);
|
||||
panel = new_panel(win);
|
||||
|
||||
@@ -604,10 +555,9 @@ void show_scroll_win(WINDOW *main_window,
|
||||
text_cols, 0);
|
||||
print_in_middle(win,
|
||||
text_lines+2,
|
||||
0,
|
||||
text_cols,
|
||||
"<OK>",
|
||||
attributes[DIALOG_MENU_FORE]);
|
||||
attr_dialog_menu_fore);
|
||||
wrefresh(win);
|
||||
|
||||
res = wgetch(win);
|
||||
|
||||
Reference in New Issue
Block a user