From 085471ee38795233f997685856fe46b38f1f9f79 Mon Sep 17 00:00:00 2001 From: Vitalii Vorobiov Date: Tue, 23 Feb 2016 11:50:12 +0000 Subject: [PATCH] Edje_Edit: update source generation to print text classes Change-Id: Ie5cc326d6e2bf76b84edcf0415090e39b43a14a5 --- src/lib/edje/edje_edit.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 69d8a09..4f432e2 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -10828,6 +10828,25 @@ edje_edit_source_generate(Evas_Object *obj) BUF_APPEND(I0 "}\n\n"); } + if (ed->file->text_classes) + { + BUF_APPEND(I0 "text_classes {\n"); + Edje_Text_Class *tc; + + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) + { + BUF_APPENDF(I1 "text_class {\n"); + BUF_APPENDF(I2 "name: \"%s\";\n", tc->name); + if (tc->font) + BUF_APPENDF(I2 "font: \"%s\";\n", tc->font); + if (tc->size > 0) + BUF_APPENDF(I2 "size: %d;\n", tc->size); + BUF_APPENDF(I1 "}\n"); + } + + BUF_APPEND(I0 "}\n\n"); + } + /* if images were found, print them */ if (images) { @@ -10881,6 +10900,7 @@ edje_edit_source_generate(Evas_Object *obj) eina_list_free(color_classes); } + /* print the main code of group collections */ BUF_APPEND(I0 "collections {\n"); /* if sounds were found, print them */ @@ -10945,6 +10965,28 @@ edje_edit_source_generate(Evas_Object *obj) #undef COLLECT_RESOURCE static Eina_Bool +_edje_generate_source_of_textclass(Edje *ed, const char *name, Eina_Strbuf *buf) +{ + Eina_List *l; + Edje_Text_Class *tc; + Eina_Bool ret = EINA_TRUE; + + EINA_LIST_FOREACH(ed->file->text_classes, l, tc) + if (!strcmp(tc->name, name)) + { + BUF_APPENDF(I1 "text_class {\n"); + BUF_APPENDF(I2 "name: \"%s\";\n", tc->name); + if (tc->font) + BUF_APPENDF(I2 "font: \"%s\";\n", tc->font); + if (tc->size > 0) + BUF_APPENDF(I2 "size: %d;\n", tc->size); + BUF_APPENDF(I1 "}\n"); + } + + return ret; +} + +static Eina_Bool _edje_generate_source_of_colorclass(Edje *ed, const char *name, Eina_Strbuf *buf) { Eina_List *l; @@ -12488,6 +12530,25 @@ _edje_generate_source(Evas_Object *obj) } } + /* Text Classes */ + if ((ll = edje_edit_text_classes_list_get(obj))) + { + BUF_APPEND(I0 "text_classes {\n"); + + EINA_LIST_FOREACH(ll, l, entry) + _edje_generate_source_of_textclass(ed, entry, buf); + + BUF_APPEND(I0 "}\n\n"); + edje_edit_string_list_free(ll); + + if (!ret) + { + ERR("Generating EDC for Text Classes"); + eina_strbuf_free(buf); + return NULL; + } + } + /* Color Classes */ if ((ll = edje_edit_color_classes_list_get(obj))) { -- 2.7.4