setting: reorganize setting view.

This commit is contained in:
Hermet Park 2016-04-17 13:31:27 +09:00
parent e6bfbd85c9
commit 8f91d45ff1
11 changed files with 496 additions and 457 deletions

View File

@ -22,7 +22,6 @@ EXTRA_DIST = \
full_logo.png \ full_logo.png \
frame_bg.png \ frame_bg.png \
part_highlight.png \ part_highlight.png \
preference.png \
runner_glow_horiz.png \ runner_glow_horiz.png \
runner_glow_vert.png \ runner_glow_vert.png \
runner_horiz.png \ runner_horiz.png \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -2,7 +2,6 @@ images {
image: "frame_bg.png" COMP; image: "frame_bg.png" COMP;
image: "setting_icon.png" COMP; image: "setting_icon.png" COMP;
image: "folder.png" COMP; image: "folder.png" COMP;
image: "preference.png" COMP;
} }
group { name: "setting_layout"; group { name: "setting_layout";
@ -225,31 +224,20 @@ group { name: "setting_layout";
} }
} }
group { name: "general_layout"; group { "build_setting_layout";
parts { parts {
part { name: "base_frame"; spacer { "img_path_frame";
type: SPACER; desc {
scale: 1; rel1 { relative: 0 0;}
description { rel2 { relative: 1 0;}
min: 580 265;
max: 580 265;
fixed: 1 1;
}
}
part { name: "img_path_frame";
type: SPACER;
description {
rel1 {to: "base_frame"; relative: 0 0;}
rel2 {to: "base_frame"; relative: 1 0;}
align: 0.5 0; align: 0.5 0;
min: 0 30; min: 0 30;
fixed: 0 1; fixed: 0 1;
} }
} }
part { name: "snd_path_frame"; spacer { "snd_path_frame";
type: SPACER;
scale: 1; scale: 1;
description { desc {
rel1 {to: "img_path_frame"; relative: 0 1;} rel1 {to: "img_path_frame"; relative: 0 1;}
rel2 {to: "img_path_frame"; relative: 1 1;} rel2 {to: "img_path_frame"; relative: 1 1;}
align: 0.5 0; align: 0.5 0;
@ -257,10 +245,9 @@ group { name: "general_layout";
fixed: 0 1; fixed: 0 1;
} }
} }
part { name: "fnt_path_frame"; spacer { "fnt_path_frame";
type: SPACER;
scale: 1; scale: 1;
description { desc {
rel1 {to: "snd_path_frame"; relative: 0 1;} rel1 {to: "snd_path_frame"; relative: 0 1;}
rel2 {to: "snd_path_frame"; relative: 1 1;} rel2 {to: "snd_path_frame"; relative: 1 1;}
align: 0.5 0; align: 0.5 0;
@ -268,10 +255,9 @@ group { name: "general_layout";
fixed: 0 1; fixed: 0 1;
} }
} }
part { name: "dat_path_frame"; spacer { "dat_path_frame";
type: SPACER;
scale: 1; scale: 1;
description { desc {
rel1 {to: "fnt_path_frame"; relative: 0 1;} rel1 {to: "fnt_path_frame"; relative: 0 1;}
rel2 {to: "fnt_path_frame"; relative: 1 1;} rel2 {to: "fnt_path_frame"; relative: 1 1;}
align: 0.5 0; align: 0.5 0;
@ -279,10 +265,9 @@ group { name: "general_layout";
fixed: 0 1; fixed: 0 1;
} }
} }
part { name: "preference_frame"; spacer { "preference_frame";
type: SPACER;
scale: 1; scale: 1;
description { desc {
rel1 {to: "dat_path_frame"; relative: 0 1; offset: 0 5;} rel1 {to: "dat_path_frame"; relative: 0 1; offset: 0 5;}
rel2 {to: "dat_path_frame"; relative: 1 1;} rel2 {to: "dat_path_frame"; relative: 1 1;}
align: 0.5 0; align: 0.5 0;
@ -290,10 +275,9 @@ group { name: "general_layout";
fixed: 0 1; fixed: 0 1;
} }
} }
part { name: "img_path_icon"; image { "img_path_icon";
type: IMAGE;
scale: 1; scale: 1;
description { desc {
align: 0 0.5; align: 0 0.5;
min: 20 20; min: 20 20;
max: 20 20; max: 20 20;
@ -303,11 +287,10 @@ group { name: "general_layout";
image.normal: "folder.png"; image.normal: "folder.png";
} }
} }
part { name: "img_path_guide"; text { "img_path_guide";
type: TEXT;
scale: 1; scale: 1;
effect: SHADOW BOTTOM; effect: SHADOW BOTTOM;
description { desc {
rel1 {to: "img_path_icon"; relative: 1 0; offset: 5 1;} rel1 {to: "img_path_icon"; relative: 1 0; offset: 5 1;}
rel2 {to: "img_path_icon"; relative: 1 1;} rel2 {to: "img_path_icon"; relative: 1 1;}
color: COL_NM; color: COL_NM;
@ -323,10 +306,9 @@ group { name: "general_layout";
} }
} }
} }
part { name: "elm.swallow.img_path_entry"; swallow { "elm.swallow.img_path_entry";
type: SWALLOW;
scale: 1; scale: 1;
description { desc {
align: 0 0; align: 0 0;
fixed: 1 1; fixed: 1 1;
rel1.to_x: "img_path_guide"; rel1.to_x: "img_path_guide";
@ -336,10 +318,9 @@ group { name: "general_layout";
rel2.to: "img_path_frame"; rel2.to: "img_path_frame";
} }
} }
part { name: "snd_path_icon"; image { "snd_path_icon";
type: IMAGE;
scale: 1; scale: 1;
description { desc {
align: 0 0.5; align: 0 0.5;
min: 20 20; min: 20 20;
max: 20 20; max: 20 20;
@ -349,11 +330,10 @@ group { name: "general_layout";
image.normal: "folder.png"; image.normal: "folder.png";
} }
} }
part { name: "snd_path_guide"; text { "snd_path_guide";
type: TEXT;
effect: SHADOW BOTTOM; effect: SHADOW BOTTOM;
scale: 1; scale: 1;
description { desc {
rel1 {to: "snd_path_icon"; relative: 1 0; offset: 5 1;} rel1 {to: "snd_path_icon"; relative: 1 0; offset: 5 1;}
rel2 {to: "snd_path_icon"; relative: 1 1;} rel2 {to: "snd_path_icon"; relative: 1 1;}
color: COL_NM; color: COL_NM;
@ -369,10 +349,9 @@ group { name: "general_layout";
} }
} }
} }
part { name: "elm.swallow.snd_path_entry"; swallow { "elm.swallow.snd_path_entry";
type: SWALLOW;
scale: 1; scale: 1;
description { desc {
align: 0 0; align: 0 0;
fixed: 1 1; fixed: 1 1;
rel1.to_x: "snd_path_guide"; rel1.to_x: "snd_path_guide";
@ -382,10 +361,9 @@ group { name: "general_layout";
rel2.to: "snd_path_frame"; rel2.to: "snd_path_frame";
} }
} }
part { name: "fnt_path_icon"; image { "fnt_path_icon";
type: IMAGE;
scale: 1; scale: 1;
description { desc {
align: 0 0.5; align: 0 0.5;
min: 20 20; min: 20 20;
max: 20 20; max: 20 20;
@ -395,11 +373,10 @@ group { name: "general_layout";
image.normal: "folder.png"; image.normal: "folder.png";
} }
} }
part { name: "fnt_path_guide"; text { "fnt_path_guide";
type: TEXT;
effect: SHADOW BOTTOM; effect: SHADOW BOTTOM;
scale: 1; scale: 1;
description { desc {
rel1 {to: "fnt_path_icon"; relative: 1 0; offset: 5 1;} rel1 {to: "fnt_path_icon"; relative: 1 0; offset: 5 1;}
rel2 {to: "fnt_path_icon"; relative: 1 1;} rel2 {to: "fnt_path_icon"; relative: 1 1;}
color: COL_NM; color: COL_NM;
@ -415,10 +392,9 @@ group { name: "general_layout";
} }
} }
} }
part { name: "elm.swallow.fnt_path_entry"; swallow { "elm.swallow.fnt_path_entry";
type: SWALLOW;
scale: 1; scale: 1;
description { desc {
align: 0 0; align: 0 0;
fixed: 1 1; fixed: 1 1;
rel1.to_x: "fnt_path_guide"; rel1.to_x: "fnt_path_guide";
@ -428,10 +404,9 @@ group { name: "general_layout";
rel2.to: "fnt_path_frame"; rel2.to: "fnt_path_frame";
} }
} }
part { name: "dat_path_icon"; image { "dat_path_icon";
type: IMAGE;
scale: 1; scale: 1;
description { desc {
align: 0 0.5; align: 0 0.5;
min: 20 20; min: 20 20;
max: 20 20; max: 20 20;
@ -441,11 +416,10 @@ group { name: "general_layout";
image.normal: "folder.png"; image.normal: "folder.png";
} }
} }
part { name: "dat_path_guide"; text { "dat_path_guide";
type: TEXT;
effect: SHADOW BOTTOM; effect: SHADOW BOTTOM;
scale: 1; scale: 1;
description { desc {
rel1 {to: "dat_path_icon"; relative: 1 0; offset: 5 1;} rel1 {to: "dat_path_icon"; relative: 1 0; offset: 5 1;}
rel2 {to: "dat_path_icon"; relative: 1 1;} rel2 {to: "dat_path_icon"; relative: 1 1;}
color: COL_NM; color: COL_NM;
@ -461,10 +435,9 @@ group { name: "general_layout";
} }
} }
} }
part { name: "elm.swallow.dat_path_entry"; swallow { "elm.swallow.dat_path_entry";
type: SWALLOW;
scale: 1; scale: 1;
description { desc {
align: 0 0; align: 0 0;
fixed: 1 1; fixed: 1 1;
rel1.to_x: "dat_path_guide"; rel1.to_x: "dat_path_guide";
@ -474,50 +447,6 @@ group { name: "general_layout";
rel2.to: "dat_path_frame"; rel2.to: "dat_path_frame";
} }
} }
part { name: "preference_icon";
type: IMAGE;
scale: 1;
description {
align: 0 0;
min: 20 20;
max: 20 20;
fixed: 1 1;
rel1.to: "preference_frame";
rel2.to: "preference_frame";
image.normal: "preference.png";
}
}
part { name: "preference_guide";
type: TEXT;
effect: SHADOW BOTTOM;
scale: 1;
description {
rel1 {to: "preference_icon"; relative: 1 0; offset: 5 1;}
rel2 {to: "preference_icon"; relative: 1 1;}
color: COL_NM;
align: 0 0;
fixed: 1 1;
text {
font: FN;
text: "Preferences:";
size: 11;
align: 0 0;
min: 1 0;
ellipsis: -1;
}
}
}
part { name: "elm.swallow.preference";
type: SWALLOW;
scale: 1;
description {
rel1.to_x: "preference_guide";
rel1.to_y: "preference_guide";
rel1.offset: 0 5;
rel1.relative: 0 1;
rel2.to: "preference_frame";
}
}
} }
} }

View File

@ -30,7 +30,8 @@ enventor_SOURCES = \
console.c \ console.c \
file_mgr.c \ file_mgr.c \
edc_navigator.c \ edc_navigator.c \
file_browser.c file_browser.c \
build_setting.c
enventor_LDADD = \ enventor_LDADD = \
$(top_builddir)/src/lib/libenventor.la \ $(top_builddir)/src/lib/libenventor.la \

200
src/bin/build_setting.c Normal file
View File

@ -0,0 +1,200 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "common.h"
typedef struct build_setting_s
{
Evas_Object *layout;
Evas_Object *img_path_entry;
Evas_Object *snd_path_entry;
Evas_Object *fnt_path_entry;
Evas_Object *dat_path_entry;
} build_setting_data;
static build_setting_data *g_bsd = NULL;
/*****************************************************************************/
/* Internal method implementation */
/*****************************************************************************/
static Evas_Object *
entry_create(Evas_Object *parent)
{
Evas_Object *entry = elm_entry_add(parent);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
evas_object_show(entry);
return entry;
}
static void
img_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_img_path);
elm_entry_entry_append(entry, ";");
}
}
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
dat_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_dat_path);
elm_entry_entry_append(entry, ";");
}
}
static void
snd_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_snd_path);
elm_entry_entry_append(entry, ";");
}
}
/*****************************************************************************/
/* Externally accessible calls */
/*****************************************************************************/
void
build_setting_focus_set(build_setting_data *bsd)
{
if (!bsd) return;
elm_object_focus_set(bsd->img_path_entry, EINA_TRUE);
}
void
build_setting_config_set(build_setting_data *bsd)
{
if (!bsd) return;
config_img_path_set(elm_object_text_get(bsd->img_path_entry));
config_snd_path_set(elm_object_text_get(bsd->snd_path_entry));
config_fnt_path_set(elm_object_text_get(bsd->fnt_path_entry));
config_dat_path_set(elm_object_text_get(bsd->dat_path_entry));
}
void
build_setting_reset(build_setting_data *bsd)
{
if (!bsd) return;
img_path_entry_update(bsd->img_path_entry,
(Eina_List *)config_img_path_list_get());
snd_path_entry_update(bsd->snd_path_entry,
(Eina_List *)config_snd_path_list_get());
fnt_path_entry_update(bsd->fnt_path_entry,
(Eina_List *)config_fnt_path_list_get());
dat_path_entry_update(bsd->dat_path_entry,
(Eina_List *)config_dat_path_list_get());
}
Evas_Object *
build_setting_content_get(build_setting_data *bsd, Evas_Object *parent)
{
if (!bsd) return NULL;
if (bsd->layout) return bsd->layout;
//Layout
Evas_Object *layout = elm_layout_add(parent);
elm_layout_file_set(layout, EDJE_PATH, "build_setting_layout");
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(layout);
//Image Path Entry
Evas_Object *img_path_entry = entry_create(layout);
img_path_entry_update(img_path_entry,
(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);
elm_layout_text_set(layout, "img_path_guide", _("Image Paths:"));
//Sound Path Entry
Evas_Object *snd_path_entry = entry_create(layout);
snd_path_entry_update(snd_path_entry,
(Eina_List *)config_snd_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.snd_path_entry",
snd_path_entry);
elm_layout_text_set(layout, "snd_path_guide", _("Sound Paths:"));
//Font Path Entry
Evas_Object *fnt_path_entry = entry_create(layout);
fnt_path_entry_update(fnt_path_entry,
(Eina_List *)config_fnt_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.fnt_path_entry",
fnt_path_entry);
elm_layout_text_set(layout, "fnt_path_guide", _("Font Paths:"));
//Data Path Entry
Evas_Object *dat_path_entry = entry_create(layout);
dat_path_entry_update(dat_path_entry,
(Eina_List *)config_dat_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.dat_path_entry",
dat_path_entry);
elm_layout_text_set(layout, "dat_path_guide", _("Data Paths:"));
bsd->layout = layout;
bsd->img_path_entry = img_path_entry;
bsd->snd_path_entry = snd_path_entry;
bsd->fnt_path_entry = fnt_path_entry;
bsd->dat_path_entry = dat_path_entry;
return layout;
}
build_setting_data *
build_setting_init(void)
{
build_setting_data *bsd = calloc(1, sizeof(build_setting_data));
if (!bsd)
{
EINA_LOG_ERR(_("Failed to allocate Memory!"));
return NULL;
}
return bsd;
}
void
build_setting_term(build_setting_data *bsd)
{
if (!bsd) return;
free(bsd);
g_bsd = NULL;
}

View File

@ -1,3 +1,6 @@
/*****************************************************************************/
/* Externally accessible calls */
/*****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
@ -5,21 +8,28 @@
#include "text_setting.h" #include "text_setting.h"
typedef enum { typedef enum {
SETTING_VIEW_GENERAL = 0, SETTING_VIEW_PREFERENCE = 0,
SETTING_VIEW_TEXT SETTING_VIEW_TEXT,
SETTING_VIEW_BUILD,
SETTING_VIEW_NONE
} setting_view; } setting_view;
typedef struct setting_s typedef struct setting_s
{ {
Evas_Object *setting_layout; Evas_Object *setting_layout;
Evas_Object *toolbar; Evas_Object *toolbar;
Evas_Object *general_layout;
Evas_Object *img_path_entry; text_setting_data *tsd;
Evas_Object *snd_path_entry; build_setting_data *bsd;
Evas_Object *fnt_path_entry;
Evas_Object *dat_path_entry;
setting_view current_view;
Evas_Object *apply_btn;
Evas_Object *reset_btn;
Evas_Object *cancel_btn;
//below: preference setting data
Evas_Object *preference;
Evas_Object *slider_view; Evas_Object *slider_view;
Evas_Object *view_size_w_entry; Evas_Object *view_size_w_entry;
Evas_Object *view_size_h_entry; Evas_Object *view_size_h_entry;
@ -31,76 +41,18 @@ typedef struct setting_s
Evas_Object *toggle_tools; Evas_Object *toggle_tools;
Evas_Object *toggle_console; Evas_Object *toggle_console;
Evas_Object *apply_btn;
Evas_Object *reset_btn;
Evas_Object *cancel_btn;
setting_view current_view;
} setting_data; } setting_data;
static setting_data *g_sd = NULL; static setting_data *g_sd = NULL;
static void preference_setting_config_set(setting_data *sd);
static void preference_setting_reset(setting_data *sd);
/*****************************************************************************/ /*****************************************************************************/
/* Internal method implementation */ /* Internal method implementation */
/*****************************************************************************/ /*****************************************************************************/
static void
img_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_img_path);
elm_entry_entry_append(entry, ";");
}
}
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
dat_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_dat_path);
elm_entry_entry_append(entry, ";");
}
}
static void
snd_path_entry_update(Evas_Object *entry, Eina_List *edc_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)
{
elm_entry_entry_append(entry, edc_snd_path);
elm_entry_entry_append(entry, ";");
}
}
static void static void
setting_dismiss_done_cb(void *data, Evas_Object *obj EINA_UNUSED, setting_dismiss_done_cb(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *emission EINA_UNUSED,
@ -108,7 +60,8 @@ setting_dismiss_done_cb(void *data, Evas_Object *obj EINA_UNUSED,
{ {
setting_data *sd = data; setting_data *sd = data;
text_setting_term(); text_setting_term(sd->tsd);
build_setting_term(sd->bsd);
evas_object_del(sd->setting_layout); evas_object_del(sd->setting_layout);
sd->setting_layout = NULL; sd->setting_layout = NULL;
@ -124,29 +77,9 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
{ {
setting_data *sd = data; setting_data *sd = data;
config_img_path_set(elm_object_text_get(sd->img_path_entry)); preference_setting_config_set(sd);
config_snd_path_set(elm_object_text_get(sd->snd_path_entry)); build_setting_config_set(sd->bsd);
config_fnt_path_set(elm_object_text_get(sd->fnt_path_entry)); text_setting_config_set(sd->tsd);
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));
config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
config_part_highlight_set(elm_check_state_get(sd->toggle_highlight));
config_dummy_parts_set(elm_check_state_get(sd->toggle_swallow));
config_file_browser_set(elm_check_state_get(sd->toggle_file_browser));
config_edc_navigator_set(elm_check_state_get(sd->toggle_edc_navigator));
text_setting_config_set();
Evas_Coord w = 0;
Evas_Coord h = 0;
const char *w_entry = elm_entry_entry_get(sd->view_size_w_entry);
if (w_entry) w = (Evas_Coord)atoi(w_entry);
const char *h_entry = elm_entry_entry_get(sd->view_size_h_entry);
if (h_entry) h = (Evas_Coord)atoi(h_entry);
config_view_size_set(w, h);
text_setting_syntax_color_save();
config_apply(); config_apply();
@ -166,43 +99,22 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
{ {
setting_data *sd = data; setting_data *sd = data;
img_path_entry_update(sd->img_path_entry, preference_setting_reset(sd);
(Eina_List *)config_img_path_list_get()); text_setting_reset(sd->tsd);
snd_path_entry_update(sd->snd_path_entry, build_setting_reset(sd->bsd);
(Eina_List *)config_snd_path_list_get()); }
fnt_path_entry_update(sd->fnt_path_entry,
(Eina_List *)config_fnt_path_list_get());
dat_path_entry_update(sd->dat_path_entry,
(Eina_List *)config_dat_path_list_get());
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get()); static void
focus_custom_chain_set(setting_data *sd, Evas_Object *content)
elm_check_state_set(sd->toggle_console, config_console_get()); {
elm_check_state_set(sd->toggle_tools, config_tools_get()); //Set a custom chain to set the focus order.
elm_check_state_set(sd->toggle_stats, config_stats_bar_get()); Eina_List *custom_chain = NULL;
elm_check_state_set(sd->toggle_highlight, config_part_highlight_get()); custom_chain = eina_list_append(custom_chain, sd->toolbar);
elm_check_state_set(sd->toggle_swallow, config_dummy_parts_get()); custom_chain = eina_list_append(custom_chain, sd->preference);
elm_check_state_set(sd->toggle_file_browser, config_file_browser_get()); custom_chain = eina_list_append(custom_chain, sd->apply_btn);
elm_check_state_set(sd->toggle_edc_navigator, config_edc_navigator_get()); custom_chain = eina_list_append(custom_chain, sd->reset_btn);
custom_chain = eina_list_append(custom_chain, sd->cancel_btn);
//Reset view scale elm_object_focus_custom_chain_set(sd->setting_layout, custom_chain);
int view_size_w, view_size_h;
config_view_size_get(&view_size_w, &view_size_h);
char buf[10];
snprintf(buf, sizeof(buf), "%d", view_size_w);
elm_entry_entry_set(sd->view_size_w_entry, buf);
snprintf(buf, sizeof(buf), "%d", view_size_h);
elm_entry_entry_set(sd->view_size_h_entry, buf);
const char *font_name;
const char *font_style;
config_font_get(&font_name, &font_style);
text_setting_font_set(font_name, font_style);
text_setting_font_scale_set((double) config_font_scale_get());
text_setting_linenumber_set(config_linenumber_get());
text_setting_auto_indent_set(config_auto_indent_get());
text_setting_auto_complete_set(config_auto_complete_get());
text_setting_syntax_color_reset();
} }
static Evas_Object * static Evas_Object *
@ -240,55 +152,57 @@ toggle_create(Evas_Object *parent, const char *text, Eina_Bool state)
return toggle; return toggle;
} }
static void
preference_setting_reset(setting_data *sd)
{
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get());
elm_check_state_set(sd->toggle_console, config_console_get());
elm_check_state_set(sd->toggle_tools, config_tools_get());
elm_check_state_set(sd->toggle_stats, config_stats_bar_get());
elm_check_state_set(sd->toggle_highlight, config_part_highlight_get());
elm_check_state_set(sd->toggle_swallow, config_dummy_parts_get());
elm_check_state_set(sd->toggle_file_browser, config_file_browser_get());
elm_check_state_set(sd->toggle_edc_navigator, config_edc_navigator_get());
//Reset view scale
int view_size_w, view_size_h;
config_view_size_get(&view_size_w, &view_size_h);
char buf[10];
snprintf(buf, sizeof(buf), "%d", view_size_w);
elm_entry_entry_set(sd->view_size_w_entry, buf);
snprintf(buf, sizeof(buf), "%d", view_size_h);
elm_entry_entry_set(sd->view_size_h_entry, buf);
}
static void
preference_setting_config_set(setting_data *sd)
{
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));
config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
config_part_highlight_set(elm_check_state_get(sd->toggle_highlight));
config_dummy_parts_set(elm_check_state_get(sd->toggle_swallow));
config_file_browser_set(elm_check_state_get(sd->toggle_file_browser));
config_edc_navigator_set(elm_check_state_get(sd->toggle_edc_navigator));
Evas_Coord w = 0;
Evas_Coord h = 0;
const char *w_entry = elm_entry_entry_get(sd->view_size_w_entry);
if (w_entry) w = (Evas_Coord)atoi(w_entry);
const char *h_entry = elm_entry_entry_get(sd->view_size_h_entry);
if (h_entry) h = (Evas_Coord)atoi(h_entry);
config_view_size_set(w, h);
}
static Evas_Object * static Evas_Object *
general_layout_create(setting_data *sd, Evas_Object *parent) preference_create(setting_data *sd, Evas_Object *parent)
{ {
static Elm_Entry_Filter_Accept_Set digits_filter_data; static Elm_Entry_Filter_Accept_Set digits_filter_data;
static Elm_Entry_Filter_Limit_Size limit_filter_data; static Elm_Entry_Filter_Limit_Size limit_filter_data;
//Layout
Evas_Object *layout = elm_layout_add(parent);
elm_layout_file_set(layout, EDJE_PATH, "general_layout");
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(layout);
//Image Path Entry
Evas_Object *img_path_entry = entry_create(layout);
img_path_entry_update(img_path_entry,
(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);
elm_layout_text_set(layout, "img_path_guide", _("Image Paths:"));
//Sound Path Entry
Evas_Object *snd_path_entry = entry_create(layout);
snd_path_entry_update(snd_path_entry,
(Eina_List *)config_snd_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.snd_path_entry",
snd_path_entry);
elm_layout_text_set(layout, "snd_path_guide", _("Sound Paths:"));
//Font Path Entry
Evas_Object *fnt_path_entry = entry_create(layout);
fnt_path_entry_update(fnt_path_entry,
(Eina_List *)config_fnt_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.fnt_path_entry",
fnt_path_entry);
elm_layout_text_set(layout, "fnt_path_guide", _("Font Paths:"));
//Data Path Entry
Evas_Object *dat_path_entry = entry_create(layout);
dat_path_entry_update(dat_path_entry,
(Eina_List *)config_dat_path_list_get());
elm_object_part_content_set(layout, "elm.swallow.dat_path_entry",
dat_path_entry);
elm_layout_text_set(layout, "dat_path_guide", _("Data Paths:"));
//Preference //Preference
Evas_Object *scroller = elm_scroller_add(layout); Evas_Object *scroller = elm_scroller_add(parent);
elm_object_part_content_set(layout, "elm.swallow.preference", scroller);
elm_layout_text_set(layout, "preference_guide", _("Preferences:"));
//Box //Box
Evas_Object *box = elm_box_add(scroller); Evas_Object *box = elm_box_add(scroller);
@ -449,13 +363,11 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
//Toggle (Console) //Toggle (Console)
Evas_Object *toggle_console = toggle_create(box, _("Auto Hiding Console"), Evas_Object *toggle_console = toggle_create(box, _("Auto Hiding Console"),
config_console_get()); config_console_get());
evas_object_size_hint_weight_set(toggle_console, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(toggle_console, EVAS_HINT_FILL, 0);
elm_box_pack_end(box, toggle_console); elm_box_pack_end(box, toggle_console);
sd->general_layout = layout; sd->preference = scroller;
sd->img_path_entry = img_path_entry;
sd->snd_path_entry = snd_path_entry;
sd->fnt_path_entry = fnt_path_entry;
sd->dat_path_entry = dat_path_entry;
sd->slider_view = slider_view; sd->slider_view = slider_view;
sd->view_size_w_entry = entry_view_size_w; sd->view_size_w_entry = entry_view_size_w;
sd->view_size_h_entry = entry_view_size_h; sd->view_size_h_entry = entry_view_size_h;
@ -467,56 +379,43 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
sd->toggle_tools = toggle_tools; sd->toggle_tools = toggle_tools;
sd->toggle_console = toggle_console; sd->toggle_console = toggle_console;
return layout; return scroller;
} }
static void static void
general_setting_focus_set(void) preference_setting_focus_set(void)
{ {
setting_data *sd = g_sd; setting_data *sd = g_sd;
elm_object_focus_set(sd->img_path_entry, EINA_TRUE); elm_object_focus_set(sd->slider_view, EINA_TRUE);
} }
static Evas_Object * static Evas_Object *
general_setting_content_get(Evas_Object *parent EINA_UNUSED) preference_setting_content_get(Evas_Object *parent EINA_UNUSED)
{ {
setting_data *sd = g_sd; setting_data *sd = g_sd;
return sd->general_layout; return sd->preference;
} }
static void static void
focus_custom_chain_set(setting_data *sd, Evas_Object *content) toolbar_preferene_cb(void *data, Evas_Object *obj EINA_UNUSED,
{ void *event_info EINA_UNUSED)
//Set a custom chain to set the focus order.
Eina_List *custom_chain = NULL;
custom_chain = eina_list_append(custom_chain, sd->toolbar);
custom_chain = eina_list_append(custom_chain, sd->general_layout);
custom_chain = eina_list_append(custom_chain, sd->apply_btn);
custom_chain = eina_list_append(custom_chain, sd->reset_btn);
custom_chain = eina_list_append(custom_chain, sd->cancel_btn);
elm_object_focus_custom_chain_set(sd->setting_layout, custom_chain);
}
static void
toolbar_general_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{ {
setting_data *sd = data; setting_data *sd = data;
if (sd->current_view == SETTING_VIEW_GENERAL) return; if (sd->current_view == SETTING_VIEW_PREFERENCE) return;
//Hide previous tab view //Hide previous tab view
Evas_Object *pcontent = elm_object_part_content_unset(sd->setting_layout, Evas_Object *pcontent = elm_object_part_content_unset(sd->setting_layout,
"elm.swallow.content"); "elm.swallow.content");
evas_object_hide(pcontent); evas_object_hide(pcontent);
Evas_Object *content = general_setting_content_get(obj); Evas_Object *content = preference_setting_content_get(obj);
elm_object_part_content_set(sd->setting_layout, "elm.swallow.content", elm_object_part_content_set(sd->setting_layout, "elm.swallow.content",
content); content);
focus_custom_chain_set(sd, content); focus_custom_chain_set(sd, content);
general_setting_focus_set(); preference_setting_focus_set();
sd->current_view = SETTING_VIEW_GENERAL; sd->current_view = SETTING_VIEW_PREFERENCE;
} }
static void static void
@ -526,20 +425,46 @@ toolbar_text_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
if (sd->current_view == SETTING_VIEW_TEXT) return; if (sd->current_view == SETTING_VIEW_TEXT) return;
if (!sd->tsd) sd->tsd = text_setting_init();
//Hide previous tab view //Hide previous tab view
Evas_Object *pcontent = elm_object_part_content_unset(sd->setting_layout, Evas_Object *pcontent = elm_object_part_content_unset(sd->setting_layout,
"elm.swallow.content"); "elm.swallow.content");
evas_object_hide(pcontent); evas_object_hide(pcontent);
Evas_Object *content = text_setting_content_get(obj); Evas_Object *content = text_setting_content_get(sd->tsd, obj);
elm_object_part_content_set(sd->setting_layout, "elm.swallow.content", elm_object_part_content_set(sd->setting_layout, "elm.swallow.content",
content); content);
focus_custom_chain_set(sd, content); focus_custom_chain_set(sd, content);
text_setting_focus_set(); text_setting_focus_set(sd->tsd);
sd->current_view = SETTING_VIEW_TEXT; sd->current_view = SETTING_VIEW_TEXT;
} }
static void
toolbar_build_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
setting_data *sd = data;
if (sd->current_view == SETTING_VIEW_BUILD) return;
if (!sd->bsd) sd->bsd = build_setting_init();
//Hide previous tab view
Evas_Object *pcontent = elm_object_part_content_unset(sd->setting_layout,
"elm.swallow.content");
evas_object_hide(pcontent);
Evas_Object *content = build_setting_content_get(sd->bsd, obj);
elm_object_part_content_set(sd->setting_layout, "elm.swallow.content",
content);
focus_custom_chain_set(sd, content);
build_setting_focus_set(sd->bsd);
sd->current_view = SETTING_VIEW_BUILD;
}
/*****************************************************************************/ /*****************************************************************************/
/* Externally accessible calls */ /* Externally accessible calls */
/*****************************************************************************/ /*****************************************************************************/
@ -558,8 +483,6 @@ setting_open(void)
} }
g_sd = sd; g_sd = sd;
text_setting_init();
search_close(); search_close();
goto_close(); goto_close();
@ -575,18 +498,25 @@ setting_open(void)
//Tabbar //Tabbar
Evas_Object *toolbar = elm_toolbar_add(layout); Evas_Object *toolbar = elm_toolbar_add(layout);
//elm_object_style_set(toolbar, "item_horizontal");
elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
elm_toolbar_item_append(toolbar, NULL, _("General"), toolbar_general_cb, sd); elm_toolbar_item_append(toolbar, NULL, _("Preferences"),
elm_toolbar_item_append(toolbar, NULL, _("Text Editor"), toolbar_text_cb, sd); toolbar_preferene_cb, sd);
elm_toolbar_item_append(toolbar, NULL, _("Text Editor"), toolbar_text_cb,
sd);
elm_toolbar_item_append(toolbar, NULL, _("EDC Build"), toolbar_build_cb,
sd);
elm_object_part_content_set(layout, "elm.swallow.toolbar", toolbar); elm_object_part_content_set(layout, "elm.swallow.toolbar", toolbar);
//General layout //Preference layout
Evas_Object *general_layout = general_layout_create(sd, layout); Evas_Object *preference = preference_create(sd, layout);
elm_object_part_content_set(layout, "elm.swallow.content", general_layout); elm_object_part_content_set(layout, "elm.swallow.content", preference);
preference_setting_focus_set();
//Apply Button //Apply Button
Evas_Object *apply_btn = elm_button_add(layout); Evas_Object *apply_btn = elm_button_add(layout);
@ -614,7 +544,6 @@ setting_open(void)
sd->apply_btn = apply_btn; sd->apply_btn = apply_btn;
sd->reset_btn = reset_btn; sd->reset_btn = reset_btn;
sd->cancel_btn = cancel_btn; sd->cancel_btn = cancel_btn;
sd->current_view = SETTING_VIEW_GENERAL;
menu_activate_request(); menu_activate_request();
} }

