From d4f92b987fb42d844008a86a0825a0eef8c98548 Mon Sep 17 00:00:00 2001 From: Andrii Kroitor Date: Mon, 22 Sep 2014 14:14:41 +0200 Subject: [PATCH] edje: Edje_Edit: fixing text properties setting Summary: edje_edit_state_text_source_set shouldn't replace existing text. edje_edit_state_text_set should update text in other parts, that are using given part as text.text_source Reviewers: seoz, Hermet, cedric Reviewed By: cedric Subscribers: cedric, reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D1463 Signed-off-by: Cedric BAIL --- src/lib/edje/edje_edit.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 2147d2686c..82f69abb59 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -6427,6 +6427,8 @@ EAPI Eina_Bool edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text) { Edje_Part_Description_Text *txt; + Edje_Real_Part *real; + unsigned int i; if (!text) return EINA_FALSE; @@ -6442,6 +6444,20 @@ edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, txt->text.text.str = (char *)eina_stringshare_add(text); txt->text.text.id = 0; + for (i = 0; i < ed->table_parts_size; i++) + { + real = ed->table_parts[i]; + if (((rp->part->type == EDJE_PART_TYPE_TEXT) || + (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) && + (real->typedata.text) && (real->typedata.text->text_source == rp)) + { + txt = (Edje_Part_Description_Text *) real; + _edje_if_string_free(ed, txt->text.text.str); + txt->text.text.str = (char *)eina_stringshare_add(text); + txt->text.text.id = 0; + } + } + edje_object_calc_force(obj); return EINA_TRUE; } @@ -6912,8 +6928,7 @@ EAPI Eina_Bool edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source) { Edje_Part_Description_Common *spd; - Edje_Part_Description_Text *txt, *source_style; - const char *style_source; + Edje_Part_Description_Text *txt; int id_source; GET_PD_OR_RETURN(EINA_FALSE); @@ -6927,15 +6942,9 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char * spd = _edje_part_description_find_byname(eed, source, state, value); if (!spd) return EINA_FALSE; txt = (Edje_Part_Description_Text *) pd; - source_style = (Edje_Part_Description_Text *) spd; id_source = _edje_part_id_find(ed, source); txt->text.id_source = id_source; - - style_source = source_style->text.text.str; - _edje_if_string_free(ed, txt->text.text.str); - txt->text.text.str = eina_stringshare_add(style_source); - txt->text.text.id = 0; } else {