reset textblock cache when text_class is changed

If text_class in the textblock is changed, it is not applied because of the cache.
When text_class is changed, reset cache to update text information.
This commit is contained in:
Sohyun Kim 2014-02-27 13:31:42 +09:00
parent 6093e68cb0
commit 85b2a8f5dc
3 changed files with 33 additions and 0 deletions

View File

@ -2165,6 +2165,7 @@ void _edje_message_del (Edje *ed);
void _edje_textblock_styles_add(Edje *ed);
void _edje_textblock_styles_del(Edje *ed);
void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class);
void _edje_textblock_style_all_update(Edje *ed);
void _edje_textblock_style_parse_and_fix(Edje_File *edf);
void _edje_textblock_style_cleanup(Edje_File *edf);

View File

@ -310,6 +310,35 @@ _edje_textblock_styles_del(Edje *ed)
}
}
void
_edje_textblock_styles_cache_free(Edje *ed, const char *text_class)
{
Eina_List *l, *ll;
Edje_Style *stl;
if (!ed->file) return;
if (!text_class) return;
EINA_LIST_FOREACH(ed->file->styles, l, stl)
{
Edje_Style_Tag *tag;
Eina_Bool found = EINA_FALSE;
EINA_LIST_FOREACH(stl->tags, ll, tag)
{
if (!tag->text_class) continue;
if (!strcmp(tag->text_class, text_class))
{
found = EINA_TRUE;
break;
}
}
if (found)
stl->cache = EINA_FALSE;
}
}
/* When we get to here the edje file had been read into memory
* the name of the style is established as well as the name and
* data for the tags. This function will create the Evas_Style

View File

@ -962,6 +962,7 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz
ed = eina_list_data_get(members);
ed->dirty = EINA_TRUE;
ed->recalc_call = EINA_TRUE;
_edje_textblock_styles_cache_free(ed, text_class);
_edje_textblock_style_all_update(ed);
#ifdef EDJE_CALC_CACHE
ed->text_part_change = EINA_TRUE;
@ -995,6 +996,7 @@ edje_text_class_del(const char *text_class)
ed = eina_list_data_get(members);
ed->dirty = EINA_TRUE;
_edje_textblock_styles_cache_free(ed, text_class);
_edje_textblock_style_all_update(ed);
#ifdef EDJE_CALC_CACHE
ed->text_part_change = EINA_TRUE;
@ -1107,6 +1109,7 @@ _text_class_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
#ifdef EDJE_CALC_CACHE
ed->text_part_change = EINA_TRUE;
#endif
_edje_textblock_styles_cache_free(ed, text_class);
_edje_textblock_style_all_update(ed);
_edje_recalc(ed);
if (ret) *ret = EINA_TRUE;