Compare commits

...

21 Commits

Author SHA1 Message Date
ChunEon Park 3ff6ae8e71 updated 2015-07-11 00:21:20 +09:00
ChunEon Park 70d14f6665 updated 2015-07-10 23:54:28 +09:00
ChunEon Park 901d833ece updated 2015-07-10 23:45:26 +09:00
ChunEon Park 94889cb99e uploaded 2015-07-10 20:45:21 +09:00
ChunEon Park 2e2cac547f updated 2015-07-10 20:44:14 +09:00
ChunEon Park d99d89ed1a updated 2015-07-10 20:38:07 +09:00
ChunEon Park e453e08b7f updated 2015-07-09 23:52:31 +09:00
ChunEon Park b879423b5e updated 2015-07-09 23:35:27 +09:00
ChunEon Park d1779f9c4a updated 2015-07-09 23:29:19 +09:00
ChunEon Park b8120086f3 updated 2015-07-09 22:41:20 +09:00
ChunEon Park ed1a3f188a updated color 2015-07-09 20:47:25 +09:00
ChunEon Park 7f8a0483aa updated color 2015-07-09 20:44:45 +09:00
ChunEon Park 8b0808ef1f editor: set default tabstops size 10 2015-07-09 20:32:30 +09:00
ChunEon Park 4b22e03235 updated 2015-07-09 20:16:14 +09:00
ChunEon Park ddbb51740e updated 2015-07-09 19:39:54 +09:00
ChunEon Park ccf6fb297d ctxpopup: cutout slider updation.
we don't need to update slider changes multiple times under the animator callback.
2015-07-09 15:35:54 +09:00
ChunEon Park bda98ec188 autocomp: remove generation of optional code. 2015-07-09 15:35:46 +09:00
ChunEon Park 0eb196f02b just back up situation 2015-07-04 01:13:06 +09:00
ChunEon Park 973a1b6fe9 config - remove edc related var names 2015-07-04 00:14:55 +09:00
ChunEon Park 464cb0373b main: code refactoring.
don't keep temporary variable.
2015-07-03 23:02:59 +09:00
ChunEon Park b9eb4c29eb newfile: code refactoring.
return function as soon as possible.
2015-07-03 22:38:18 +09:00
22 changed files with 982 additions and 449 deletions

View File

@ -733,9 +733,9 @@ group "lexem" struct {
}
group "txt" var_array {
count 1;
value "string" string: "%s: \"\" 0.0;";
value "string" string: "%s: \"\";";
}
value "cursor_offset" int: 6;
value "cursor_offset" int: 2;
value "line_back" int: 0;
group "name" var_array {
count 1;
@ -1255,9 +1255,9 @@ group "lexem" struct {
}
group "txt" var_array {
count 1;
value "string" string: "%s: STATE_SET \"\" 0.0;";
value "string" string: "%s: STATE_SET \"\";";
}
value "cursor_offset" int: 6;
value "cursor_offset" int: 2;
value "line_back" int: 0;
group "name" var_array {
count 1;

View File

@ -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

View File

@ -2,6 +2,7 @@ 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 {
@ -160,6 +161,7 @@ group "syntax_color_group" struct {
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";
@ -170,8 +172,10 @@ group "syntax_color_group" struct {
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";
@ -180,6 +184,7 @@ group "syntax_color_group" struct {
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";
@ -207,6 +212,8 @@ group "syntax_color_group" struct {
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";

100
data/color/xml.src Normal file
View File

@ -0,0 +1,100 @@
group "syntax_color_group" struct {
value "string" string: "CCCCCC";
value "comment" string: "00B000";
value "macro" string: "D42A2A";
value "count" string: "3";
group "colors" array {
count 3;
group "color" struct {
value "val" string: "777777";
group "keys" list {
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: "Bg";
value "key" string: "Box";
value "key" string: "Button";
value "key" string: "Check";
value "key" string: "Conformant";
value "key" string: "Entry";
value "key" string: "Frame";
value "key" string: "Grid";
value "key" string: "Group";
value "key" string: "Image";
value "key" string: "Include";
value "key" string: "Label";
value "key" string: "Layout";
value "key" string: "List_Item";
value "key" string: "List";
value "key" string: "Naviframe_Item";
value "key" string: "Naviframe";
value "key" string: "Rect";
value "key" string: "Scroller";
value "key" string: "Table";
value "key" string: "Text";
value "key" string: "Toolbar_Item";
value "key" string: "Toolbar";
value "key" string: "Win";
}
}
group "color" struct {
value "val" string: "72AAD4";
group "keys" list {
value "key" string: "align_h";
value "key" string: "align_v";
value "key" string: "alpha";
value "key" string: "bg_option";
value "key" string: "borderless";
value "key" string: "color";
value "key" string: "column_span";
value "key" string: "column";
value "key" string: "direction";
value "key" string: "disabled";
value "key" string: "ellipsis";
value "key" string: "event_cb";
value "key" string: "expand_h";
value "key" string: "expand_v";
value "key" string: "fill_h";
value "key" string: "fill_v";
value "key" string: "fullscreen";
value "key" string: "group";
value "key" string: "height";
value "key" string: "homogeneous";
value "key" string: "icon";
value "key" string: "id";
value "key" string: "line_wrap";
value "key" string: "max_w";
value "key" string: "max_h";
value "key" string: "min_w";
value "key" string: "minx_h";
value "key" string: "padding_w";
value "key" string: "padding_h";
value "key" string: "part";
value "key" string: "password";
value "key" string: "rel1_x";
value "key" string: "rel1_y";
value "key" string: "rel2_x";
value "key" string: "rel2_y";
value "key" string: "row_span";
value "key" string: "row";
value "key" string: "scale";
value "key" string: "scrollable";
value "key" string: "single_line";
value "key" string: "src";
value "key" string: "style";
value "key" string: "text";
value "key" string: "visible";
value "key" string: "weight_h";
value "key" string: "weight_v";
value "key" string: "width";
value "key" string: "xmlns";
}
}
}
}

View File

@ -1657,23 +1657,23 @@ group { name: "elm/entry/base/enventor";
styles {
style { name: "entry_style";
base: "font="FN" font_size=10 color=#ffffff style=shadow,bottom shadow_color=#00000080 wrap=word text_class=enventor_entry color_class=enventor_entry left_margin=2 right_margin=2";
base: "font="FN" font_size=10 color=#ffffff style=shadow,bottom shadow_color=#00000080 wrap=word text_class=enventor_entry color_class=enventor_entry left_margin=2 right_margin=2 tabstops=10";
ENABLED_TEXTBLOCK_TAGS
}
style { name: "entry_nowrap_style";
base: "font="FN" font_size=10 color=#ffffff style=shadow,bottom shadow_color=#00000080 text_class=enventor_entry color_class=enventor_entry left_margin=2 right_margin=2";
base: "font="FN" font_size=10 color=#ffffff style=shadow,bottom shadow_color=#00000080 text_class=enventor_entry color_class=enventor_entry left_margin=2 right_margin=2 tabstops=10";
ENABLED_TEXTBLOCK_TAGS
}
style { name: "entry_disabled_style";
base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffff19 wrap=word text_class=enventor_entry color_class=enventor_entry_disabled left_margin=2 right_margin=2";
base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffff19 wrap=word text_class=enventor_entry color_class=enventor_entry_disabled left_margin=2 right_margin=2 tabstops=10";
DISABLED_TEXTBLOCK_TAGS
}
style { name: "entry_nowrap_disabled_style";
base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffff19 text_class=enventor_entry color_class=enventor_entry_disabled left_margin=2 right_margin=2";
base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffff19 text_class=enventor_entry color_class=enventor_entry_disabled left_margin=2 right_margin=2 tabstops=10";
DISABLED_TEXTBLOCK_TAGS
}
style { name: "entry_guide_style";
base: "font="FN" font_size=10 color=#000000 style=shadow,bottom shadow_color=#ffffff19 wrap=word text_class=enventor_entry color_class=enventor_entry_guide left_margin=2 right_margin=2 ellipsis=0.0";
base: "font="FN" font_size=10 color=#000000 style=shadow,bottom shadow_color=#ffffff19 wrap=word text_class=enventor_entry color_class=enventor_entry_guide left_margin=2 right_margin=2 ellipsis=0.0 tabstops=10";
DISABLED_TEXTBLOCK_TAGS
}
}

View File

@ -2,19 +2,19 @@
typedef struct config_s
{
const char *edc_path;
const char *edj_path;
const char *input_path;
const char *output_path;
const char *font_name;
const char *font_style;
Eina_List *edc_img_path_list;
Eina_List *edc_snd_path_list;
Eina_List *edc_fnt_path_list;
Eina_List *edc_dat_path_list;
Eina_Strbuf *edc_img_path_buf; //pre-stored image paths for edc compile.
Eina_Strbuf *edc_snd_path_buf; //pre-stored sound paths for edc compile.
Eina_Strbuf *edc_fnt_path_buf; //pre-stored font paths for edc compile.
Eina_Strbuf *edc_dat_path_buf; //pre-stored data paths for edc compile.
Eina_List *img_path_list;
Eina_List *snd_path_list;
Eina_List *fnt_path_list;
Eina_List *dat_path_list;
Eina_Strbuf *img_path_buf; //pre-stored image paths for compile.
Eina_Strbuf *snd_path_buf; //pre-stored sound paths for compile.
Eina_Strbuf *fnt_path_buf; //pre-stored font paths for compile.
Eina_Strbuf *dat_path_buf; //pre-stored data paths for compile.
Eina_List *syntax_color_list;
@ -29,6 +29,8 @@ typedef struct config_s
Evas_Coord view_size_w, view_size_h;
Evas_Coord win_size_w, win_size_h;
Enventor_File_Format file_format;
Eina_Bool stats_bar;
Eina_Bool linenumber;
Eina_Bool part_highlight;
@ -50,8 +52,8 @@ config_edj_path_update(config_data *cd)
char buf[PATH_MAX];
Eina_Tmpstr *tmp_path;
char *ext = strstr(cd->edc_path, ".edc");
const char *file = ecore_file_file_get(cd->edc_path);
char *ext = strstr(cd->input_path, ".edc");
const char *file = ecore_file_file_get(cd->input_path);
if (ext && file)
{
char filename[PATH_MAX];
@ -67,7 +69,7 @@ config_edj_path_update(config_data *cd)
return;
}
eina_stringshare_replace(&cd->edj_path, tmp_path);
eina_stringshare_replace(&cd->output_path, tmp_path);
eina_tmpstr_del(tmp_path);
}
@ -148,10 +150,10 @@ config_load(void)
// loaded config is not compatile with current version of Enventor
if (cd->version < ENVENTOR_CONFIG_VERSION)
{
cd->edc_img_path_list = NULL;
cd->edc_snd_path_list = NULL;
cd->edc_fnt_path_list = NULL;
cd->edc_dat_path_list = NULL;
cd->img_path_list = NULL;
cd->snd_path_list = NULL;
cd->fnt_path_list = NULL;
cd->dat_path_list = NULL;
cd->font_scale = 1;
cd->view_scale = 1;
cd->editor_size = DEFAULT_EDITOR_SIZE;
@ -170,37 +172,37 @@ config_load(void)
g_cd = cd;
if (!cd->edc_img_path_list)
if (!cd->img_path_list)
{
sprintf(buf, "%s/images", elm_app_data_dir_get());
config_edc_img_path_set(buf);
config_img_path_set(buf);
}
else cd->edc_img_path_buf =
config_paths_buf_set(cd->edc_img_path_list, " -id ");
else cd->img_path_buf =
config_paths_buf_set(cd->img_path_list, " -id ");
if (!cd->edc_snd_path_list)
if (!cd->snd_path_list)
{
sprintf(buf, "%s/sounds", elm_app_data_dir_get());
config_edc_snd_path_set(buf);
config_snd_path_set(buf);
}
else cd->edc_snd_path_buf =
config_paths_buf_set(cd->edc_snd_path_list, " -sd ");
else cd->snd_path_buf =
config_paths_buf_set(cd->snd_path_list, " -sd ");
if (!cd->edc_fnt_path_list)
if (!cd->fnt_path_list)
{
sprintf(buf, "%s/fonts", elm_app_data_dir_get());
config_edc_fnt_path_set(buf);
config_fnt_path_set(buf);
}
else cd->edc_fnt_path_buf =
config_paths_buf_set(cd->edc_fnt_path_list, " -fd ");
else cd->fnt_path_buf =
config_paths_buf_set(cd->fnt_path_list, " -fd ");
if (!cd->edc_dat_path_list)
if (!cd->dat_path_list)
{
sprintf(buf, "%s/data", elm_app_data_dir_get());
config_edc_dat_path_set(buf);
config_dat_path_set(buf);
}
else cd->edc_dat_path_buf =
config_paths_buf_set(cd->edc_dat_path_list, " -dd ");
else cd->dat_path_buf =
config_paths_buf_set(cd->dat_path_list, " -dd ");
if (!cd->syntax_color_list)
{
@ -221,13 +223,13 @@ eddc_init(void)
edd_base = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
"edc_img_path_list", edc_img_path_list);
"img_path_list", img_path_list);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
"edc_snd_path_list", edc_snd_path_list);
"snd_path_list", snd_path_list);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
"edc_fnt_path_list", edc_fnt_path_list);
"fnt_path_list", fnt_path_list);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
"edc_dat_path_list", edc_dat_path_list);
"dat_path_list", dat_path_list);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
"syntax_color_list", syntax_color_list);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "version", version, EET_T_UINT);
@ -273,38 +275,40 @@ eddc_init(void)
}
void
config_edc_path_set(const char *edc_path)
config_input_path_set(const char *input_path)
{
config_data *cd = g_cd;
eina_stringshare_replace(&cd->edc_path, edc_path);
eina_stringshare_replace(&cd->input_path, input_path);
config_edj_path_update(cd);
}
void
config_init(const char *edc_path, const char *edj_path,
Eina_List *edc_img_path, Eina_List *edc_snd_path,
Eina_List *edc_fnt_path, Eina_List *edc_dat_path)
config_init(Enventor_File_Format file_format,
const char *input_path, const char *output_path,
Eina_List *img_path, Eina_List *snd_path,
Eina_List *fnt_path, Eina_List *dat_path)
{
eddc_init();
config_data *cd = config_load();
g_cd = cd;
if (edc_path[0]) config_edc_path_set(edc_path);
if (edj_path[0])
eina_stringshare_replace(&cd->edj_path, edj_path);
cd->file_format = file_format;
if (edc_img_path)
g_cd->edc_img_path_list = edc_img_path;
if (input_path[0]) config_input_path_set(input_path);
if (output_path[0]) eina_stringshare_replace(&cd->output_path, output_path);
if (edc_snd_path)
g_cd->edc_snd_path_list = edc_snd_path;
if (img_path)
g_cd->img_path_list = img_path;
if (edc_fnt_path)
g_cd->edc_fnt_path_list = edc_fnt_path;
if (snd_path)
g_cd->snd_path_list = snd_path;
if (edc_dat_path)
g_cd->edc_dat_path_list = edc_dat_path;
if (fnt_path)
g_cd->fnt_path_list = fnt_path;
if (dat_path)
g_cd->dat_path_list = dat_path;
}
void
@ -314,191 +318,191 @@ config_term(void)
config_save(cd);
eina_stringshare_del(cd->edc_path);
eina_stringshare_del(cd->edj_path);
eina_stringshare_del(cd->input_path);
eina_stringshare_del(cd->output_path);
Eina_Stringshare *str;
EINA_LIST_FREE(cd->edc_img_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->edc_snd_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->edc_fnt_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->edc_dat_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->img_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->snd_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->fnt_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->dat_path_list, str) eina_stringshare_del(str);
EINA_LIST_FREE(cd->syntax_color_list, str) eina_stringshare_del(str);
if (cd->edc_img_path_buf) eina_strbuf_free(cd->edc_img_path_buf);
if (cd->edc_snd_path_buf) eina_strbuf_free(cd->edc_snd_path_buf);
if (cd->edc_fnt_path_buf) eina_strbuf_free(cd->edc_fnt_path_buf);
if (cd->edc_dat_path_buf) eina_strbuf_free(cd->edc_dat_path_buf);
if (cd->img_path_buf) eina_strbuf_free(cd->img_path_buf);
if (cd->snd_path_buf) eina_strbuf_free(cd->snd_path_buf);
if (cd->fnt_path_buf) eina_strbuf_free(cd->fnt_path_buf);
if (cd->dat_path_buf) eina_strbuf_free(cd->dat_path_buf);
eet_data_descriptor_free(edd_base);
free(cd);
}
void
config_edc_snd_path_set(const char *edc_snd_path)
config_snd_path_set(const char *snd_path)
{
config_data *cd = g_cd;
//Free the existing paths
const char *s;
EINA_LIST_FREE(cd->edc_snd_path_list, s) eina_stringshare_del(s);
EINA_LIST_FREE(cd->snd_path_list, s) eina_stringshare_del(s);
if (cd->edc_snd_path_buf) eina_strbuf_free(cd->edc_snd_path_buf);
cd->edc_snd_path_buf = eina_strbuf_new();
if (cd->snd_path_buf) eina_strbuf_free(cd->snd_path_buf);
cd->snd_path_buf = eina_strbuf_new();
//parse paths by ';'
const char *lex;
Eina_Stringshare *append;
while(edc_snd_path && (strlen(edc_snd_path) > 0))
while(snd_path && (strlen(snd_path) > 0))
{
lex = strstr(edc_snd_path, ";");
lex = strstr(snd_path, ";");
if (lex)
{
append = eina_stringshare_add_length(edc_snd_path,
(lex - edc_snd_path));
cd->edc_snd_path_list = eina_list_append(cd->edc_snd_path_list,
append = eina_stringshare_add_length(snd_path,
(lex - snd_path));
cd->snd_path_list = eina_list_append(cd->snd_path_list,
append);
eina_strbuf_append(cd->edc_snd_path_buf, " -sd ");
eina_strbuf_append(cd->edc_snd_path_buf, append);
eina_strbuf_append(cd->snd_path_buf, " -sd ");
eina_strbuf_append(cd->snd_path_buf, append);
lex++;
}
else
{
append = eina_stringshare_add(edc_snd_path);
cd->edc_snd_path_list = eina_list_append(cd->edc_snd_path_list,
append = eina_stringshare_add(snd_path);
cd->snd_path_list = eina_list_append(cd->snd_path_list,
append);
eina_strbuf_append(cd->edc_snd_path_buf, " -sd ");
eina_strbuf_append(cd->edc_snd_path_buf, append);
eina_strbuf_append(cd->snd_path_buf, " -sd ");
eina_strbuf_append(cd->snd_path_buf, append);
}
edc_snd_path = lex;
snd_path = lex;
}
}
void
config_edc_dat_path_set(const char *edc_dat_path)
config_dat_path_set(const char *dat_path)
{
config_data *cd = g_cd;
//Free the existing paths
const char *s;
EINA_LIST_FREE(cd->edc_dat_path_list, s) eina_stringshare_del(s);
EINA_LIST_FREE(cd->dat_path_list, s) eina_stringshare_del(s);
if (cd->edc_dat_path_buf) eina_strbuf_free(cd->edc_dat_path_buf);
cd->edc_dat_path_buf = eina_strbuf_new();
if (cd->dat_path_buf) eina_strbuf_free(cd->dat_path_buf);
cd->dat_path_buf = eina_strbuf_new();
//parse paths by ';'
const char *lex;
Eina_Stringshare *append;
while(edc_dat_path && (strlen(edc_dat_path) > 0))
while(dat_path && (strlen(dat_path) > 0))
{
lex = strstr(edc_dat_path, ";");
lex = strstr(dat_path, ";");
if (lex)
{
append = eina_stringshare_add_length(edc_dat_path,
(lex - edc_dat_path));
cd->edc_dat_path_list = eina_list_append(cd->edc_dat_path_list,
append = eina_stringshare_add_length(dat_path,
(lex - dat_path));
cd->dat_path_list = eina_list_append(cd->dat_path_list,
append);
eina_strbuf_append(cd->edc_dat_path_buf, " -dd ");
eina_strbuf_append(cd->edc_dat_path_buf, append);
eina_strbuf_append(cd->dat_path_buf, " -dd ");
eina_strbuf_append(cd->dat_path_buf, append);
lex++;
}
else
{
append = eina_stringshare_add(edc_dat_path);
cd->edc_dat_path_list = eina_list_append(cd->edc_dat_path_list,
append = eina_stringshare_add(dat_path);
cd->dat_path_list = eina_list_append(cd->dat_path_list,
append);
eina_strbuf_append(cd->edc_dat_path_buf, " -dd ");
eina_strbuf_append(cd->edc_dat_path_buf, append);
eina_strbuf_append(cd->dat_path_buf, " -dd ");
eina_strbuf_append(cd->dat_path_buf, append);
}
edc_dat_path = lex;
dat_path = lex;
}
}
void
config_edc_fnt_path_set(const char *edc_fnt_path)
config_fnt_path_set(const char *fnt_path)
{
config_data *cd = g_cd;
//Free the existing paths
const char *s;
EINA_LIST_FREE(cd->edc_fnt_path_list, s) eina_stringshare_del(s);
EINA_LIST_FREE(cd->fnt_path_list, s) eina_stringshare_del(s);
if (cd->edc_fnt_path_buf) eina_strbuf_free(cd->edc_fnt_path_buf);
cd->edc_fnt_path_buf = eina_strbuf_new();
if (cd->fnt_path_buf) eina_strbuf_free(cd->fnt_path_buf);
cd->fnt_path_buf = eina_strbuf_new();
//parse paths by ';'
const char *lex;
Eina_Stringshare *append;
while(edc_fnt_path && (strlen(edc_fnt_path) > 0))
while(fnt_path && (strlen(fnt_path) > 0))
{
lex = strstr(edc_fnt_path, ";");
lex = strstr(fnt_path, ";");
if (lex)
{
append = eina_stringshare_add_length(edc_fnt_path,
(lex - edc_fnt_path));
cd->edc_fnt_path_list = eina_list_append(cd->edc_fnt_path_list,
append = eina_stringshare_add_length(fnt_path,
(lex - fnt_path));
cd->fnt_path_list = eina_list_append(cd->fnt_path_list,
append);
eina_strbuf_append(cd->edc_fnt_path_buf, " -fd ");
eina_strbuf_append(cd->edc_fnt_path_buf, append);
eina_strbuf_append(cd->fnt_path_buf, " -fd ");
eina_strbuf_append(cd->fnt_path_buf, append);
lex++;
}
else
{
append = eina_stringshare_add(edc_fnt_path);
cd->edc_fnt_path_list = eina_list_append(cd->edc_fnt_path_list,
append = eina_stringshare_add(fnt_path);
cd->fnt_path_list = eina_list_append(cd->fnt_path_list,
append);
eina_strbuf_append(cd->edc_fnt_path_buf, " -fd ");
eina_strbuf_append(cd->edc_fnt_path_buf, append);
eina_strbuf_append(cd->fnt_path_buf, " -fd ");
eina_strbuf_append(cd->fnt_path_buf, append);
}
edc_fnt_path = lex;
fnt_path = lex;
}
}
void
config_edc_img_path_set(const char *edc_img_path)
config_img_path_set(const char *img_path)
{
config_data *cd = g_cd;
//Free the existing paths
const char *s;
EINA_LIST_FREE(cd->edc_img_path_list, s) eina_stringshare_del(s);
EINA_LIST_FREE(cd->img_path_list, s) eina_stringshare_del(s);
if (cd->edc_img_path_buf) eina_strbuf_free(cd->edc_img_path_buf);
cd->edc_img_path_buf = eina_strbuf_new();
if (cd->img_path_buf) eina_strbuf_free(cd->img_path_buf);
cd->img_path_buf = eina_strbuf_new();
//parse paths by ';'
const char *lex;
Eina_Stringshare *append;
while(edc_img_path && (strlen(edc_img_path) > 0))
while(img_path && (strlen(img_path) > 0))
{
lex = strstr(edc_img_path, ";");
lex = strstr(img_path, ";");
if (lex)
{
append = eina_stringshare_add_length(edc_img_path,
(lex - edc_img_path));
cd->edc_img_path_list = eina_list_append(cd->edc_img_path_list,
append = eina_stringshare_add_length(img_path,
(lex - img_path));
cd->img_path_list = eina_list_append(cd->img_path_list,
append);
eina_strbuf_append(cd->edc_img_path_buf, " -id ");
eina_strbuf_append(cd->edc_img_path_buf, append);
eina_strbuf_append(cd->img_path_buf, " -id ");
eina_strbuf_append(cd->img_path_buf, append);
lex++;
}
else
{
append = eina_stringshare_add(edc_img_path);
cd->edc_img_path_list = eina_list_append(cd->edc_img_path_list,
append = eina_stringshare_add(img_path);
cd->img_path_list = eina_list_append(cd->img_path_list,
append);
eina_strbuf_append(cd->edc_img_path_buf, " -id ");
eina_strbuf_append(cd->edc_img_path_buf, append);
eina_strbuf_append(cd->img_path_buf, " -id ");
eina_strbuf_append(cd->img_path_buf, append);
}
edc_img_path = lex;
img_path = lex;
}
}
@ -510,77 +514,77 @@ config_apply(void)
}
Eina_List *
config_edc_img_path_list_get(void)
config_img_path_list_get(void)
{
config_data *cd = g_cd;
return cd->edc_img_path_list;
return cd->img_path_list;
}
Eina_List *
config_edc_snd_path_list_get(void)
config_snd_path_list_get(void)
{
config_data *cd = g_cd;
return cd->edc_snd_path_list;
return cd->snd_path_list;
}
Eina_List *
config_edc_dat_path_list_get(void)
config_dat_path_list_get(void)
{
config_data *cd = g_cd;
return cd->edc_dat_path_list;
return cd->dat_path_list;
}
Eina_List *
config_edc_fnt_path_list_get(void)
config_fnt_path_list_get(void)
{
config_data *cd = g_cd;
return cd->edc_fnt_path_list;
return cd->fnt_path_list;
}
const char *
config_edc_img_path_get(void)
config_img_path_get(void)
{
config_data *cd = g_cd;
if (!cd->edc_img_path_buf) return NULL;
return eina_strbuf_string_get(cd->edc_img_path_buf);
if (!cd->img_path_buf) return NULL;
return eina_strbuf_string_get(cd->img_path_buf);
}
const char *
config_edc_snd_path_get(void)
config_snd_path_get(void)
{
config_data *cd = g_cd;
if (!cd->edc_snd_path_buf) return NULL;
return eina_strbuf_string_get(cd->edc_snd_path_buf);
if (!cd->snd_path_buf) return NULL;
return eina_strbuf_string_get(cd->snd_path_buf);
}
const char *
config_edc_dat_path_get(void)
config_dat_path_get(void)
{
config_data *cd = g_cd;
if (!cd->edc_dat_path_buf) return NULL;
return eina_strbuf_string_get(cd->edc_dat_path_buf);
if (!cd->dat_path_buf) return NULL;
return eina_strbuf_string_get(cd->dat_path_buf);
}
const char *
config_edc_fnt_path_get(void)
config_fnt_path_get(void)
{
config_data *cd = g_cd;
if (!cd->edc_fnt_path_buf) return NULL;
return eina_strbuf_string_get(cd->edc_fnt_path_buf);
if (!cd->fnt_path_buf) return NULL;
return eina_strbuf_string_get(cd->fnt_path_buf);
}
const char *
config_edc_path_get(void)
config_input_path_get(void)
{
config_data *cd = g_cd;
return cd->edc_path;
return cd->input_path;
}
const char *
config_edj_path_get(void)
config_output_path_get(void)
{
config_data *cd = g_cd;
return cd->edj_path;
return cd->output_path;
}
void

View File

@ -54,7 +54,7 @@ warning_replace_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
file_mgr_data *fmd = data;
enventor_object_file_set(fmd->enventor, config_edc_path_get());
enventor_object_file_set(fmd->enventor, config_input_path_get());
warning_close(fmd);
}
@ -148,14 +148,16 @@ file_mgr_edc_save(void)
char buf[PATH_MAX];
file_mgr_data *fmd = g_fmd;
Eina_Bool save_success = enventor_object_save(fmd->enventor, config_edc_path_get());
Eina_Bool save_success = enventor_object_save(fmd->enventor,
config_input_path_get());
if (!config_stats_bar_get()) return;
if (save_success)
snprintf(buf, sizeof(buf), "File saved. \"%s\"", config_edc_path_get());
snprintf(buf, sizeof(buf), "File saved. \"%s\"", config_input_path_get());
else
snprintf(buf, sizeof(buf), "Already saved. \"%s\"", config_edc_path_get());
snprintf(buf, sizeof(buf), "Already saved. \"%s\"",
config_input_path_get());
stats_info_msg_update(buf);
}

View File

@ -195,7 +195,7 @@ live_edit_insert(live_data *ld)
ld->part_info.rel2_x,
ld->part_info.rel2_y,
NULL, 0);
enventor_object_save(ld->enventor, config_edc_path_get());
enventor_object_save(ld->enventor, config_input_path_get());
}
static Eina_Bool

View File

@ -6,10 +6,18 @@
#include <Eio.h>
#include "common.h"
typedef enum
{
INPUT_FORMAT_DEFAULT_EDC = 0,
INPUT_FORMAT_DEFAULT_XML,
INPUT_FORMAT_SPECIFIED_EDC,
INPUT_FORMAT_SPECIFIED_XML,
} input_format;
typedef struct app_s
{
Evas_Object *enventor;
Eina_Bool template_new : 1;
Eina_Bool on_saving : 1;
Eina_Bool lazy_save : 1;
} app_data;
@ -57,18 +65,18 @@ enventor_common_setup(Evas_Object *enventor)
enventor_object_auto_indent_set(enventor, config_auto_indent_get());
enventor_object_auto_complete_set(enventor, config_auto_complete_get());
Eina_List *list = eina_list_append(NULL, config_edj_path_get());
Eina_List *list = eina_list_append(NULL, config_output_path_get());
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_EDJ, list);
eina_list_free(list);
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_IMAGE,
config_edc_img_path_list_get());
config_img_path_list_get());
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_SOUND,
config_edc_snd_path_list_get());
config_snd_path_list_get());
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_FONT,
config_edc_fnt_path_list_get());
config_fnt_path_list_get());
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_DATA,
config_edc_dat_path_list_get());
config_dat_path_list_get());
}
static void
@ -87,7 +95,7 @@ syntax_color_update(Evas_Object *enventor)
{
enventor_color = enventor_object_syntax_color_get(enventor,
color_type);
if (strcmp(config_color, enventor_color))
if (enventor_color && strcmp(config_color, enventor_color))
{
enventor_object_syntax_color_set(enventor, color_type,
config_color);
@ -222,11 +230,11 @@ tools_set(Evas_Object *enventor)
return tools;
}
static Eina_Bool
args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
static input_format
args_dispatch(int argc, char **argv, char *input_path, char *output_path,
Eina_List **img_path, Eina_List **snd_path,
Eina_List **fnt_path, Eina_List **dat_path,
Eina_Bool *template_new)
Eina_Bool *template)
{
Eina_List *id = NULL;
@ -236,7 +244,7 @@ args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
Eina_Bool quit = EINA_FALSE;
Eina_Bool help = EINA_FALSE;
Eina_Bool default_edc = EINA_TRUE;
input_format format = INPUT_FORMAT_DEFAULT_EDC;
//No arguments. set defaults
if (argc == 1) goto defaults;
@ -268,7 +276,7 @@ args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
};
Ecore_Getopt_Value values[] = {
ECORE_GETOPT_VALUE_BOOL(*template_new),
ECORE_GETOPT_VALUE_BOOL(*template),
ECORE_GETOPT_VALUE_LIST(id),
ECORE_GETOPT_VALUE_LIST(sd),
ECORE_GETOPT_VALUE_LIST(fd),
@ -286,12 +294,17 @@ args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
{
if (strstr(argv[i], ".edc"))
{
sprintf(edc_path, "%s", argv[i]);
default_edc = EINA_FALSE;
sprintf(input_path, "%s", argv[i]);
format = INPUT_FORMAT_SPECIFIED_EDC;
}
else if (strstr(argv[i], ".edj"))
{
sprintf(edj_path, "%s", argv[i]);
sprintf(output_path, "%s", argv[i]);
}
else if (strstr(argv[i], ".xml"))
{
sprintf(input_path, "%s", argv[i]);
format = INPUT_FORMAT_SPECIFIED_XML;
}
}
@ -304,11 +317,11 @@ args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
}
defaults:
if (default_edc)
if (format == INPUT_FORMAT_DEFAULT_EDC)
{
Eina_Tmpstr *tmp_path;
eina_file_mkstemp(DEFAULT_EDC_FORMAT, &tmp_path);
sprintf(edc_path, "%s", (const char *)tmp_path);
sprintf(input_path, "%s", (const char *)tmp_path);
eina_tmpstr_del(tmp_path);
}
@ -342,28 +355,45 @@ defaults:
ecore_getopt_list_free(sd);
ecore_getopt_list_free(dd);
return default_edc;
return format;
}
static Eina_Bool
config_data_set(app_data *ad, int argc, char **argv)
static input_format
config_data_set(app_data *ad, int argc, char **argv, Eina_Bool *template)
{
char edc_path[PATH_MAX] = { 0, };
char edj_path[PATH_MAX] = { 0, };
char input_path[PATH_MAX] = { 0, };
char output_path[PATH_MAX] = { 0, };
Eina_List *img_path = NULL;
Eina_List *snd_path = NULL;
Eina_List *fnt_path = NULL;
Eina_List *dat_path = NULL;
Eina_Bool template_new = EINA_FALSE;
Eina_Bool default_edc = args_dispatch(argc, argv, edc_path, edj_path,
&img_path, &snd_path, &fnt_path,
&dat_path, &template_new);
config_init(edc_path, edj_path, img_path, snd_path, fnt_path, dat_path);
input_format format = args_dispatch(argc, argv, input_path, output_path,
&img_path, &snd_path, &fnt_path,
&dat_path, template);
//decide file format
Enventor_File_Format file_format;
switch (format)
{
case INPUT_FORMAT_DEFAULT_EDC:
case INPUT_FORMAT_SPECIFIED_EDC:
file_format = ENVENTOR_FILE_FORMAT_EDC;
break;
case INPUT_FORMAT_DEFAULT_XML:
case INPUT_FORMAT_SPECIFIED_XML:
file_format = ENVENTOR_FILE_FORMAT_XML;
break;
default:
file_format = ENVENTOR_FILE_FORMAT_EDC;
break;
}
config_init(file_format, input_path, output_path, img_path, snd_path,
fnt_path, dat_path);
config_update_cb_set(config_update_cb, ad);
ad->template_new = template_new;
return default_edc;
return format;
}
static void
@ -478,7 +508,7 @@ enventor_ctxpopup_changed_cb(void *data, Evas_Object *obj,
return;
}
ad->on_saving = EINA_TRUE;
enventor_object_save(obj, config_edc_path_get());
enventor_object_save(obj, config_input_path_get());
}
static void
@ -489,7 +519,7 @@ enventor_live_view_updated_cb(void *data, Evas_Object *obj,
if (ad->lazy_save && enventor_object_modified_get(obj))
{
enventor_object_save(obj, config_edc_path_get());
enventor_object_save(obj, config_input_path_get());
ad->lazy_save = EINA_FALSE;
}
else
@ -547,10 +577,10 @@ enventor_setup(app_data *ad)
enventor_common_setup(enventor);
enventor_object_file_set(enventor, config_edc_path_get());
enventor_object_file_set(enventor, config_input_path_get());
base_enventor_set(enventor);
base_title_set(config_edc_path_get());
base_title_set(config_input_path_get());
base_live_view_set(enventor_object_live_view_get(enventor));
ad->enventor = enventor;
@ -572,7 +602,7 @@ default_template_insert(app_data *ad)
char msg[64];
snprintf(msg, sizeof(msg), "Template code inserted, (%s)", syntax);
stats_info_msg_update(msg);
enventor_object_save(ad->enventor, config_edc_path_get());
enventor_object_save(ad->enventor, config_input_path_get());
}
else
{
@ -835,13 +865,6 @@ statusbar_set()
tools_status_update(NULL, EINA_FALSE);
}
static void
template_show(app_data *ad)
{
if (ad->template_new)
menu_edc_new(EINA_TRUE);
}
static void
live_edit_set(Evas_Object *enventor, Evas_Object *tools)
{
@ -849,6 +872,22 @@ live_edit_set(Evas_Object *enventor, Evas_Object *tools)
live_edit_init(enventor, trigger);
}
static void
default_file_set(input_format format)
{
switch (format)
{
case INPUT_FORMAT_DEFAULT_EDC:
newfile_default_edc_set();
break;
case INPUT_FORMAT_DEFAULT_XML:
//TODO:
break;
default:
break;
}
}
static Eina_Bool
init(app_data *ad, int argc, char **argv)
{
@ -859,8 +898,9 @@ init(app_data *ad, int argc, char **argv)
enventor_init(argc, argv);
Eina_Bool default_edc = config_data_set(ad, argc, argv);
newfile_default_set(default_edc);
Eina_Bool template = EINA_FALSE;
input_format format = config_data_set(ad, argc, argv, &template);
default_file_set(format);
base_gui_init();
statusbar_set();
enventor_setup(ad);
@ -875,7 +915,7 @@ init(app_data *ad, int argc, char **argv)
menu_init(ad->enventor);
template_show(ad);
if (template) menu_edc_new(EINA_TRUE);
//Initialize syntax color.
syntax_color_init(ad->enventor);

View File

@ -321,7 +321,7 @@ exit_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
menu_data *md = data;
enventor_object_save(md->enventor, config_edc_path_get());
enventor_object_save(md->enventor, config_input_path_get());
elm_exit();
}
@ -369,7 +369,7 @@ new_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
menu_data *md = data;
enventor_object_save(md->enventor, config_edc_path_get());
enventor_object_save(md->enventor, config_input_path_get());
newfile_open(md);
warning_close(md);
menu_close(md);
@ -426,8 +426,8 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
if (is_edc)
{
config_edc_path_set(selected);
Eina_List *list = eina_list_append(NULL, config_edj_path_get());
config_input_path_set(selected);
Eina_List *list = eina_list_append(NULL, config_output_path_get());
enventor_object_path_set(md->enventor, ENVENTOR_PATH_TYPE_EDJ, list);
eina_list_free(list);
if (!enventor_object_save(md->enventor, selected))
@ -451,7 +451,7 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
enventor_object_path_set(md->enventor, ENVENTOR_PATH_TYPE_EDJ,
edj_pathes);
enventor_object_modified_set(md->enventor, EINA_TRUE);
enventor_object_save(md->enventor, config_edc_path_get());
enventor_object_save(md->enventor, config_input_path_get());
eina_list_free(edj_pathes);
}
@ -516,7 +516,7 @@ fileselector_load_done_cb(void *data, Evas_Object *obj, void *event_info)
"elm,action,msg,show", "");
return;
}
config_edc_path_set(selected);
config_input_path_set(selected);
enventor_object_file_set(md->enventor, selected);
base_title_set(selected);
fileselector_close(md);
@ -612,7 +612,7 @@ load_save_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
menu_data *md = data;
enventor_object_save(md->enventor, config_edc_path_get());
enventor_object_save(md->enventor, config_input_path_get());
edc_file_load(md);
warning_close(md);
}

