summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVitalii Vorobiov <vi.vorobiov@samsung.com>2016-04-28 15:38:50 +0300
committerVitalii Vorobiov <vi.vorobiov@samsung.com>2016-07-21 16:40:47 +0300
commitd8da59ba0bb5cc4773871d1d7d9ec6c17f7b1a96 (patch)
tree85d8b005f3868716f27f7661cea01436ddb5a4e9 /src
parent2606bc58cad62b6a2a709b34f24f2d0c3a50fd1d (diff)
downloadefl-d8da59ba0bb5cc4773871d1d7d9ec6c17f7b1a96.tar.gz
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)
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h6
-rw-r--r--src/lib/edje/edje_edit.c30
2 files changed, 32 insertions, 4 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 6a564e2f9b..e5eabc277a 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -5562,7 +5562,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.
*
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index c030508ed4..67071a13bc 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -8825,12 +8825,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;
@@ -8846,7 +8848,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); \
@@ -8854,7 +8856,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)) \
{ \
@@ -8896,6 +8906,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: