enventor - show the messages in some case of file load scenarios

This commit is contained in:
ChunEon Park 2013-07-30 01:16:58 +09:00
parent 9f58afb8e5
commit b3ba86b30b
5 changed files with 117 additions and 28 deletions

View File

@ -1,3 +1,5 @@
#define FN "Sans"
collections {
#include "content.edc"
#include "images.edc"

View File

@ -1,6 +1,6 @@
styles {
style { name: "entry_statusbar_style";
base: "font=Sans font_size=11 color=#000000 text_class=entry color=#606060";
base: "font="FN" font_size=11 color=#000000 text_class=entry color=#606060";
}
}
@ -117,7 +117,7 @@ group { name: "statusbar_layout";
align: 0 0.5;
color: 0 0 0 0;
text {
font: "Sans";
font: FN;
size: 11;
align: 0 0.5;
}

View File

@ -146,6 +146,28 @@ group { name: "fileselector_layout";
rel2 { to: "base_frame"; }
}
}
part { name: "elm.text.msg";
type: TEXT;
scale: 1;
clip_to: "clipper";
description { state: "default" 0.0;
rel1.relative: 0 1;
rel1.to: "elm.swallow.fileselector";
rel2.relative: 1 1;
rel2.to: "elm.swallow.fileselector";
text {
font: FN;
size: 11;
align: 0.5 1;
text: "adfasdfadsf";
}
color: 0 0 0 0;
}
description { state: "show" 0.0;
inherit: "default" 0.0;
color: 255 0 0 255;
}
}
part { name: "event_blocker";
type: RECT;
description { state: "default" 0.0;
@ -184,6 +206,25 @@ group { name: "fileselector_layout";
program { name: "dismiss_done";
action: SIGNAL_EMIT "elm,state,dismiss,done" "";
}
program { name: "msg_show";
signal: "elm,action,msg,show";
source: "";
action: STATE_SET "show" 0.0;
target: "elm.text.msg";
transition: DECELERATE 0.3;
after: "msg_idle";
}
program { name: "msg_idle";
action: STATE_SET "show" 0.0;
target: "elm.text.msg";
transition: DECELERATE 1;
after: "msg_hide";
}
program { name: "msg_hide";
action: STATE_SET "default" 0.0;
target: "elm.text.msg";
transition: DECELERATE 0.3;
}
}
}
@ -266,7 +307,7 @@ group { name: "warning_layout";
rel2.relative: 0.5 0;
text.text: "EDC has been changed";
text {
font: "Sans";
font: FN;
size: 14;
align: 0.5 0;
min: 1 1;
@ -285,7 +326,7 @@ group { name: "warning_layout";
rel2 { to: "elm.text.title"; relative: 0.5 1; }
text.text: "Without save, you will lost last changes!";
text {
font: "Sans";
font: FN;
size: 12;
align: 0.5 0;
min: 1 1;
@ -304,7 +345,7 @@ group { name: "warning_layout";
rel2 { to: "elm.text.desc"; relative: 0.5 1; }
text.text: "Are you sure you want to do this?";
text {
font: "Sans";
font: FN;
size: 12;
align: 0.5 0;
min: 1 1;
@ -770,7 +811,7 @@ group { name: "setting_layout";
align: 0 0.5;
fixed: 1 1;
text {
font: "Sans";
font: FN;
text: "Image Paths:";
size: 12;
align: 0 0.5;
@ -817,7 +858,7 @@ group { name: "setting_layout";
align: 0 0.5;
fixed: 1 1;
text {
font: "Sans";
font: FN;
text: "Sound Paths:";
size: 12;
align: 0 0.5;
@ -864,7 +905,7 @@ group { name: "setting_layout";
align: 0 0;
fixed: 1 1;
text {
font: "Sans";
font: FN;
text: "Preferences:";
size: 12;
align: 0 0;

View File

@ -1,7 +1,7 @@
styles
{
style { name: "entry_linenumber_style";
base: "font=Sans font_size=11 color=#6f6f6f text_class=entry";
base: "font="FN" font_size=11 color=#6f6f6f text_class=entry";
tag: "em" "+ font_style=Oblique";
tag: "link" "+ color=#800 underline=on underline_color=#8008";
tag: "hilight" "+ font_weight=Bold";
@ -9,7 +9,7 @@ styles
tag: "preedit_sel" "+ backing=on backing_color=#000 color=#FFFFFF";
}
style { name: "entry_edit_style";
base: "font=Sans font_size=11 color=#c80000 text_class=entry";
base: "font="FN" font_size=11 color=#c80000 text_class=entry";
tag: "em" "+ font_style=Oblique";
tag: "link" "+ color=#800 underline=on underline_color=#8008";
tag: "hilight" "+ font_weight=Bold";
@ -17,12 +17,12 @@ styles
tag: "preedit_sel" "+ backing=on backing_color=#000 color=#FFFFFF";
}
style { name: "entry_textblock_guide_style";
base: "font=Sans font_size=10 color=#00000040 wrap=word text_class=entry ellipsis=0.0";
base: "font="FN" font_size=10 color=#00000040 wrap=word text_class=entry ellipsis=0.0";
tag: "em" "+ font_style=Oblique";
tag: "hilight" "+ font_weight=Bold";
}
style { name: "entry_single_textblock_style";
base: "font=Sans font_size=12 color=#323232 wrap=none text_class=entry left_margin=2 right_margin=2";
base: "font="FN" font_size=12 color=#323232 wrap=none text_class=entry left_margin=2 right_margin=2";
tag: "br" "";
tag: "ps" "";
tag: "em" "+ font_style=Oblique";
@ -1214,11 +1214,11 @@ group { name: "elm/ctxpopup/bg/enventor";
}
}
programs {
program { name: "clicked_event";
/* program { name: "clicked_event";
signal: "mouse,clicked,1";
source: "ctxpopup_bg";
action: SIGNAL_EMIT "elm,action,click" "";
}
} */
program { name: "show";
signal: "elm,state,show";
source: "elm";

View File

@ -660,6 +660,12 @@ fileselector_save_done_cb(void *data, Evas_Object *obj EINA_UNUSED,
else fileselector_close(md);
}
static void
fileselector_save_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
fileselector_save_done_cb(data, obj, event_info);
}
static void
fileselector_load_done_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info)
@ -667,22 +673,58 @@ fileselector_load_done_cb(void *data, Evas_Object *obj EINA_UNUSED,
menu_data *md = data;
const char *selected = event_info;
if (selected)
if (!selected)
{
//Filter to read only edc extension file.
char *ext = strrchr(selected, '.');
if (!ext || strcmp(ext, ".edc") || !ecore_file_can_read(selected))
{
//show failed message box.
fileselector_close(md);
return;
}
edc_reload(md, selected);
fileselector_close(md);
menu_close(md, EINA_FALSE);
}
else fileselector_close(md);
return;
}
char buf[PATH_MAX];
//Directory?
if (ecore_file_is_dir(selected))
{
snprintf(buf, sizeof(buf), "Choose a file to load.");
elm_object_part_text_set(md->fileselector_layout,
"elm.text.msg", buf);
elm_object_signal_emit(md->fileselector_layout,
"elm,action,msg,show", "");
return;
}
//Filter to read only edc extension file.
char *ext = strrchr(selected, '.');
if (!ext || strcmp(ext, ".edc"))
{
elm_object_part_text_set(md->fileselector_layout,
"elm.text.msg",
"Support only edc file.");
elm_object_signal_emit(md->fileselector_layout,
"elm,action,msg,show", "");
return;
}
//Show a message if the it failed to load the file.
if (!ecore_file_can_read(selected))
{
const char *filename = ecore_file_file_get(selected);
snprintf(buf, sizeof(buf), "Failed to load: %s.", filename);
elm_object_part_text_set(md->fileselector_layout,
"elm.text.msg", buf);
elm_object_signal_emit(md->fileselector_layout,
"elm,action,msg,show", "");
return;
}
edc_reload(md, selected);
fileselector_close(md);
menu_close(md, EINA_FALSE);
}
static void
fileselector_load_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
fileselector_load_done_cb(data, obj, event_info);
}
static void
@ -703,6 +745,8 @@ edc_file_save(menu_data *md)
elm_fileselector_expandable_set(fs, EINA_FALSE);
elm_fileselector_is_save_set(fs, EINA_TRUE);
evas_object_smart_callback_add(fs, "done", fileselector_save_done_cb, md);
evas_object_smart_callback_add(fs, "selected", fileselector_save_selected_cb,
md);
evas_object_show(fs);
elm_object_part_content_set(layout, "elm.swallow.fileselector", fs);
@ -732,6 +776,8 @@ edc_file_load(menu_data *md)
elm_fileselector_expandable_set(fs, EINA_FALSE);
elm_fileselector_is_save_set(fs, EINA_TRUE);
evas_object_smart_callback_add(fs, "done", fileselector_load_done_cb, md);
evas_object_smart_callback_add(fs, "selected", fileselector_load_selected_cb,
md);
evas_object_show(fs);
elm_object_part_content_set(layout, "elm.swallow.fileselector", fs);