View File

@ -35,17 +35,17 @@ newfile_set(Evas_Object *enventor, Eina_Bool template_new)
snprintf(buf, sizeof(buf), "%s/templates/%s.edc",
elm_app_data_dir_get(), elm_object_item_text_get(it));
if (template_new && config_edc_path_get())
sprintf(path, "%s", config_edc_path_get());
if (template_new && config_input_path_get())
sprintf(path, "%s", config_input_path_get());
else
{
Eina_Tmpstr *tmp_path;
eina_file_mkstemp(DEFAULT_EDC_FORMAT, &tmp_path);
sprintf(path, "%s", (const char *)tmp_path);
eina_tmpstr_del(tmp_path);
config_edc_path_set(path);
config_input_path_set(path);
Eina_List *list = eina_list_append(NULL, config_edj_path_get());
Eina_List *list = eina_list_append(NULL, config_output_path_get());
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_EDJ, list);
eina_list_free(list);
}
@ -62,17 +62,15 @@ newfile_set(Evas_Object *enventor, Eina_Bool template_new)
}
void
newfile_default_set(Eina_Bool default_edc)
newfile_default_edc_set(void)
{
Eina_Bool success = EINA_TRUE;
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/templates/basic.edc",
elm_app_data_dir_get());
if (default_edc)
{
success = eina_file_copy(buf,config_edc_path_get(),
EINA_FILE_COPY_DATA, NULL, NULL);
}
success = eina_file_copy(buf,config_input_path_get(),
EINA_FILE_COPY_DATA, NULL, NULL);
if (!success)
{
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);

View File

@ -34,57 +34,57 @@ typedef struct setting_s setting_data;
static setting_data *g_sd = NULL;
static void
img_path_entry_update(Evas_Object *entry, Eina_List *edc_img_paths)
img_path_entry_update(Evas_Object *entry, Eina_List *img_paths)
{
elm_entry_entry_set(entry, NULL);
Eina_List *l;
char *edc_img_path;
EINA_LIST_FOREACH(edc_img_paths, l, edc_img_path)
char *img_path;
EINA_LIST_FOREACH(img_paths, l, img_path)
{
elm_entry_entry_append(entry, edc_img_path);
elm_entry_entry_append(entry, img_path);
elm_entry_entry_append(entry, ";");
}
}
static void
fnt_path_entry_update(Evas_Object *entry, Eina_List *edc_fnt_paths)
fnt_path_entry_update(Evas_Object *entry, Eina_List *fnt_paths)
{
elm_entry_entry_set(entry, NULL);
Eina_List *l;
char *edc_fnt_path;
EINA_LIST_FOREACH(edc_fnt_paths, l, edc_fnt_path)
char *fnt_path;
EINA_LIST_FOREACH(fnt_paths, l, fnt_path)
{
elm_entry_entry_append(entry, edc_fnt_path);
elm_entry_entry_append(entry, fnt_path);
elm_entry_entry_append(entry, ";");
}
}
static void
dat_path_entry_update(Evas_Object *entry, Eina_List *edc_dat_paths)
dat_path_entry_update(Evas_Object *entry, Eina_List *dat_paths)
{
elm_entry_entry_set(entry, NULL);
Eina_List *l;
char *edc_dat_path;
EINA_LIST_FOREACH(edc_dat_paths, l, edc_dat_path)
char *dat_path;
EINA_LIST_FOREACH(dat_paths, l, dat_path)
{
elm_entry_entry_append(entry, edc_dat_path);
elm_entry_entry_append(entry, dat_path);
elm_entry_entry_append(entry, ";");
}
}
static void
snd_path_entry_update(Evas_Object *entry, Eina_List *edc_snd_paths)
snd_path_entry_update(Evas_Object *entry, Eina_List *snd_paths)
{
elm_entry_entry_set(entry, NULL);
Eina_List *l;
char *edc_snd_path;
EINA_LIST_FOREACH(edc_snd_paths, l, edc_snd_path)
char *snd_path;
EINA_LIST_FOREACH(snd_paths, l, snd_path)
{
elm_entry_entry_append(entry, edc_snd_path);
elm_entry_entry_append(entry, snd_path);
elm_entry_entry_append(entry, ";");
}
}
@ -112,10 +112,10 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
{
setting_data *sd = data;
config_edc_img_path_set(elm_object_text_get(sd->img_path_entry));
config_edc_snd_path_set(elm_object_text_get(sd->snd_path_entry));
config_edc_fnt_path_set(elm_object_text_get(sd->fnt_path_entry));
config_edc_dat_path_set(elm_object_text_get(sd->dat_path_entry));
config_img_path_set(elm_object_text_get(sd->img_path_entry));
config_snd_path_set(elm_object_text_get(sd->snd_path_entry));
config_fnt_path_set(elm_object_text_get(sd->fnt_path_entry));
config_dat_path_set(elm_object_text_get(sd->dat_path_entry));
config_view_scale_set(elm_slider_value_get(sd->slider_view));
config_tools_set(elm_check_state_get(sd->toggle_tools));
config_console_set(elm_check_state_get(sd->toggle_console));
@ -150,13 +150,13 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
setting_data *sd = data;
img_path_entry_update(sd->img_path_entry,
(Eina_List *)config_edc_img_path_list_get());
(Eina_List *)config_img_path_list_get());
snd_path_entry_update(sd->snd_path_entry,
(Eina_List *)config_edc_snd_path_list_get());
(Eina_List *)config_snd_path_list_get());
fnt_path_entry_update(sd->fnt_path_entry,
(Eina_List *)config_edc_fnt_path_list_get());
(Eina_List *)config_fnt_path_list_get());
dat_path_entry_update(sd->dat_path_entry,
(Eina_List *)config_edc_dat_path_list_get());
(Eina_List *)config_dat_path_list_get());
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get());
@ -239,7 +239,7 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
//Image Path Entry
Evas_Object *img_path_entry = entry_create(layout);
img_path_entry_update(img_path_entry,
(Eina_List *)config_edc_img_path_list_get());
(Eina_List *)config_img_path_list_get());
elm_object_focus_set(img_path_entry, EINA_TRUE);
elm_object_part_content_set(layout, "elm.swallow.img_path_entry",
img_path_entry);
@ -247,20 +247,20 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
//Sound Path Entry
Evas_Object *snd_path_entry = entry_create(layout);
snd_path_entry_update(snd_path_entry,
(Eina_List *)config_edc_snd_path_list_get());
(Eina_List *)config_snd_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.snd_path_entry",
snd_path_entry);
//Font Path Entry
Evas_Object *fnt_path_entry = entry_create(layout);
fnt_path_entry_update(fnt_path_entry,
(Eina_List *)config_edc_fnt_path_list_get());
(Eina_List *)config_fnt_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.fnt_path_entry",
fnt_path_entry);
//Data Path Entry
Evas_Object *dat_path_entry = entry_create(layout);
dat_path_entry_update(dat_path_entry,
(Eina_List *)config_edc_dat_path_list_get());
(Eina_List *)config_dat_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.dat_path_entry",
dat_path_entry);

View File

@ -3,22 +3,22 @@
#define MAX_VIEW_SCALE 10.0
#define MIN_VIEW_SCALE 0.1
void config_init(const char *edc_path, const char *edj_path, Eina_List *edc_img_path, Eina_List *edc_snd_path, Eina_List *edc_fnt_path, Eina_List *edc_dat_path);
void config_init(Enventor_File_Format file_format, const char *input_path, const char *output_path, Eina_List *img_path, Eina_List *snd_path, Eina_List *fnt_path, Eina_List *dat_path);
void config_term(void);
const char *config_edc_path_get(void);
const char *config_edj_path_get(void);
const char *config_edc_img_path_get(void);
const char *config_edc_snd_path_get(void);
const char *config_edc_fnt_path_get(void);
const char *config_edc_dat_path_get(void);
void config_edc_img_path_set(const char *edc_img_path);
void config_edc_snd_path_set(const char *edc_snd_path);
void config_edc_fnt_path_set(const char *edc_fnt_path);
void config_edc_dat_path_set(const char *edc_fnt_path);
Eina_List *config_edc_img_path_list_get(void);
Eina_List *config_edc_snd_path_list_get(void);
Eina_List *config_edc_fnt_path_list_get(void);
Eina_List *config_edc_dat_path_list_get(void);
const char *config_input_path_get(void);
const char *config_output_path_get(void);
const char *config_img_path_get(void);
const char *config_snd_path_get(void);
const char *config_fnt_path_get(void);
const char *config_dat_path_get(void);
void config_img_path_set(const char *img_path);
void config_snd_path_set(const char *snd_path);
void config_fnt_path_set(const char *fnt_path);
void config_dat_path_set(const char *fnt_path);
Eina_List *config_img_path_list_get(void);
Eina_List *config_snd_path_list_get(void);
Eina_List *config_fnt_path_list_get(void);
Eina_List *config_dat_path_list_get(void);
void config_syntax_color_set(Enventor_Syntax_Color_Type color_type, const char *val);
const char *config_syntax_color_get(Enventor_Syntax_Color_Type color_type);
void config_update_cb_set(void (*cb)(void *data), void *data);
@ -27,7 +27,7 @@ void config_linenumber_set(Eina_Bool enabled);
Eina_Bool config_stats_bar_get(void);
Eina_Bool config_linenumber_get(void);
void config_apply(void);
void config_edc_path_set(const char *edc_path);
void config_input_path_set(const char *input_path);
void config_view_size_get(Evas_Coord *w, Evas_Coord *h);
void config_view_size_set(Evas_Coord w, Evas_Coord h);
Eina_Bool config_view_size_configurable_get(void);

View File

@ -1,4 +1,4 @@
void newfile_default_set(Eina_Bool default_edc);
void newfile_default_edc_set(void);
void newfile_set(Evas_Object *enventor, Eina_Bool template_new);
Evas_Object * newfile_create(Evas_Object *parent, Evas_Smart_Cb selected_cb, void *data);

View File

@ -16,6 +16,13 @@
#define EOAPI EAPI
#endif
typedef enum
{
ENVENTOR_FILE_FORMAT_EDC = 0,
ENVENTOR_FILE_FORMAT_XML,
ENVENTOR_FILE_FORMAT_LAST
} Enventor_File_Format;
typedef enum
{
ENVENTOR_PATH_TYPE_EDJ = 0,

View File

@ -103,6 +103,7 @@ slider_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
strcat(ctxdata->candidate, buf);
}
strcat(ctxdata->candidate, ctxdata->attr->append_str);
ecore_animator_del(ctxdata->animator);
ctxdata->animator = ecore_animator_add(changed_animator_cb, ctxdata);
}

View File

@ -254,7 +254,7 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
parser_line_cnt_get(ed->pd, info->change.insert.content);
}
if (ed->auto_indent)
if (edit_auto_indent_get(ed))
{
increase =
indent_insert_apply(syntax_indent_data_get(ed->sh), ed->en_edit,
@ -267,7 +267,7 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
int decrease = parser_line_cnt_get(ed->pd, info->change.del.content);
if (ed->auto_indent)
if (edit_auto_indent_get(ed))
{
if (indent_delete_apply(syntax_indent_data_get(ed->sh),
ed->en_edit, info->change.del.content,
@ -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);
@ -1215,7 +1213,8 @@ edit_part_highlight_get(edit_data *ed)
}
Eina_Bool
edit_load(edit_data *ed, const char *edc_path)
edit_load(edit_data *ed, const char *edc_path,
Enventor_File_Format file_format)
{
parser_cancel(ed->pd);
elm_entry_entry_set(ed->en_edit, "");
@ -1223,6 +1222,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);
//Update syntax help
if (!ed->sh || syntax_file_format_get(ed->sh) != file_format)
{
if (ed->sh) syntax_term(ed->sh);
ed->sh = syntax_init(file_format);
}
redoundo_clear(ed->rd);
return ret;

View File

@ -12,6 +12,10 @@
#define TAB "<tab/>"
#define TAB_LEN 6
#define TAB_SPACE 3
#define GT "&gt;"
#define GT_LEN 4
#define LT "&lt;"
#define LT_LEN 4
#define REL1_X 0.25f
#define REL1_Y 0.25f
#define REL2_X 0.75f
@ -87,7 +91,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,14 +123,15 @@ 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);
Enventor_File_Format syntax_file_format_get(syntax_helper *sh);
/* indent */
indent_data *indent_init(Eina_Strbuf *strbuf);
indent_data *indent_init(Eina_Strbuf *strbuf, Enventor_File_Format file_format);
void indent_term(indent_data *id);
int indent_space_get(indent_data *id, Evas_Object *entry);
int indent_insert_apply(indent_data *id, Evas_Object *entry, const char *insert, int cur_line);
@ -253,7 +258,7 @@ void edit_ctxpopup_enabled_set(edit_data *ed, Eina_Bool enabled);
Eina_Bool edit_ctxpopup_enabled_get(edit_data *ed);
Eina_Bool edit_ctxpopup_visible_get(edit_data *ed);
void edit_ctxpopup_dismiss(edit_data *ed);
Eina_Bool edit_load(edit_data *ed, const char *edc_path);
Eina_Bool edit_load(edit_data *ed, const char *edc_path, Enventor_File_Format file_format);
void edit_selection_clear(edit_data *ed);
Eina_Bool edit_redoundo(edit_data *ed, Eina_Bool undo);
void edit_disabled_set(edit_data *ed, Eina_Bool disabled);

View File

@ -26,6 +26,7 @@ typedef struct _Enventor_Object_Data
Eio_Monitor *edc_monitor;
Eina_Stringshare *group_name;
Ecore_Timer *file_modified_timer;
Enventor_File_Format file_format;
Eina_Bool dummy_swallow : 1;
@ -269,11 +270,26 @@ _enventor_object_efl_file_file_set(Eo *obj EINA_UNUSED,
const char *group EINA_UNUSED)
{
eio_monitor_del(pd->edc_monitor);
//Decide file format
if (file)
{
if (strstr(file, ".edc"))
pd->file_format = ENVENTOR_FILE_FORMAT_EDC;
else if (strstr(file, ".xml"))
pd->file_format = ENVENTOR_FILE_FORMAT_XML;
}
build_edc_path_set(file);
autocomp_target_set(pd->ed);
if (!edit_load(pd->ed, file)) goto err;
pd->edc_monitor = eio_monitor_add(file);
build_edc();
if (!edit_load(pd->ed, file, pd->file_format)) goto err;
if (pd->file_format == ENVENTOR_FILE_FORMAT_EDC)
{
pd->edc_monitor = eio_monitor_add(file);
build_edc();
}
edit_changed_set(pd->ed, EINA_FALSE);
return EINA_TRUE;
@ -608,7 +624,11 @@ _enventor_object_save(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
if (build_edc_path_get() != file) edit_changed_set(pd->ed, EINA_TRUE);
Eina_Bool saved = edit_save(pd->ed, file);
//EDC file is newly generated, we need to reload as the input.
if (saved && !pd->edc_monitor) enventor_object_file_set(obj, file);
if (saved && !pd->edc_monitor)
{
if (pd->file_format == ENVENTOR_FILE_FORMAT_EDC)
enventor_object_file_set(obj, file);
}
return saved;
}

View File

@ -8,44 +8,14 @@
struct indent_s
{
Eina_Strbuf *strbuf;
Enventor_File_Format file_format;
};
/*****************************************************************************/
/* Internal method implementation */
/* Internal method implementation (COMMON) */
/*****************************************************************************/
static int
indent_depth_get(indent_data *id EINA_UNUSED, char *src, int pos)
{
if (!src || (pos < 1)) return 0;
int depth = 0;
const char *quot = "\"";
int quot_len = 1; // strlen("&quot;");
char *cur = (char *) src;
char *end = ((char *) src) + pos;
while (cur && (cur <= end))
{
//Skip "" range
if (*cur == *quot)
{
cur += quot_len;
cur = strstr(cur, quot);
if (!cur) return depth;
cur += quot_len;
}
if (*cur == '{') depth++;
else if (*cur == '}') depth--;
cur++;
}
return depth;
}
static void
indent_insert_br_case(indent_data *id, Evas_Object *entry)
indent_common_insert_br_case(indent_data *id, Evas_Object *entry)
{
Evas_Object *tb = elm_entry_textblock_get(entry);
Evas_Textblock_Cursor *cur = evas_object_textblock_cursor_get(tb);
@ -84,8 +54,14 @@ indent_insert_br_case(indent_data *id, Evas_Object *entry)
elm_entry_entry_insert(entry, p);
}
/*****************************************************************************/
/* Internal method implementation (EDC) */
/*****************************************************************************/
static void
indent_insert_bracket_case(indent_data *id, Evas_Object *entry, int cur_line)
indent_edc_insert_bracket_case(indent_data *id, Evas_Object *entry,
int cur_line)
{
Evas_Object *tb = elm_entry_textblock_get(entry);
Evas_Textblock_Cursor *cur = evas_object_textblock_cursor_new(tb);
@ -103,7 +79,11 @@ indent_insert_bracket_case(indent_data *id, Evas_Object *entry, int cur_line)
}
int space = indent_space_get(id, entry);
if (space == len) return;
if (space == len)
{
free(utf8);
return;
}
int i = 0;
if (len > space)
@ -144,97 +124,9 @@ indent_insert_bracket_case(indent_data *id, Evas_Object *entry, int cur_line)
free(utf8);
}
/*****************************************************************************/
/* Externally accessible calls */
/*****************************************************************************/
indent_data *
indent_init(Eina_Strbuf *strbuf)
{
indent_data *id = malloc(sizeof(indent_data));
if (!id)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
id->strbuf = strbuf;
return id;
}
void
indent_term(indent_data *id)
{
free(id);
}
int
indent_space_get(indent_data *id, Evas_Object *entry)
{
//Get the indentation depth
int pos = elm_entry_cursor_pos_get(entry);
char *src = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
int space = indent_depth_get(id, src, pos);
if (space < 0) space = 0;
space *= TAB_SPACE;
free(src);
return space;
}
Eina_Bool
indent_delete_apply(indent_data *id EINA_UNUSED, Evas_Object *entry,
const char *del, int cur_line)
{
if (del[0] != ' ') return EINA_FALSE;
Evas_Object *tb = elm_entry_textblock_get(entry);
Evas_Textblock_Cursor *cur = evas_object_textblock_cursor_new(tb);
evas_textblock_cursor_line_set(cur, cur_line - 1);
const char *text = evas_textblock_cursor_paragraph_text_get(cur);
char *utf8 = elm_entry_markup_to_utf8(text);
Eina_Strbuf* diff = eina_strbuf_new();
int rd_cur_pos = evas_textblock_cursor_pos_get(cur);
redoundo_data *rd = evas_object_data_get(entry, "redoundo");
int len = strlen(utf8);
if (len < 0) return EINA_FALSE;
evas_textblock_cursor_paragraph_char_last(cur);
while (len > 0)
{
if ((utf8[(len - 1)] == ' '))
{
evas_textblock_cursor_char_prev(cur);
eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur));
evas_textblock_cursor_char_delete(cur);
}
else break;
len--;
}
if (len == 0)
{
eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur));
evas_textblock_cursor_char_delete(cur);
}
redoundo_text_push(rd, eina_strbuf_string_get(diff), rd_cur_pos, 0,
EINA_FALSE);
elm_entry_calc_force(entry);
evas_textblock_cursor_free(cur);
free(utf8);
eina_strbuf_free(diff);
if (len == 0)
{
elm_entry_cursor_prev(entry);
return EINA_TRUE;
}
return EINA_FALSE;
}
static int
indent_text_auto_format(indent_data *id EINA_UNUSED,
Evas_Object *entry, const char *insert)
indent_edc_text_auto_format(indent_data *id EINA_UNUSED,
Evas_Object *entry, const char *insert)
{
int line_cnt = 0;
char *utf8 = evas_textblock_text_markup_to_utf8(NULL, insert);
@ -342,28 +234,345 @@ indent_text_auto_format(indent_data *id EINA_UNUSED,
eina_strbuf_free(buf);
free(frmt_buf);
evas_textblock_cursor_free(cur_start);
return line_cnt;
}
int
indent_insert_apply(indent_data *id, Evas_Object *entry, const char *insert,
int cur_line)
static int
indent_edc_insert_apply(indent_data *id, Evas_Object *entry, const char *insert,
int cur_line)
{
int len = strlen(insert);
if (len == 1)
{
if (insert[0] == '}')
indent_insert_bracket_case(id, entry, cur_line);
indent_edc_insert_bracket_case(id, entry, cur_line);
return 0;
}
else
{
if (!strcmp(insert, EOL))
{
indent_insert_br_case(id, entry);
indent_common_insert_br_case(id, entry);
return 1;
}
else
return indent_text_auto_format(id, entry, insert);
return indent_edc_text_auto_format(id, entry, insert);
}
}
static Eina_Bool
indent_edc_delete_apply(indent_data *id EINA_UNUSED, Evas_Object *entry,
const char *del, int cur_line)
{
if (del[0] != ' ') return EINA_FALSE;
Evas_Object *tb = elm_entry_textblock_get(entry);
Evas_Textblock_Cursor *cur = evas_object_textblock_cursor_new(tb);
evas_textblock_cursor_line_set(cur, cur_line - 1);
const char *text = evas_textblock_cursor_paragraph_text_get(cur);
char *utf8 = elm_entry_markup_to_utf8(text);
Eina_Strbuf* diff = eina_strbuf_new();
int rd_cur_pos = evas_textblock_cursor_pos_get(cur);
redoundo_data *rd = evas_object_data_get(entry, "redoundo");
int len = strlen(utf8);
if (len < 0) return EINA_FALSE;
evas_textblock_cursor_paragraph_char_last(cur);
while (len > 0)
{
if ((utf8[(len - 1)] == ' '))
{
evas_textblock_cursor_char_prev(cur);
eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur));
evas_textblock_cursor_char_delete(cur);
}
else break;
len--;
}
if (len == 0)
{
eina_strbuf_append(diff, evas_textblock_cursor_content_get(cur));
evas_textblock_cursor_char_delete(cur);
}
redoundo_text_push(rd, eina_strbuf_string_get(diff), rd_cur_pos, 0,
EINA_FALSE);
elm_entry_calc_force(entry);
evas_textblock_cursor_free(cur);
free(utf8);
eina_strbuf_free(diff);
if (len == 0)
{
elm_entry_cursor_prev(entry);
return EINA_TRUE;
}
return EINA_FALSE;
}
static int
indent_edc_space_get(indent_data *id, Evas_Object *entry)
{
//Get the indentation depth
int pos = elm_entry_cursor_pos_get(entry);
if (pos < 1) return 0;
char *src = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
if (!src) return 0;
int depth = 0;
const char *quot = "\"";
int quot_len = 1; // strlen("&quot;");
char *cur = (char *) src;
char *end = ((char *) src) + pos;
while (cur && (cur <= end))
{
//Skip "" range
if (*cur == *quot)
{
cur += quot_len;
cur = strstr(cur, quot);
if (!cur) return depth;
cur += quot_len;
}
if (*cur == '{') depth++;
else if (*cur == '}') depth--;
cur++;
}
if (depth < 0) depth = 0;
depth *= TAB_SPACE;
free(src);
return depth;
}
/*****************************************************************************/
/* Internal method implementation (XML) */
/*****************************************************************************/
static void
indent_xml_insert_slash_case(indent_data *id, Evas_Object *entry, int cur_line)
{
Evas_Object *tb = elm_entry_textblock_get(entry);
Evas_Textblock_Cursor *cur = evas_object_textblock_cursor_new(tb);
evas_textblock_cursor_line_set(cur, cur_line - 1);
const char *text = evas_textblock_cursor_paragraph_text_get(cur);
char *utf8 = elm_entry_markup_to_utf8(text);
int len = strlen(utf8) - 1;
if (len < 0) return;
while (len)
{
if (utf8[len] == '<') break;
len--;
}
//Check is it closing case.
if (strncmp(utf8 + len, "</", 2))
{
free(utf8);
return;
}
int space = indent_space_get(id, entry);
if (space == len)
{
free(utf8);
return;
}
int i = 0;
if (len > space)
{
evas_textblock_cursor_line_char_first(cur);
while (i < len)
{
//Guarantee One linear or not.
if (utf8[i] != ' ')
{
free(utf8);
return;
}
evas_textblock_cursor_char_next(cur);
i++;
}
i = 0;
while (i < (len - space))
{
if (utf8[(len - 1) - i] == ' ')
{
evas_textblock_cursor_char_prev(cur);
evas_textblock_cursor_char_delete(cur);
}
else break;
i++;
}
}
else
{
//Alloc Empty spaces
space = (space - len);
char *p = alloca(space + 1);
memset(p, ' ', space);
p[space] = '\0';
evas_textblock_cursor_text_prepend(cur, p);
}
elm_entry_calc_force(entry);
evas_textblock_cursor_free(cur);
free(utf8);
}
static int
indent_xml_insert_apply(indent_data *id, Evas_Object *entry, const char *insert,
int cur_line)
{
int len = strlen(insert);
if (len == GT_LEN)
{
if (!strncmp(insert, GT, GT_LEN))
indent_xml_insert_slash_case(id, entry, cur_line);
return 0;
}
else
{
if (!strcmp(insert, EOL))
{
indent_common_insert_br_case(id, entry);
return 1;
}
}
return 0;
}
static int
indent_xml_space_get(indent_data *id, Evas_Object *entry)
{
//Get the indentation depth
int pos = elm_entry_cursor_pos_get(entry);
if (pos <= 1) return 0;
char *src = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
if (!src) return 0;
int depth = 0;
const char *quot = "\"";
int quot_len = 1; // strlen("&quot;");
char *cur = (char *) src;
char *end = ((char *) src) + pos - 1;
while (cur && (cur <= end))
{
//Skip "" range
if (*cur == *quot)
{
cur += quot_len;
cur = strstr(cur, quot);
if (!cur) return depth;
cur += quot_len;
}
if (!strncmp(cur, "</", 2))
{
depth--;
cur+=2;
}
else if (!strncmp(cur, "<!", 2))
{
cur+=2;
}
else if (*cur == '<')
{
depth++;
cur++;
}
else if (!strncmp(cur, "/>", 2))
{
depth--;
cur+=2;
}
else cur++;
}
/* If current Cursor move back placed in just prior to </xxx>
Then we need to depth down one more */
if (!strncmp((src + pos), "</", 2)) depth--;
if (depth < 0) depth = 0;
depth *= TAB_SPACE;
free(src);
return depth;
}
/*****************************************************************************/
/* Externally accessible calls */
/*****************************************************************************/
indent_data *
indent_init(Eina_Strbuf *strbuf, Enventor_File_Format file_format)
{
indent_data *id = malloc(sizeof(indent_data));
if (!id)
{
EINA_LOG_ERR("Failed to allocate Memory!");
return NULL;
}
id->strbuf = strbuf;
id->file_format = file_format;
return id;
}
void
indent_term(indent_data *id)
{
free(id);
}
int
indent_space_get(indent_data *id, Evas_Object *entry)
{
switch (id->file_format)
{
case ENVENTOR_FILE_FORMAT_XML:
return indent_xml_space_get(id, entry);
default:
return indent_edc_space_get(id, entry);
}
}
Eina_Bool
indent_delete_apply(indent_data *id, Evas_Object *entry, const char *del,
int cur_line)
{
switch (id->file_format)
{
default:
return indent_edc_delete_apply(id, entry, del, cur_line);
}
}
int
indent_insert_apply(indent_data *id, Evas_Object *entry, const char *insert,
int cur_line)
{
switch (id->file_format)
{
case ENVENTOR_FILE_FORMAT_XML:
return indent_xml_insert_apply(id, entry, insert, cur_line);
default:
return indent_edc_insert_apply(id, entry, insert, cur_line);
}
}

View File

@ -5,7 +5,7 @@
#include <Enventor.h>
#include "enventor_private.h"
#define COL_NUM 6
#define MAX_COL_NUM 6
typedef struct color_tuple
{
@ -24,7 +24,8 @@ typedef struct syntax_color_group
char *string;
char *comment;
char *macro;
color colors[COL_NUM];
char *count;
color colors[MAX_COL_NUM];
} syntax_color_group;
struct syntax_color_s
@ -35,9 +36,11 @@ struct syntax_color_s
Eina_Stringshare *col_string;
Eina_Stringshare *col_comment;
Eina_Stringshare *col_macro;
Eina_Stringshare *cols[COL_NUM];
Eina_Stringshare *cols[MAX_COL_NUM];
int color_cnt;
Eina_List *macros;
Ecore_Thread *thread;
Enventor_File_Format file_format;
Eina_Bool ready: 1;
};
@ -85,6 +88,8 @@ eddc_init(void)
comment, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_scg, syntax_color_group, "macro",
macro, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_scg, syntax_color_group, "count",
count, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_color, color, "val", val, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_color, color, "keys", keys);
@ -101,10 +106,19 @@ 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());
switch (file_format)
{
case ENVENTOR_FILE_FORMAT_XML:
snprintf(buf, sizeof(buf), "%s/color/xml.eet", elm_app_data_dir_get());
break;
default:
snprintf(buf, sizeof(buf), "%s/color/edc.eet", elm_app_data_dir_get());
break;
}
Eet_File *ef = eet_open(buf, EET_FILE_MODE_READ);
if (ef)
@ -134,10 +148,12 @@ color_table_init(color_data *cd)
//free(scg->comment);
cd->col_macro = eina_stringshare_add(scg->macro);
//free(scg->macro);
cd->color_cnt = atoi(scg->count);
//free(scg->count);
cd->color_hash = eina_hash_string_small_new(hash_free_cb);
for (i = 0; i < COL_NUM; i++)
for (i = 0; i < cd->color_cnt; i++)
{
cd->cols[i] = eina_stringshare_add(scg->colors[i].val);
//free(scg->colors[i].val);
@ -214,7 +230,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);
@ -379,6 +395,74 @@ comment2_apply(Eina_Strbuf *strbuf, const char **src, int length, char **cur,
return -1;
}
static int
comment3_apply(Eina_Strbuf *strbuf, const char **src, int length, char **cur,
char **prev, const Eina_Stringshare *col,
Eina_Bool *inside_comment)
{
if (!(*inside_comment))
{
if ((*cur)[0] != '&') return 0;
int cmp_size = 7; //strlen("<!--");
if (strncmp(*cur, "&lt;!--", cmp_size)) return 0;
eina_strbuf_append_length(strbuf, *prev, (*cur - *prev));
char buf[128];
snprintf(buf, sizeof(buf), "<color=#%s>&lt;!--", col);
eina_strbuf_append(strbuf, buf);
*cur += cmp_size;
if (*cur > (*src + length))
{
*inside_comment = EINA_TRUE;
return -1;
}
*prev = *cur;
cmp_size = 6; //strlen("-->");
*cur = strstr(*prev, "--&gt;");
if (*cur)
{
eina_strbuf_append_length(strbuf, *prev, (*cur - *prev));
eina_strbuf_append(strbuf, "--&gt;</color>");
*cur += cmp_size;
*prev = *cur;
return 0;
}
eina_strbuf_append(strbuf, *prev);
*prev = *cur;
*inside_comment = EINA_TRUE;
return -1;
}
else
{
int cmp_size = 6; //strlen("-->");
if ((*cur)[0] != '-') return 0;
if (strncmp(*cur, "--&gt;", cmp_size)) return 0;
eina_strbuf_append_length(strbuf, *prev, (*cur - *prev));
eina_strbuf_append(strbuf, "--&gt;</color>");
*cur += cmp_size;
*inside_comment = EINA_FALSE;
if (*cur > (*src + length)) return -1;
*prev = *cur;
return 1;
}
return -1;
}
static int
string_apply(Eina_Strbuf *strbuf, char **cur, char **prev,
const Eina_Stringshare *col, Eina_Bool inside_string)
@ -510,25 +594,31 @@ color_cancel(color_data *cd, const char *src, int length, int from_pos,
while (cur && (cur <= (src + length)))
{
//Capture start line
if (find_from && (line == from_pos))
{
from_pos = eina_strbuf_length_get(strbuf);
find_from = EINA_FALSE;
}
if (find_to && (line == to_pos))
{
to_pos = eina_strbuf_length_get(strbuf);
find_to = EINA_FALSE;
}
if (*cur == '<')
{
//escape EOL: <br/>
if (!strncmp(cur, EOL, EOL_LEN))
{
eina_strbuf_append_length(strbuf, prev, (cur - prev + EOL_LEN));
//Capture end line
if (find_to && (line == to_pos))
{
to_pos = eina_strbuf_length_get(strbuf);
find_to = EINA_FALSE;
}
eina_strbuf_append_length(strbuf, prev,
(cur - prev + EOL_LEN));
cur += EOL_LEN;
prev = cur;
line++;
continue;
}
//escape TAB: <tab/>
@ -537,13 +627,20 @@ color_cancel(color_data *cd, const char *src, int length, int from_pos,
cur += TAB_LEN;
continue;
}
//escape markups: <..> ~ </..>
if (markup_skip(strbuf, &src, length, &cur, &prev) == 1)
continue;
//escape markups: <..> ~ </..>
if (markup_skip(strbuf, &src, length, &cur, &prev) == 1)
continue;
}
cur++;
}
//Capture end line
if (find_to && (line == to_pos))
{
to_pos = eina_strbuf_length_get(strbuf);
find_to = EINA_FALSE;
}
//Same with origin source.
if (prev == src)
str = src;
@ -601,7 +698,7 @@ static int
color_markup_insert(Eina_Strbuf *strbuf, const char **src, int length, char **cur,
char **prev, color_data *cd)
{
const char *SYMBOLS = " {}[];:.()!<>=&|";
const char *SYMBOLS = " {}[];:.()!<>=&|/";
Eina_Bool symbol = EINA_FALSE;
if (strchr(SYMBOLS, (*cur)[0])) symbol = EINA_TRUE;
@ -654,9 +751,9 @@ 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 = malloc(sizeof(color_data));
color_data *cd = calloc(1, sizeof(color_data));
if (!cd)
{
EINA_LOG_ERR("Failed to allocate Memory!");
@ -664,8 +761,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;
}
@ -686,7 +783,7 @@ color_term(color_data *cd)
EINA_LIST_FREE(cd->macros, macro) eina_stringshare_del(macro);
int i;
for(i = 0; i < COL_NUM; i++)
for(i = 0; i < cd->color_cnt; i++)
eina_stringshare_del(cd->cols[i]);
free(cd);
@ -860,6 +957,20 @@ color_apply(color_data *cd, const char *src, int length, char *from, char *to)
}
}
//escape string: " ~ "
ret = string_apply(strbuf, &cur, &prev, cd->col_string, inside_string);
if (ret == 1)
{
inside_string = !inside_string;
continue;
}
if (inside_string || inside_comment)
{
cur++;
continue;
}
//handle comment: /* ~ */
ret = comment_apply(strbuf, &src, length, &cur, &prev, cd->col_comment,
&inside_comment);
@ -875,18 +986,30 @@ color_apply(color_data *cd, const char *src, int length, char *from, char *to)
else if (ret == -1) goto finished;
}
//escape string: " ~ "
ret = string_apply(strbuf, &cur, &prev, cd->col_string, inside_string);
if (ret == 1)
//handle comment: <!-- -->
if (!from || (cur >= from))
{
inside_string = !inside_string;
continue;
ret = comment3_apply(strbuf, &src, length, &cur, &prev,
cd->col_comment, &inside_comment);
if (ret == 1) continue;
else if (ret == -1) goto finished;
}
if (inside_string || inside_comment)
if (*cur == '<')
{
cur++;
continue;
//escape EOL: <br/>
if (!strncmp(cur, EOL, EOL_LEN))
{
cur += EOL_LEN;
continue;
}
//escape TAB: <tab/>
if (!strncmp(cur, TAB, TAB_LEN))
{
cur += TAB_LEN;
continue;
}
}
//handle comment: preprocessors, #

View File

@ -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,9 +46,10 @@ 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->id = indent_init(sh->strbuf);
sh->cd = color_init(sh->strbuf, file_format);
sh->id = indent_init(sh->strbuf, file_format);
return sh;
}
@ -63,6 +65,12 @@ syntax_term(syntax_helper *sh)
free(sh);
}
Enventor_File_Format
syntax_file_format_get(syntax_helper *sh)
{
return sh->file_format;
}
color_data *
syntax_color_data_get(syntax_helper *sh)
{