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 <cedric@osg.samsung.com>
This commit is contained in:
Andrii Kroitor 2014-09-22 14:14:41 +02:00 committed by Cedric BAIL
parent 51a5f852c2
commit d4f92b987f
1 changed files with 17 additions and 8 deletions

View File

@ -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
{