From 630ff7d918303a22878a7ab8b9020f87d93c310f Mon Sep 17 00:00:00 2001 From: Subodh Kumar Date: Tue, 3 Dec 2019 17:18:18 +0530 Subject: [PATCH] Edje: Add color class feature for textblock properties. These properties were missing, as underline color is being used used heavily. There is link pressed effect feature which requires color class for underline color. Also link pressed effect works on link tag. So link tag is provided by default and if app wants to customises the color then whole style needs to be rrecreated so replacing color code for link tag will work as aspected. Change-Id: I04e826a64610981a0491d753a855d5c8984fc259 --- src/lib/edje/edje_private.h | 3 +++ src/lib/edje/edje_textblock_styles.c | 43 +++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 52c2ec3..d42a3fb 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -652,6 +652,9 @@ struct _Edje_Style_Tag Edje_Color color; Edje_Color outline_color; Edje_Color shadow_color; + Edje_Color underline_color; + Edje_Color underline_dash_color; + Edje_Color backing_color; /******* * END * *******/ diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 882c19f..b003363 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -389,7 +389,18 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag, Eina_ else if ((key_len == 12) && !strncmp(key, "shadow_color", key_len)) { _parse_color(val, &(tag->shadow_color)); - + } + else if ((key_len == 20) && !strncmp(key, "underline_dash_color", key_len)) + { + _parse_color(val, &(tag->underline_dash_color)); + } + else if ((key_len == 15) && !strncmp(key, "underline_color", key_len)) + { + _parse_color(val, &(tag->underline_color)); + } + else if ((key_len == 15) && !strncmp(key, "backing_color", key_len)) + { + _parse_color(val, &(tag->backing_color)); } /******* * END * @@ -550,6 +561,36 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl) eina_strbuf_append(txt, color); } } + if (cc && tag->underline_dash_color.a) + { + Eina_Bool result = _edje_textblock_color_calc(&(tag->underline_dash_color), + cc->r, cc->g, cc->b, cc->a, color); + if (result) + { + eina_strbuf_append(txt, " underline_dash_color="); + eina_strbuf_append(txt, color); + } + } + if (cc && tag->underline_color.a) + { + Eina_Bool result = _edje_textblock_color_calc(&(tag->underline_color), + cc->r, cc->g, cc->b, cc->a, color); + if (result) + { + eina_strbuf_append(txt, " underline_color="); + eina_strbuf_append(txt, color); + } + } + if (cc && tag->backing_color.a) + { + Eina_Bool result = _edje_textblock_color_calc(&(tag->backing_color), + cc->r, cc->g, cc->b, cc->a, color); + if (result) + { + eina_strbuf_append(txt, " underline_dash_color="); + eina_strbuf_append(txt, color); + } + } /******* * END * *******/ -- 2.7.4