forked from enlightenment/enlightenment
parent
98ebb2936a
commit
c0e46ebfe7
|
@ -25,15 +25,16 @@ group { \
|
|||
#define FILEMAN_ICON(TYPE) \
|
||||
group { \
|
||||
name: "icons/fileman/"TYPE; \
|
||||
max: 64 64; \
|
||||
max: 48 48; \
|
||||
parts { \
|
||||
part { \
|
||||
name: "icon"; \
|
||||
mouse_events: 0; \
|
||||
description { \
|
||||
description { \
|
||||
state: "default" 0.0; \
|
||||
aspect: 1.0 1.0; \
|
||||
max: 64 64; \
|
||||
align: 0.5 0.0; \
|
||||
max: 48 48; \
|
||||
image { \
|
||||
normal: "e17_icon_fileman_"TYPE".png"; \
|
||||
} \
|
||||
|
@ -45,23 +46,25 @@ group { \
|
|||
#define FILEMAN_ICON_CLICKABLE(TYPE) \
|
||||
group { \
|
||||
name: "icons/fileman/"TYPE; \
|
||||
max: 64 64; \
|
||||
max: 48 48; \
|
||||
parts { \
|
||||
part { \
|
||||
name: "icon"; \
|
||||
mouse_events: 0; \
|
||||
description { \
|
||||
state: "default" 0.0; \
|
||||
align: 0.5 0.0; \
|
||||
aspect: 1.0 1.0; \
|
||||
max: 64 64; \
|
||||
max: 48 48; \
|
||||
image { \
|
||||
normal: "e17_icon_fileman_"TYPE".png"; \
|
||||
} \
|
||||
} \
|
||||
description { \
|
||||
state: "clicked" 0.0; \
|
||||
align: 0.5 0.0; \
|
||||
aspect: 1.0 1.0; \
|
||||
max: 64 64; \
|
||||
max: 48 48; \
|
||||
image { \
|
||||
normal: "e17_icon_fileman_"TYPE"_clicked.png"; \
|
||||
} \
|
||||
|
@ -153,7 +156,7 @@ styles
|
|||
{
|
||||
style {
|
||||
name: "fileman_icon_style";
|
||||
base: "font=Edje-Vera color=#000 style=shadow shadow_color=#cccccc font_size=10 align=center wrap=char";
|
||||
base: "font=Edje-Vera color=#000 style=shadow shadow_color=#cccccc font_size=10 align=center wrap=char";
|
||||
tag: "br" "\n";
|
||||
tag: "hilight" "+ font=Edje-Vera-Bold";
|
||||
tag: "invisible" "+ font=Edje-Vera font_size=7 style=none color=#0002";
|
||||
|
@ -912,57 +915,50 @@ group {
|
|||
group {
|
||||
name: "fileman/icon_normal";
|
||||
min: 48 48;
|
||||
max: 128 128;
|
||||
max: 128 9999;
|
||||
parts {
|
||||
part {
|
||||
/* this is used for debugging */
|
||||
name: "ghost";
|
||||
type: RECT;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 128 128 128 128;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "icon_swallow";
|
||||
type: SWALLOW;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
min: 48 48;
|
||||
max: 128 128;
|
||||
max: 48 48;
|
||||
align: 0.5 0.0;
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 5 5;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -6 -20;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "icon_title";
|
||||
type: TEXT;
|
||||
effect: SHADOW;
|
||||
type: SWALLOW;
|
||||
description {
|
||||
fixed: 1 1;
|
||||
align: 0.5 0.0;
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "icon_swallow";
|
||||
relative: 0.0 1.0;
|
||||
offset: 5 -6;
|
||||
offset: -1 -1;
|
||||
}
|
||||
rel2 {
|
||||
to: "icon_swallow";
|
||||
relative: 1.0 1.0;
|
||||
offset: -6 -6;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
color3: 255 255 255 128;
|
||||
text {
|
||||
text: "No Title";
|
||||
align: 0.0 0.0;
|
||||
font: "Edje-Vera";
|
||||
size: 10;
|
||||
// min: 1 1;
|
||||
}
|
||||
offset: -1 -1;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
text {
|
||||
font: "Edje-Vera-Bold";
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
|
@ -974,12 +970,10 @@ group {
|
|||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
//to: "icon_swallow";
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
//to: "icon_swallow";
|
||||
}
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _E_Smart_Data E_Smart_Data;
|
|||
|
||||
struct _E_Smart_Data
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord x, y, w, h, iw, ih;
|
||||
|
||||
Evas *evas;
|
||||
Evas_Object *obj;
|
||||
|
@ -19,6 +19,7 @@ struct _E_Smart_Data
|
|||
Evas_Object *icon_object;
|
||||
Evas_Object *image_object;
|
||||
Evas_Object *entry_object;
|
||||
Evas_Object *title_object;
|
||||
|
||||
E_Fm_File *file;
|
||||
|
||||
|
@ -132,8 +133,8 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
|
|||
if (e_thumb_exists(sd->file->path))
|
||||
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
||||
sd->evas,
|
||||
sd->w,
|
||||
sd->h);
|
||||
sd->iw,
|
||||
sd->ih);
|
||||
else
|
||||
{
|
||||
thumb_files = evas_list_append(thumb_files, sd);
|
||||
|
@ -148,23 +149,47 @@ e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file)
|
|||
|
||||
_e_fm_icon_type_set(sd);
|
||||
|
||||
edje_object_size_min_calc(sd->icon_object, &icon_w, &icon_h);
|
||||
evas_object_resize(sd->icon_object, icon_w, icon_h);
|
||||
evas_object_resize(sd->event_object, icon_w, icon_h);
|
||||
evas_object_resize(sd->obj, icon_w, icon_h);
|
||||
//edje_object_size_min_calc(sd->icon_object, &icon_w, &icon_h);
|
||||
//evas_object_resize(sd->icon_object, icon_w, icon_h);
|
||||
//evas_object_resize(sd->event_object, icon_w, icon_h);
|
||||
//evas_object_resize(sd->obj, icon_w, icon_h);
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_title_set(Evas_Object *obj, const char *title)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
E_FREE(sd->saved_title);
|
||||
sd->saved_title = E_NEW(char, strlen(title) + 1);
|
||||
snprintf(sd->saved_title, strlen(title) + 1, "%s", title);
|
||||
if (sd->icon_object) edje_object_part_text_set(sd->icon_object, "icon_title", title);
|
||||
//if (sd->icon_object) edje_object_part_text_set(sd->icon_object, "icon_title", title);
|
||||
if(sd->icon_object)
|
||||
{
|
||||
Evas_Textblock_Style *e_editable_text_style;
|
||||
Evas_Coord fw, fh, il, ir, it, ib;
|
||||
|
||||
e_editable_text_style = evas_textblock_style_new();
|
||||
evas_textblock_style_set(e_editable_text_style, "DEFAULT='font=Vera font_size=10 style=shadow shadow_color=#ffffff80 align=center color=#000000 wrap=char'");
|
||||
|
||||
|
||||
evas_object_textblock_style_set(sd->title_object, e_editable_text_style);
|
||||
evas_object_textblock_text_markup_set(sd->title_object, sd->file->name);
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, 1);
|
||||
evas_object_textblock_size_formatted_get(sd->title_object, &fw, &fh);
|
||||
evas_object_textblock_style_insets_get(sd->title_object, &il, &ir, &it, &ib);
|
||||
|
||||
sd->h = sd->ih + fh + it + ib;
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, fh + it + ib);
|
||||
edje_extern_object_min_size_set(sd->title_object, sd->w, fh + it + ib);
|
||||
evas_object_resize(sd->icon_object, sd->w, sd->h);
|
||||
evas_object_resize(sd->obj, sd->w, sd->h);
|
||||
edje_object_part_swallow(sd->icon_object, "icon_title", sd->title_object);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -206,6 +231,19 @@ e_fm_icon_assoc_set(Evas_Object *obj, const char *assoc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
e_fm_icon_image_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
sd->iw = w;
|
||||
sd->ih = h;
|
||||
evas_object_resize(sd->image_object, w, h);
|
||||
}
|
||||
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_fm_icon_smart_add(Evas_Object *obj)
|
||||
|
@ -219,12 +257,19 @@ _e_fm_icon_smart_add(Evas_Object *obj)
|
|||
sd->obj = obj;
|
||||
sd->saved_title = NULL;
|
||||
sd->type = E_FM_ICON_NORMAL;
|
||||
sd->w = 64;
|
||||
sd->h = 64;
|
||||
sd->iw = 48;
|
||||
sd->ih = 48;
|
||||
sd->event_object = evas_object_rectangle_add(sd->evas);
|
||||
evas_object_color_set(sd->event_object, 0, 0, 0, 0);
|
||||
evas_object_smart_member_add(sd->event_object, obj);
|
||||
evas_object_show(sd->event_object);
|
||||
evas_object_smart_data_set(obj, sd);
|
||||
|
||||
|
||||
sd->title_object = evas_object_textblock_add(sd->evas);
|
||||
evas_object_smart_member_add(sd->title_object, obj);
|
||||
|
||||
sd->visible = 1;
|
||||
sd->icon_object = edje_object_add(sd->evas);
|
||||
evas_object_smart_member_add(sd->icon_object, obj);
|
||||
|
@ -257,6 +302,11 @@ _e_fm_icon_smart_del(Evas_Object *obj)
|
|||
evas_object_smart_member_del(sd->image_object);
|
||||
evas_object_del(sd->image_object);
|
||||
}
|
||||
if (sd->title_object)
|
||||
{
|
||||
evas_object_smart_member_del(sd->title_object);
|
||||
evas_object_del(sd->title_object);
|
||||
}
|
||||
E_FREE(sd->saved_title);
|
||||
if (sd->file) e_object_unref(E_OBJECT(sd->file));
|
||||
free(sd);
|
||||
|
@ -289,10 +339,13 @@ _e_fm_icon_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
|||
|
||||
if(sd->w == w && sd->h == h) return;
|
||||
|
||||
evas_object_resize(sd->event_object, w, h);
|
||||
if (sd->icon_object) evas_object_resize(sd->icon_object, w, h);
|
||||
sd->w = w;
|
||||
sd->h = h;
|
||||
if(sd->h < h)
|
||||
sd->h = h;
|
||||
|
||||
evas_object_resize(sd->event_object, sd->w, sd->h);
|
||||
if (sd->icon_object) evas_object_resize(sd->icon_object, sd->w, sd->h);
|
||||
|
||||
//if (sd->image_object) evas_object_resize(sd->image_object, w, h);
|
||||
}
|
||||
|
||||
|
@ -402,7 +455,7 @@ _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event)
|
|||
if (sd->image_object) evas_object_del(sd->image_object);
|
||||
sd->image_object = e_thumb_evas_object_get(sd->file->path,
|
||||
sd->evas,
|
||||
sd->w, sd->h);
|
||||
sd->iw, sd->ih);
|
||||
edje_object_part_swallow(sd->icon_object, "icon_swallow",
|
||||
sd->image_object);
|
||||
}
|
||||
|
@ -440,8 +493,52 @@ _e_fm_icon_type_set(E_Smart_Data *sd)
|
|||
evas_object_show(sd->image_object);
|
||||
}
|
||||
|
||||
if(sd->saved_title)
|
||||
edje_object_part_text_set(sd->icon_object, "icon_title", sd->saved_title);
|
||||
if(sd->saved_title)
|
||||
{
|
||||
Evas_Textblock_Style *e_editable_text_style;
|
||||
Evas_Coord fw, fh, il, ir, it, ib;
|
||||
|
||||
e_editable_text_style = evas_textblock_style_new();
|
||||
evas_textblock_style_set(e_editable_text_style, "DEFAULT='font=Vera font_size=10 align=center color=#000000 wrap=char'");
|
||||
|
||||
|
||||
evas_object_textblock_style_set(sd->title_object, e_editable_text_style);
|
||||
evas_object_textblock_text_markup_set(sd->title_object, sd->file->name);
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, 1);
|
||||
evas_object_textblock_size_formatted_get(sd->title_object, &fw, &fh);
|
||||
evas_object_textblock_style_insets_get(sd->title_object, &il, &ir, &it, &ib);
|
||||
|
||||
sd->h = sd->ih + fh + it + ib;
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, fh + it + ib);
|
||||
edje_extern_object_min_size_set(sd->title_object, sd->w, fh + it + ib);
|
||||
evas_object_resize(sd->icon_object, sd->w, sd->h);
|
||||
evas_object_resize(sd->obj, sd->w, sd->h);
|
||||
edje_object_part_swallow(sd->icon_object, "icon_title", sd->title_object);
|
||||
}
|
||||
else
|
||||
edje_object_part_text_set(sd->icon_object, "icon_title", sd->file->name);
|
||||
{
|
||||
Evas_Textblock_Style *e_editable_text_style;
|
||||
Evas_Coord fw, fh, il, ir, it, ib;
|
||||
|
||||
e_editable_text_style = evas_textblock_style_new();
|
||||
evas_textblock_style_set(e_editable_text_style, "DEFAULT='font=Vera font_size=10 align=center color=#000000 wrap=char'");
|
||||
|
||||
|
||||
evas_object_textblock_style_set(sd->title_object, e_editable_text_style);
|
||||
evas_object_textblock_text_markup_set(sd->title_object, sd->file->name);
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, 1);
|
||||
evas_object_textblock_size_formatted_get(sd->title_object, &fw, &fh);
|
||||
evas_object_textblock_style_insets_get(sd->title_object, &il, &ir, &it, &ib);
|
||||
|
||||
sd->h = sd->ih + fh + it + ib;
|
||||
|
||||
evas_object_resize(sd->title_object, sd->w, fh + it + ib);
|
||||
edje_extern_object_min_size_set(sd->title_object, sd->w, fh + it + ib);
|
||||
evas_object_resize(sd->icon_object, sd->w, sd->h);
|
||||
evas_object_resize(sd->obj, sd->w, sd->h);
|
||||
edje_object_part_swallow(sd->icon_object, "icon_title", sd->title_object);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ EAPI void e_fm_icon_title_set(Evas_Object *obj, const char *title);
|
|||
EAPI void e_fm_icon_type_set(Evas_Object *obj, int type);
|
||||
EAPI void e_fm_icon_edit_entry_set(Evas_Object *obj, Evas_Object *entry);
|
||||
EAPI void e_fm_icon_signal_emit(Evas_Object *obj, const char *source, const char *emission);
|
||||
EAPI void e_fm_icon_image_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -513,8 +513,8 @@ _e_fm_smart_add(Evas_Object *object)
|
|||
|
||||
sd->icon_info.w = 48;
|
||||
sd->icon_info.h = 48;
|
||||
sd->icon_info.x_space = 25;
|
||||
sd->icon_info.y_space = 25;
|
||||
sd->icon_info.x_space = 12;
|
||||
sd->icon_info.y_space = 10;
|
||||
|
||||
sd->evas = evas_object_evas_get(object);
|
||||
sd->frozen = 0;
|
||||
|
@ -1352,10 +1352,12 @@ _e_fm_dir_set(E_Fm_Smart_Data *sd, const char *dir)
|
|||
{
|
||||
E_Fm_Icon *icon;
|
||||
Evas_Coord icon_w, icon_h;
|
||||
|
||||
Evas_Coord w, h;
|
||||
|
||||
icon = l->data;
|
||||
|
||||
evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
//evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
e_fm_icon_image_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
evas_object_show(icon->icon_object);
|
||||
evas_object_geometry_get(icon->icon_object, NULL, NULL, &icon_w, &icon_h);
|
||||
D(("_e_fm_dir_set: Icon, w=%d h=%d\n", icon_w, icon_h));
|
||||
|
@ -1427,10 +1429,12 @@ _e_fm_dir_files_get(E_Fm_Smart_Data *sd, int type)
|
|||
}
|
||||
else
|
||||
{
|
||||
Evas_Coord w, h;
|
||||
|
||||
icon->icon_object = e_fm_icon_add(sd->evas);
|
||||
icon->sd = sd;
|
||||
e_fm_icon_file_set(icon->icon_object, icon->file);
|
||||
evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
e_fm_icon_image_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
files = evas_list_append(files, icon);
|
||||
}
|
||||
}
|
||||
|
@ -1479,6 +1483,7 @@ _e_fm_dir_monitor_cb(void *data, Ecore_File_Monitor *ecore_file_monitor,
|
|||
char *dir;
|
||||
E_Fm_Icon *icon;
|
||||
Evas_List *l;
|
||||
Evas_Coord w, h;
|
||||
|
||||
sd = data;
|
||||
|
||||
|
@ -1502,8 +1507,7 @@ _e_fm_dir_monitor_cb(void *data, Ecore_File_Monitor *ecore_file_monitor,
|
|||
icon->sd = sd;
|
||||
e_icon_layout_freeze(sd->layout);
|
||||
e_fm_icon_file_set(icon->icon_object, icon->file);
|
||||
evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
evas_object_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
e_fm_icon_image_resize(icon->icon_object, sd->icon_info.w, sd->icon_info.h);
|
||||
evas_object_show(icon->icon_object);
|
||||
e_icon_layout_pack(sd->layout, icon->icon_object);
|
||||
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
|
||||
|
@ -2073,7 +2077,6 @@ _e_fm_icon_mouse_in_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
icon = data;
|
||||
|
||||
e_fm_icon_signal_emit(icon->icon_object, "hilight", "");
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -308,7 +308,7 @@ _e_icon_layout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *
|
|||
static void
|
||||
_e_icon_layout_smart_reconfigure(E_Smart_Data *sd)
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord x, y, w, h, maxw, maxh;
|
||||
Evas_List *l;
|
||||
|
||||
//if (!sd->changed) return;
|
||||
|
@ -317,6 +317,8 @@ _e_icon_layout_smart_reconfigure(E_Smart_Data *sd)
|
|||
y = sd->y + sd->ys;
|
||||
w = sd->vw;
|
||||
h = sd->vh;
|
||||
maxw = 0;
|
||||
maxh = 0;
|
||||
|
||||
if (sd->fixed == 0)
|
||||
{
|
||||
|
@ -327,11 +329,14 @@ _e_icon_layout_smart_reconfigure(E_Smart_Data *sd)
|
|||
|
||||
obj = l->data;
|
||||
li = evas_object_data_get(obj, "e_icon_layout_data");
|
||||
|
||||
if(li->h > maxh) maxh = li->h;
|
||||
|
||||
if(x > sd->x + w || x + li->w > sd->x + w)
|
||||
{
|
||||
x = sd->x + sd->xs;
|
||||
y += li->h + sd->ys;
|
||||
y += maxh + sd->ys;
|
||||
maxh = 0;
|
||||
}
|
||||
|
||||
li->x = x;
|
||||
|
@ -355,10 +360,13 @@ _e_icon_layout_smart_reconfigure(E_Smart_Data *sd)
|
|||
obj = l->data;
|
||||
li = evas_object_data_get(obj, "e_icon_layout_data");
|
||||
|
||||
if(li->w > maxw) maxw = li->w;
|
||||
|
||||
if(y > sd->y + h || y + li->h > sd->y + h)
|
||||
{
|
||||
y = sd->y + sd->ys;
|
||||
x += li->w + sd->xs;
|
||||
x += maxw + sd->xs;
|
||||
maxw = 0;
|
||||
}
|
||||
|
||||
li->x = x;
|
||||
|
|
Loading…
Reference in New Issue