diff --git a/src/bin/edc_editor.c b/src/bin/edc_editor.c index 1228169..10bc611 100644 --- a/src/bin/edc_editor.c +++ b/src/bin/edc_editor.c @@ -8,6 +8,12 @@ const int SYNTAX_COLOR_SPARE_LINES = 42; const double SYNTAX_COLOR_DEFAULT_TIME = 0.25; const double SYNTAX_COLOR_SHORT_TIME = 0.025; +static const char ALPHA_STRING[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + +static const char ALPHA_STRING_LEN = 52; + typedef struct syntax_color_thread_data_s { edit_data *ed; @@ -463,6 +469,14 @@ edit_cur_indent_depth_get(edit_data *ed) return indent_space_get(syntax_indent_data_get(ed->sh), ed->en_edit); } +static void +part_name_string_generate(char *part_name_line) +{ + char *pos = strstr(part_name_line, QUOT); + while (*(++pos) != QUOT_C) + *pos = ALPHA_STRING[rand() % ALPHA_STRING_LEN]; +} + void edit_template_part_insert(edit_data *ed, Edje_Part_Type type) { @@ -525,6 +539,14 @@ edit_template_part_insert(edit_data *ed, Edje_Part_Type type) break; } + char *part_name_line = strdup(TEMPLATE_PART_NAME_FORMAT); + part_name_string_generate(part_name_line); + + elm_entry_entry_insert(ed->en_edit, p); + elm_entry_entry_insert(ed->en_edit, part_name_line); + edit_line_increase(ed, 1); + free(part_name_line); + int i; for (i = 0; i < (line_cnt - 1); i++) { @@ -982,6 +1004,7 @@ scroller_vbar_unpress_cb(void *data, Evas_Object *obj EINA_UNUSED, edit_data * edit_init(Evas_Object *parent) { + srand(time(NULL)); parser_data *pd = parser_init(); syntax_helper *sh = syntax_init(); diff --git a/src/include/template_code.h b/src/include/template_code.h index 5c7e452..77338a1 100644 --- a/src/include/template_code.h +++ b/src/include/template_code.h @@ -32,12 +32,13 @@ const char *TEMPLATE_GROUP[TEMPLATE_GROUP_LINE_CNT] = "}" }; +const char * TEMPLATE_PART_NAME_FORMAT = + "part { name: \"PartName\";
"; #define TEMPLATE_PART_IMAGE_LINE_CNT 15 const char *TEMPLATE_PART_IMAGE[TEMPLATE_PART_IMAGE_LINE_CNT] = { - "part { name: \"XXX\";
", " type: IMAGE;
", " scale: 1;
", " mouse_events: 1;
", @@ -58,7 +59,6 @@ const char *TEMPLATE_PART_IMAGE[TEMPLATE_PART_IMAGE_LINE_CNT] = const char *TEMPLATE_PART_RECT[TEMPLATE_PART_RECT_LINE_CNT] = { - "part { name: \"XXX\";
", " type: RECT;
", " scale: 1;
", " mouse_events: 1;
", @@ -78,7 +78,6 @@ const char *TEMPLATE_PART_RECT[TEMPLATE_PART_RECT_LINE_CNT] = const char *TEMPLATE_PART_SWALLOW[TEMPLATE_PART_SWALLOW_LINE_CNT] = { - "part { name: \"XXX\";
", " type: SWALLOW;
", " scale: 1;
", " mouse_events: 1;
", @@ -97,7 +96,6 @@ const char *TEMPLATE_PART_SWALLOW[TEMPLATE_PART_SWALLOW_LINE_CNT] = const char *TEMPLATE_PART_SPACER[TEMPLATE_PART_SPACER_LINE_CNT] = { - "part { name: \"XXX\";
", " type: SPACER;
", " scale: 1;
", " description { state: \"default\" 0.0;
", @@ -114,7 +112,6 @@ const char *TEMPLATE_PART_SPACER[TEMPLATE_PART_SPACER_LINE_CNT] = const char *TEMPLATE_PART_TEXT[TEMPLATE_PART_TEXT_LINE_CNT] = { - "part { name: \"XXX\";
", " type: TEXT;
", " scale: 1;
", " mouse_events: 1;
", @@ -144,7 +141,6 @@ const char *TEMPLATE_PART_TEXT[TEMPLATE_PART_TEXT_LINE_CNT] = const char *TEMPLATE_PART_TEXTBLOCK[TEMPLATE_PART_TEXTBLOCK_LINE_CNT] = { - "part { name: \"XXX\";
", " type: TEXTBLOCK;
", " description { state: \"default\" 0.0;
", " rel1 { relative: 0.0 0.0; offset: 0 0; /*to: \"XXX\";*/ }
",