color: integrate the hilite attribute into the pair number
Color-pair numbers and attributes can be OR'd together -- do so, to save an attron() call whenever the hilite is on.master
parent
62eeda3e9f
commit
8507dd4bd0
|
@ -62,8 +62,9 @@ void set_colorpairs(void)
|
||||||
if (background == -1 && !using_defaults)
|
if (background == -1 && !using_defaults)
|
||||||
background = COLOR_BLACK;
|
background = COLOR_BLACK;
|
||||||
init_pair(i + 1, foreground, background);
|
init_pair(i + 1, foreground, background);
|
||||||
interface_color_pair[i].bright = bright;
|
interface_color_pair[i].bright = FALSE;
|
||||||
interface_color_pair[i].pairnum = COLOR_PAIR(i + 1);
|
interface_color_pair[i].pairnum =
|
||||||
|
COLOR_PAIR(i + 1) | (bright ? A_BOLD : A_NORMAL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
interface_color_pair[i].bright = FALSE;
|
interface_color_pair[i].bright = FALSE;
|
||||||
|
|
|
@ -491,8 +491,6 @@ void update_the_statusbar(void)
|
||||||
index = strnlenpt(answer, statusbar_x);
|
index = strnlenpt(answer, statusbar_x);
|
||||||
page_start = get_statusbar_page_start(start_col, start_col + index);
|
page_start = get_statusbar_page_start(start_col, start_col + index);
|
||||||
|
|
||||||
if (interface_color_pair[TITLE_BAR].bright)
|
|
||||||
wattron(bottomwin, A_BOLD);
|
|
||||||
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
@ -505,7 +503,6 @@ void update_the_statusbar(void)
|
||||||
waddstr(bottomwin, expanded);
|
waddstr(bottomwin, expanded);
|
||||||
free(expanded);
|
free(expanded);
|
||||||
|
|
||||||
wattroff(bottomwin, A_BOLD);
|
|
||||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
statusbar_pww = statusbar_xplustabs();
|
statusbar_pww = statusbar_xplustabs();
|
||||||
|
@ -855,14 +852,11 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
onekey("^C", _("Cancel"), width);
|
onekey("^C", _("Cancel"), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interface_color_pair[TITLE_BAR].bright)
|
|
||||||
wattron(bottomwin, A_BOLD);
|
|
||||||
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||||
|
|
||||||
wattroff(bottomwin, A_BOLD);
|
|
||||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
/* Refresh edit window and statusbar before getting input. */
|
/* Refresh edit window and statusbar before getting input. */
|
||||||
|
|
12
src/winio.c
12
src/winio.c
|
@ -1868,8 +1868,6 @@ void titlebar(const char *path)
|
||||||
|
|
||||||
assert(path != NULL || openfile->filename != NULL);
|
assert(path != NULL || openfile->filename != NULL);
|
||||||
|
|
||||||
if (interface_color_pair[TITLE_BAR].bright)
|
|
||||||
wattron(topwin, A_BOLD);
|
|
||||||
wattron(topwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattron(topwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
blank_titlebar();
|
blank_titlebar();
|
||||||
|
@ -1957,7 +1955,6 @@ void titlebar(const char *path)
|
||||||
else if (statelen > 0)
|
else if (statelen > 0)
|
||||||
mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
|
mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
|
||||||
|
|
||||||
wattroff(topwin, A_BOLD);
|
|
||||||
wattroff(topwin, interface_color_pair[TITLE_BAR].pairnum);
|
wattroff(topwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||||
|
|
||||||
wnoutrefresh(topwin);
|
wnoutrefresh(topwin);
|
||||||
|
@ -2027,14 +2024,11 @@ void statusline(message_type importance, const char *msg, ...)
|
||||||
start_x = (COLS - strlenpt(foo) - 4) / 2;
|
start_x = (COLS - strlenpt(foo) - 4) / 2;
|
||||||
|
|
||||||
wmove(bottomwin, 0, start_x);
|
wmove(bottomwin, 0, start_x);
|
||||||
if (interface_color_pair[STATUS_BAR].bright)
|
|
||||||
wattron(bottomwin, A_BOLD);
|
|
||||||
wattron(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
wattron(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
||||||
waddstr(bottomwin, "[ ");
|
waddstr(bottomwin, "[ ");
|
||||||
waddstr(bottomwin, foo);
|
waddstr(bottomwin, foo);
|
||||||
free(foo);
|
free(foo);
|
||||||
waddstr(bottomwin, " ]");
|
waddstr(bottomwin, " ]");
|
||||||
wattroff(bottomwin, A_BOLD);
|
|
||||||
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
||||||
|
|
||||||
/* Push the message to the screen straightaway. */
|
/* Push the message to the screen straightaway. */
|
||||||
|
@ -2132,22 +2126,16 @@ void onekey(const char *keystroke, const char *desc, int length)
|
||||||
{
|
{
|
||||||
assert(keystroke != NULL && desc != NULL);
|
assert(keystroke != NULL && desc != NULL);
|
||||||
|
|
||||||
if (interface_color_pair[KEY_COMBO].bright)
|
|
||||||
wattron(bottomwin, A_BOLD);
|
|
||||||
wattron(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
wattron(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
||||||
waddnstr(bottomwin, keystroke, actual_x(keystroke, length));
|
waddnstr(bottomwin, keystroke, actual_x(keystroke, length));
|
||||||
wattroff(bottomwin, A_BOLD);
|
|
||||||
wattroff(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
wattroff(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
|
||||||
|
|
||||||
length -= strlenpt(keystroke) + 1;
|
length -= strlenpt(keystroke) + 1;
|
||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
waddch(bottomwin, ' ');
|
waddch(bottomwin, ' ');
|
||||||
if (interface_color_pair[FUNCTION_TAG].bright)
|
|
||||||
wattron(bottomwin, A_BOLD);
|
|
||||||
wattron(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
wattron(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
||||||
waddnstr(bottomwin, desc, actual_x(desc, length));
|
waddnstr(bottomwin, desc, actual_x(desc, length));
|
||||||
wattroff(bottomwin, A_BOLD);
|
|
||||||
wattroff(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
wattroff(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue