summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2013-12-23 09:47:51 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-23 09:49:53 +0900
commit7a3cd879d2c63a76834620ead93e0b45ba196b32 (patch)
tree82cf168222950259693b6973fcbd8bf3f58ab4c3 /src/lib
parent10babb62cd52d029c79595e1f892c662aa019205 (diff)
edje: edje_edit - fix .edc file generation
Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D401 Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/edje_edit.c107
1 files changed, 75 insertions, 32 deletions
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 1f7cddb572..2bfd2e3348 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -7015,7 +7015,7 @@ edje_edit_script_error_list_get(Evas_Object *obj)
7015#define BUF_APPENDF(FMT, ...) \ 7015#define BUF_APPENDF(FMT, ...) \
7016 ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__) 7016 ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__)
7017 7017
7018static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "SPACER"}; 7018static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY", "SPACER"};
7019static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"}; 7019static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"};
7020static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"}; 7020static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
7021 7021
@@ -7046,21 +7046,57 @@ _edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf)
7046 Edje_Style_Tag *t; 7046 Edje_Style_Tag *t;
7047 Eina_Bool ret = EINA_TRUE; 7047 Eina_Bool ret = EINA_TRUE;
7048 7048
7049 int len, i;
7050 #define ESCAPE_VAL(VAL) \
7051 for (i = 0, len = strlen(VAL); i < len; i++) \
7052 switch(VAL[i]) \
7053 { \
7054 case '\n': \
7055 { \
7056 BUF_APPENDF("%s", "\\n"); \
7057 break; \
7058 } \
7059 case '\t': \
7060 { \
7061 BUF_APPENDF("%s", "\\t"); \
7062 break; \
7063 } \
7064 case '"': \
7065 { \
7066 BUF_APPENDF("%s", "\\\""); \
7067 break; \
7068 } \
7069 case '\\': \
7070 { \
7071 BUF_APPENDF("%s", "\\\\"); \
7072 break; \
7073 } \
7074 default: BUF_APPENDF("%c", VAL[i]); \
7075 }
7076
7049 EINA_LIST_FOREACH(ed->file->styles, l, s) 7077 EINA_LIST_FOREACH(ed->file->styles, l, s)
7050 if (!strcmp(s->name, name)) 7078 if (!strcmp(s->name, name))
7051 { 7079 {
7052 t = s->tags ? s->tags->data : NULL; 7080 t = s->tags ? s->tags->data : NULL;
7053 BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name); 7081 BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name);
7054 if (t && t->value) 7082 if (t && t->value)
7055 BUF_APPENDF(I2 "base: \"%s\";\n", t->value); 7083 {
7084 BUF_APPEND(I2 "base: \"");
7085 ESCAPE_VAL(t->value);
7086 BUF_APPEND("\";\n");
7087 }
7056 7088
7057 EINA_LIST_FOREACH(s->tags, ll, t) 7089 EINA_LIST_FOREACH(s->tags, ll, t)
7058 if (ll->prev && t && t->value) 7090 if (ll->prev && t && t->value)
7059 BUF_APPENDF(I2 "tag: \"%s\" \"%s\";\n", t->key, 7091 {
7060 t->value); 7092 BUF_APPENDF(I2 "tag: \"%s\" \"", t->key);
7093 ESCAPE_VAL(t->value);
7094 BUF_APPEND("\";\n");
7095 }
7061 BUF_APPEND(I1 "}\n"); 7096 BUF_APPEND(I1 "}\n");
7062 return ret; 7097 return ret;
7063 } 7098 }
7099 #undef ESCAPE_VAL
7064 return EINA_FALSE; 7100 return EINA_FALSE;
7065} 7101}
7066 7102
@@ -7352,34 +7388,41 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
7352 7388
7353 //Fill 7389 //Fill
7354 7390
7355 BUF_APPEND(I5"fill {\n"); 7391 if (!img->image.fill.smooth || img->image.fill.pos_rel_x ||
7356 if (!img->image.fill.smooth) 7392 img->image.fill.pos_rel_y || img->image.fill.pos_abs_x ||
7357 BUF_APPEND(I6"smooth: 0;\n"); 7393 img->image.fill.pos_abs_y || TO_DOUBLE(img->image.fill.rel_x) != 1.0 ||
7358 //TODO Support spread 7394 TO_DOUBLE(img->image.fill.rel_y) != 1.0 ||
7359 7395 img->image.fill.abs_x || img->image.fill.abs_y)
7360 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y || 7396 {
7361 img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) 7397 BUF_APPEND(I5"fill {\n");
7362 { 7398 if (!img->image.fill.smooth)
7363 BUF_APPEND(I6"origin {\n"); 7399 BUF_APPEND(I6"smooth: 0;\n");
7364 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y) 7400 //TODO Support spread
7365 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.pos_rel_x), TO_DOUBLE(img->image.fill.pos_rel_y)); 7401
7366 if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) 7402 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y ||
7367 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y); 7403 img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
7368 BUF_APPEND(I6"}\n"); 7404 {
7369 } 7405 BUF_APPEND(I6"origin {\n");
7370 7406 if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y)
7371 if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 || 7407 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.pos_rel_x), TO_DOUBLE(img->image.fill.pos_rel_y));
7372 img->image.fill.abs_x || img->image.fill.abs_y) 7408 if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y)
7373 { 7409 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y);
7374 BUF_APPEND(I6"size {\n"); 7410 BUF_APPEND(I6"}\n");
7375 if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0) 7411 }
7376 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.rel_x), TO_DOUBLE(img->image.fill.rel_y)); 7412
7377 if (img->image.fill.abs_x || img->image.fill.abs_y) 7413 if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 ||
7378 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y); 7414 img->image.fill.abs_x || img->image.fill.abs_y)
7379 BUF_APPEND(I6"}\n"); 7415 {
7380 } 7416 BUF_APPEND(I6"size {\n");
7381 7417 if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0)
7382 BUF_APPEND(I5"}\n"); 7418 BUF_APPENDF(I7"relative: %g %g;\n", TO_DOUBLE(img->image.fill.rel_x), TO_DOUBLE(img->image.fill.rel_y));
7419 if (img->image.fill.abs_x || img->image.fill.abs_y)
7420 BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y);
7421 BUF_APPEND(I6"}\n");
7422 }
7423
7424 BUF_APPEND(I5"}\n");
7425 }
7383 } 7426 }
7384 7427
7385 if (rp->part->type == EDJE_PART_TYPE_PROXY) 7428 if (rp->part->type == EDJE_PART_TYPE_PROXY)