diff options
author | Vyacheslav Reutskiy <v.reutskiy@samsung.com> | 2016-10-12 15:00:05 +0300 |
---|---|---|
committer | Vyacheslav Reutskiy <v.reutskiy@samsung.com> | 2016-10-12 15:03:20 +0300 |
commit | e6fa6ba945de03080b85367feb6eaf143533a969 (patch) | |
tree | 783ae8b47e5640378c9c9e4fc32d58994b137ce8 | |
parent | 8d7ec4181e939d377e3dc75918005e4363ef472f (diff) | |
download | efl-e6fa6ba945de03080b85367feb6eaf143533a969.tar.gz |
edje_edit: new API for generate source code for color classes
Extend edje edit deberate source API. Add two new API.
- edje_edit_object_color_class_list_get return a list of used color classes for
given object
- edje_edit_color_classes_source_generate is generate code for given
color classes list
-rw-r--r-- | src/lib/edje/Edje_Edit.h | 21 | ||||
-rw-r--r-- | src/lib/edje/edje_edit.c | 60 |
2 files changed, 81 insertions, 0 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 89502c31c8..1aa007539d 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -8174,6 +8174,27 @@ EAPI char *edje_edit_full_source_generate(Evas_Object *obj); */ EAPI const char * edje_edit_data_source_generate(Evas_Object *obj); +/** + * Get a list of color clsses which given object use. + * + * @paramaram obj The object being edited + * + * @return The color classes list + */ +EAPI Eina_List * +edje_edit_object_color_class_list_get(Evas_Object *obj); + +/** + * Get the source code for given color classes + * + * @param obj The object being edited + * @param color_classes The list of color classes for generete code + * + * @return The color classes source code + */ +EAPI const char * +edje_edit_color_classes_source_generate(Evas_Object *obj, Eina_List *color_classes); + //@} /******************************************************************************/ /************************** ERROR API ***********************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 7d897319ee..3d4dbf3157 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -12841,6 +12841,66 @@ edje_edit_data_source_generate(Evas_Object *obj) return str; } +EAPI Eina_List * +edje_edit_object_color_class_list_get(Evas_Object *obj) +{ + Edje_Part_Collection_Directory_Entry *ce; + Edje_Part *part; + Edje_Part_Description_Common *part_desc; + unsigned int j, i; + Eina_List *color_classes = NULL; + + GET_ED_OR_RETURN(NULL); + + if (!ed->file) return NULL; + + ce = eina_hash_find(ed->file->collection, ed->group); + if (!ce) return NULL; + + /* Go through all of group's parts to find all resources needed for that group. */ + for (i = 0; i < ed->table_parts_size; i++) + { + part = ed->table_parts[i]->part; + part_desc = (Edje_Part_Description_Common *)part->default_desc; + + /* find all color_classes required by those every part. */ + COLLECT_RESOURCE(part_desc->color_class, color_classes); + for (j = 0; j < part->other.desc_count; j++) + { + part_desc = part->other.desc[j]; + COLLECT_RESOURCE(part_desc->color_class, color_classes); + } + } + + return color_classes; +} + +EAPI const char * +edje_edit_color_classes_source_generate(Evas_Object *obj, Eina_List *color_classes) +{ + Eina_Strbuf *buf; + Eina_List *l; + const char *entry; + Eina_Bool ret = EINA_TRUE; + Eina_Stringshare *str = NULL; + + GET_ED_OR_RETURN(NULL); + + buf = eina_strbuf_new(); + + BUF_APPEND(I0 "color_classes {\n"); + + EINA_LIST_FOREACH(color_classes, l, entry) + _edje_generate_source_of_colorclass(ed, entry, buf); + + BUF_APPEND(I0 "}\n\n"); + + if (ret) + str = eina_stringshare_add(eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); + return str; +} + #undef COLLECT_RESOURCE static Eina_Bool |