forked from enlightenment/efl
Edje_Edit: update function that return image usage to include sets
Image can be also used not only inside of any image parts, but also inside of any sets (and plenty of times)
This commit is contained in:
parent
9ec49c3f4f
commit
e6d4c34449
|
@ -5852,7 +5852,11 @@ EAPI Eina_Bool edje_edit_image_replace(Evas_Object *obj, const char *name, const
|
|||
EAPI Eina_Bool edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name);
|
||||
|
||||
/** Get list of (Edje_Part_Image_Use *) - group-part-state triplets where given
|
||||
* image is used
|
||||
* image is used.
|
||||
*
|
||||
* Important! Image can also be used inside of set and plenty of times, so for each use
|
||||
* inside of set triplet would set "set's" name into group name, and it's state
|
||||
* value would be -1. Every other fields will be 0.
|
||||
*
|
||||
* Use edje_edit_image_usage_list_free() when you don't need it anymore.
|
||||
*
|
||||
|
|
|
@ -9139,12 +9139,14 @@ edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name)
|
|||
EAPI Eina_List *
|
||||
edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool first_only)
|
||||
{
|
||||
Eina_List *result = NULL;
|
||||
Eina_List *result = NULL, *l;
|
||||
Eina_Iterator *it;
|
||||
Edje_Part_Collection_Directory_Entry *pce;
|
||||
Edje_Part_Image_Use *item;
|
||||
Edje_Part *part;
|
||||
Edje_Part_Description_Image *part_desc_image;
|
||||
Edje_Image_Directory_Set *de = NULL;
|
||||
Edje_Image_Directory_Set_Entry *dim = NULL;
|
||||
unsigned int i, j, k;
|
||||
int image_id;
|
||||
|
||||
|
@ -9160,7 +9162,7 @@ edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool fir
|
|||
|
||||
it = eina_hash_iterator_data_new(ed->file->collection);
|
||||
|
||||
#define ITEM_ADD() \
|
||||
#define ITEM_ADD() \
|
||||
item = (Edje_Part_Image_Use *)calloc(1, sizeof(Edje_Part_Image_Use)); \
|
||||
item->group = eina_stringshare_add(pce->entry); \
|
||||
item->part = eina_stringshare_add(part->name); \
|
||||
|
@ -9168,7 +9170,15 @@ edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool fir
|
|||
item->state.value = part_desc_image->common.state.value; \
|
||||
result = eina_list_append(result, item);
|
||||
|
||||
#define FIND_IN_PART_DESCRIPTION() \
|
||||
#define ITEM_SET_ADD() \
|
||||
item = (Edje_Part_Image_Use *)calloc(1, sizeof(Edje_Part_Image_Use)); \
|
||||
item->group = eina_stringshare_add(de->name); \
|
||||
item->part = NULL; \
|
||||
item->state.name = NULL; \
|
||||
item->state.value = -1; \
|
||||
result = eina_list_append(result, item);
|
||||
|
||||
#define FIND_IN_PART_DESCRIPTION() \
|
||||
if ((part_desc_image->image.id == image_id) && \
|
||||
(!part_desc_image->image.set)) \
|
||||
{ \
|
||||
|
@ -9210,6 +9220,20 @@ edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool fir
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NOW CHECKING IF IMAGE IS USED INSIDE OF SET */
|
||||
for (i = 0; i < ed->file->image_dir->sets_count; ++i)
|
||||
{
|
||||
de = ed->file->image_dir->sets + i;
|
||||
EINA_LIST_FOREACH(de->entries, l, dim)
|
||||
{
|
||||
if (dim->id == image_id)
|
||||
{
|
||||
ITEM_SET_ADD()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef ITEM_ADD
|
||||
#undef FIND_IN_PART_DESCRIPTION
|
||||
end:
|
||||
|
|
Loading…
Reference in New Issue