View File

@ -29,6 +29,7 @@ typedef struct text_setting_s
Evas_Object *toggle_autocomp; Evas_Object *toggle_autocomp;
Evas_Object *toggle_smart_undo_redo; Evas_Object *toggle_smart_undo_redo;
Evas_Object *list_font_name; Evas_Object *list_font_name;
Evas_Object *list_font_style;
color_keyword *color_keyword_list; color_keyword *color_keyword_list;
char *syntax_template_format; char *syntax_template_format;
@ -93,8 +94,6 @@ static int color_type_list[COLOR_KEYWORD_MAX_CNT] =
ENVENTOR_SYNTAX_COLOR_SYMBOL, ENVENTOR_SYNTAX_COLOR_SYMBOL ENVENTOR_SYNTAX_COLOR_SYMBOL, ENVENTOR_SYNTAX_COLOR_SYMBOL
}; };
static text_setting_data *g_tsd = NULL;
/*****************************************************************************/ /*****************************************************************************/
/* Internal method implementation */ /* Internal method implementation */
/*****************************************************************************/ /*****************************************************************************/
@ -149,9 +148,8 @@ syntax_template_set(char *syntax_template_str, char *syntax_template_format,
} }
static void static void
syntax_template_apply(void) syntax_template_apply(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd;
Evas_Object *layout = tsd->layout; Evas_Object *layout = tsd->layout;
if (!layout) return; if (!layout) return;
@ -175,15 +173,14 @@ text_setting_syntax_color_load(void)
} }
} }
void static void
text_setting_syntax_color_reset(void) text_setting_syntax_color_reset(text_setting_data *tsd)
{ {
text_setting_syntax_color_load(); text_setting_syntax_color_load();
syntax_template_apply(tsd);
syntax_template_apply();
} }
void static void
text_setting_syntax_color_save(void) text_setting_syntax_color_save(void)
{ {
Enventor_Syntax_Color_Type color_type = ENVENTOR_SYNTAX_COLOR_STRING; Enventor_Syntax_Color_Type color_type = ENVENTOR_SYNTAX_COLOR_STRING;
@ -230,10 +227,10 @@ color_ctxpopup_dismiss_cb(void *data EINA_UNUSED, Evas_Object *obj,
} }
static void static void
color_ctxpopup_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, color_ctxpopup_del_cb(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj, void *event_info EINA_UNUSED) Evas_Object *obj, void *event_info EINA_UNUSED)
{ {
text_setting_data *tsd = g_tsd; text_setting_data *tsd = data;
color_keyword *selected_color_keyword; color_keyword *selected_color_keyword;
selected_color_keyword = evas_object_data_get(obj, "color_keyword"); selected_color_keyword = evas_object_data_get(obj, "color_keyword");
@ -241,7 +238,7 @@ color_ctxpopup_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
elm_object_focus_set(tsd->slider_font, EINA_TRUE); elm_object_focus_set(tsd->slider_font, EINA_TRUE);
text_setting_syntax_color_update(obj, selected_color_keyword); text_setting_syntax_color_update(obj, selected_color_keyword);
syntax_template_apply(); syntax_template_apply(tsd);
elm_config_focus_autoscroll_mode_set(ELM_FOCUS_AUTOSCROLL_MODE_SHOW); elm_config_focus_autoscroll_mode_set(ELM_FOCUS_AUTOSCROLL_MODE_SHOW);
@ -249,20 +246,23 @@ color_ctxpopup_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
} }
static void static void
color_slider_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, color_slider_changed_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
text_setting_data *tsd = data;
Evas_Object *ctxpopup = evas_object_data_get(obj, "ctxpopup"); Evas_Object *ctxpopup = evas_object_data_get(obj, "ctxpopup");
color_keyword *selected_color_keyword; color_keyword *selected_color_keyword;
selected_color_keyword = evas_object_data_get(ctxpopup, "color_keyword"); selected_color_keyword = evas_object_data_get(ctxpopup, "color_keyword");
text_setting_syntax_color_update(ctxpopup, selected_color_keyword); text_setting_syntax_color_update(ctxpopup, selected_color_keyword);
syntax_template_apply(); syntax_template_apply(tsd);
} }
static Evas_Object * static Evas_Object *
color_slider_layout_create(Evas_Object *parent, Evas_Object *ctxpopup, color_slider_layout_create(text_setting_data *tsd, Evas_Object *parent,
const char *type, double slider_val) Evas_Object *ctxpopup, const char *type,
double slider_val)
{ {
//Layout //Layout
Evas_Object *layout = elm_layout_add(parent); Evas_Object *layout = elm_layout_add(parent);
@ -289,7 +289,7 @@ color_slider_layout_create(Evas_Object *parent, Evas_Object *ctxpopup,
elm_object_part_text_set(layout, "elm.text.slider_max", slider_max); elm_object_part_text_set(layout, "elm.text.slider_max", slider_max);
elm_object_part_content_set(layout, "elm.swallow.slider", slider); elm_object_part_content_set(layout, "elm.swallow.slider", slider);
evas_object_smart_callback_add(slider, "changed", color_slider_changed_cb, evas_object_smart_callback_add(slider, "changed", color_slider_changed_cb,
NULL); tsd);
return layout; return layout;
} }
@ -321,7 +321,7 @@ convert_hexadecimal_to_decimal(char *hexadecimal)
} }
static void static void
color_slider_layout_set(Evas_Object *ctxpopup) color_slider_layout_set(text_setting_data *tsd, Evas_Object *ctxpopup)
{ {
Eina_Array *type_array; Eina_Array *type_array;
Eina_Stringshare *type = NULL; Eina_Stringshare *type = NULL;
@ -358,7 +358,7 @@ color_slider_layout_set(Evas_Object *ctxpopup)
EINA_ARRAY_ITER_NEXT(type_array, i, type, itr) EINA_ARRAY_ITER_NEXT(type_array, i, type, itr)
{ {
layout = color_slider_layout_create(box, ctxpopup, type, layout = color_slider_layout_create(tsd, box, ctxpopup, type,
color_rgb_val[i]); color_rgb_val[i]);
if (i % 2) elm_object_signal_emit(layout, "odd,item,set", ""); if (i % 2) elm_object_signal_emit(layout, "odd,item,set", "");
elm_box_pack_end(box, layout); elm_box_pack_end(box, layout);
@ -372,10 +372,10 @@ color_slider_layout_set(Evas_Object *ctxpopup)
} }
static Evas_Object * static Evas_Object *
color_ctxpopup_create(Evas_Object *parent, color_ctxpopup_create(text_setting_data *tsd,
color_keyword *selected_color_keyword) color_keyword *selected_color_keyword)
{ {
Evas_Object *ctxpopup = elm_ctxpopup_add(parent); Evas_Object *ctxpopup = elm_ctxpopup_add(tsd->layout);
if (!ctxpopup) return NULL; if (!ctxpopup) return NULL;
elm_config_focus_autoscroll_mode_set(ELM_FOCUS_AUTOSCROLL_MODE_NONE); elm_config_focus_autoscroll_mode_set(ELM_FOCUS_AUTOSCROLL_MODE_NONE);
@ -386,10 +386,10 @@ color_ctxpopup_create(Evas_Object *parent,
ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_LEFT,
ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP,
ELM_CTXPOPUP_DIRECTION_DOWN); ELM_CTXPOPUP_DIRECTION_DOWN);
color_slider_layout_set(ctxpopup); color_slider_layout_set(tsd, ctxpopup);
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL,
color_ctxpopup_del_cb, NULL); color_ctxpopup_del_cb, tsd);
evas_object_smart_callback_add(ctxpopup, "dismissed", evas_object_smart_callback_add(ctxpopup, "dismissed",
color_ctxpopup_dismiss_cb, NULL); color_ctxpopup_dismiss_cb, NULL);
return ctxpopup; return ctxpopup;
@ -427,10 +427,8 @@ color_keyword_list_create(char *syntax_template_str)
} }
static char * static char *
syntax_template_format_create(void) syntax_template_format_create(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd;
text_setting_syntax_color_load(); text_setting_syntax_color_load();
char file_path[PATH_MAX]; char file_path[PATH_MAX];
@ -468,17 +466,17 @@ err:
} }
static char * static char *
syntax_template_create(double font_scale) syntax_template_create(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd;
char *syntax_template_str = NULL; char *syntax_template_str = NULL;
char *syntax_template_format = syntax_template_format_create(); char *syntax_template_format = syntax_template_format_create(tsd);
if (!syntax_template_format) goto err; if (!syntax_template_format) goto err;
syntax_template_str = calloc(1, sizeof(char) * SYNTAX_TEMPLATE_MAX_LEN); syntax_template_str = calloc(1, sizeof(char) * SYNTAX_TEMPLATE_MAX_LEN);
if (!syntax_template_str) goto err; if (!syntax_template_str) goto err;
syntax_template_set(syntax_template_str, syntax_template_format, font_scale); syntax_template_set(syntax_template_str, syntax_template_format,
tsd->font_scale);
color_keyword *color_keyword_list; color_keyword *color_keyword_list;
color_keyword_list = color_keyword_list_create(syntax_template_str); color_keyword_list = color_keyword_list_create(syntax_template_str);
@ -562,8 +560,7 @@ text_setting_double_clicked_cb(void *data, Evas_Object *obj,
if ((pos >= selected_color_keyword->pos_begin) && if ((pos >= selected_color_keyword->pos_begin) &&
(pos <= selected_color_keyword->pos_end)) (pos <= selected_color_keyword->pos_end))
{ {
ctxpopup = color_ctxpopup_create(tsd->layout, ctxpopup = color_ctxpopup_create(tsd, selected_color_keyword);
selected_color_keyword);
if (!ctxpopup) return; if (!ctxpopup) return;
evas_pointer_output_xy_get(evas_object_evas_get(obj), &x, &y); evas_pointer_output_xy_get(evas_object_evas_get(obj), &x, &y);
@ -618,14 +615,12 @@ font_scale_slider_changed_cb(void *data, Evas_Object *obj,
double val = elm_slider_value_get(obj); double val = elm_slider_value_get(obj);
tsd->font_scale = val; tsd->font_scale = val;
syntax_template_apply(); syntax_template_apply(tsd);
} }
static void static void
text_setting_font_apply(void) text_setting_font_apply(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd;
char text_class_name[32]; char text_class_name[32];
snprintf(text_class_name, sizeof(text_class_name), "%s_setting_entry", snprintf(text_class_name, sizeof(text_class_name), "%s_setting_entry",
"enventor"); "enventor");
@ -649,23 +644,22 @@ font_cmp_cb(const void *data1,
} }
static void static void
font_style_selected_cb(void *data EINA_UNUSED, Evas_Object *obj, font_style_selected_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
text_setting_data *tsd = g_tsd; text_setting_data *tsd = data;
Elm_Object_Item *font_style_it = elm_list_selected_item_get(obj); Elm_Object_Item *font_style_it = elm_list_selected_item_get(obj);
const char *font_style = elm_object_item_text_get(font_style_it); const char *font_style = elm_object_item_text_get(font_style_it);
eina_stringshare_replace(&tsd->font_style, font_style); eina_stringshare_replace(&tsd->font_style, font_style);
text_setting_font_apply(); text_setting_font_apply(tsd);
} }
static void static void
font_name_selected_cb(void *data, Evas_Object *obj, font_name_selected_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED) void *event_info EINA_UNUSED)
{ {
text_setting_data *tsd = g_tsd; text_setting_data *tsd = data;
Evas_Object *list_font_style = data;
Elm_Object_Item *font_name_it = elm_list_selected_item_get(obj); Elm_Object_Item *font_name_it = elm_list_selected_item_get(obj);
Elm_Object_Item *font_style_it = NULL; Elm_Object_Item *font_style_it = NULL;
const char *sel_font_name = elm_object_item_text_get(font_name_it); const char *sel_font_name = elm_object_item_text_get(font_name_it);
@ -674,7 +668,7 @@ font_name_selected_cb(void *data, Evas_Object *obj,
config_font_get(&font_name, &font_style); config_font_get(&font_name, &font_style);
elm_list_clear(list_font_style); elm_list_clear(tsd->list_font_style);
//Append Items of Font Style List //Append Items of Font Style List
Elm_Font_Properties *efp; Elm_Font_Properties *efp;
@ -694,9 +688,10 @@ font_name_selected_cb(void *data, Evas_Object *obj,
EINA_LIST_FOREACH(efp->styles, ll, style) EINA_LIST_FOREACH(efp->styles, ll, style)
{ {
Elm_Object_Item *it Elm_Object_Item *it
= elm_list_item_append(list_font_style, style, NULL, = elm_list_item_append(tsd->list_font_style, style,
NULL,
NULL, font_style_selected_cb, NULL, font_style_selected_cb,
NULL); tsd);
if (font_name && !strcmp(font_name, efp->name) && if (font_name && !strcmp(font_name, efp->name) &&
font_style && !strcmp(font_style, style)) font_style && !strcmp(font_style, style))
font_style_it = it; font_style_it = it;
@ -705,12 +700,12 @@ font_name_selected_cb(void *data, Evas_Object *obj,
elm_font_properties_free(efp); elm_font_properties_free(efp);
} }
} }
elm_list_go(list_font_style); elm_list_go(tsd->list_font_style);
if (font_style_it) elm_list_item_selected_set(font_style_it, EINA_TRUE); if (font_style_it) elm_list_item_selected_set(font_style_it, EINA_TRUE);
eina_stringshare_replace(&tsd->font_name, sel_font_name); eina_stringshare_replace(&tsd->font_name, sel_font_name);
eina_stringshare_replace(&tsd->font_style, NULL); eina_stringshare_replace(&tsd->font_style, NULL);
text_setting_font_apply(); text_setting_font_apply(tsd);
} }
static Eina_Bool static Eina_Bool
@ -728,14 +723,38 @@ is_supported_font(const char *font_name)
return EINA_TRUE; return EINA_TRUE;
} }
static void
text_setting_font_set(text_setting_data *tsd, const char *font_name,
const char *font_style)
{
eina_stringshare_replace(&tsd->font_name, font_name);
eina_stringshare_replace(&tsd->font_style, font_style);
if (!tsd->list_font_name) return;
const Eina_List *it_list = elm_list_items_get(tsd->list_font_name);
const Eina_List *l;
Elm_Object_Item *it;
EINA_LIST_FOREACH(it_list, l, it)
{
const char *name = elm_object_item_text_get(it);
if (font_name && !strcmp(font_name, name))
{
elm_list_item_selected_set(it, EINA_TRUE);
break;
}
}
}
/*****************************************************************************/ /*****************************************************************************/
/* Externally accessible calls */ /* Externally accessible calls */
/*****************************************************************************/ /*****************************************************************************/
Evas_Object * Evas_Object *
text_setting_content_get(Evas_Object *parent) text_setting_content_get(text_setting_data *tsd, Evas_Object *parent)
{ {
text_setting_data *tsd = g_tsd; if (!tsd) return NULL;
if (tsd->layout) return tsd->layout; if (tsd->layout) return tsd->layout;
//Layout //Layout
@ -759,7 +778,7 @@ text_setting_content_get(Evas_Object *parent)
//Font Scale Information //Font Scale Information
tsd->font_scale = (double) config_font_scale_get(); tsd->font_scale = (double) config_font_scale_get();
char *syntax_template_str = syntax_template_create(tsd->font_scale); char *syntax_template_str = syntax_template_create(tsd);
elm_entry_entry_set(entry, syntax_template_str); elm_entry_entry_set(entry, syntax_template_str);
evas_object_smart_callback_add(entry, "clicked,double", evas_object_smart_callback_add(entry, "clicked,double",
text_setting_double_clicked_cb, tsd); text_setting_double_clicked_cb, tsd);
@ -879,8 +898,8 @@ text_setting_content_get(Evas_Object *parent)
label_font_style); label_font_style);
//Font Style (List) //Font Style (List)
Evas_Object *list_font_style = list_create(box2); tsd->list_font_style = list_create(box2);
elm_box_pack_end(box2, list_font_style); elm_box_pack_end(box2, tsd->list_font_style);
//Font Name and Style Information //Font Name and Style Information
const char *font_name; const char *font_name;
@ -909,7 +928,7 @@ text_setting_content_get(Evas_Object *parent)
Elm_Object_Item *it Elm_Object_Item *it
= elm_list_item_append(list_font_name, efp->name, NULL, = elm_list_item_append(list_font_name, efp->name, NULL,
NULL, font_name_selected_cb, NULL, font_name_selected_cb,
list_font_style); tsd);
if (font_name && !strcmp(font_name, efp->name)) if (font_name && !strcmp(font_name, efp->name))
font_name_it = it; font_name_it = it;
snprintf(prev_font, sizeof(prev_font), "%s", efp->name); snprintf(prev_font, sizeof(prev_font), "%s", efp->name);
@ -933,16 +952,17 @@ text_setting_content_get(Evas_Object *parent)
} }
void void
text_setting_focus_set(void) text_setting_focus_set(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd; if (!tsd) return;
elm_object_focus_set(tsd->slider_font, EINA_TRUE); elm_object_focus_set(tsd->slider_font, EINA_TRUE);
} }
void void
text_setting_config_set(void) text_setting_config_set(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd; if (!tsd) return;
config_font_set(tsd->font_name, tsd->font_style); config_font_set(tsd->font_name, tsd->font_style);
config_font_scale_set((float) elm_slider_value_get(tsd->slider_font)); config_font_scale_set((float) elm_slider_value_get(tsd->slider_font));
@ -950,88 +970,48 @@ text_setting_config_set(void)
config_auto_indent_set(elm_check_state_get(tsd->toggle_indent)); config_auto_indent_set(elm_check_state_get(tsd->toggle_indent));
config_auto_complete_set(elm_check_state_get(tsd->toggle_autocomp)); config_auto_complete_set(elm_check_state_get(tsd->toggle_autocomp));
config_smart_undo_redo_set(elm_check_state_get(tsd->toggle_smart_undo_redo)); config_smart_undo_redo_set(elm_check_state_get(tsd->toggle_smart_undo_redo));
text_setting_syntax_color_save();
} }
void void
text_setting_font_set(const char *font_name, const char *font_style) text_setting_reset(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd; if (!tsd) return;
eina_stringshare_replace(&tsd->font_name, font_name); //font scale
eina_stringshare_replace(&tsd->font_style, font_style); tsd->font_scale = (double) config_font_scale_get();
if (!tsd->list_font_name) return;
const Eina_List *it_list = elm_list_items_get(tsd->list_font_name);
const Eina_List *l;
Elm_Object_Item *it;
EINA_LIST_FOREACH(it_list, l, it)
{
const char *name = elm_object_item_text_get(it);
if (font_name && !strcmp(font_name, name))
{
elm_list_item_selected_set(it, EINA_TRUE);
break;
}
}
}
void
text_setting_font_scale_set(double font_scale)
{
text_setting_data *tsd = g_tsd;
tsd->font_scale = font_scale;
elm_slider_value_set(tsd->slider_font, tsd->font_scale); elm_slider_value_set(tsd->slider_font, tsd->font_scale);
elm_check_state_set(tsd->toggle_linenum, config_linenumber_get());
elm_check_state_set(tsd->toggle_indent, config_auto_indent_get());
elm_check_state_set(tsd->toggle_autocomp, config_auto_complete_get());
elm_check_state_set(tsd->toggle_smart_undo_redo,
config_smart_undo_redo_get());
//font reset
const char *font_name, *font_style;
config_font_get(&font_name, &font_style);
text_setting_font_set(tsd, font_name, font_style);
text_setting_syntax_color_reset(tsd);
} }
void text_setting_data *
text_setting_linenumber_set(Eina_Bool enabled)
{
text_setting_data *tsd = g_tsd;
elm_check_state_set(tsd->toggle_linenum, enabled);
}
void
text_setting_auto_indent_set(Eina_Bool enabled)
{
text_setting_data *tsd = g_tsd;
elm_check_state_set(tsd->toggle_indent, enabled);
}
void
text_setting_auto_complete_set(Eina_Bool enabled)
{
text_setting_data *tsd = g_tsd;
elm_check_state_set(tsd->toggle_autocomp, enabled);
}
void
text_setting_smart_undo_redo_set(Eina_Bool enabled)
{
text_setting_data *tsd = g_tsd;
elm_check_state_set(tsd->toggle_smart_undo_redo, enabled);
}
void
text_setting_init(void) text_setting_init(void)
{ {
text_setting_data *tsd = g_tsd; text_setting_data *tsd = calloc(1, sizeof(text_setting_data));
if (tsd) return;
tsd = calloc(1, sizeof(text_setting_data));
if (!tsd) if (!tsd)
{ {
EINA_LOG_ERR(_("Failed to allocate Memory!")); EINA_LOG_ERR(_("Failed to allocate Memory!"));
return; return NULL;
} }
g_tsd = tsd; return tsd;
} }
void void
text_setting_term(void) text_setting_term(text_setting_data *tsd)
{ {
text_setting_data *tsd = g_tsd;
if (!tsd) return; if (!tsd) return;
evas_object_del(tsd->color_ctxpopup); evas_object_del(tsd->color_ctxpopup);
@ -1041,5 +1021,4 @@ text_setting_term(void)
eina_stringshare_del(tsd->font_name); eina_stringshare_del(tsd->font_name);
eina_stringshare_del(tsd->font_style); eina_stringshare_del(tsd->font_style);
free(tsd); free(tsd);
g_tsd = NULL;
} }

