diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 8c9ae077b4..4398fbef83 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3042,7 +3042,7 @@ edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *s EAPI Eina_Bool edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style); -/** Get part name, which used as text source. +/** Get part name, which used as style text source. * * @param obj Object being edited. * @param part Part that contain state. @@ -3054,9 +3054,9 @@ edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *s EAPI const char * edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value); -/** Set the source text part for a given part. - * Causes the part to display the text content of another part and update them - * as they change. +/** Set the source part which would be used as style for text for a given part. + * Causes the part to use the text properties (like font and size) of another + * part and update them as they change. * * @param obj Object being edited. * @param part Part that contain state. @@ -3077,6 +3077,8 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char * * * @return A list containing all the fonts names found in the edje file. */ + + EAPI Eina_List * edje_edit_fonts_list_get(Evas_Object *obj); /** Add a new font to the edje file. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 59dde23cf1..38f1c60715 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5168,10 +5168,10 @@ edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char * if ((rp->part->type == EDJE_PART_TYPE_TEXT) || (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) { - Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) pd; - if (txt->text.id_text_source == -1) return NULL; - rel = ed->table_parts[txt->text.id_text_source % ed->table_parts_size]; + Edje_Part_Description_Text *txt; + txt = (Edje_Part_Description_Text *) pd; + if (txt->text.id_source == -1) return NULL; + rel = ed->table_parts[txt->text.id_source % ed->table_parts_size]; if (rel->part->name) return eina_stringshare_add(rel->part->name); } @@ -5181,23 +5181,35 @@ edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char * 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_Text *txt; - int id_text_source; + Edje_Part_Description_Common *spd; + Edje_Part_Description_Text *txt, *source_style; + const char *style_source; + int id_source; + GET_PD_OR_RETURN(EINA_FALSE); if (!source) return EINA_FALSE; - if ((rp->part->type != EDJE_PART_TYPE_TEXT) || + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; + spd = _edje_part_description_find_byname(eed, source, state, value); txt = (Edje_Part_Description_Text *) pd; - id_text_source = _edje_part_id_find(ed, source); - txt->text.id_text_source = id_text_source; + 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; /* need to recalc, because the source part can has a text */ edje_object_calc_force(obj); return EINA_TRUE; } + /****************/ /* IMAGES API */ /****************/