aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/edje
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-01 18:38:18 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-10-01 19:51:28 +0300
commit0061a4bb349e6c8e122913791bf83f7f40b0cede (patch)
tree4673e65a50bf4a255a20c20568f4448b562d7310 /src/lib/edje
parentelm_code_widget: set appropriate background colour. (diff)
downloadefl-0061a4bb349e6c8e122913791bf83f7f40b0cede.tar.gz
Canvas layout: improve legacy code paths for Efl.Text
Better handling of specific cases where you want to efl_text_set on a TEXTBLOCK part. Follow-up to af1595fd0160f76de82cddeb2576143f65492c0b.
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_part_text.c4
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_util.c39
3 files changed, 28 insertions, 17 deletions
diff --git a/src/lib/edje/edje_part_text.c b/src/lib/edje/edje_part_text.c
index 0e5e4aa4ae..56c96ee7e0 100644
--- a/src/lib/edje/edje_part_text.c
+++ b/src/lib/edje/edje_part_text.c
@@ -11,7 +11,7 @@ _efl_canvas_layout_part_text_efl_text_text_set(Eo *obj,
void *_pd EINA_UNUSED, const char *text)
{
PROXY_DATA_GET(obj, pd);
- _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE);
+ _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE, EINA_FALSE);
RETURN_VOID;
}
@@ -36,7 +36,7 @@ _efl_canvas_layout_part_text_efl_text_markup_markup_set(Eo *obj,
void *_pd EINA_UNUSED, const char *text)
{
PROXY_DATA_GET(obj, pd);
- _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_TRUE);
+ _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE, EINA_TRUE);
RETURN_VOID;
}
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index c65f560071..d84d004f70 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -3160,7 +3160,7 @@ Evas_Object *_edje_object_part_external_content_get(Edje *ed, const char *part,
/* part text */
Eo *_edje_text_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp);
-Eina_Bool _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text, Eina_Bool set_markup);
+Eina_Bool _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text, Eina_Bool legacy, Eina_Bool set_markup);
const char *_edje_efl_text_get(Eo *obj, Edje *ed, const char *part, Eina_Bool legacy, Eina_Bool get_markup);
Eina_Bool _edje_efl_text_markup_set(Eo *obj, Edje *ed, const char *part, const char *markup);
const char *_edje_efl_text_markup_get(Eo *obj, Edje *ed, const char *part);
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index c175c140f1..db0a3939c7 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -1842,7 +1842,7 @@ _edje_object_text_change_cb_set(Eo *obj EINA_UNUSED, Edje *ed, Edje_Text_Change_
}
Eina_Bool
-_edje_object_part_text_raw_generic_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text, Eina_Bool set_markup)
+_edje_object_part_text_raw_generic_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text, Eina_Bool set_markup, Eina_Bool legacy)
{
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return EINA_TRUE;
@@ -1861,18 +1861,25 @@ _edje_object_part_text_raw_generic_set(Edje *ed, Evas_Object *obj, Edje_Real_Par
else
if (text)
{
- if (set_markup && (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
+ if (legacy)
{
- char *mkup;
- mkup =
- efl_text_markup_util_text_to_markup(EFL_TEXT_MARKUP_UTIL_CLASS,
- text);
- rp->typedata.text->text = eina_stringshare_add(mkup);
- free(mkup);
+ rp->typedata.text->text = eina_stringshare_add(text);
}
- else
+ else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
{
- rp->typedata.text->text = eina_stringshare_add(text);
+ if (set_markup)
+ {
+ rp->typedata.text->text = eina_stringshare_add(text);
+ }
+ else
+ {
+ char *mkup;
+ mkup = efl_text_markup_util_text_to_markup(
+ EFL_TEXT_MARKUP_UTIL_CLASS,
+ text);
+ rp->typedata.text->text = eina_stringshare_add(mkup);
+ free(mkup);
+ }
}
}
ed->dirty = EINA_TRUE;
@@ -1891,7 +1898,7 @@ Eina_Bool
_edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
{
return _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text,
- EINA_FALSE);
+ EINA_FALSE, EINA_TRUE);
}
void
@@ -1924,7 +1931,7 @@ _edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_
Eina_Bool
_edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text,
- Eina_Bool set_markup)
+ Eina_Bool legacy, Eina_Bool set_markup)
{
Edje_Real_Part *rp;
Eina_Bool int_ret;
@@ -1940,7 +1947,7 @@ _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text,
return EINA_TRUE;
}
int_ret = _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text,
- set_markup);
+ set_markup, legacy);
_edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_NORMAL);
return int_ret;
}
@@ -6134,7 +6141,11 @@ edje_object_part_swallow_get(const Edje_Object *obj, const char *part)
EAPI Eina_Bool
edje_object_part_text_set(const Edje_Object *obj, const char *part, const char *text)
{
- efl_text_set(efl_part(obj, part), text);
+ Edje *ed;
+
+ ed = _edje_fetch(obj);
+
+ _edje_efl_text_set((Eo *) obj, ed, part, text, EINA_TRUE, EINA_FALSE);
return EINA_TRUE;
}