1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

struct text_style_color fg,bg -> foreground, background

This commit is contained in:
Laurent MONIN 2007-10-12 16:41:06 +02:00
parent f8cdb5d472
commit bc498c00da
13 changed files with 35 additions and 34 deletions

View File

@ -46,7 +46,7 @@ css_apply_color(struct html_context *html_context, struct html_element *element,
assert(prop->value_type == CSS_VT_COLOR);
if (use_document_fg_colors(html_context->options))
element->attr.style.color.fg = prop->value.color;
element->attr.style.color.foreground = prop->value.color;
}
static void
@ -57,7 +57,7 @@ css_apply_background_color(struct html_context *html_context,
assert(prop->value_type == CSS_VT_COLOR);
if (use_document_bg_colors(html_context->options))
element->attr.style.color.bg = prop->value.color;
element->attr.style.color.background = prop->value.color;
}
static void

View File

@ -99,7 +99,7 @@ render_dom_document(struct cache_entry *cached, struct document *document,
init_dom_renderer(&renderer, document, buffer, convert_table);
document->bgcolor = document->options.default_style.color.bg;
document->bgcolor = document->options.default_style.color.background;
#ifdef CONFIG_UTF8
document->options.utf8 = is_cp_utf8(document->options.cp);
#endif /* CONFIG_UTF8 */

View File

@ -50,10 +50,10 @@ init_template_by_style(struct screen_char *template, struct document_options *op
case CSS_PT_BACKGROUND_COLOR:
case CSS_PT_BACKGROUND:
if (property->value_type == CSS_VT_COLOR)
style.color.bg = property->value.color;
style.color.background = property->value.color;
break;
case CSS_PT_COLOR:
style.color.fg = property->value.color;
style.color.foreground = property->value.color;
break;
case CSS_PT_FONT_WEIGHT:
case CSS_PT_FONT_STYLE:
@ -288,7 +288,7 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
link->npoints = length;
link->type = LINK_HYPERTEXT;
link->where = where;
link->color.background = document->options.default_style.color.bg;
link->color.background = document->options.default_style.color.background;
link->color.foreground = fgcolor;
link->number = document->nlinks;

View File

@ -40,7 +40,7 @@ get_screen_char_template(struct screen_char *template,
}
{
struct color_pair colors = INIT_COLOR_PAIR(style.color.bg, style.color.fg);
struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground);
set_term_color(template, &colors, options->color_flags, options->color_mode);
}
}

View File

