forked from enlightenment/efl
edje: Add edje to text_class_member_hash properly.
Summary: When textblock styles have text_classes, all edjes in the files were added to text_class_member_hash even if the edjes didn't use the textblock styles. It makes time long to update text_class. This will add the edje using the textblock style which has a text_class to text_class_member_hash. Reviewers: cedric, raster Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2035
This commit is contained in:
parent
c029a8db52
commit
78ddad3daf
|
@ -382,7 +382,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
|
|||
edje_module_load(ed->file->external_dir->entries[i].entry);
|
||||
}
|
||||
|
||||
_edje_textblock_styles_add(ed);
|
||||
_edje_textblock_style_all_update(ed);
|
||||
|
||||
ed->has_entries = EINA_FALSE;
|
||||
|
@ -571,6 +570,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
|
|||
_edje_callbacks_focus_add(rp->object, ed, rp);
|
||||
break;
|
||||
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||
_edje_textblock_styles_add(ed, rp);
|
||||
textblocks = eina_list_append(textblocks, rp);
|
||||
rp->object = evas_object_textblock_add(ed->base->evas);
|
||||
break;
|
||||
|
@ -1407,11 +1407,11 @@ _edje_file_del(Edje *ed)
|
|||
Edje_Part *ep;
|
||||
unsigned int i;
|
||||
|
||||
_edje_textblock_styles_del(ed);
|
||||
for (i = 0; i < ed->collection->parts_count; ++i)
|
||||
{
|
||||
ep = ed->collection->parts[i];
|
||||
|
||||
_edje_textblock_styles_del(ed, ep);
|
||||
_edje_text_part_on_del(ed, ep);
|
||||
_edje_color_class_on_del(ed, ep);
|
||||
}
|
||||
|
|
|
@ -2362,8 +2362,8 @@ void _edje_message_queue_process (void);
|
|||
void _edje_message_queue_clear (void);
|
||||
void _edje_message_del (Edje *ed);
|
||||
|
||||
void _edje_textblock_styles_add(Edje *ed);
|
||||
void _edje_textblock_styles_del(Edje *ed);
|
||||
void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
|
||||
void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
|
||||
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);
|
||||
|
|
|
@ -61,8 +61,7 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt)
|
|||
unsigned int i;
|
||||
|
||||
if (!pt) return;
|
||||
if (pt->type != EDJE_PART_TYPE_TEXT
|
||||
&& pt->type != EDJE_PART_TYPE_TEXTBLOCK)
|
||||
if (pt->type != EDJE_PART_TYPE_TEXT)
|
||||
return;
|
||||
|
||||
desc = (Edje_Part_Description_Text *) pt->default_desc;
|
||||
|
|
|
@ -268,44 +268,130 @@ _edje_textblock_style_all_update(Edje *ed)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_textblock_styles_add(Edje *ed)
|
||||
_edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
Edje_Style *stl;
|
||||
Edje_Part *pt = ep->part;
|
||||
Edje_Part_Description_Text *desc;
|
||||
Edje_Style *stl = NULL;
|
||||
const char *style;
|
||||
unsigned int i;
|
||||
|
||||
if (!ed->file) return;
|
||||
if (pt->type != EDJE_PART_TYPE_TEXTBLOCK) return;
|
||||
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
/* if text class exists in the textblock styles for this part,
|
||||
add the edje to the tc member list */
|
||||
desc = (Edje_Part_Description_Text *)pt->default_desc;
|
||||
style = edje_string_get(&desc->text.style);
|
||||
if (style)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
/* Make sure the style contains the text_class */
|
||||
EINA_LIST_FOREACH(stl->tags, ll, tag)
|
||||
{
|
||||
if (!tag->text_class) continue;
|
||||
_edje_text_class_member_add(ed, tag->text_class);
|
||||
}
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
{
|
||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
||||
stl = NULL;
|
||||
}
|
||||
}
|
||||
if (stl)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(stl->tags, l, tag)
|
||||
{
|
||||
if (tag->text_class)
|
||||
_edje_text_class_member_add(ed, tag->text_class);
|
||||
}
|
||||
}
|
||||
|
||||
/* If any other classes exist add them */
|
||||
for (i = 0; i < pt->other.desc_count; ++i)
|
||||
{
|
||||
desc = (Edje_Part_Description_Text *)pt->other.desc[i];
|
||||
style = edje_string_get(&desc->text.style);
|
||||
if (style)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
{
|
||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
||||
stl = NULL;
|
||||
}
|
||||
}
|
||||
if (stl)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(stl->tags, l, tag)
|
||||
{
|
||||
if (tag->text_class)
|
||||
_edje_text_class_member_add(ed, tag->text_class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_edje_textblock_styles_del(Edje *ed)
|
||||
_edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
|
||||
{
|
||||
Eina_List *l, *ll;
|
||||
Edje_Style *stl;
|
||||
Edje_Part_Description_Text *desc;
|
||||
Edje_Style *stl = NULL;
|
||||
const char *style;
|
||||
unsigned int i;
|
||||
|
||||
if (!ed->file) return;
|
||||
if (pt->type != EDJE_PART_TYPE_TEXTBLOCK) return;
|
||||
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
desc = (Edje_Part_Description_Text *)pt->default_desc;
|
||||
style = edje_string_get(&desc->text.style);
|
||||
if (style)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
/* Make sure the style contains the text_class */
|
||||
EINA_LIST_FOREACH(stl->tags, ll, tag)
|
||||
{
|
||||
if (!tag->text_class) continue;
|
||||
_edje_text_class_member_del(ed, tag->text_class);
|
||||
}
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
{
|
||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
||||
stl = NULL;
|
||||
}
|
||||
}
|
||||
if (stl)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(stl->tags, l, tag)
|
||||
{
|
||||
if (tag->text_class)
|
||||
_edje_text_class_member_del(ed, tag->text_class);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pt->other.desc_count; ++i)
|
||||
{
|
||||
desc = (Edje_Part_Description_Text *)pt->other.desc[i];
|
||||
style = edje_string_get(&desc->text.style);
|
||||
if (style)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
||||
{
|
||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
||||
stl = NULL;
|
||||
}
|
||||
}
|
||||
if (stl)
|
||||
{
|
||||
Edje_Style_Tag *tag;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(stl->tags, l, tag)
|
||||
{
|
||||
if (tag->text_class)
|
||||
_edje_text_class_member_del(ed, tag->text_class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue