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

Mark colors in struct document_options by using a new struct for them.

default_(link|vlink|...) -> default_color.(link|vlink|...)
This commit is contained in:
Laurent MONIN 2007-10-12 12:11:31 +02:00
parent a5548fadd2
commit 24605c967e
5 changed files with 21 additions and 19 deletions

View File

@ -276,14 +276,14 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
return NULL; return NULL;
#ifdef CONFIG_GLOBHIST #ifdef CONFIG_GLOBHIST
else if (get_global_history_item(where)) else if (get_global_history_item(where))
fgcolor = document->options.default_vlink; fgcolor = document->options.default_color.link;
#endif #endif
#ifdef CONFIG_BOOKMARKS #ifdef CONFIG_BOOKMARKS
else if (get_bookmark(where)) else if (get_bookmark(where))
fgcolor = document->options.default_bookmark_link; fgcolor = document->options.default_color.bookmark_link;
#endif #endif
else else
fgcolor = document->options.default_link; fgcolor = document->options.default_color.link;
link->npoints = length; link->npoints = length;
link->type = LINK_HYPERTEXT; link->type = LINK_HYPERTEXT;

View File

@ -899,12 +899,12 @@ init_html_parser(struct uri *uri, struct document_options *options,
format.title = NULL; format.title = NULL;
format.style = options->default_style; format.style = options->default_style;
format.color.clink = options->default_link; format.color.clink = options->default_color.link;
format.color.vlink = options->default_vlink; format.color.vlink = options->default_color.vlink;
#ifdef CONFIG_BOOKMARKS #ifdef CONFIG_BOOKMARKS
format.color.bookmark_link = options->default_bookmark_link; format.color.bookmark_link = options->default_color.bookmark_link;
#endif #endif
format.color.image_link = options->default_image_link; format.color.image_link = options->default_color.image_link;
par_format.align = ALIGN_LEFT; par_format.align = ALIGN_LEFT;
par_format.leftmargin = options->margin; par_format.leftmargin = options->margin;

View File

@ -39,12 +39,12 @@ init_document_options(struct session *ses, struct document_options *doo)
/* Color options. */ /* Color options. */
doo->default_style.color.fg = get_opt_color("document.colors.text", ses); 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.bg = get_opt_color("document.colors.background", ses);
doo->default_link = get_opt_color("document.colors.link", ses); doo->default_color.link = get_opt_color("document.colors.link", ses);
doo->default_vlink = get_opt_color("document.colors.vlink", ses); doo->default_color.vlink = get_opt_color("document.colors.vlink", ses);
#ifdef CONFIG_BOOKMARKS #ifdef CONFIG_BOOKMARKS
doo->default_bookmark_link = get_opt_color("document.colors.bookmark", ses); doo->default_color.bookmark_link = get_opt_color("document.colors.bookmark", ses);
#endif #endif
doo->default_image_link = get_opt_color("document.colors.image", ses); doo->default_color.image_link = get_opt_color("document.colors.image", ses);
doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", ses); doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", ses);
doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", ses); doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", ses);

View File

@ -36,12 +36,14 @@ struct document_options {
/** @name The default (fallback) colors. /** @name The default (fallback) colors.
* @{ */ * @{ */
struct text_style default_style; struct text_style default_style;
color_T default_link; struct {
color_T default_vlink; color_T link;
color_T vlink;
#ifdef CONFIG_BOOKMARKS #ifdef CONFIG_BOOKMARKS
color_T default_bookmark_link; color_T bookmark_link;
#endif #endif
color_T default_image_link; color_T image_link;
} default_color;
/** @} */ /** @} */
/** Color model/optimizations */ /** Color model/optimizations */

View File

@ -94,7 +94,7 @@ add_document_link(struct document *document, unsigned char *uri, int length,
link->type = LINK_HYPERTEXT; link->type = LINK_HYPERTEXT;
link->where = uri; link->where = uri;
link->color.background = document->options.default_style.color.bg; link->color.background = document->options.default_style.color.bg;
link->color.foreground = document->options.default_link; link->color.foreground = document->options.default_color.link;
link->number = document->nlinks; link->number = document->nlinks;
for (point = link->points; length > 0; length--, point++, x++) { for (point = link->points; length > 0; length--, point++, x++) {
@ -203,14 +203,14 @@ print_document_link(struct plain_renderer *renderer, int lineno,
; /* Shut up compiler */ ; /* Shut up compiler */
#ifdef CONFIG_GLOBHIST #ifdef CONFIG_GLOBHIST
else if (get_global_history_item(start)) else if (get_global_history_item(start))
new_link->color.foreground = doc_opts->default_vlink; new_link->color.foreground = doc_opts->default_color.vlink;
#endif #endif
#ifdef CONFIG_BOOKMARKS #ifdef CONFIG_BOOKMARKS
else if (get_bookmark(start)) else if (get_bookmark(start))
new_link->color.foreground = doc_opts->default_bookmark_link; new_link->color.foreground = doc_opts->default_color.bookmark_link;
#endif #endif
else else
new_link->color.foreground = doc_opts->default_link; new_link->color.foreground = doc_opts->default_color.link;
line[link_end] = saved_char; line[link_end] = saved_char;