config - got rid of config instance handling outside of the config_data scope.
count config as a singletone instance also. since we won't handle multiple configs in the enventor.
This commit is contained in:
parent
b4b5c1b112
commit
4fcf8eaef7
|
@ -4,7 +4,7 @@
|
|||
static char *EDJE_CC_CMD = NULL;
|
||||
|
||||
Eina_Bool
|
||||
build_cmd_set(config_data *cd)
|
||||
build_cmd_set()
|
||||
{
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
if (!buf) return EINA_FALSE;
|
||||
|
@ -13,16 +13,16 @@ build_cmd_set(config_data *cd)
|
|||
|
||||
eina_strbuf_append_printf(buf,
|
||||
"edje_cc -fastcomp %s %s -id %s/images -sd %s/sounds -fd %s/fonts -dd %s/data %s %s %s %s",
|
||||
config_edc_path_get(cd),
|
||||
config_edj_path_get(cd),
|
||||
config_edc_path_get(),
|
||||
config_edj_path_get(),
|
||||
elm_app_data_dir_get(),
|
||||
elm_app_data_dir_get(),
|
||||
elm_app_data_dir_get(),
|
||||
elm_app_data_dir_get(),
|
||||
config_edc_img_path_get(cd),
|
||||
config_edc_snd_path_get(cd),
|
||||
config_edc_fnt_path_get(cd),
|
||||
config_edc_data_path_get(cd));
|
||||
config_edc_img_path_get(),
|
||||
config_edc_snd_path_get(),
|
||||
config_edc_fnt_path_get(),
|
||||
config_edc_data_path_get());
|
||||
|
||||
EDJE_CC_CMD = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
|
@ -44,9 +44,9 @@ build_edc()
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
build_init(config_data *cd)
|
||||
build_init()
|
||||
{
|
||||
return build_cmd_set(cd);
|
||||
return build_cmd_set();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -18,7 +18,7 @@ struct config_s
|
|||
float font_size;
|
||||
double view_scale;
|
||||
|
||||
void (*update_cb)(void *data, config_data *cd);
|
||||
void (*update_cb)(void *data);
|
||||
void *update_cb_data;
|
||||
Evas_Coord_Size view_size;
|
||||
|
||||
|
@ -29,6 +29,8 @@ struct config_s
|
|||
Eina_Bool auto_indent : 1;
|
||||
};
|
||||
|
||||
static config_data *g_cd = NULL;
|
||||
|
||||
static void
|
||||
config_edj_path_update(config_data *cd)
|
||||
{
|
||||
|
@ -48,25 +50,27 @@ config_edj_path_update(config_data *cd)
|
|||
}
|
||||
|
||||
void
|
||||
config_edc_path_set(config_data *cd, const char *edc_path)
|
||||
config_edc_path_set(const char *edc_path)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
eina_stringshare_replace(&cd->edc_path, edc_path);
|
||||
config_edj_path_update(cd);
|
||||
}
|
||||
|
||||
config_data *
|
||||
void
|
||||
config_init(const char *edc_path, const char *edc_img_path,
|
||||
const char *edc_snd_path, const char *edc_fnt_path,
|
||||
const char *edc_data_path)
|
||||
{
|
||||
config_data *cd = calloc(1, sizeof(config_data));
|
||||
g_cd = cd;
|
||||
|
||||
cd->edc_path = eina_stringshare_add(edc_path);
|
||||
config_edj_path_update(cd);
|
||||
config_edc_img_path_set(cd, edc_img_path);
|
||||
config_edc_snd_path_set(cd, edc_snd_path);
|
||||
config_edc_fnt_path_set(cd, edc_fnt_path);
|
||||
config_edc_data_path_set(cd, edc_data_path);
|
||||
config_edc_img_path_set(edc_img_path);
|
||||
config_edc_snd_path_set(edc_snd_path);
|
||||
config_edc_fnt_path_set(edc_fnt_path);
|
||||
config_edc_data_path_set(edc_data_path);
|
||||
|
||||
cd->font_size = 1.0f;
|
||||
cd->view_scale = 1;
|
||||
|
@ -74,13 +78,13 @@ config_init(const char *edc_path, const char *edc_img_path,
|
|||
cd->part_highlight = EINA_TRUE;
|
||||
cd->dummy_swallow = EINA_TRUE;
|
||||
cd->auto_indent = EINA_TRUE;
|
||||
|
||||
return cd;
|
||||
}
|
||||
|
||||
void
|
||||
config_term(config_data *cd)
|
||||
config_term()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
eina_stringshare_del(cd->edc_path);
|
||||
eina_stringshare_del(cd->edj_path);
|
||||
|
||||
|
@ -116,8 +120,10 @@ config_term(config_data *cd)
|
|||
}
|
||||
|
||||
void
|
||||
config_edc_snd_path_set(config_data *cd, const char *edc_snd_path)
|
||||
config_edc_snd_path_set(const char *edc_snd_path)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
//Free the existing paths
|
||||
Eina_List *l;
|
||||
const char *s;
|
||||
|
@ -159,8 +165,10 @@ config_edc_snd_path_set(config_data *cd, const char *edc_snd_path)
|
|||
}
|
||||
|
||||
void
|
||||
config_edc_data_path_set(config_data *cd, const char *edc_data_path)
|
||||
config_edc_data_path_set(const char *edc_data_path)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
//Free the existing paths
|
||||
Eina_List *l;
|
||||
const char *s;
|
||||
|
@ -202,8 +210,10 @@ config_edc_data_path_set(config_data *cd, const char *edc_data_path)
|
|||
}
|
||||
|
||||
void
|
||||
config_edc_fnt_path_set(config_data *cd, const char *edc_fnt_path)
|
||||
config_edc_fnt_path_set(const char *edc_fnt_path)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
//Free the existing paths
|
||||
Eina_List *l;
|
||||
const char *s;
|
||||
|
@ -245,8 +255,10 @@ config_edc_fnt_path_set(config_data *cd, const char *edc_fnt_path)
|
|||
}
|
||||
|
||||
void
|
||||
config_edc_img_path_set(config_data *cd, const char *edc_img_path)
|
||||
config_edc_img_path_set(const char *edc_img_path)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
//Free the existing paths
|
||||
Eina_List *l;
|
||||
const char *s;
|
||||
|
@ -288,140 +300,162 @@ config_edc_img_path_set(config_data *cd, const char *edc_img_path)
|
|||
}
|
||||
|
||||
void
|
||||
config_apply(config_data *cd)
|
||||
config_apply()
|
||||
{
|
||||
if (cd->update_cb) cd->update_cb(cd->update_cb_data, cd);
|
||||
config_data *cd = g_cd;
|
||||
if (cd->update_cb) cd->update_cb(cd->update_cb_data);
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
config_edc_img_path_list_get(config_data *cd)
|
||||
config_edc_img_path_list_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edc_img_path_list;
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
config_edc_snd_path_list_get(config_data *cd)
|
||||
config_edc_snd_path_list_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edc_snd_path_list;
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
config_edc_data_path_list_get(config_data *cd)
|
||||
config_edc_data_path_list_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edc_data_path_list;
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
config_edc_fnt_path_list_get(config_data *cd)
|
||||
config_edc_fnt_path_list_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edc_fnt_path_list;
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_img_path_get(config_data *cd)
|
||||
config_edc_img_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
if (!cd->edc_img_path_buf) return NULL;
|
||||
return eina_strbuf_string_get(cd->edc_img_path_buf);
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_snd_path_get(config_data *cd)
|
||||
config_edc_snd_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
if (!cd->edc_snd_path_buf) return NULL;
|
||||
return eina_strbuf_string_get(cd->edc_snd_path_buf);
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_data_path_get(config_data *cd)
|
||||
config_edc_data_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
if (!cd->edc_data_path_buf) return NULL;
|
||||
return eina_strbuf_string_get(cd->edc_data_path_buf);
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_fnt_path_get(config_data *cd)
|
||||
config_edc_fnt_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
if (!cd->edc_fnt_path_buf) return NULL;
|
||||
return eina_strbuf_string_get(cd->edc_fnt_path_buf);
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_path_get(config_data *cd)
|
||||
config_edc_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edc_path;
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edj_path_get(config_data *cd)
|
||||
config_edj_path_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->edj_path;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_linenumber_get(config_data *cd)
|
||||
config_linenumber_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->linenumber;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_stats_bar_get(config_data *cd)
|
||||
config_stats_bar_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->stats_bar;
|
||||
}
|
||||
|
||||
void
|
||||
config_linenumber_set(config_data *cd, Eina_Bool enabled)
|
||||
config_linenumber_set(Eina_Bool enabled)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->linenumber = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
config_stats_bar_set(config_data *cd, Eina_Bool enabled)
|
||||
config_stats_bar_set(Eina_Bool enabled)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->stats_bar = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
config_update_cb_set(config_data *cd, void (*cb)(void *data, config_data *cd),
|
||||
void *data)
|
||||
config_update_cb_set(void (*cb)(void *data), void *data)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->update_cb = cb;
|
||||
cd->update_cb_data = data;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_part_highlight_get(config_data *cd)
|
||||
config_part_highlight_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->part_highlight;
|
||||
}
|
||||
|
||||
void
|
||||
config_part_highlight_set(config_data *cd, Eina_Bool highlight)
|
||||
config_part_highlight_set(Eina_Bool highlight)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->part_highlight = highlight;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_dummy_swallow_get(config_data *cd)
|
||||
config_dummy_swallow_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->dummy_swallow;
|
||||
}
|
||||
|
||||
void
|
||||
config_dummy_swallow_set(config_data *cd, Eina_Bool dummy_swallow)
|
||||
config_dummy_swallow_set(Eina_Bool dummy_swallow)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->dummy_swallow = dummy_swallow;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_auto_indent_get(config_data *cd)
|
||||
config_auto_indent_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->auto_indent;
|
||||
}
|
||||
|
||||
void
|
||||
config_font_size_set(config_data *cd, float font_size)
|
||||
config_font_size_set(float font_size)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
if (font_size > MAX_FONT_SIZE)
|
||||
font_size = MAX_FONT_SIZE;
|
||||
else if (font_size < MIN_FONT_SIZE)
|
||||
|
@ -431,20 +465,24 @@ config_font_size_set(config_data *cd, float font_size)
|
|||
}
|
||||
|
||||
float
|
||||
config_font_size_get(config_data *cd)
|
||||
config_font_size_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->font_size;
|
||||
}
|
||||
|
||||
void
|
||||
config_auto_indent_set(config_data *cd, Eina_Bool auto_indent)
|
||||
config_auto_indent_set(Eina_Bool auto_indent)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->auto_indent = auto_indent;
|
||||
}
|
||||
|
||||
void
|
||||
config_view_scale_set(config_data *cd, double view_scale)
|
||||
config_view_scale_set(double view_scale)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
if (view_scale > MAX_VIEW_SCALE)
|
||||
view_scale = MAX_VIEW_SCALE;
|
||||
else if (view_scale < MIN_VIEW_SCALE)
|
||||
|
@ -453,21 +491,26 @@ config_view_scale_set(config_data *cd, double view_scale)
|
|||
}
|
||||
|
||||
double
|
||||
config_view_scale_get(config_data *cd)
|
||||
config_view_scale_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->view_scale;
|
||||
}
|
||||
|
||||
void
|
||||
config_view_size_set(config_data *cd, Evas_Coord w, Evas_Coord h)
|
||||
config_view_size_set(Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
cd->view_size.w = w;
|
||||
cd->view_size.h = h;
|
||||
}
|
||||
|
||||
void
|
||||
config_view_size_get(config_data *cd, Evas_Coord *w, Evas_Coord *h)
|
||||
config_view_size_get(Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
|
||||
if (w) *w = cd->view_size.w;
|
||||
if (h) *h = cd->view_size.h;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ struct editor_s
|
|||
|
||||
syntax_helper *sh;
|
||||
stats_data *sd;
|
||||
config_data *cd;
|
||||
parser_data *pd;
|
||||
|
||||
int cur_line;
|
||||
|
@ -123,7 +122,7 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
syntax_color = EINA_FALSE;
|
||||
}
|
||||
|
||||
if (config_auto_indent_get(ed->cd))
|
||||
if (config_auto_indent_get())
|
||||
indent_insert_apply(syntax_indent_data_get(ed->sh), ed->en_edit,
|
||||
info->change.insert.content, ed->cur_line);
|
||||
}
|
||||
|
@ -131,7 +130,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 (config_auto_indent_get(ed->cd))
|
||||
if (config_auto_indent_get())
|
||||
{
|
||||
if (indent_delete_apply(syntax_indent_data_get(ed->sh),
|
||||
ed->en_edit, info->change.del.content,
|
||||
|
@ -150,16 +149,14 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
static void
|
||||
save_msg_show(edit_data *ed)
|
||||
{
|
||||
if (!config_stats_bar_get(ed->cd)) return;
|
||||
if (!config_stats_bar_get()) return;
|
||||
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (ed->edit_changed)
|
||||
snprintf(buf, sizeof(buf), "File saved. \"%s\"",
|
||||
config_edc_path_get(ed->cd));
|
||||
snprintf(buf, sizeof(buf), "File saved. \"%s\"", config_edc_path_get());
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "Already saved. \"%s\"",
|
||||
config_edc_path_get(ed->cd));
|
||||
snprintf(buf, sizeof(buf), "Already saved. \"%s\"", config_edc_path_get());
|
||||
|
||||
stats_info_msg_update(ed->sd, buf);
|
||||
}
|
||||
|
@ -176,7 +173,7 @@ edit_save(edit_data *ed)
|
|||
const char *text = elm_entry_entry_get(ed->en_edit);
|
||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||
|
||||
FILE *fp = fopen(config_edc_path_get(ed->cd), "w");
|
||||
FILE *fp = fopen(config_edc_path_get(), "w");
|
||||
if (!fp) return EINA_FALSE;
|
||||
|
||||
fputs(utf8, fp);
|
||||
|
@ -400,7 +397,7 @@ edit_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
|
|||
static void
|
||||
cur_line_pos_set(edit_data *ed)
|
||||
{
|
||||
if (!config_stats_bar_get(ed->cd)) return;
|
||||
if (!config_stats_bar_get()) return;
|
||||
|
||||
Evas_Coord y, h;
|
||||
elm_entry_cursor_geometry_get(ed->en_edit, NULL, &y, NULL, &h);
|
||||
|
@ -479,7 +476,7 @@ image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y)
|
|||
char fullpath[PATH_MAX];
|
||||
|
||||
//1.Find the image path.
|
||||
Eina_List *list = config_edc_img_path_list_get(ed->cd);
|
||||
Eina_List *list = config_edc_img_path_list_get();
|
||||
Eina_List *l;
|
||||
char *path;
|
||||
Eina_Bool found = EINA_FALSE;
|
||||
|
@ -597,7 +594,7 @@ cur_name_get_cb(void *data, Eina_Stringshare *part_name,
|
|||
void
|
||||
edit_view_sync(edit_data *ed)
|
||||
{
|
||||
if (!config_part_highlight_get(ed->cd)) return;
|
||||
if (!config_part_highlight_get()) return;
|
||||
|
||||
parser_cur_name_get(ed->pd, ed->en_edit, cur_name_get_cb, ed);
|
||||
}
|
||||
|
@ -654,7 +651,7 @@ key_up_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
}
|
||||
|
||||
edit_data *
|
||||
edit_init(Evas_Object *parent, stats_data *sd, config_data *cd)
|
||||
edit_init(Evas_Object *parent, stats_data *sd)
|
||||
{
|
||||
parser_data *pd = parser_init();
|
||||
syntax_helper *sh = syntax_init();
|
||||
|
@ -663,7 +660,6 @@ edit_init(Evas_Object *parent, stats_data *sd, config_data *cd)
|
|||
ed->sd = sd;
|
||||
ed->pd = pd;
|
||||
ed->sh = sh;
|
||||
ed->cd = cd;
|
||||
|
||||
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, key_down_cb, ed);
|
||||
ecore_event_handler_add(ECORE_EVENT_KEY_UP, key_up_cb, ed);
|
||||
|
@ -831,7 +827,7 @@ edit_changed_set(edit_data *ed, Eina_Bool changed)
|
|||
void
|
||||
edit_line_number_toggle(edit_data *ed)
|
||||
{
|
||||
Eina_Bool linenumber = config_linenumber_get(ed->cd);
|
||||
Eina_Bool linenumber = config_linenumber_get();
|
||||
if (ed->linenumber == linenumber) return;
|
||||
ed->linenumber = linenumber;
|
||||
|
||||
|
@ -847,25 +843,23 @@ edit_new(edit_data *ed)
|
|||
parser_cancel(ed->pd);
|
||||
elm_entry_entry_set(ed->en_edit, "");
|
||||
elm_entry_entry_set(ed->en_line, "");
|
||||
edit_edc_read(ed, config_edc_path_get(ed->cd));
|
||||
edit_edc_read(ed, config_edc_path_get());
|
||||
ed->edit_changed = EINA_TRUE;
|
||||
|
||||
char buf[PATH_MAX];
|
||||
snprintf(buf, sizeof(buf), "File Path: \"%s\"",
|
||||
config_edc_path_get(ed->cd));
|
||||
snprintf(buf, sizeof(buf), "File Path: \"%s\"", config_edc_path_get());
|
||||
stats_info_msg_update(ed->sd, buf);
|
||||
}
|
||||
|
||||
void
|
||||
edit_font_size_update(edit_data *ed, Eina_Bool msg)
|
||||
{
|
||||
elm_object_scale_set(ed->en_edit, config_font_size_get(ed->cd));
|
||||
elm_object_scale_set(ed->en_line, config_font_size_get(ed->cd));
|
||||
elm_object_scale_set(ed->en_edit, config_font_size_get());
|
||||
elm_object_scale_set(ed->en_line, config_font_size_get());
|
||||
|
||||
if (!msg) return;
|
||||
|
||||
char buf[128];
|
||||
snprintf(buf, sizeof(buf), "Font Size: %1.1fx",
|
||||
config_font_size_get(ed->cd));
|
||||
snprintf(buf, sizeof(buf), "Font Size: %1.1fx", config_font_size_get());
|
||||
stats_info_msg_update(ed->sd, buf);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ struct edj_mgr_s
|
|||
Eina_List *edjs;
|
||||
edj_data *edj;
|
||||
Evas_Object *layout;
|
||||
config_data *cd;
|
||||
|
||||
Eina_Bool reload_need : 1;
|
||||
};
|
||||
|
@ -38,14 +37,13 @@ edj_mgr_clear(edj_mgr *em)
|
|||
}
|
||||
|
||||
edj_mgr *
|
||||
edj_mgr_init(Evas_Object *parent, config_data *cd)
|
||||
edj_mgr_init(Evas_Object *parent)
|
||||
{
|
||||
edj_mgr *em = calloc(1, sizeof(edj_mgr));
|
||||
Evas_Object *layout = elm_layout_add(parent);
|
||||
elm_layout_file_set(layout, EDJE_PATH, "viewer_layout");
|
||||
evas_object_show(layout);
|
||||
em->layout = layout;
|
||||
em->cd = cd;
|
||||
g_em = em;
|
||||
return em;
|
||||
}
|
||||
|
@ -107,7 +105,7 @@ edj_mgr_view_new(edj_mgr *em, const char *group, stats_data *sd)
|
|||
edj_data *edj = calloc(1, sizeof(edj_data));
|
||||
if (!edj) return NULL;
|
||||
|
||||
view_data *vd = view_init(em->layout, group, sd, em->cd, view_del_cb, edj);
|
||||
view_data *vd = view_init(em->layout, group, sd, view_del_cb, edj);
|
||||
if (!vd)
|
||||
{
|
||||
free(edj);
|
||||
|
@ -143,7 +141,7 @@ edj_mgr_view_switch_to(edj_mgr *em, view_data *vd)
|
|||
elm_object_part_content_set(em->layout, "elm.swallow.content",
|
||||
view_obj_get(vd));
|
||||
|
||||
view_scale_set(vd, config_view_scale_get(em->cd));
|
||||
view_scale_set(vd, config_view_scale_get());
|
||||
|
||||
//Switching effect
|
||||
if (prev && (prev != view_obj_get(vd)))
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
struct viewer_s
|
||||
{
|
||||
stats_data *sd;
|
||||
config_data *cd;
|
||||
|
||||
Evas_Object *parent;
|
||||
Evas_Object *layout;
|
||||
|
@ -38,7 +37,7 @@ file_set_timer_cb(void *data)
|
|||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
if (edje_object_file_set(vd->layout, config_edj_path_get(vd->cd),
|
||||
if (edje_object_file_set(vd->layout, config_edj_path_get(),
|
||||
vd->group_name))
|
||||
{
|
||||
vd->timer = NULL;
|
||||
|
@ -88,11 +87,11 @@ layout_resize_cb(void *data, Evas *e EINA_UNUSED,
|
|||
Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
view_data *vd = data;
|
||||
if (!config_stats_bar_get(vd->cd)) return;
|
||||
if (!config_stats_bar_get()) return;
|
||||
|
||||
Evas_Coord w, h;
|
||||
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
||||
config_view_size_set(vd->cd, w, h);
|
||||
config_view_size_set(w, h);
|
||||
stats_view_size_update(vd->sd);
|
||||
}
|
||||
|
||||
|
@ -101,7 +100,7 @@ rect_mouse_move_cb(void *data, Evas *e EINA_UNUSED,
|
|||
Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
view_data *vd = data;
|
||||
if (!config_stats_bar_get(vd->cd)) return;
|
||||
if (!config_stats_bar_get()) return;
|
||||
|
||||
Evas_Event_Mouse_Move *ev = event_info;
|
||||
|
||||
|
@ -131,7 +130,7 @@ edje_change_file_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
const char *source EINA_UNUSED)
|
||||
{
|
||||
view_data *vd = data;
|
||||
if (!edje_object_file_set(vd->layout, config_edj_path_get(vd->cd),
|
||||
if (!edje_object_file_set(vd->layout, config_edj_path_get(),
|
||||
vd->group_name))
|
||||
{
|
||||
vd->del_cb(vd->data);
|
||||
|
@ -205,9 +204,8 @@ view_obj_idler_cb(void *data)
|
|||
{
|
||||
view_data *vd = data;
|
||||
|
||||
vd->layout = view_obj_create(vd, config_edj_path_get(vd->cd),
|
||||
vd->group_name);
|
||||
view_scale_set(vd, config_view_scale_get(vd->cd));
|
||||
vd->layout = view_obj_create(vd, config_edj_path_get(), vd->group_name);
|
||||
view_scale_set(vd, config_view_scale_get());
|
||||
|
||||
event_layer_set(vd);
|
||||
elm_object_content_set(vd->scroller, vd->layout);
|
||||
|
@ -224,7 +222,7 @@ view_obj_idler_cb(void *data)
|
|||
void
|
||||
view_dummy_toggle(view_data *vd, Eina_Bool msg)
|
||||
{
|
||||
Eina_Bool dummy_on = config_dummy_swallow_get(vd->cd);
|
||||
Eina_Bool dummy_on = config_dummy_swallow_get();
|
||||
if (dummy_on == vd->dummy_on) return;
|
||||
if (dummy_on)
|
||||
{
|
||||
|
@ -242,14 +240,13 @@ view_dummy_toggle(view_data *vd, Eina_Bool msg)
|
|||
|
||||
view_data *
|
||||
view_init(Evas_Object *parent, const char *group, stats_data *sd,
|
||||
config_data *cd, void (*del_cb)(void *data), void *data)
|
||||
void (*del_cb)(void *data), void *data)
|
||||
{
|
||||
view_data *vd = calloc(1, sizeof(view_data));
|
||||
vd->parent = parent;
|
||||
vd->sd = sd;
|
||||
vd->cd = cd;
|
||||
vd->scroller = view_scroller_create(parent);
|
||||
vd->dummy_on = config_dummy_swallow_get(cd);
|
||||
vd->dummy_on = config_dummy_swallow_get();
|
||||
|
||||
vd->group_name = eina_stringshare_add(group);
|
||||
vd->idler = ecore_idler_add(view_obj_idler_cb, vd);
|
||||
|
|
|
@ -8,7 +8,6 @@ struct app_s
|
|||
edit_data *ed;
|
||||
edj_mgr *em;
|
||||
stats_data *sd;
|
||||
config_data *cd;
|
||||
|
||||
Evas_Object *layout;
|
||||
Evas_Object *panes;
|
||||
|
@ -30,7 +29,7 @@ edc_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
|||
|
||||
if (!edit_changed_get(ad->ed)) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
if (strcmp(ev->filename, config_edc_path_get(ad->cd)))
|
||||
if (strcmp(ev->filename, config_edc_path_get()))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
build_edc();
|
||||
|
@ -86,7 +85,7 @@ base_gui_construct(app_data *ad)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
edc_proto_setup(config_data *cd)
|
||||
edc_proto_setup()
|
||||
{
|
||||
Eina_Bool success = EINA_TRUE;
|
||||
|
||||
|
@ -94,11 +93,10 @@ edc_proto_setup(config_data *cd)
|
|||
snprintf(buf, sizeof(buf), "%s/.proto/proto.edc",
|
||||
elm_app_data_dir_get());
|
||||
|
||||
if (!ecore_file_exists(config_edc_path_get(cd)))
|
||||
if (!ecore_file_exists(config_edc_path_get()))
|
||||
{
|
||||
EINA_LOG_INFO("No working edc file exists. Copy a proto.edc");
|
||||
success = eina_file_copy(buf,
|
||||
config_edc_path_get(cd),
|
||||
success = eina_file_copy(buf, config_edc_path_get(),
|
||||
EINA_FILE_COPY_DATA, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -133,7 +131,7 @@ main_key_up_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
static void
|
||||
statusbar_toggle(app_data *ad)
|
||||
{
|
||||
if (config_stats_bar_get(ad->cd))
|
||||
if (config_stats_bar_get())
|
||||
elm_object_signal_emit(ad->layout, "elm,state,statusbar,show", "");
|
||||
else
|
||||
elm_object_signal_emit(ad->layout, "elm,state,statusbar,hide", "");
|
||||
|
@ -142,7 +140,7 @@ statusbar_toggle(app_data *ad)
|
|||
static void
|
||||
part_highlight_toggle(app_data *ad, Eina_Bool msg)
|
||||
{
|
||||
Eina_Bool highlight = config_part_highlight_get(ad->cd);
|
||||
Eina_Bool highlight = config_part_highlight_get();
|
||||
if (highlight) edit_view_sync(ad->ed);
|
||||
else view_part_highlight_set(VIEW_DATA, NULL);
|
||||
|
||||
|
@ -157,10 +155,10 @@ part_highlight_toggle(app_data *ad, Eina_Bool msg)
|
|||
static void
|
||||
auto_indentation_toggle(app_data *ad)
|
||||
{
|
||||
Eina_Bool toggle = !config_auto_indent_get(ad->cd);
|
||||
Eina_Bool toggle = !config_auto_indent_get();
|
||||
if (toggle) stats_info_msg_update(ad->sd, "Auto Indentation Enabled.");
|
||||
else stats_info_msg_update(ad->sd, "Auto Indentation Disabled.");
|
||||
config_auto_indent_set(ad->cd, toggle);
|
||||
config_auto_indent_set(toggle);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -233,14 +231,14 @@ ctrl_func(app_data *ad, const char *keyname)
|
|||
//Part Highlight
|
||||
if (!strcmp(keyname, "h") || !strcmp(keyname, "H"))
|
||||
{
|
||||
config_part_highlight_set(ad->cd, !config_part_highlight_get(ad->cd));
|
||||
config_part_highlight_set(!config_part_highlight_get());
|
||||
part_highlight_toggle(ad, EINA_TRUE);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
//Swallow Dummy Object
|
||||
if (!strcmp(keyname, "w") || !strcmp(keyname, "W"))
|
||||
{
|
||||
config_dummy_swallow_set(ad->cd, !config_dummy_swallow_get(ad->cd));
|
||||
config_dummy_swallow_set(!config_dummy_swallow_get());
|
||||
view_dummy_toggle(VIEW_DATA, EINA_TRUE);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
@ -265,14 +263,14 @@ ctrl_func(app_data *ad, const char *keyname)
|
|||
//Font Size Up
|
||||
if (!strcmp(keyname, "equal"))
|
||||
{
|
||||
config_font_size_set(ad->cd, config_font_size_get(ad->cd) + 0.1f);
|
||||
config_font_size_set(config_font_size_get() + 0.1f);
|
||||
edit_font_size_update(ad->ed, EINA_TRUE);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
//Font Size Down
|
||||
if (!strcmp(keyname, "minus"))
|
||||
{
|
||||
config_font_size_set(ad->cd, config_font_size_get(ad->cd) - 0.1f);
|
||||
config_font_size_set(config_font_size_get() - 0.1f);
|
||||
edit_font_size_update(ad->ed, EINA_TRUE);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
@ -342,14 +340,14 @@ main_key_down_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
//Line Number
|
||||
if (!strcmp(event->keyname, "F5"))
|
||||
{
|
||||
config_linenumber_set(ad->cd, !config_linenumber_get(ad->cd));
|
||||
config_linenumber_set(!config_linenumber_get());
|
||||
edit_line_number_toggle(ad->ed);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
//Statusbar
|
||||
if (!strcmp(event->keyname, "F6"))
|
||||
{
|
||||
config_stats_bar_set(ad->cd, !config_stats_bar_get(ad->cd));
|
||||
config_stats_bar_set(!config_stats_bar_get());
|
||||
statusbar_toggle(ad);
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
@ -373,13 +371,13 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
|
||||
//Scale up/down layout
|
||||
view_data *vd = edj_mgr_view_get(ad->em, NULL);
|
||||
double scale = config_view_scale_get(ad->cd);
|
||||
double scale = config_view_scale_get();
|
||||
|
||||
if (event->z < 0) scale += 0.1;
|
||||
else scale -= 0.1;
|
||||
|
||||
config_view_scale_set(ad->cd, scale);
|
||||
scale = config_view_scale_get(ad->cd);
|
||||
config_view_scale_set(scale);
|
||||
scale = config_view_scale_get();
|
||||
view_scale_set(vd, scale);
|
||||
|
||||
char buf[256];
|
||||
|
@ -390,8 +388,7 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
}
|
||||
|
||||
static void
|
||||
edc_view_set(app_data *ad, config_data *cd, stats_data *sd,
|
||||
Eina_Stringshare *group)
|
||||
edc_view_set(app_data *ad, stats_data *sd, Eina_Stringshare *group)
|
||||
{
|
||||
view_data *vd = edj_mgr_view_get(ad->em, group);
|
||||
if (vd) edj_mgr_view_switch_to(ad->em, vd);
|
||||
|
@ -408,36 +405,36 @@ view_sync_cb(void *data, Eina_Stringshare *part_name,
|
|||
{
|
||||
app_data *ad = data;
|
||||
if (stats_group_name_get(ad->sd) != group_name)
|
||||
edc_view_set(ad, ad->cd, ad->sd, group_name);
|
||||
edc_view_set(ad, ad->sd, group_name);
|
||||
view_part_highlight_set(VIEW_DATA, part_name);
|
||||
}
|
||||
|
||||
static void
|
||||
edc_edit_set(app_data *ad, stats_data *sd, config_data *cd)
|
||||
edc_edit_set(app_data *ad, stats_data *sd)
|
||||
{
|
||||
edit_data *ed = edit_init(ad->panes, sd, cd);
|
||||
edit_edc_read(ed, config_edc_path_get(cd));
|
||||
edit_data *ed = edit_init(ad->panes, sd);
|
||||
edit_edc_read(ed, config_edc_path_get());
|
||||
elm_object_part_content_set(ad->panes, "right", edit_obj_get(ed));
|
||||
edit_view_sync_cb_set(ed, view_sync_cb, ad);
|
||||
ad->ed = ed;
|
||||
}
|
||||
|
||||
static void
|
||||
statusbar_set(app_data *ad, config_data *cd)
|
||||
statusbar_set(app_data *ad)
|
||||
{
|
||||
stats_data *sd = stats_init(ad->layout, cd);
|
||||
stats_data *sd = stats_init(ad->layout);
|
||||
elm_object_part_content_set(ad->layout, "elm.swallow.statusbar",
|
||||
stats_obj_get(sd));
|
||||
ad->sd = sd;
|
||||
config_stats_bar_set(ad->cd, EINA_TRUE);
|
||||
config_stats_bar_set(EINA_TRUE);
|
||||
statusbar_toggle(ad);
|
||||
}
|
||||
|
||||
static void
|
||||
config_update_cb(void *data, config_data *cd)
|
||||
config_update_cb(void *data)
|
||||
{
|
||||
app_data *ad = data;
|
||||
build_cmd_set(cd);
|
||||
build_cmd_set();
|
||||
edit_line_number_toggle(ad->ed);
|
||||
edit_font_size_update(ad->ed, EINA_FALSE);
|
||||
|
||||
|
@ -451,9 +448,9 @@ config_update_cb(void *data, config_data *cd)
|
|||
build_edc();
|
||||
edit_changed_set(ad->ed, EINA_FALSE);
|
||||
edj_mgr_clear(ad->em);
|
||||
edc_view_set(ad, ad->cd, ad->sd, stats_group_name_get(ad->sd));
|
||||
edc_view_set(ad, ad->sd, stats_group_name_get(ad->sd));
|
||||
if (ad->edc_monitor) eio_monitor_del(ad->edc_monitor);
|
||||
ad->edc_monitor = eio_monitor_add(config_edc_path_get(ad->cd));
|
||||
ad->edc_monitor = eio_monitor_add(config_edc_path_get());
|
||||
}
|
||||
//If the edc is reloaded, then rebuild it!
|
||||
else if (edit_changed_get(ad->ed))
|
||||
|
@ -461,8 +458,7 @@ config_update_cb(void *data, config_data *cd)
|
|||
edit_changed_set(ad->ed, EINA_FALSE);
|
||||
}
|
||||
|
||||
view_scale_set(edj_mgr_view_get(ad->em, NULL),
|
||||
config_view_scale_get(ad->cd));
|
||||
view_scale_set(edj_mgr_view_get(ad->em, NULL), config_view_scale_get());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -542,10 +538,8 @@ config_data_set(app_data *ad, int argc, char **argv)
|
|||
char data_path[PATH_MAX];
|
||||
|
||||
args_dispatch(argc, argv, edc_path, img_path, snd_path, fnt_path, data_path);
|
||||
config_data *cd = config_init(edc_path, img_path, snd_path, fnt_path,
|
||||
data_path);
|
||||
config_update_cb_set(cd, config_update_cb, ad);
|
||||
ad->cd = cd;
|
||||
config_init(edc_path, img_path, snd_path, fnt_path, data_path);
|
||||
config_update_cb_set(config_update_cb, ad);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -573,9 +567,9 @@ elm_setup()
|
|||
}
|
||||
|
||||
static void
|
||||
edj_mgr_set(app_data *ad, config_data *cd)
|
||||
edj_mgr_set(app_data *ad)
|
||||
{
|
||||
ad->em = edj_mgr_init(ad->panes, cd);
|
||||
ad->em = edj_mgr_init(ad->panes);
|
||||
elm_object_part_content_set(ad->panes, "left", edj_mgr_obj_get(ad->em));
|
||||
}
|
||||
|
||||
|
@ -593,20 +587,20 @@ init(app_data *ad, int argc, char **argv)
|
|||
elm_setup();
|
||||
config_data_set(ad, argc, argv);
|
||||
|
||||
if (!build_init(ad->cd)) return EINA_FALSE;
|
||||
if (!edc_proto_setup(ad->cd)) return EINA_FALSE;
|
||||
if (!build_init()) return EINA_FALSE;
|
||||
if (!edc_proto_setup()) return EINA_FALSE;
|
||||
if (!base_gui_construct(ad)) return EINA_FALSE;
|
||||
|
||||
edj_mgr_set(ad, ad->cd);
|
||||
statusbar_set(ad, ad->cd);
|
||||
edc_edit_set(ad, ad->sd, ad->cd);
|
||||
edc_view_set(ad, ad->cd, ad->sd, stats_group_name_get(ad->sd));
|
||||
menu_init(ad->win, ad->ed, ad->cd);
|
||||
edj_mgr_set(ad);
|
||||
statusbar_set(ad);
|
||||
edc_edit_set(ad, ad->sd);
|
||||
edc_view_set(ad, ad->sd, stats_group_name_get(ad->sd));
|
||||
menu_init(ad->win, ad->ed);
|
||||
|
||||
Evas_Object *hotkeys = hotkeys_create(ad->layout);
|
||||
elm_object_part_content_set(ad->layout, "elm.swallow.hotkeys", hotkeys);
|
||||
|
||||
ad->edc_monitor = eio_monitor_add(config_edc_path_get(ad->cd));
|
||||
ad->edc_monitor = eio_monitor_add(config_edc_path_get());
|
||||
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, edc_changed_cb, ad);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -620,7 +614,7 @@ term(app_data *ad)
|
|||
edit_term(ad->ed);
|
||||
edj_mgr_term(ad->em);
|
||||
stats_term(ad->sd);
|
||||
config_term(ad->cd);
|
||||
config_term();
|
||||
|
||||
elm_shutdown();
|
||||
ecore_event_shutdown();
|
||||
|
|
|
@ -26,7 +26,6 @@ struct menu_s
|
|||
|
||||
int open_depth;
|
||||
|
||||
config_data *cd;
|
||||
edit_data *ed;
|
||||
};
|
||||
|
||||
|
@ -201,21 +200,20 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
menu_data *md = data;
|
||||
config_data *cd = md->cd;
|
||||
|
||||
config_edc_img_path_set(cd, elm_object_text_get(md->img_path_entry));
|
||||
config_edc_snd_path_set(cd, elm_object_text_get(md->snd_path_entry));
|
||||
config_edc_fnt_path_set(cd, elm_object_text_get(md->fnt_path_entry));
|
||||
config_edc_data_path_set(cd, elm_object_text_get(md->data_path_entry));
|
||||
config_font_size_set(cd, (float) elm_slider_value_get(md->slider_font));
|
||||
config_view_scale_set(cd, elm_slider_value_get(md->slider_view));
|
||||
config_stats_bar_set(cd, elm_check_state_get(md->toggle_stats));
|
||||
config_linenumber_set(cd, elm_check_state_get(md->toggle_linenum));
|
||||
config_part_highlight_set(cd, elm_check_state_get(md->toggle_highlight));
|
||||
config_dummy_swallow_set(cd, elm_check_state_get(md->toggle_swallow));
|
||||
config_auto_indent_set(cd, elm_check_state_get(md->toggle_indent));
|
||||
config_edc_img_path_set(elm_object_text_get(md->img_path_entry));
|
||||
config_edc_snd_path_set(elm_object_text_get(md->snd_path_entry));
|
||||
config_edc_fnt_path_set(elm_object_text_get(md->fnt_path_entry));
|
||||
config_edc_data_path_set(elm_object_text_get(md->data_path_entry));
|
||||
config_font_size_set((float) elm_slider_value_get(md->slider_font));
|
||||
config_view_scale_set(elm_slider_value_get(md->slider_view));
|
||||
config_stats_bar_set(elm_check_state_get(md->toggle_stats));
|
||||
config_linenumber_set(elm_check_state_get(md->toggle_linenum));
|
||||
config_part_highlight_set(elm_check_state_get(md->toggle_highlight));
|
||||
config_dummy_swallow_set(elm_check_state_get(md->toggle_swallow));
|
||||
config_auto_indent_set(elm_check_state_get(md->toggle_indent));
|
||||
|
||||
config_apply(cd);
|
||||
config_apply();
|
||||
|
||||
setting_close(md);
|
||||
}
|
||||
|
@ -289,25 +287,24 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
menu_data *md = data;
|
||||
config_data *cd = md->cd;
|
||||
|
||||
img_path_entry_update(md->img_path_entry,
|
||||
(Eina_List *)config_edc_img_path_list_get(md->cd));
|
||||
(Eina_List *)config_edc_img_path_list_get());
|
||||
snd_path_entry_update(md->snd_path_entry,
|
||||
(Eina_List *)config_edc_snd_path_list_get(md->cd));
|
||||
(Eina_List *)config_edc_snd_path_list_get());
|
||||
fnt_path_entry_update(md->fnt_path_entry,
|
||||
(Eina_List *)config_edc_fnt_path_list_get(md->cd));
|
||||
(Eina_List *)config_edc_fnt_path_list_get());
|
||||
data_path_entry_update(md->data_path_entry,
|
||||
(Eina_List *)config_edc_data_path_list_get(md->cd));
|
||||
(Eina_List *)config_edc_data_path_list_get());
|
||||
|
||||
elm_slider_value_set(md->slider_font, (double) config_font_size_get(cd));
|
||||
elm_slider_value_set(md->slider_view, (double) config_view_scale_get(cd));
|
||||
elm_slider_value_set(md->slider_font, (double) config_font_size_get());
|
||||
elm_slider_value_set(md->slider_view, (double) config_view_scale_get());
|
||||
|
||||
elm_check_state_set(md->toggle_stats, config_stats_bar_get(cd));
|
||||
elm_check_state_set(md->toggle_linenum, config_linenumber_get(cd));
|
||||
elm_check_state_set(md->toggle_highlight, config_part_highlight_get(cd));
|
||||
elm_check_state_set(md->toggle_swallow, config_dummy_swallow_get(cd));
|
||||
elm_check_state_set(md->toggle_indent, config_auto_indent_get(cd));
|
||||
elm_check_state_set(md->toggle_stats, config_stats_bar_get());
|
||||
elm_check_state_set(md->toggle_linenum, config_linenumber_get());
|
||||
elm_check_state_set(md->toggle_highlight, config_part_highlight_get());
|
||||
elm_check_state_set(md->toggle_swallow, config_dummy_swallow_get());
|
||||
elm_check_state_set(md->toggle_indent, config_auto_indent_get());
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
@ -351,7 +348,7 @@ setting_open(menu_data *md)
|
|||
//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(md->cd));
|
||||
(Eina_List *)config_edc_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);
|
||||
|
@ -359,20 +356,20 @@ setting_open(menu_data *md)
|
|||
//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(md->cd));
|
||||
(Eina_List *)config_edc_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(md->cd));
|
||||
(Eina_List *)config_edc_fnt_path_list_get());
|
||||
elm_object_part_content_set(layout, "elm.swallow.fnt_path_entry",
|
||||
fnt_path_entry);
|
||||
|
||||
//Data Path Entry
|
||||
Evas_Object *data_path_entry = entry_create(layout);
|
||||
data_path_entry_update(data_path_entry,
|
||||
(Eina_List *)config_edc_data_path_list_get(md->cd));
|
||||
(Eina_List *)config_edc_data_path_list_get());
|
||||
elm_object_part_content_set(layout, "elm.swallow.data_path_entry",
|
||||
data_path_entry);
|
||||
|
||||
|
@ -417,7 +414,7 @@ setting_open(menu_data *md)
|
|||
elm_slider_indicator_show_set(slider_font, EINA_FALSE);
|
||||
elm_slider_unit_format_set(slider_font, "%1.1fx");
|
||||
elm_slider_min_max_set(slider_font, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||||
elm_slider_value_set(slider_font, (double) config_font_size_get(md->cd));
|
||||
elm_slider_value_set(slider_font, (double) config_font_size_get());
|
||||
evas_object_show(slider_font);
|
||||
|
||||
elm_box_pack_end(box2, slider_font);
|
||||
|
@ -449,7 +446,7 @@ setting_open(menu_data *md)
|
|||
elm_slider_indicator_show_set(slider_view, EINA_FALSE);
|
||||
elm_slider_unit_format_set(slider_view, "%1.2fx");
|
||||
elm_slider_min_max_set(slider_view, MIN_VIEW_SCALE, MAX_VIEW_SCALE);
|
||||
elm_slider_value_set(slider_view, (double) config_view_scale_get(md->cd));
|
||||
elm_slider_value_set(slider_view, (double) config_view_scale_get());
|
||||
evas_object_show(slider_view);
|
||||
|
||||
elm_box_pack_end(box2, slider_view);
|
||||
|
@ -461,27 +458,27 @@ setting_open(menu_data *md)
|
|||
|
||||
//Toggle (Status bar)
|
||||
Evas_Object *toggle_stats = toggle_create(box, "Status Bar",
|
||||
config_stats_bar_get(md->cd));
|
||||
config_stats_bar_get());
|
||||
elm_box_pack_end(box, toggle_stats);
|
||||
|
||||
//Toggle (Line Number)
|
||||
Evas_Object *toggle_linenum = toggle_create(box, "Line Number",
|
||||
config_linenumber_get(md->cd));
|
||||
config_linenumber_get());
|
||||
elm_box_pack_end(box, toggle_linenum);
|
||||
|
||||
//Toggle (Part Highlighting)
|
||||
Evas_Object *toggle_highlight = toggle_create(box, "Part Highlighting",
|
||||
config_part_highlight_get(md->cd));
|
||||
config_part_highlight_get());
|
||||
elm_box_pack_end(box, toggle_highlight);
|
||||
|
||||
//Toggle (Dummy Swallow)
|
||||
Evas_Object *toggle_swallow = toggle_create(box, "Dummy Swallow",
|
||||
config_dummy_swallow_get(md->cd));
|
||||
config_dummy_swallow_get());
|
||||
elm_box_pack_end(box, toggle_swallow);
|
||||
|
||||
//Toggle (Auto Indentation)
|
||||
Evas_Object *toggle_indent = toggle_create(box, "Auto Indentation",
|
||||
config_auto_indent_get(md->cd));
|
||||
config_auto_indent_get());
|
||||
elm_box_pack_end(box, toggle_indent);
|
||||
|
||||
Evas_Object *btn;
|
||||
|
@ -681,10 +678,10 @@ btn_effect_timer_cb(void *data)
|
|||
static void
|
||||
edc_reload(menu_data *md, const char *edc_path)
|
||||
{
|
||||
config_edc_path_set(md->cd, edc_path);
|
||||
config_edc_path_set(edc_path);
|
||||
edit_new(md->ed);
|
||||
edj_mgr_reload_need_set(edj_mgr_get(), EINA_TRUE);
|
||||
config_apply(md->cd);
|
||||
config_apply();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -761,10 +758,10 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
//Update the edc file and try to save.
|
||||
if (strcmp(config_edc_path_get(md->cd), selected))
|
||||
if (strcmp(config_edc_path_get(), selected))
|
||||
edit_changed_set(md->ed, EINA_TRUE);
|
||||
|
||||
config_edc_path_set(md->cd, selected);
|
||||
config_edc_path_set(selected);
|
||||
|
||||
if (!edit_save(md->ed))
|
||||
{
|
||||
|
@ -778,7 +775,7 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
edj_mgr_reload_need_set(edj_mgr_get(), EINA_TRUE);
|
||||
config_apply(md->cd);
|
||||
config_apply();
|
||||
|
||||
fileselector_close(md);
|
||||
menu_close(md);
|
||||
|
@ -1004,12 +1001,11 @@ ctxpopup_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
void
|
||||
menu_init(Evas_Object *win, edit_data *ed, config_data *cd)
|
||||
menu_init(Evas_Object *win, edit_data *ed)
|
||||
{
|
||||
menu_data *md = calloc(1, sizeof(menu_data));
|
||||
md->win = win;
|
||||
md->ed = ed;
|
||||
md->cd = cd;
|
||||
g_md = md;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ struct statusbar_s
|
|||
Eina_Stringshare *group_name;
|
||||
int cur_line;
|
||||
int max_line;
|
||||
config_data *cd;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -25,14 +24,14 @@ void
|
|||
stats_edc_file_set(stats_data *sd, Eina_Stringshare *group_name)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
const char *filename = ecore_file_file_get(config_edc_path_get(sd->cd));
|
||||
const char *filename = ecore_file_file_get(config_edc_path_get());
|
||||
snprintf(buf, sizeof(buf), "<align=right>File [<style=glow><color=#3399ff>%s</color></style>] Group [<style=glow><color=#3399ff>%s</color></style>]</align>", filename, group_name);
|
||||
elm_object_part_text_set(sd->layout, "elm.text.file_group_name", buf);
|
||||
sd->group_name = eina_stringshare_add(group_name);
|
||||
}
|
||||
|
||||
stats_data *
|
||||
stats_init(Evas_Object *parent, config_data *cd)
|
||||
stats_init(Evas_Object *parent)
|
||||
{
|
||||
stats_data *sd = calloc(1, sizeof(stats_data));
|
||||
|
||||
|
@ -44,7 +43,6 @@ stats_init(Evas_Object *parent, config_data *cd)
|
|||
elm_object_part_text_set(layout, "elm.text.cur_pos",
|
||||
"Cursor [<style=glow><color=#3399ff>0</color></style>,<style=glow><color=#3399ff>0</color></style>] [<style=glow><color=#3399ff>0.00</color></style>,<style=glow><color=#3399ff>0.00</color></style>]");
|
||||
sd->layout = layout;
|
||||
sd->cd = cd;
|
||||
|
||||
stats_edc_file_set(sd, NULL);
|
||||
|
||||
|
@ -73,7 +71,7 @@ stats_term(stats_data *sd)
|
|||
void
|
||||
stats_info_msg_update(stats_data *sd, const char *msg)
|
||||
{
|
||||
if (!config_stats_bar_get(sd->cd)) return;
|
||||
if (!config_stats_bar_get()) return;
|
||||
|
||||
elm_object_part_text_set(sd->layout, "elm.text.info_msg", msg);
|
||||
elm_object_signal_emit(sd->layout, "elm,action,info_msg,show", "");
|
||||
|
@ -83,7 +81,7 @@ void
|
|||
stats_view_size_update(stats_data *sd)
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
config_view_size_get(sd->cd, &w, &h);
|
||||
config_view_size_get(&w, &h);
|
||||
|
||||
char buf[128];
|
||||
snprintf(buf, sizeof(buf),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
void build_edc();
|
||||
Eina_Bool build_init(config_data *cd);
|
||||
Eina_Bool build_init();
|
||||
void build_term();
|
||||
Eina_Bool build_cmd_set(config_data *cd);
|
||||
Eina_Bool build_cmd_set();
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
#define MAX_VIEW_SCALE 5.0
|
||||
#define MIN_VIEW_SCALE 0.5
|
||||
|
||||
config_data *config_init(const char *edc_path, const char *edc_img_path, const char *edc_snd_path, const char *edc_fnt_path, const char *edc_data_path);
|
||||
void config_term(config_data *cd);
|
||||
const char *config_edc_path_get(config_data *cd);
|
||||
const char *config_edj_path_get(config_data *cd);
|
||||
const char *config_edc_img_path_get(config_data *cd);
|
||||
const char *config_edc_snd_path_get(config_data *cd);
|
||||
const char *config_edc_fnt_path_get(config_data *cd);
|
||||
const char *config_edc_data_path_get(config_data *cd);
|
||||
void config_edc_img_path_set(config_data *cd, const char *edc_img_path);
|
||||
void config_edc_snd_path_set(config_data *cd, const char *edc_snd_path);
|
||||
void config_edc_fnt_path_set(config_data *cd, const char *edc_fnt_path);
|
||||
void config_edc_data_path_set(config_data *cd, const char *edc_fnt_path);
|
||||
Eina_List *config_edc_img_path_list_get(config_data *cd);
|
||||
Eina_List *config_edc_snd_path_list_get(config_data *cd);
|
||||
Eina_List *config_edc_fnt_path_list_get(config_data *cd);
|
||||
Eina_List *config_edc_data_path_list_get(config_data *cd);
|
||||
void config_update_cb_set(config_data *cd, void (*cb)(void *data, config_data *cd), void *data);
|
||||
void config_stats_bar_set(config_data *cd, Eina_Bool enabled);
|
||||
void config_linenumber_set(config_data *cd, Eina_Bool enabled);
|
||||
Eina_Bool config_stats_bar_get(config_data *cd);
|
||||
Eina_Bool config_linenumber_get(config_data *cd);
|
||||
void config_apply(config_data *cd);
|
||||
void config_edc_path_set(config_data *cd, const char *edc_path);
|
||||
void config_view_size_get(config_data *cd, Evas_Coord *w, Evas_Coord *h);
|
||||
void config_view_size_set(config_data *cd, Evas_Coord w, Evas_Coord h);
|
||||
Eina_Bool config_part_highlight_get(config_data *cd);
|
||||
void config_part_highlight_set(config_data *cd, Eina_Bool highlight);
|
||||
Eina_Bool config_dummy_swallow_get(config_data *cd);
|
||||
void config_dummy_swallow_set(config_data *cd, Eina_Bool dummy_swallow);
|
||||
void config_auto_indent_set(config_data *cd, Eina_Bool auto_indent);
|
||||
Eina_Bool config_auto_indent_get(config_data *cd);
|
||||
void config_font_size_set(config_data *cd, float font_size);
|
||||
float config_font_size_get(config_data *cd);
|
||||
void config_view_scale_set(config_data *cd, double view_scale);
|
||||
double config_view_scale_get(config_data *cd);
|
||||
void config_init(const char *edc_path, const char *edc_img_path, const char *edc_snd_path, const char *edc_fnt_path, const char *edc_data_path);
|
||||
void config_term();
|
||||
const char *config_edc_path_get();
|
||||
const char *config_edj_path_get();
|
||||
const char *config_edc_img_path_get();
|
||||
const char *config_edc_snd_path_get();
|
||||
const char *config_edc_fnt_path_get();
|
||||
const char *config_edc_data_path_get();
|
||||
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_data_path_set(const char *edc_fnt_path);
|
||||
Eina_List *config_edc_img_path_list_get();
|
||||
Eina_List *config_edc_snd_path_list_get();
|
||||
Eina_List *config_edc_fnt_path_list_get();
|
||||
Eina_List *config_edc_data_path_list_get();
|
||||
void config_update_cb_set(void (*cb)(void *data), void *data);
|
||||
void config_stats_bar_set(Eina_Bool enabled);
|
||||
void config_linenumber_set(Eina_Bool enabled);
|
||||
Eina_Bool config_stats_bar_get();
|
||||
Eina_Bool config_linenumber_get();
|
||||
void config_apply();
|
||||
void config_edc_path_set(const char *edc_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_part_highlight_get();
|
||||
void config_part_highlight_set(Eina_Bool highlight);
|
||||
Eina_Bool config_dummy_swallow_get();
|
||||
void config_dummy_swallow_set(Eina_Bool dummy_swallow);
|
||||
void config_auto_indent_set(Eina_Bool auto_indent);
|
||||
Eina_Bool config_auto_indent_get();
|
||||
void config_font_size_set(float font_size);
|
||||
float config_font_size_get();
|
||||
void config_view_scale_set(double view_scale);
|
||||
double config_view_scale_get();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
edit_data *edit_init(Evas_Object *win, stats_data *sd, config_data *cd);
|
||||
edit_data *edit_init(Evas_Object *win, stats_data *sd);
|
||||
void edit_term(edit_data *ed);
|
||||
void edit_edc_read(edit_data *ed, const char *file_path);
|
||||
void edit_focus_set(edit_data *ed);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
edj_mgr *edj_mgr_get();
|
||||
edj_mgr *edj_mgr_init(Evas_Object *parent, config_data *cd);
|
||||
edj_mgr *edj_mgr_init(Evas_Object *parent);
|
||||
void edj_mgr_term(edj_mgr *em);
|
||||
view_data * edj_mgr_view_new(edj_mgr *em, const char *group, stats_data *sd);
|
||||
view_data *edj_mgr_view_get(edj_mgr *em, Eina_Stringshare *group);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
view_data * view_init(Evas_Object *parent, const char *group, stats_data *sd, config_data *cd, void (*del_cb)(void *data), void *data);
|
||||
view_data * view_init(Evas_Object *parent, const char *group, stats_data *sd,
|
||||
void (*del_cb)(void *data), void *data);
|
||||
void view_term(view_data *vd);
|
||||
Evas_Object *view_obj_get(view_data *vd);
|
||||
void view_new(view_data *vd, const char *group);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define VIEW_DATA edj_mgr_view_get(NULL, NULL)
|
||||
|
||||
void menu_init(Evas_Object *win, edit_data *ed, config_data *cd);
|
||||
void menu_init(Evas_Object *win, edit_data *ed);
|
||||
void menu_term();
|
||||
void menu_toggle();
|
||||
void menu_ctxpopup_register(Evas_Object *ctxpopup);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
stats_data *stats_init(Evas_Object *parent, config_data *cd);
|
||||
stats_data *stats_init(Evas_Object *parent);
|
||||
void stats_term(stats_data *sd);
|
||||
void stats_view_size_update(stats_data *sd);
|
||||
void stats_cursor_pos_update(stats_data *sd, Evas_Coord x, Evas_Coord y, float rel_x, float rel_y);
|
||||
|
|
Loading…
Reference in New Issue