View File

@ -17,4 +17,5 @@ EXTRA_DIST = common.h \
console.h \ console.h \
file_mgr.h \ file_mgr.h \
edc_navigator.h \ edc_navigator.h \
file_browser.h file_browser.h \
build_setting.h

View File

@ -0,0 +1,7 @@
typedef struct build_setting_s build_setting_data;
Evas_Object *build_setting_content_get(build_setting_data *tsd, Evas_Object *parent);
void build_setting_config_set(build_setting_data *tsd);
void build_setting_term(build_setting_data *tsd);
build_setting_data *build_setting_init(void);
void build_setting_focus_set(build_setting_data *tsd);

View File

@ -79,7 +79,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
#include "live_edit.h" #include "live_edit.h"
#include "console.h" #include "console.h"
#include "file_mgr.h" #include "file_mgr.h"
#include "build_setting.h"
/* localization */ /* localization */
#ifdef HAVE_GETTEXT #ifdef HAVE_GETTEXT

View File

@ -1,13 +1,7 @@
Evas_Object *text_setting_content_get(Evas_Object *parent); typedef struct text_setting_s text_setting_data;
void text_setting_syntax_color_reset(void);
void text_setting_syntax_color_save(void); Evas_Object *text_setting_content_get(text_setting_data *tsd, Evas_Object *parent);
void text_setting_config_set(void); void text_setting_config_set(text_setting_data *tsd);
void text_setting_font_set(const char *font_name, const char *font_style); void text_setting_term(text_setting_data *tsd);
void text_setting_font_scale_set(double font_scale); text_setting_data *text_setting_init(void);
void text_setting_linenumber_set(Eina_Bool enabled); void text_setting_focus_set(text_setting_data *tsd);
void text_setting_auto_indent_set(Eina_Bool enabled);
void text_setting_auto_complete_set(Eina_Bool enabled);
void text_setting_smart_undo_redo_set(Eina_Bool enabled);
void text_setting_term(void);
void text_setting_init(void);
void text_setting_focus_set(void);