From 24605c967eb9175cbd83525e29ea7fcfe62dc52d Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Fri, 12 Oct 2007 12:11:31 +0200 Subject: [PATCH] Mark colors in struct document_options by using a new struct for them. default_(link|vlink|...) -> default_color.(link|vlink|...) --- src/document/dom/util.c | 6 +++--- src/document/html/parser.c | 8 ++++---- src/document/options.c | 8 ++++---- src/document/options.h | 10 ++++++---- src/document/plain/renderer.c | 8 ++++---- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/document/dom/util.c b/src/document/dom/util.c index 0e4155c1..09fb4111 100644 --- a/src/document/dom/util.c +++ b/src/document/dom/util.c @@ -276,14 +276,14 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length, return NULL; #ifdef CONFIG_GLOBHIST else if (get_global_history_item(where)) - fgcolor = document->options.default_vlink; + fgcolor = document->options.default_color.link; #endif #ifdef CONFIG_BOOKMARKS else if (get_bookmark(where)) - fgcolor = document->options.default_bookmark_link; + fgcolor = document->options.default_color.bookmark_link; #endif else - fgcolor = document->options.default_link; + fgcolor = document->options.default_color.link; link->npoints = length; link->type = LINK_HYPERTEXT; diff --git a/src/document/html/parser.c b/src/document/html/parser.c index f1243264..9a71b6ce 100644 --- a/src/document/html/parser.c +++ b/src/document/html/parser.c @@ -899,12 +899,12 @@ init_html_parser(struct uri *uri, struct document_options *options, format.title = NULL; format.style = options->default_style; - format.color.clink = options->default_link; - format.color.vlink = options->default_vlink; + format.color.clink = options->default_color.link; + format.color.vlink = options->default_color.vlink; #ifdef CONFIG_BOOKMARKS - format.color.bookmark_link = options->default_bookmark_link; + format.color.bookmark_link = options->default_color.bookmark_link; #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.leftmargin = options->margin; diff --git a/src/document/options.c b/src/document/options.c index d6969516..72bd1328 100644 --- a/src/document/options.c +++ b/src/document/options.c @@ -39,12 +39,12 @@ init_document_options(struct session *ses, struct document_options *doo) /* 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_link = get_opt_color("document.colors.link", ses); - doo->default_vlink = get_opt_color("document.colors.vlink", 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 - doo->default_bookmark_link = get_opt_color("document.colors.bookmark", ses); + doo->default_color.bookmark_link = get_opt_color("document.colors.bookmark", ses); #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.bg = get_opt_color("document.browse.links.active_link.colors.background", ses); diff --git a/src/document/options.h b/src/document/options.h index b31935fb..4a69fd83 100644 --- a/src/document/options.h +++ b/src/document/options.h @@ -36,12 +36,14 @@ struct document_options { /** @name The default (fallback) colors. * @{ */ struct text_style default_style; - color_T default_link; - color_T default_vlink; + struct { + color_T link; + color_T vlink; #ifdef CONFIG_BOOKMARKS - color_T default_bookmark_link; + color_T bookmark_link; #endif - color_T default_image_link; + color_T image_link; + } default_color; /** @} */ /** Color model/optimizations */ diff --git a/src/document/plain/renderer.c b/src/document/plain/renderer.c index b777e7f6..3f326d63 100644 --- a/src/document/plain/renderer.c +++ b/src/document/plain/renderer.c @@ -94,7 +94,7 @@ add_document_link(struct document *document, unsigned char *uri, int length, link->type = LINK_HYPERTEXT; link->where = uri; 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; 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 */ #ifdef CONFIG_GLOBHIST 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 #ifdef CONFIG_BOOKMARKS 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 else - new_link->color.foreground = doc_opts->default_link; + new_link->color.foreground = doc_opts->default_color.link; line[link_end] = saved_char;