From d1779f9c4a73b4bac5caf02a44204d7d1db82209 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 9 Jul 2015 23:29:19 +0900 Subject: [PATCH] updated --- data/color/Makefile.am | 6 +- data/color/edc.src | 266 ++++++++++++++++++++++++++++++ data/color/{color.src => xml.src} | 0 src/lib/edc_editor.c | 10 +- src/lib/enventor_private.h | 4 +- src/lib/syntax_color.c | 15 +- src/lib/syntax_helper.c | 6 +- 7 files changed, 294 insertions(+), 13 deletions(-) create mode 100644 data/color/edc.src rename data/color/{color.src => xml.src} (100%) diff --git a/data/color/Makefile.am b/data/color/Makefile.am index baa1d36..f72a8be 100644 --- a/data/color/Makefile.am +++ b/data/color/Makefile.am @@ -3,12 +3,14 @@ MAINTAINERCLEANFILES = Makefile.in EET_EET = @eet_eet@ EXTRA_DIST = \ -color.src \ +edc.src \ +xml.src \ syntax_template.dat filesdir = $(datadir)/$(PACKAGE)/color files_DATA = \ -color.eet \ +edc.eet \ +xml.eet \ syntax_template.dat %.eet: %.src diff --git a/data/color/edc.src b/data/color/edc.src new file mode 100644 index 0000000..093386e --- /dev/null +++ b/data/color/edc.src @@ -0,0 +1,266 @@ +group "syntax_color_group" struct { + value "string" string: "AAAAAA"; + value "comment" string: "00B000"; + value "macro" string: "D42A2A"; + value "count" string: "6"; + group "colors" array { + count 6; + group "color" struct { + value "val" string: "777777"; + group "keys" list { + value "key" string: "{"; + value "key" string: "}"; + value "key" string: "["; + value "key" string: "]"; + value "key" string: ";"; + value "key" string: ":"; + value "key" string: "."; + value "key" string: "("; + value "key" string: ")"; + value "key" string: "!"; + value "key" string: "="; + value "key" string: "&"; + value "key" string: ">"; + value "key" string: "<"; + value "key" string: "|"; + value "key" string: "\\"; + } + } + group "color" struct { + value "val" string: "2070D0"; + group "keys" list { + value "key" string: "box"; + value "key" string: "collections"; + value "key" string: "data"; + value "key" string: "description"; + value "key" string: "desc"; + value "key" string: "dragable"; + value "key" string: "external"; + value "key" string: "fill"; + value "key" string: "gradient"; + value "key" string: "group"; + value "key" string: "images"; + value "key" string: "image "; + value "key" string: "image."; + value "key" string: "items"; + value "key" string: "item"; + value "key" string: "map"; + value "key" string: "origin"; + value "key" string: "parts"; + value "key" string: "part"; + value "key" string: "programs"; + value "key" string: "program"; + value "key" string: "proxy"; + value "key" string: "perspective "; + value "key" string: "rect"; + value "key" string: "rel1"; + value "key" string: "rel2"; + value "key" string: "rotation"; + value "key" string: "sample"; + value "key" string: "script"; + value "key" string: "set."; + value "key" string: "set "; + value "key" string: "sounds"; + value "key" string: "spacer"; + value "key" string: "styles"; + value "key" string: "swallow"; + value "key" string: "size "; + value "key" string: "table"; + value "key" string: "text "; + value "key" string: "text."; + value "key" string: "textblock"; + value "key" string: "zoom"; + } + } + group "color" struct { + value "val" string: "72AAD4"; + group "keys" list { + value "key" string: "action"; + value "key" string: "after"; + value "key" string: "alias"; + value "key" string: "align"; + value "key" string: "anti_alias"; + value "key" string: "aspect_mode"; + value "key" string: "aspect_preference"; + value "key" string: "aspect"; + value "key" string: "backface_cull"; + value "key" string: "base_scale"; + value "key" string: "base"; + value "key" string: "border_scale"; + value "key" string: "border"; + value "key" string: "center"; + value "key" string: "clip_to"; + value "key" string: "color2"; + value "key" string: "color3"; + value "key" string: "color_class"; + value "key" string: "color"; + value "key" string: "confine"; + value "key" string: "cursor_mode"; + value "key" string: "effect"; + value "key" string: "ellipsis"; + value "key" string: "entry_mode"; + value "key" string: "fixed"; + value "key" string: "focal"; + value "key" string: "font"; + value "key" string: "ignore_flags"; + value "key" string: "image"; + value "key" string: "inherit"; + value "key" string: "insert_after"; + value "key" string: "insert_before"; + value "key" string: "in"; + value "key" string: "layout"; + value "key" string: "max"; + value "key" string: "middle"; + value "key" string: "min"; + value "key" string: "mouse_events"; + value "key" string: "multiline"; + value "key" string: "name"; + value "key" string: "nomouse"; + value "key" string: "normal"; + value "key" string: "offset"; + value "key" string: "on"; + value "key" string: "padding:"; + value "key" string: "perspective:"; + value "key" string: "perspective_on"; + value "key" string: "position"; + value "key" string: "prefer"; + value "key" string: "relative"; + value "key" string: "repch"; + value "key" string: "repeat_events"; + value "key" string: "scale"; + value "key" string: "select_mode"; + value "key" string: "signal"; + value "key" string: "span"; + value "key" string: "spread"; + value "key" string: "state"; + value "key" string: "style"; + value "key" string: "smooth"; + value "key" string: "source"; + value "key" string: "size"; + value "key" string: "tag"; + value "key" string: "target"; + value "key" string: "text:"; + value "key" string: "text_class"; + value "key" string: "text_source"; + value "key" string: "to_x"; + value "key" string: "to_y"; + value "key" string: "to"; + value "key" string: "transition"; + value "key" string: "type"; + value "key" string: "tween"; + value "key" string: "visible"; + value "key" string: "weight"; + value "key" string: "x:"; + value "key" string: "y:"; + value "key" string: "z:"; + value "key" string: "zplane"; + } + } + group "color" struct { + value "val" string: "D4D42A"; + group "keys" list { + value "key" string: "ACCELERATE_FACTOR"; + value "key" string: "ACCELERATE"; + value "key" string: "ACCEL_FAC"; + value "key" string: "ACTION_STOP"; + value "key" string: "BEFORE"; + value "key" string: "BOTH"; + value "key" string: "BOTTOM"; + value "key" string: "BOUNCE"; + value "key" string: "CUBIC_BEZIER"; + value "key" string: "COMP"; + value "key" string: "CURRENT"; + value "key" string: "DECELERATE_FACTOR"; + value "key" string: "DECELERATE"; + value "key" string: "DECEL_FAC"; + value "key" string: "DEFAULT"; + value "key" string: "DIVISOR_INTERP"; + value "key" string: "DIVIS"; + value "key" string: "EDITABLE"; + value "key" string: "EXPLICIT"; + value "key" string: "FAR_SHADOW"; + value "key" string: "FAR_SOFT_SHADOW"; + value "key" string: "FOCUS_SET"; + value "key" string: "GLOW"; + value "key" string: "HORIZONTAL"; + value "key" string: "LINEAR"; + value "key" string: "LIN"; + value "key" string: "LOSSY"; + value "key" string: "MSG_FLOAT_SET"; + value "key" string: "MSG_FLOAT"; + value "key" string: "MSG_INT_FLOAT_SET"; + value "key" string: "MSG_INT_FLOAT"; + value "key" string: "MSG_INT_SET"; + value "key" string: "MSG_INT"; + value "key" string: "MSG_STRING_INT_SET"; + value "key" string: "MSG_STRING_INT"; + value "key" string: "MSG_STRING_SET"; + value "key" string: "MSG_STRING"; + value "key" string: "NEITHER"; + value "key" string: "NONE"; + value "key" string: "ON_HOLD"; + value "key" string: "OUTLINE_SOFT_SHADOW"; + value "key" string: "OUTLINE_SHADOW"; + value "key" string: "OUTLINE"; + value "key" string: "PART"; + value "key" string: "PASSWORD"; + value "key" string: "PLAIN"; + value "key" string: "PLAY_SAMPLE"; + value "key" string: "PROGRAM"; + value "key" string: "RAW"; + value "key" string: "SHADOW"; + value "key" string: "SIGNAL_EMIT"; + value "key" string: "SINUSOIDAL_FACTOR"; + value "key" string: "SINUSOIDAL"; + value "key" string: "SIN_FAC"; + value "key" string: "SIN"; + value "key" string: "SOFT_OUTLINE"; + value "key" string: "SOFT_SHADOW"; + value "key" string: "SOLID"; + value "key" string: "SPRING"; + value "key" string: "STATE_SET"; + value "key" string: "USER"; + value "key" string: "VERTICAL"; + } + } + group "color" struct { + value "val" string: "00FFFF"; + group "keys" list { + value "key" string: "anim"; + value "key" string: "cancel_anim"; + value "key" string: "cancel_timer"; + value "key" string: "custom_state"; + value "key" string: "emit"; + value "key" string: "getarg"; + value "key" string: "get_drag"; + value "key" string: "get_float"; + value "key" string: "get_geometry"; + value "key" string: "get_int"; + value "key" string: "get_state_val"; + value "key" string: "get_state"; + value "key" string: "get_text"; + value "key" string: "round"; + value "key" string: "run_program"; + value "key" string: "set_float"; + value "key" string: "set_int"; + value "key" string: "set_state_val"; + value "key" string: "set_state"; + value "key" string: "set_text"; + value "key" string: "set_tween_state"; + value "key" string: "snprintf"; + value "key" string: "strcmp"; + value "key" string: "timer"; + } + } + group "color" struct { + value "val" string: "D78700"; + group "keys" list { + value "key" string: "else"; + value "key" string: "if"; + value "key" string: "new"; + value "key" string: "public"; + value "key" string: "return"; + } + } + } +} diff --git a/data/color/color.src b/data/color/xml.src similarity index 100% rename from data/color/color.src rename to data/color/xml.src diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c index 48fd670..10f7abc 100644 --- a/src/lib/edc_editor.c +++ b/src/lib/edc_editor.c @@ -1013,7 +1013,6 @@ edit_init(Evas_Object *enventor) { srand(time(NULL)); parser_data *pd = parser_init(); - syntax_helper *sh = syntax_init(); edit_data *ed = calloc(1, sizeof(edit_data)); if (!ed) @@ -1022,7 +1021,6 @@ edit_init(Evas_Object *enventor) return NULL; } ed->pd = pd; - ed->sh = sh; ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, key_down_cb, ed); ecore_event_handler_add(ECORE_EVENT_KEY_UP, key_up_cb, ed); @@ -1223,6 +1221,14 @@ edit_load(edit_data *ed, const char *edc_path) Eina_Bool ret = edit_edc_load(ed, edc_path); if (ret) edit_changed_set(ed, EINA_TRUE); edj_mgr_reload_need_set(EINA_TRUE); + + //Decide File Format + Enventor_File_Format file_format; + if (strstr(edc_path, ".xml")) file_format = ENVENTOR_FILE_FORMAT_XML; + else file_format = ENVENTOR_FILE_FORMAT_EDC; + //FIXME: Update file format + if (!ed->sh) ed->sh = syntax_init(file_format); + redoundo_clear(ed->rd); return ret; diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h index 7e86206..50d5a44 100644 --- a/src/lib/enventor_private.h +++ b/src/lib/enventor_private.h @@ -87,7 +87,7 @@ void autocomp_reset(void); /* syntax color */ -color_data *color_init(Eina_Strbuf *strbuf); +color_data *color_init(Eina_Strbuf *strbuf, Enventor_File_Format file_format); void color_term(color_data *cd); void color_set(color_data *cd, Enventor_Syntax_Color_Type color_type, const char *val); const char *color_get(color_data *cd, Enventor_Syntax_Color_Type color_type); @@ -119,7 +119,7 @@ Eina_Bool parser_state_info_get(Evas_Object *entry, state_info *info); /* syntax helper */ -syntax_helper *syntax_init(void); +syntax_helper *syntax_init(Enventor_File_Format file_format); void syntax_term(syntax_helper *sh); color_data *syntax_color_data_get(syntax_helper *sh); indent_data *syntax_indent_data_get(syntax_helper *sh); diff --git a/src/lib/syntax_color.c b/src/lib/syntax_color.c index e470100..6a77ae2 100644 --- a/src/lib/syntax_color.c +++ b/src/lib/syntax_color.c @@ -40,6 +40,7 @@ struct syntax_color_s int color_cnt; Eina_List *macros; Ecore_Thread *thread; + Enventor_File_Format file_format; Eina_Bool ready: 1; }; @@ -105,10 +106,14 @@ eddc_term(void) } static void -color_load() +color_load(Enventor_File_Format file_format) { char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "%s/color/color.eet", elm_app_data_dir_get()); + + if (file_format == ENVENTOR_FILE_FORMAT_EDC) + snprintf(buf, sizeof(buf), "%s/color/edc.eet", elm_app_data_dir_get()); + else + snprintf(buf, sizeof(buf), "%s/color/xml.eet", elm_app_data_dir_get()); Eet_File *ef = eet_open(buf, EET_FILE_MODE_READ); if (ef) @@ -220,7 +225,7 @@ init_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) color_data *cd = data; eddc_init(); - color_load(); + color_load(cd->file_format); eddc_term(); color_table_init(cd); @@ -741,7 +746,7 @@ color_markup_insert(Eina_Strbuf *strbuf, const char **src, int length, char **cu /*****************************************************************************/ color_data * -color_init(Eina_Strbuf *strbuf) +color_init(Eina_Strbuf *strbuf, Enventor_File_Format file_format) { color_data *cd = calloc(1, sizeof(color_data)); if (!cd) @@ -751,8 +756,8 @@ color_init(Eina_Strbuf *strbuf) } cd->strbuf = strbuf; cd->cachebuf = eina_strbuf_new(); + cd->file_format = file_format; cd->thread = ecore_thread_run(init_thread_blocking, NULL, NULL, cd); - cd->macros = NULL; return cd; } diff --git a/src/lib/syntax_helper.c b/src/lib/syntax_helper.c index 1a5ebd2..1d9adad 100644 --- a/src/lib/syntax_helper.c +++ b/src/lib/syntax_helper.c @@ -11,6 +11,7 @@ struct syntax_helper_s indent_data *id; Eina_Strbuf *strbuf; Ecore_Timer *buf_flush_timer; + Enventor_File_Format file_format; }; /*****************************************************************************/ @@ -35,7 +36,7 @@ buf_flush_timer_cb(void *data) /*****************************************************************************/ syntax_helper * -syntax_init(void) +syntax_init(Enventor_File_Format file_format) { syntax_helper *sh = malloc(sizeof(syntax_helper)); if (!sh) @@ -45,8 +46,9 @@ syntax_init(void) } sh->strbuf = eina_strbuf_new(); sh->buf_flush_timer = ecore_timer_add(1800, buf_flush_timer_cb, sh); + sh->file_format = file_format; - sh->cd = color_init(sh->strbuf); + sh->cd = color_init(sh->strbuf, file_format); sh->id = indent_init(sh->strbuf); return sh;