summaryrefslogtreecommitdiff
path: root/src/lib
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
parent9ab866f32c5cf965a254fd21a47f086887053398 (diff)
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')
-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,
11 void *_pd EINA_UNUSED, const char *text) 11 void *_pd EINA_UNUSED, const char *text)
12{ 12{
13 PROXY_DATA_GET(obj, pd); 13 PROXY_DATA_GET(obj, pd);
14 _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE); 14 _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE, EINA_FALSE);
15 RETURN_VOID; 15 RETURN_VOID;
16} 16}
17 17
@@ -36,7 +36,7 @@ _efl_canvas_layout_part_text_efl_text_markup_markup_set(Eo *obj,
36 void *_pd EINA_UNUSED, const char *text) 36 void *_pd EINA_UNUSED, const char *text)
37{ 37{
38 PROXY_DATA_GET(obj, pd); 38 PROXY_DATA_GET(obj, pd);
39 _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_TRUE); 39 _edje_efl_text_set(obj, pd->ed, pd->part, text, EINA_FALSE, EINA_TRUE);
40 RETURN_VOID; 40 RETURN_VOID;
41} 41}
42 42
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,
3160 3160
3161/* part text */ 3161/* part text */
3162Eo *_edje_text_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp); 3162Eo *_edje_text_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp);
3163Eina_Bool _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text, Eina_Bool set_markup); 3163Eina_Bool _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text, Eina_Bool legacy, Eina_Bool set_markup);
3164const char *_edje_efl_text_get(Eo *obj, Edje *ed, const char *part, Eina_Bool legacy, Eina_Bool get_markup); 3164const char *_edje_efl_text_get(Eo *obj, Edje *ed, const char *part, Eina_Bool legacy, Eina_Bool get_markup);
3165Eina_Bool _edje_efl_text_markup_set(Eo *obj, Edje *ed, const char *part, const char *markup); 3165Eina_Bool _edje_efl_text_markup_set(Eo *obj, Edje *ed, const char *part, const char *markup);
3166const char *_edje_efl_text_markup_get(Eo *obj, Edje *ed, const char *part); 3166const 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_
1842} 1842}
1843 1843
1844Eina_Bool 1844Eina_Bool
1845_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) 1845_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)
1846{ 1846{
1847 if ((rp->type != EDJE_RP_TYPE_TEXT) || 1847 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1848 (!rp->typedata.text)) return EINA_TRUE; 1848 (!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
1861 else 1861 else
1862 if (text) 1862 if (text)
1863 { 1863 {
1864 if (set_markup && (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) 1864 if (legacy)
1865 { 1865 {
1866 char *mkup; 1866 rp->typedata.text->text = eina_stringshare_add(text);
1867 mkup =
1868 efl_text_markup_util_text_to_markup(EFL_TEXT_MARKUP_UTIL_CLASS,
1869 text);
1870 rp->typedata.text->text = eina_stringshare_add(mkup);
1871 free(mkup);
1872 } 1867 }
1873 else 1868 else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
1874 { 1869 {
1875 rp->typedata.text->text = eina_stringshare_add(text); 1870 if (set_markup)
1871 {
1872 rp->typedata.text->text = eina_stringshare_add(text);
1873 }
1874 else
1875 {
1876 char *mkup;
1877 mkup = efl_text_markup_util_text_to_markup(
1878 EFL_TEXT_MARKUP_UTIL_CLASS,
1879 text);
1880 rp->typedata.text->text = eina_stringshare_add(mkup);
1881 free(mkup);
1882 }
1876 } 1883 }
1877 } 1884 }
1878 ed->dirty = EINA_TRUE; 1885 ed->dirty = EINA_TRUE;
@@ -1891,7 +1898,7 @@ Eina_Bool
1891_edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text) 1898_edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
1892{ 1899{
1893 return _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text, 1900 return _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text,
1894 EINA_FALSE); 1901 EINA_FALSE, EINA_TRUE);
1895} 1902}
1896 1903
1897void 1904void
@@ -1924,7 +1931,7 @@ _edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_
1924 1931
1925Eina_Bool 1932Eina_Bool
1926_edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text, 1933_edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text,
1927 Eina_Bool set_markup) 1934 Eina_Bool legacy, Eina_Bool set_markup)
1928{ 1935{
1929 Edje_Real_Part *rp; 1936 Edje_Real_Part *rp;
1930 Eina_Bool int_ret; 1937 Eina_Bool int_ret;
@@ -1940,7 +1947,7 @@ _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text,
1940 return EINA_TRUE; 1947 return EINA_TRUE;
1941 } 1948 }
1942 int_ret = _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text, 1949 int_ret = _edje_object_part_text_raw_generic_set(ed, obj, rp, part, text,
1943 set_markup); 1950 set_markup, legacy);
1944 _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_NORMAL); 1951 _edje_user_define_string(ed, part, rp->typedata.text->text, EDJE_TEXT_TYPE_NORMAL);
1945 return int_ret; 1952 return int_ret;
1946} 1953}
@@ -6134,7 +6141,11 @@ edje_object_part_swallow_get(const Edje_Object *obj, const char *part)
6134EAPI Eina_Bool 6141EAPI Eina_Bool
6135edje_object_part_text_set(const Edje_Object *obj, const char *part, const char *text) 6142edje_object_part_text_set(const Edje_Object *obj, const char *part, const char *text)
6136{ 6143{
6137 efl_text_set(efl_part(obj, part), text); 6144 Edje *ed;
6145
6146 ed = _edje_fetch(obj);
6147
6148 _edje_efl_text_set((Eo *) obj, ed, part, text, EINA_TRUE, EINA_FALSE);
6138 return EINA_TRUE; 6149 return EINA_TRUE;
6139} 6150}
6140 6151