+2014-05-10 Mark Majeres <mark@engine12.com>
+ * src/*.h, src/*.c: Make it possible for the foreground colour of
+ interface elements to be bright.
+
2014-05-09 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_mouseinput): Count only shortcuts that are actually
shown, so that clicking on the ones after ^T (Speller/Linter) will work
void set_colorpairs(void)
{
const syntaxtype *this_syntax = syntaxes;
- bool bright = FALSE, defok = FALSE;
+ bool defok = FALSE;
short fg, bg;
size_t i;
#endif
for (i = 0; i < NUMBER_OF_ELEMENTS; i++) {
+ bool bright = FALSE;
+
if (parse_color_names(specified_color_combo[i], &fg, &bg, &bright)) {
if (fg == -1 && !defok)
fg = COLOR_WHITE;
if (bg == -1 && !defok)
bg = COLOR_BLACK;
init_pair(i + 1, fg, bg);
- interface_color_pair[i] = COLOR_PAIR(i + 1);
+ interface_color_pair[i].bright = bright;
+ interface_color_pair[i].pairnum = COLOR_PAIR(i + 1);
+ }
+ else {
+ interface_color_pair[i].bright = FALSE;
+ if (i != FUNCTION_TAG)
+ interface_color_pair[i].pairnum = hilite_attribute;
+ else
+ interface_color_pair[i].pairnum = A_NORMAL;
}
- else if (i != FUNCTION_TAG)
- interface_color_pair[i] = hilite_attribute;
if (specified_color_combo[i] != NULL) {
free(specified_color_combo[i]);
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
colortype *this_color = this_syntax->color;
- int color_pair = NUMBER_OF_ELEMENTS + 1;
+ int clr_pair = NUMBER_OF_ELEMENTS + 1;
for (; this_color != NULL; this_color = this_color->next) {
const colortype *beforenow = this_syntax->color;
if (beforenow != this_color)
this_color->pairnum = beforenow->pairnum;
else {
- this_color->pairnum = color_pair;
- color_pair++;
+ this_color->pairnum = clr_pair;
+ clr_pair++;
}
}
}
char* specified_color_combo[] = {};
/* The color combinations as specified in the rcfile. */
#endif
-int interface_color_pair[] = {};
+color_pair interface_color_pair[] = {};
/* The processed color pairs for the interface elements. */
char *homedir = NULL;
#ifndef DISABLE_COLOR
set_colorpairs();
#else
- interface_color_pair[TITLE_BAR] = hilite_attribute;
- interface_color_pair[STATUS_BAR] = hilite_attribute;
- interface_color_pair[KEY_COMBO] = hilite_attribute;
- interface_color_pair[FUNCTION_TAG] = A_NORMAL;
+ interface_color_pair[TITLE_BAR].pairnum = hilite_attribute;
+ interface_color_pair[STATUS_BAR].pairnum = hilite_attribute;
+ interface_color_pair[KEY_COMBO].pairnum = hilite_attribute;
+ interface_color_pair[FUNCTION_TAG].pairnum = A_NORMAL;
+ interface_color_pair[TITLE_BAR].bright = FALSE;
+ interface_color_pair[STATUS_BAR].bright = FALSE;
+ interface_color_pair[KEY_COMBO].bright = FALSE;
+ interface_color_pair[FUNCTION_TAG].bright = FALSE;
#endif
#ifdef DEBUG
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, ENTER, INSERT, OTHER
} undo_type;
+typedef struct color_pair {
+ int pairnum;
+ /* The color pair number used for this foreground color and
+ * background color. */
+ bool bright;
+ /* Is this color A_BOLD? */
+} color_pair;
+
#ifndef DISABLE_COLOR
typedef struct colortype {
short fg;
index = strnlenpt(curranswer, index);
page_start = get_statusbar_page_start(start_col, start_col + index);
- wattron(bottomwin, interface_color_pair[TITLE_BAR]);
+ if (interface_color_pair[TITLE_BAR].bright)
+ wattron(bottomwin, A_BOLD);
+ wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
waddstr(bottomwin, expanded);
free(expanded);
- wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
+ wattroff(bottomwin, A_BOLD);
+ wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
onekey("^C", _("Cancel"), width);
}
- wattron(bottomwin, interface_color_pair[TITLE_BAR]);
+ if (interface_color_pair[TITLE_BAR].bright)
+ wattron(bottomwin, A_BOLD);
+ wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
- wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
+ wattroff(bottomwin, A_BOLD);
+ wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
/* Refresh the edit window and the statusbar before getting
* input. */
#ifndef DISABLE_COLOR
extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
#endif
-extern int interface_color_pair[NUMBER_OF_ELEMENTS];
+extern color_pair interface_color_pair[NUMBER_OF_ELEMENTS];
extern char *homedir;
assert(path != NULL || openfile->filename != NULL);
- wattron(topwin, interface_color_pair[TITLE_BAR]);
+ if (interface_color_pair[TITLE_BAR].bright)
+ wattron(topwin, A_BOLD);
+ wattron(topwin, interface_color_pair[TITLE_BAR].pairnum);
blank_titlebar();
}
}
- wattroff(topwin, interface_color_pair[TITLE_BAR]);
+ wattroff(topwin, A_BOLD);
+ wattroff(topwin, interface_color_pair[TITLE_BAR].pairnum);
wnoutrefresh(topwin);
reset_cursor();
start_x = (COLS - strlenpt(foo) - 4) / 2;
wmove(bottomwin, 0, start_x);
- wattron(bottomwin, interface_color_pair[STATUS_BAR]);
+ if (interface_color_pair[STATUS_BAR].bright)
+ wattron(bottomwin, A_BOLD);
+ wattron(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
waddstr(bottomwin, "[ ");
waddstr(bottomwin, foo);
free(foo);
waddstr(bottomwin, " ]");
- wattroff(bottomwin, interface_color_pair[STATUS_BAR]);
+ wattroff(bottomwin, A_BOLD);
+ wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
wnoutrefresh(bottomwin);
reset_cursor();
wnoutrefresh(edit);
assert(keystroke != NULL && desc != NULL);
- wattron(bottomwin, interface_color_pair[KEY_COMBO]);
+ if (interface_color_pair[KEY_COMBO].bright)
+ wattron(bottomwin, A_BOLD);
+ wattron(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
waddnstr(bottomwin, keystroke, actual_x(keystroke, len));
- wattroff(bottomwin, interface_color_pair[KEY_COMBO]);
+ wattroff(bottomwin, A_BOLD);
+ wattroff(bottomwin, interface_color_pair[KEY_COMBO].pairnum);
if (len > keystroke_len)
len -= keystroke_len;
len = 0;
if (len > 0) {
- wattron(bottomwin, interface_color_pair[FUNCTION_TAG]);
waddch(bottomwin, ' ');
+ if (interface_color_pair[FUNCTION_TAG].bright)
+ wattron(bottomwin, A_BOLD);
+ wattron(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
waddnstr(bottomwin, desc, actual_x(desc, len));
- wattroff(bottomwin, interface_color_pair[FUNCTION_TAG]);
+ wattroff(bottomwin, A_BOLD);
+ wattroff(bottomwin, interface_color_pair[FUNCTION_TAG].pairnum);
}
}