diff options
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 25 | ||||
-rw-r--r-- | mail/em-format-html.c | 18 | ||||
-rw-r--r-- | mail/em-format-html.h | 2 |
4 files changed, 48 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a172d33ed0..4bae234613 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,15 @@ 2003-11-24 Radek Doulik <rodo@ximian.com> + * em-format-html.c (efh_text_plain): use new colors + (efh_text_html): ditto + + * em-format-html-display.c (efhd_gtkhtml_realise): set new colors + according to style + + * em-format-html.c (efh_init): init new colors + + * em-format-html.h: added frame and content colors + * em-format.c (emf_multipart_mixed): do not use horizonal rule, attachment content is now inside simple frame diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 3d57961537..ec606ec5d7 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -171,6 +171,31 @@ efhd_gtkhtml_realise(GtkHTML *html, EMFormatHTMLDisplay *efhd) efhd->formathtml.body_colour = ((r<<16) | (g<< 8) | b) & 0xffffff; +#undef SCALE +#define SCALE (174) + /* choose a suitably darker or lighter colour */ + r = style->base[state].red >> 8; + g = style->base[state].green >> 8; + b = style->base[state].blue >> 8; + + if (r+b+g > 128*3) { + r = (r*SCALE) >> 8; + g = (g*SCALE) >> 8; + b = (b*SCALE) >> 8; + } else { + r = 128 - ((SCALE * r) >> 9); + g = 128 - ((SCALE * g) >> 9); + b = 128 - ((SCALE * b) >> 9); + } + + efhd->formathtml.frame_colour = ((r<<16) | (g<< 8) | b) & 0xffffff; + + r = style->base[GTK_STATE_NORMAL].red >> 8; + g = style->base[GTK_STATE_NORMAL].green >> 8; + b = style->base[GTK_STATE_NORMAL].blue >> 8; + + efhd->formathtml.content_colour = ((r<<16) | (g<< 8) | b) & 0xffffff; + r = style->text[state].red >> 8; g = style->text[state].green >> 8; b = style->text[state].blue >> 8; diff --git a/mail/em-format-html.c b/mail/em-format-html.c index d7929a0a18..e1ef6be129 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -136,6 +136,8 @@ efh_init(GObject *o) efh->body_colour = 0xeeeeee; efh->text_colour = 0; + efh->frame_colour = 0x3f3f3f; + efh->content_colour = 0xffffff; efh->text_html_flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES | CAMEL_MIME_FILTER_TOHTML_MARK_CITATION; } @@ -658,9 +660,10 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo int i, count; camel_stream_printf (stream, - "<table bgcolor=darkgray cellspacing=0 cellpadding=1 width=100%%><tr><td>\n" - "<table bgcolor=white cellspacing=0 cellpadding=0 width=100%%><tr><td>\n" - "<table cellspacing=0 cellpadding=10><td><tr>\n"); + "<table bgcolor=\"#%06x\" cellspacing=0 cellpadding=1 width=100%%><tr><td>\n" + "<table bgcolor=\"#%06x\" cellspacing=0 cellpadding=0 width=100%%><tr><td>\n" + "<table cellspacing=0 cellpadding=10><td><tr>\n", + efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff); flags = efh->text_html_flags; @@ -770,10 +773,11 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor const char *location, *base; EMFormatPURI *puri; - camel_stream_write_string(stream, - "<table bgcolor=darkgray cellspacing=0 cellpadding=1 width=100%%><tr><td>\n" - "<table bgcolor=white cellspacing=0 cellpadding=0 width=100%%><tr><td>\n" - "<!-- text/html -->\n"); + camel_stream_printf (stream, + "<table bgcolor=\"#%06x\" cellspacing=0 cellpadding=1 width=100%%><tr><td>\n" + "<table bgcolor=\"#%06x\" cellspacing=0 cellpadding=0 width=100%%><tr><td>\n" + "<!-- text/html -->\n", + efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff); if ((base = camel_medium_get_header((CamelMedium *)part, "Content-Base"))) { char *base_url; diff --git a/mail/em-format-html.h b/mail/em-format-html.h index c54669aebc..5e48c8c671 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -113,6 +113,8 @@ struct _EMFormatHTML { guint32 text_html_flags; /* default flags for text to html conversion */ guint32 body_colour; /* header box colour */ guint32 text_colour; + guint32 frame_colour; + guint32 content_colour; guint32 citation_colour; unsigned int xmailer_mask:4; unsigned int load_http:1; |