hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=f2cc7271463721e7467b0dc9e3335c213eef7a5d
commit f2cc7271463721e7467b0dc9e3335c213eef7a5d Author: taehyub <taehyub....@samsung.com> Date: Fri Jan 29 16:41:59 2016 +0900 make group, description and program tempalte code compilable Summary: make group, description and program tempalte code compilable Test Plan: 1. insert template code using ctrl + t 2. see the name of the template and checkt the compile error. Reviewers: Jaehyun_Cho, Hermet Subscribers: NikaWhite Differential Revision: https://phab.enlightenment.org/D3613 --- src/lib/template.c | 29 ++++++++++++++++++++++------- src/lib/template_code.h | 20 ++++++++------------ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/lib/template.c b/src/lib/template.c index 5ea3e9c..561f691 100644 --- a/src/lib/template.c +++ b/src/lib/template.c @@ -303,6 +303,7 @@ template_insert(edit_data *ed, Enventor_Template_Insert_Type insert_type, { Evas_Object *entry = edit_entry_get(ed); Eina_Stringshare *paragh = edit_cur_paragh_get(ed); + Eina_Bool ret = EINA_FALSE; if (!paragh) return EINA_FALSE; @@ -317,6 +318,17 @@ template_insert(edit_data *ed, Enventor_Template_Insert_Type insert_type, int line_cnt; char **t = NULL; + char first_line[40]; + char random_name[9]; + int space = edit_cur_indent_depth_get(ed); + + //Alloc Empty spaces + char *p = alloca(space + 1); + memset(p, ' ', space); + p[space] = '\0'; + + template_random_string_create(random_name, 9); + elm_entry_cursor_line_begin_set(entry); if (!strcmp(paragh, "part") || !strcmp(paragh, "image") || !strcmp(paragh, "rect") || !strcmp(paragh, "swallow") || @@ -325,18 +337,21 @@ template_insert(edit_data *ed, Enventor_Template_Insert_Type insert_type, line_cnt = TEMPLATE_DESC_LINE_CNT; t = (char **) &TEMPLATE_DESC; strncpy(syntax, "Description", n); + snprintf(first_line, 40, "desc { \"%s\";<br/>", random_name); } else if (!strcmp(paragh, "spacer")) { line_cnt = TEMPLATE_DESC_SPACER_LINE_CNT; t = (char **) &TEMPLATE_DESC_SPACER; strncpy(syntax, "Description", n); + snprintf(first_line, 40, "desc { \"%s\";<br/>", random_name); } else if (!strcmp(paragh, "programs")) { line_cnt = TEMPLATE_PROG_LINE_CNT; t = (char **) &TEMPLATE_PROG; strncpy(syntax, "Program", n); + snprintf(first_line, 40, "program { \"%s\";<br/>", random_name); } else if (!strcmp(paragh, "images")) { @@ -349,19 +364,19 @@ template_insert(edit_data *ed, Enventor_Template_Insert_Type insert_type, line_cnt = TEMPLATE_GROUP_LINE_CNT; t = (char **) &TEMPLATE_GROUP; strncpy(syntax, "Group", n); + snprintf(first_line, 40, "group { \"%s\";<br/>", random_name); } if (!t) goto end; + if (strcmp(paragh, "images")) + { + elm_entry_entry_insert(entry, p); + elm_entry_entry_insert(entry, first_line); + } + int cursor_pos = elm_entry_cursor_pos_get(entry); - elm_entry_cursor_line_begin_set(entry); int cursor_pos1 = elm_entry_cursor_pos_get(entry); - int space = edit_cur_indent_depth_get(ed); - - //Alloc Empty spaces - char *p = alloca(space + 1); - memset(p, ' ', space); - p[space] = '\0'; int i; for (i = 0; i < (line_cnt - 1); i++) diff --git a/src/lib/template_code.h b/src/lib/template_code.h index fbcc9d5..c2381b9 100644 --- a/src/lib/template_code.h +++ b/src/lib/template_code.h @@ -1,8 +1,7 @@ -#define TEMPLATE_GROUP_LINE_CNT 27 +#define TEMPLATE_GROUP_LINE_CNT 26 const char *TEMPLATE_GROUP[TEMPLATE_GROUP_LINE_CNT] = { - "group { \"XXX\";<br/>", " parts {<br/>", " image { \"XXX\";<br/>", " scale: 1;<br/>", @@ -126,11 +125,10 @@ const char *TEMPLATE_PART_TEXTBLOCK[TEMPLATE_PART_TEXTBLOCK_LINE_CNT] = " text.text: \"TEXTBLOCK\";<br/>" }; -#define TEMPLATE_DESC_LINE_CNT 10 +#define TEMPLATE_DESC_LINE_CNT 9 const char *TEMPLATE_DESC[TEMPLATE_DESC_LINE_CNT] = { - "desc { \"XXX\";<br/>", " //inherit: \"default\";<br/>", " rel1 { relative: 0.0 0.0; offset: 0 0; /*to: \"XXX\";*/ }<br/>", " rel2 { relative: 1.0 1.0; offset: -1 -1; /*to: \"XXX\";*/ }<br/>", @@ -139,32 +137,30 @@ const char *TEMPLATE_DESC[TEMPLATE_DESC_LINE_CNT] = " min: 0 0;<br/>", " visible: 1;<br/>", " color: 255 255 255 255;<br/>", - "}", + "}" }; -#define TEMPLATE_DESC_SPACER_LINE_CNT 8 +#define TEMPLATE_DESC_SPACER_LINE_CNT 7 const char *TEMPLATE_DESC_SPACER[TEMPLATE_DESC_SPACER_LINE_CNT] = { - "desc { \"XXX\";<br/>", " //inherit: \"default\";<br/>", " rel1 { relative: 0.0 0.0; offset: 0 0; /*to: \"XXX\";*/ }<br/>", " rel2 { relative: 1.0 1.0; offset: -1 -1; /*to: \"XXX\";*/ }<br/>", " align: 0.5 0.5;<br/>", " fixed: 0 0;<br/>", " min: 0 0;<br/>", - "}", + "}" }; -#define TEMPLATE_PROG_LINE_CNT 7 +#define TEMPLATE_PROG_LINE_CNT 6 const char *TEMPLATE_PROG[TEMPLATE_PROG_LINE_CNT] = { - "program { \"XXX\";<br/>", " //signal: \"XXX\";<br/>", " //source: \"XXX\";<br/>", - " action: STATE_SET \"default\";<br/>", - " target: \"XXX\";<br/>", + " //action: STATE_SET \"default\";<br/>", + " //target: \"XXX\";<br/>", " //transition: LINEAR 1.0;<br/>", "}" }; --