@ -17,8 +17,8 @@ enum text_style_format {
};
struct text_style_color {
color_T fg;
color_T bg;
color_T foreground;
color_T background;
};
struct text_style {

View File

@ -915,7 +915,7 @@ init_html_parser(struct uri *uri, struct document_options *options,
par_format.dd_margin = options->margin;
par_format.flags = P_NONE;
par_format.bgcolor = options->default_style.color.bg;
par_format.bgcolor = options->default_style.color.background;
html_top->invisible = 0;
html_top->name = NULL;

View File

@ -158,18 +158,18 @@ html_font(struct html_context *html_context, unsigned char *a,
}
mem_free(al);
}
get_color(html_context, a, "color", &format.style.color.fg);
get_color(html_context, a, "color", &format.style.color.foreground);
}
void
html_body(struct html_context *html_context, unsigned char *a,
unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
get_color(html_context, a, "text", &format.style.color.fg);
get_color(html_context, a, "text", &format.style.color.foreground);
get_color(html_context, a, "link", &format.color.clink);
get_color(html_context, a, "vlink", &format.color.vlink);
if (get_bgcolor(html_context, a, &format.style.color.bg) != -1)
if (get_bgcolor(html_context, a, &format.style.color.background) != -1)
html_context->was_body_background = 1;
html_context->was_body = 1; /* this will be used by "meta inside body" */
@ -187,17 +187,17 @@ html_apply_canvas_bgcolor(struct html_context *html_context)
&html_context->stack);
#endif
if (par_format.bgcolor != format.style.color.bg) {
if (par_format.bgcolor != format.style.color.background) {
/* Modify the root HTML element - format_html_part() will take
* this from there. */
struct html_element *e = html_bottom;
html_context->was_body_background = 1;
e->parattr.bgcolor = e->attr.style.color.bg = par_format.bgcolor = format.style.color.bg;
e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background;
}
if (html_context->has_link_lines
&& par_format.bgcolor != html_context->options->default_style.color.bg
&& par_format.bgcolor != html_context->options->default_style.color.background
&& !search_html_stack(html_context, "BODY")) {
html_context->special_f(html_context, SP_COLOR_LINK_LINES);
}
@ -416,8 +416,8 @@ html_html(struct html_context *html_context, unsigned char *a,
* this from there. */
struct html_element *e = html_bottom;
if (par_format.bgcolor != format.style.color.bg)
e->parattr.bgcolor = e->attr.style.color.bg = par_format.bgcolor = format.style.color.bg;
if (par_format.bgcolor != format.style.color.background)
e->parattr.bgcolor = e->attr.style.color.background = par_format.bgcolor = format.style.color.background;
}
void

View File

@ -66,19 +66,19 @@ html_a(struct html_context *html_context, unsigned char *a,
; /* Shut up compiler */
#ifdef CONFIG_GLOBHIST
} else if (get_global_history_item(format.link)) {
format.style.color.fg = format.color.vlink;
format.style.color.foreground = format.color.vlink;
html_top->pseudo_class &= ~ELEMENT_LINK;
html_top->pseudo_class |= ELEMENT_VISITED;
#endif
#ifdef CONFIG_BOOKMARKS
} else if (get_bookmark(format.link)) {
format.style.color.fg = format.color.bookmark_link;
format.style.color.foreground = format.color.bookmark_link;
html_top->pseudo_class &= ~ELEMENT_VISITED;
/* XXX: Really set ELEMENT_LINK? --pasky */
html_top->pseudo_class |= ELEMENT_LINK;
#endif
} else {
format.style.color.fg = format.color.clink;
format.style.color.foreground = format.color.clink;
html_top->pseudo_class &= ~ELEMENT_VISITED;
html_top->pseudo_class |= ELEMENT_LINK;
}
@ -198,10 +198,10 @@ put_image_label(unsigned char *a, unsigned char *label,
* extension to the standard. After all, it makes sense. */
html_focusable(html_context, a);
fg = format.style.color.fg;
format.style.color.fg = format.color.image_link;
fg = format.style.color.foreground;
format.style.color.foreground = format.color.image_link;
put_chrs(html_context, label, strlen(label));
format.style.color.fg = fg;
format.style.color.foreground = fg;
}
static void
@ -367,7 +367,7 @@ put_link_line(unsigned char *prefix, unsigned char *linkname,
put_chrs(html_context, prefix, strlen(prefix));
format.link = join_urls(html_context->base_href, link);
format.target = stracpy(target);
format.style.color.fg = format.color.clink;
format.style.color.foreground = format.color.clink;
/* FIXME: linkname typically comes from get_attr_val, which
* has already converted it from the document charset to the
* terminal charset and expanded character entity references.

View File

@ -887,7 +887,7 @@ start_element(struct element_info *ei,
/* XXX: Put something better to format.link. --pasky */
mem_free_set(&format.link, stracpy("javascript:void(0);"));
mem_free_set(&format.target, stracpy(html_context->base_target));
format.style.color.fg = format.color.clink;
format.style.color.foreground = format.color.clink;
html_top->pseudo_class = ELEMENT_LINK;
mem_free_set(&format.title, stracpy("onClick placeholder"));
/* Er. I know. Well, double html_focusable()s shouldn't

View File

@ -1304,9 +1304,10 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen)
link->target = null_or_stracpy(form ? form->target : NULL);
}
link->color.background = format.style.color.bg;
link->color.background = format.style.color.background;
link->color.foreground = link_is_textinput(link)
? format.style.color.fg : format.color.clink;
? format.style.color.foreground
: format.color.clink;
init_link_event_hooks(html_context, link);

View File

@ -872,7 +872,7 @@ draw_table_cell(struct table *table, int col, int row, int x, int y,
if (cell->is_header) format.style.attr |= AT_BOLD;
format.style.color.bg = cell->bgcolor;
format.style.color.background = cell->bgcolor;
par_format.bgcolor = cell->bgcolor;
if (cell->valign == VALIGN_MIDDLE)

View File

@ -37,8 +37,8 @@ init_document_options(struct session *ses, struct document_options *doo)
doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", ses);
/* Color options. */
doo->default_style.color.fg = get_opt_color("document.colors.text", ses);
doo->default_style.color.bg = get_opt_color("document.colors.background", ses);
doo->default_style.color.foreground = get_opt_color("document.colors.text", ses);
doo->default_style.color.background = get_opt_color("document.colors.background", ses);
doo->default_color.link = get_opt_color("document.colors.link", ses);
doo->default_color.vlink = get_opt_color("document.colors.vlink", ses);
#ifdef CONFIG_BOOKMARKS

View File

@ -93,7 +93,7 @@ add_document_link(struct document *document, unsigned char *uri, int length,
link->npoints = length;
link->type = LINK_HYPERTEXT;
link->where = uri;
link->color.background = document->options.default_style.color.bg;
link->color.background = document->options.default_style.color.background;
link->color.foreground = document->options.default_color.link;
link->number = document->nlinks;
@ -214,7 +214,7 @@ print_document_link(struct plain_renderer *renderer, int lineno,
line[link_end] = saved_char;
new_link->color.background = doc_opts->default_style.color.bg;
new_link->color.background = doc_opts->default_style.color.background;
set_term_color(&template, &new_link->color,
doc_opts->color_flags, doc_opts->color_mode);
@ -637,7 +637,7 @@ render_plain_document(struct cache_entry *cached, struct document *document,
renderer.max_width = document->options.wrap ? document->options.box.width
: INT_MAX;
document->bgcolor = document->options.default_style.color.bg;
document->bgcolor = document->options.default_style.color.background;
document->width = 0;
#ifdef CONFIG_UTF8
document->options.utf8 = is_cp_utf8(document->options.cp);