Commit 9dab83ed authored by Tomas Popela's avatar Tomas Popela
Browse files

EWebView, EHTMLEditorView - Improve citations look

Draw a color line (different for each level) on left and right side of citation
even in mail preview. Also make the citations more compact (in preview
and in editor).
parent 76e05715
......@@ -7937,36 +7937,6 @@ e_html_editor_view_paste_clipboard_quoted (EHTMLEditorView *view)
class->paste_clipboard_quoted (view);
}
static const gchar *
citation_color_level_1 (void)
{
return "rgb(114,159,207)"; /* Sky Blue 1 */
}
static const gchar *
citation_color_level_2 (void)
{
return "rgb(173,127,168)"; /* Plum 1 */
}
static const gchar *
citation_color_level_3 (void)
{
return "rgb(138,226,52)"; /* Chameleon 1 */
}
static const gchar *
citation_color_level_4 (void)
{
return "rgb(252,175,62)"; /* Orange 1 */
}
static const gchar *
citation_color_level_5 (void)
{
return "rgb(233,185,110)"; /* Chocolate 1 */
}
/**
* e_html_editor_view_update_fonts:
* @view: an #EHTMLEditorView
......@@ -8231,7 +8201,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" color: %s;\n"
"}\n",
citation_color_level_1 ());
e_web_view_get_citation_color_for_level (1));
g_string_append_printf (
stylesheet,
......@@ -8240,7 +8210,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" color: %s;\n"
"}\n",
citation_color_level_2 ());
e_web_view_get_citation_color_for_level (2));
g_string_append_printf (
stylesheet,
......@@ -8250,7 +8220,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" color: %s;\n"
"}\n",
citation_color_level_3 ());
e_web_view_get_citation_color_for_level (3));
g_string_append_printf (
stylesheet,
......@@ -8261,7 +8231,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" color: %s;\n"
"}\n",
citation_color_level_4 ());
e_web_view_get_citation_color_for_level (4));
g_string_append_printf (
stylesheet,
......@@ -8273,14 +8243,14 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" color: %s;\n"
"}\n",
citation_color_level_5 ());
e_web_view_get_citation_color_for_level (5));
g_string_append (
stylesheet,
"blockquote[type=cite]:not(.-x-evo-plaintext-quoted) "
"{\n"
" padding: 0.4ex 1ex;\n"
" margin: 1ex;\n"
" padding: 0ch 1ch 0ch 1ch;\n"
" margin: 0ch;\n"
" border-width: 0px 2px 0px 2px;\n"
" border-style: none solid none solid;\n"
" border-radius: 2px;\n"
......@@ -8294,7 +8264,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" border-color: %s;\n"
"}\n",
citation_color_level_1 ());
e_web_view_get_citation_color_for_level (1));
g_string_append_printf (
stylesheet,
......@@ -8303,7 +8273,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" border-color: %s;\n"
"}\n",
citation_color_level_2 ());
e_web_view_get_citation_color_for_level (2));
g_string_append_printf (
stylesheet,
......@@ -8313,7 +8283,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" border-color: %s;\n"
"}\n",
citation_color_level_3 ());
e_web_view_get_citation_color_for_level (3));
g_string_append_printf (
stylesheet,
......@@ -8324,7 +8294,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" border-color: %s;\n"
"}\n",
citation_color_level_4 ());
e_web_view_get_citation_color_for_level (4));
g_string_append_printf (
stylesheet,
......@@ -8336,7 +8306,7 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
"{\n"
" border-color: %s;\n"
"}\n",
citation_color_level_5 ());
e_web_view_get_citation_color_for_level (5));
gdk_color_free (link);
gdk_color_free (visited);
......
......@@ -2575,6 +2575,22 @@ e_web_view_get_selection_html (EWebView *web_view)
return NULL;
}
const gchar *
e_web_view_get_citation_color_for_level (gint level)
{
static const gchar *citation_color_levels[5] = {
"rgb(233,185,110)", /* level 5 - Chocolate 1 */
"rgb(114,159,207)", /* level 1 - Sky Blue 1 */
"rgb(173,127,168)", /* level 2 - Plum 1 */
"rgb(138,226,52)", /* level 3 - Chameleon 1 */
"rgb(252,175,62)", /* level 4 - Orange 1 */
};
g_return_val_if_fail (level > 0, citation_color_levels[1]);
return citation_color_levels[level % 5];
}
void
e_web_view_update_fonts (EWebView *web_view)
{
......@@ -2709,6 +2725,68 @@ e_web_view_update_fonts (EWebView *web_view)
gdk_color_free (link);
gdk_color_free (visited);
g_string_append (
stylesheet,
"blockquote[type=cite] "
"{\n"
" padding: 0ch 1ch 0ch 1ch;\n"
" margin: 0ch;\n"
" border-width: 0px 2px 0px 2px;\n"
" border-style: none solid none solid;\n"
" border-radius: 2px;\n"
"}\n");
/* Block quote border colors are borrowed from Thunderbird. */
g_string_append_printf (
stylesheet,
"blockquote[type=cite] "
"{\n"
" border-color: %s;\n"
"}\n",
e_web_view_get_citation_color_for_level (1));
g_string_append_printf (
stylesheet,
"blockquote[type=cite] "
"blockquote[type=cite] "
"{\n"
" border-color: %s;\n"
"}\n",
e_web_view_get_citation_color_for_level (2));
g_string_append_printf (
stylesheet,
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"{\n"
" border-color: %s;\n"
"}\n",
e_web_view_get_citation_color_for_level (3));
g_string_append_printf (
stylesheet,
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"{\n"
" border-color: %s;\n"
"}\n",
e_web_view_get_citation_color_for_level (4));
g_string_append_printf (
stylesheet,
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"blockquote[type=cite] "
"{\n"
" border-color: %s;\n"
"}\n",
e_web_view_get_citation_color_for_level (5));
base64 = g_base64_encode ((guchar *) stylesheet->str, stylesheet->len);
g_string_free (stylesheet, TRUE);
......
......@@ -215,6 +215,8 @@ void element_remove_class (WebKitDOMElement *element,
const gchar* class);
void remove_node (WebKitDOMNode *node);
void remove_node_if_empty (WebKitDOMNode *node);
const gchar * e_web_view_get_citation_color_for_level
(gint level);
G_END_DECLS
#endif /* E_WEB_VIEW_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment