enventor - now you can set the font path
This commit is contained in:
parent
731f23819c
commit
a485774263
2
README
2
README
|
@ -60,7 +60,7 @@ Ctrl+- = Font Size Down
|
|||
- Command Line Usage:
|
||||
|
||||
enventor --help
|
||||
enventor [input file] [-id image path] [-sd sound path]
|
||||
enventor [input file] [-id image path] [-sd sound path] [-fd font path]
|
||||
|
||||
|
||||
* FOR ANY ISSUES PLEASE EMAIL *
|
||||
|
|
|
@ -865,7 +865,7 @@ group { name: "setting_layout";
|
|||
fixed: 0 1;
|
||||
}
|
||||
}
|
||||
part { name: "preference_frame";
|
||||
part { name: "fnt_path_frame";
|
||||
type: RECT;
|
||||
clip_to: "clipper";
|
||||
description {
|
||||
|
@ -873,7 +873,19 @@ group { name: "setting_layout";
|
|||
rel2 {to: "snd_path_frame"; relative: 1 1;}
|
||||
align: 0.5 0;
|
||||
visible: 0;
|
||||
min: 0 260;
|
||||
min: 0 30;
|
||||
fixed: 0 1;
|
||||
}
|
||||
}
|
||||
part { name: "preference_frame";
|
||||
type: RECT;
|
||||
clip_to: "clipper";
|
||||
description {
|
||||
rel1 {to: "fnt_path_frame"; relative: 0 1;}
|
||||
rel2 {to: "fnt_path_frame"; relative: 1 1;}
|
||||
align: 0.5 0;
|
||||
visible: 0;
|
||||
min: 0 230;
|
||||
fixed: 0 1;
|
||||
}
|
||||
}
|
||||
|
@ -971,6 +983,53 @@ group { name: "setting_layout";
|
|||
rel2.to: "snd_path_frame";
|
||||
}
|
||||
}
|
||||
part { name: "fnt_path_icon";
|
||||
type: IMAGE;
|
||||
scale: 1;
|
||||
clip_to: "clipper";
|
||||
description {
|
||||
align: 0 0.5;
|
||||
min: 20 20;
|
||||
max: 20 20;
|
||||
fixed: 1 1;
|
||||
rel1.to: "fnt_path_frame";
|
||||
rel2.to: "fnt_path_frame";
|
||||
image.normal: "folder.png";
|
||||
}
|
||||
}
|
||||
part { name: "fnt_path_guide";
|
||||
type: TEXT;
|
||||
scale: 1;
|
||||
clip_to: "clipper";
|
||||
description {
|
||||
rel1 {to: "fnt_path_icon"; relative: 1 0; offset: 5 1;}
|
||||
rel2 {to: "fnt_path_icon"; relative: 1 1;}
|
||||
color: 30 30 30 255;
|
||||
align: 0 0.5;
|
||||
fixed: 1 1;
|
||||
text {
|
||||
font: FN;
|
||||
text: "Font Paths:";
|
||||
size: 12;
|
||||
align: 0 0.5;
|
||||
min: 1 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.fnt_path_entry";
|
||||
type: SWALLOW;
|
||||
scale: 1;
|
||||
clip_to: "clipper";
|
||||
description {
|
||||
align: 0 0;
|
||||
fixed: 1 1;
|
||||
rel1.to_x: "fnt_path_guide";
|
||||
rel1.to_y: "fnt_path_guide";
|
||||
rel1.offset: 17 0;
|
||||
rel1.relative: 1 0;
|
||||
rel2.to: "fnt_path_frame";
|
||||
}
|
||||
}
|
||||
part { name: "preference_icon";
|
||||
type: IMAGE;
|
||||
scale: 1;
|
||||
|
|
|
@ -8,8 +8,11 @@ struct config_s
|
|||
|
||||
Eina_List *edc_img_path_list;
|
||||
Eina_List *edc_snd_path_list;
|
||||
Eina_List *edc_fnt_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 sound paths for edc compile.
|
||||
|
||||
float font_size;
|
||||
|
||||
void (*update_cb)(void *data, config_data *cd);
|
||||
|
@ -65,7 +68,7 @@ config_edc_path_set(config_data *cd, const char *edc_path)
|
|||
|
||||
config_data *
|
||||
config_init(const char *edc_path, const char *edc_img_path,
|
||||
const char *edc_snd_path)
|
||||
const char *edc_snd_path, const char *edc_fnt_path)
|
||||
{
|
||||
config_data *cd = calloc(1, sizeof(config_data));
|
||||
|
||||
|
@ -73,6 +76,7 @@ config_init(const char *edc_path, const char *edc_img_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);
|
||||
|
||||
cd->font_size = 1.0f;
|
||||
cd->linenumber = EINA_TRUE;
|
||||
|
@ -102,6 +106,11 @@ config_term(config_data *cd)
|
|||
eina_stringshare_del(str);
|
||||
eina_list_free(cd->edc_snd_path_list);
|
||||
|
||||
//free the font paths
|
||||
EINA_LIST_FOREACH(cd->edc_fnt_path_list, l, str)
|
||||
eina_stringshare_del(str);
|
||||
eina_list_free(cd->edc_fnt_path_list);
|
||||
|
||||
free(cd);
|
||||
}
|
||||
|
||||
|
@ -148,6 +157,48 @@ 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)
|
||||
{
|
||||
//Free the existing paths
|
||||
Eina_List *l;
|
||||
const char *s;
|
||||
EINA_LIST_FOREACH(cd->edc_fnt_path_list, l, s)
|
||||
eina_stringshare_del(s);
|
||||
cd->edc_fnt_path_list = eina_list_free(cd->edc_fnt_path_list);
|
||||
|
||||
if (cd->edc_fnt_path_buf) eina_strbuf_free(cd->edc_fnt_path_buf);
|
||||
cd->edc_fnt_path_buf = eina_strbuf_new();
|
||||
|
||||
//parse paths by ';'
|
||||
const char *lex;
|
||||
Eina_Stringshare *append;
|
||||
|
||||
while(edc_fnt_path && (strlen(edc_fnt_path) > 0))
|
||||
{
|
||||
lex = strstr(edc_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_strbuf_append(cd->edc_fnt_path_buf, " -fd ");
|
||||
eina_strbuf_append(cd->edc_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_strbuf_append(cd->edc_fnt_path_buf, " -fd ");
|
||||
eina_strbuf_append(cd->edc_fnt_path_buf, append);
|
||||
}
|
||||
|
||||
edc_fnt_path = lex;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
config_edc_img_path_set(config_data *cd, const char *edc_img_path)
|
||||
|
@ -210,6 +261,12 @@ config_edc_snd_path_list_get(config_data *cd)
|
|||
return cd->edc_snd_path_list;
|
||||
}
|
||||
|
||||
const Eina_List *
|
||||
config_edc_fnt_path_list_get(config_data *cd)
|
||||
{
|
||||
return cd->edc_fnt_path_list;
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_img_path_get(config_data *cd)
|
||||
{
|
||||
|
@ -224,6 +281,13 @@ config_edc_snd_path_get(config_data *cd)
|
|||
return eina_strbuf_string_get(cd->edc_snd_path_buf);
|
||||
}
|
||||
|
||||
const char *
|
||||
config_edc_fnt_path_get(config_data *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)
|
||||
{
|
||||
|
|
|
@ -58,11 +58,12 @@ edje_cc_cmd_set(config_data *cd)
|
|||
{
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
if (!buf) return EINA_FALSE;
|
||||
eina_strbuf_append_printf(buf, "edje_cc -fastcomp %s %s %s %s",
|
||||
eina_strbuf_append_printf(buf, "edje_cc -fastcomp %s %s %s %s %s",
|
||||
config_edc_path_get(cd),
|
||||
config_edj_path_get(cd),
|
||||
config_edc_img_path_get(cd),
|
||||
config_edc_snd_path_get(cd));
|
||||
config_edc_snd_path_get(cd),
|
||||
config_edc_fnt_path_get(cd));
|
||||
eina_strbuf_append(buf, " > /dev/null");
|
||||
EDJE_CC_CMD = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
|
@ -386,11 +387,12 @@ config_update_cb(void *data, config_data *cd)
|
|||
|
||||
static void
|
||||
args_dispatch(int argc, char **argv, char *edc_path, char *img_path,
|
||||
char *snd_path)
|
||||
char *snd_path, char *fnt_path)
|
||||
{
|
||||
Eina_Bool default_edc = EINA_TRUE;
|
||||
Eina_Bool default_img = EINA_TRUE;
|
||||
Eina_Bool default_snd = EINA_TRUE;
|
||||
Eina_Bool default_fnt = EINA_TRUE;
|
||||
|
||||
//No arguments. set defaults
|
||||
if (argc == 1) goto defaults;
|
||||
|
@ -398,7 +400,7 @@ args_dispatch(int argc, char **argv, char *edc_path, char *img_path,
|
|||
//Help
|
||||
if ((argc >=2 ) && !strcmp(argv[1], "--help"))
|
||||
{
|
||||
fprintf(stdout, "Usage: enventor [input file] [-id image path] [-sd sound path]\n");
|
||||
fprintf(stdout, "Usage: enventor [input file] [-id image path] [-sd sound path] [-fd font path]\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -427,6 +429,11 @@ args_dispatch(int argc, char **argv, char *edc_path, char *img_path,
|
|||
sprintf(snd_path, "%s", argv[cur_arg + 1]);
|
||||
default_snd = EINA_FALSE;
|
||||
}
|
||||
else if (!strcmp("-fd", argv[cur_arg]))
|
||||
{
|
||||
sprintf(fnt_path, "%s", argv[cur_arg + 1]);
|
||||
default_fnt = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
cur_arg += 2;
|
||||
}
|
||||
|
@ -435,6 +442,7 @@ defaults:
|
|||
if (default_edc) sprintf(edc_path, "%s", PROTO_EDC_PATH);
|
||||
if (default_img) sprintf(img_path, "%s/images", elm_app_data_dir_get());
|
||||
if (default_snd) sprintf(snd_path, "%s/sounds", elm_app_data_dir_get());
|
||||
if (default_fnt) sprintf(fnt_path, "%s/fonts", elm_app_data_dir_get());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -443,9 +451,10 @@ config_data_set(app_data *ad, int argc, char **argv)
|
|||
char edc_path[PATH_MAX];
|
||||
char img_path[PATH_MAX];
|
||||
char snd_path[PATH_MAX];
|
||||
char fnt_path[PATH_MAX];
|
||||
|
||||
args_dispatch(argc, argv, edc_path, img_path, snd_path);
|
||||
config_data *cd = config_init(edc_path, img_path, snd_path);
|
||||
args_dispatch(argc, argv, edc_path, img_path, snd_path, fnt_path);
|
||||
config_data *cd = config_init(edc_path, img_path, snd_path, fnt_path);
|
||||
config_update_cb_set(cd, config_update_cb, ad);
|
||||
ad->cd = cd;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ struct menu_s
|
|||
Evas_Object *help_layout;
|
||||
Evas_Object *img_path_entry;
|
||||
Evas_Object *snd_path_entry;
|
||||
Evas_Object *fnt_path_entry;
|
||||
Evas_Object *slider_font;
|
||||
Evas_Object *toggle_stats;
|
||||
Evas_Object *toggle_linenumber;
|
||||
|
@ -198,6 +199,7 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
|
||||
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_font_size_set(cd, (float) elm_slider_value_get(md->slider_font));
|
||||
config_stats_bar_set(cd, elm_check_state_get(md->toggle_stats));
|
||||
config_linenumber_set(cd, elm_check_state_get(md->toggle_linenumber));
|
||||
|
@ -224,6 +226,20 @@ img_path_entry_update(Evas_Object *entry, Eina_List *edc_img_paths)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fnt_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
|
||||
{
|
||||
elm_entry_entry_append(entry, edc_fnt_path);
|
||||
elm_entry_entry_append(entry, ";");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
snd_path_entry_update(Evas_Object *entry, Eina_List *edc_snd_paths)
|
||||
{
|
||||
|
@ -249,6 +265,9 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
(Eina_List *)config_edc_img_path_list_get(md->cd));
|
||||
snd_path_entry_update(md->snd_path_entry,
|
||||
(Eina_List *)config_edc_snd_path_list_get(md->cd));
|
||||
fnt_path_entry_update(md->fnt_path_entry,
|
||||
(Eina_List *)config_edc_fnt_path_list_get(md->cd));
|
||||
|
||||
elm_slider_value_set(md->slider_font, (double) config_font_size_get(cd));
|
||||
|
||||
elm_check_state_set(md->toggle_stats, config_stats_bar_get(cd));
|
||||
|
@ -294,7 +313,17 @@ setting_open(menu_data *md)
|
|||
|
||||
elm_object_part_content_set(layout, "elm.swallow.snd_path_entry",
|
||||
snd_path_entry);
|
||||
//Font Path Entry
|
||||
Evas_Object *fnt_path_entry = elm_entry_add(layout);
|
||||
elm_object_style_set(fnt_path_entry, elm_app_name_get());
|
||||
elm_entry_single_line_set(fnt_path_entry, EINA_TRUE);
|
||||
elm_entry_scrollable_set(fnt_path_entry, EINA_TRUE);
|
||||
fnt_path_entry_update(fnt_path_entry,
|
||||
(Eina_List *)config_edc_fnt_path_list_get(md->cd));
|
||||
evas_object_show(fnt_path_entry);
|
||||
|
||||
elm_object_part_content_set(layout, "elm.swallow.fnt_path_entry",
|
||||
fnt_path_entry);
|
||||
//Preference
|
||||
Evas_Object *scroller = elm_scroller_add(layout);
|
||||
elm_object_part_content_set(layout, "elm.swallow.preference", scroller);
|
||||
|
@ -466,6 +495,7 @@ setting_open(menu_data *md)
|
|||
md->setting_layout = layout;
|
||||
md->img_path_entry = img_path_entry;
|
||||
md->snd_path_entry = snd_path_entry;
|
||||
md->fnt_path_entry = fnt_path_entry;
|
||||
md->slider_font = slider;
|
||||
md->toggle_stats = toggle_stats;
|
||||
md->toggle_linenumber = toggle_linenumber;
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
config_data *config_init(const char *edc_path, const char *edc_img_path,
|
||||
const char *edc_snd_path);
|
||||
const char *edc_snd_path, const char *edc_fnt_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);
|
||||
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);
|
||||
const Eina_List *config_edc_img_path_list_get(config_data *cd);
|
||||
const Eina_List *config_edc_snd_path_list_get(config_data *cd);
|
||||
const Eina_List *config_edc_fnt_path_list_get(config_data *cd);
|
||||
void config_update_cb_set(config_data *cd,
|
||||
void (*cb)(void *data, config_data *cd),
|
||||
void *data);
|
||||
|
|
Loading…
Reference in New Issue