signal: "clicked"; \
source: ""; \
action: STATE_SET "clicked" 0.0; \
+ transition: LINEAR 0.1; \
target: "icon"; \
} \
program { \
signal: "unclicked"; \
source: ""; \
action: STATE_SET "default" 0.0; \
+ transition: LINEAR 0.1; \
target: "icon"; \
} \
program { \
*/
#include "e.h"
+#define NEWD(str, typ) \
+ eet_data_descriptor_new(str, sizeof(typ), \
+ (void *(*) (void *))evas_list_next, \
+ (void *(*) (void *, void *))evas_list_append, \
+ (void *(*) (void *))evas_list_data, \
+ (void *(*) (void *))evas_list_free, \
+ (void (*) (void *, int (*) (void *, const char *, void *, void *), void *))evas_hash_foreach, \
+ (void *(*) (void *, const char *, void *))evas_hash_add, \
+ (void (*) (void *))evas_hash_free)
+
+#define FREED(eed) \
+ if (eed) \
+ { \
+ eet_data_descriptor_free((eed)); \
+ (eed) = NULL; \
+ }
+#define NEWI(str, it, type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_icon_meta_edd, E_Fm_Icon_Metadata, str, it, type)
+
+
typedef struct _E_Smart_Data E_Smart_Data;
struct _E_Smart_Data
static void _e_fm_icon_type_set(E_Smart_Data *sd);
+static void _e_fm_icon_meta_fill(E_Fm_Icon_Metadata *m, E_Smart_Data *sd);
/* local subsystem globals */
static Evas_Smart *e_smart = NULL;
static Evas_List *event_handlers = NULL;
+static Eet_Data_Descriptor *_e_fm_icon_meta_edd = NULL;
+
/* externally accessible functions */
int
e_fm_icon_init(void)
{
+ _e_fm_icon_meta_edd = NEWD("E_Fm_Icon_Metadata", E_Fm_Icon_Metadata);
+ NEWI("x", x, EET_T_INT);
+ NEWI("y", y, EET_T_INT);
+ NEWI("w", w, EET_T_INT);
+ NEWI("h", h, EET_T_INT);
+ NEWI("nm", name, EET_T_STRING);
+
event_handlers = evas_list_append(event_handlers,
ecore_event_handler_add(ECORE_EVENT_EXE_EXIT,
_e_fm_icon_thumb_cb_exe_exit,
int
e_fm_icon_shutdown(void)
{
+ FREED(_e_fm_icon_meta_edd);
while (event_handlers)
{
ecore_event_handler_del(event_handlers->data);
e_fm_icon_type_set(Evas_Object *obj, int type)
{
E_Smart_Data *sd;
-
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+
if(sd->type == type)
return;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
- e_object_ref(E_OBJECT(file));
+ if(!sd->file)
+ e_object_ref(E_OBJECT(file));
sd->file = file;
file->icon_object = obj;
}
void
+e_fm_icon_appear_cb(Evas_Object *obj, void *data)
+{
+ E_Smart_Data *sd;
+
+ evas_object_show(obj);
+ return;
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+ if(sd->visible) return;
+ sd->visible = 1;
+
+ sd->icon_object = edje_object_add(sd->evas);
+ evas_object_smart_member_add(sd->icon_object, obj);
+
+ 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_smart_data_set(obj, sd);
+
+ e_fm_icon_file_set(obj, sd->file);
+ evas_object_show(obj);
+}
+
+void
+e_fm_icon_disappear_cb(Evas_Object *obj, void *data)
+{
+ E_Smart_Data *sd;
+
+ evas_object_hide(obj);
+ return;
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+ if(!sd->visible) return;
+ sd->visible = 0;
+
+ if (sd->event_object) evas_object_del(sd->event_object);
+ if (sd->icon_object) evas_object_del(sd->icon_object);
+ if (sd->image_object) evas_object_del(sd->image_object);
+ if (sd->thumb_object) evas_object_del(sd->thumb_object);
+ E_FREE(sd->saved_title);
+}
+
+void
e_fm_icon_title_set(Evas_Object *obj, const char *title)
{
E_Smart_Data *sd;
if (sd->image_object) edje_object_signal_emit(sd->image_object, source, emission);
}
+E_Fm_Icon_Metadata *
+e_fm_icon_meta_generate(Evas_Object *obj)
+{
+ E_Smart_Data *sd;
+ E_Fm_Icon_Metadata *m;
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+
+ m = calloc(1, sizeof(E_Fm_Icon_Metadata));
+ if (!m) return NULL;
+ _e_fm_icon_meta_fill(m, sd);
+
+ return m;
+}
+
+void
+e_fm_icon_meta_free(E_Fm_Icon_Metadata *m)
+{
+ if (!m) return;
+ E_FREE(m->name);
+
+ free(m);
+}
+
+
int
e_fm_icon_assoc_set(Evas_Object *obj, const char *assoc)
{
sd->h = 64;
sd->iw = 48;
sd->ih = 48;
+ sd->file = NULL;
sd->icon_object = edje_object_add(sd->evas);
evas_object_smart_member_add(sd->icon_object, obj);
if ((sd->x == x) && (sd->y == y)) return;
sd->x = x;
sd->y = y;
- evas_object_move(sd->event_object, x, y);
- evas_object_move(sd->icon_object, x, y);
+ if(sd->event_object)
+ evas_object_move(sd->event_object, x, y);
+ if(sd->icon_object)
+ evas_object_move(sd->icon_object, x, y);
}
static void
if ((sd->w == w) && (sd->h == h)) return;
sd->w = w;
sd->h = h;
- evas_object_resize(sd->event_object, sd->w, sd->h);
+ if(sd->event_object)
+ evas_object_resize(sd->event_object, sd->w, sd->h);
+ if(sd->icon_object)
evas_object_resize(sd->icon_object, sd->w, sd->h);
}
sd = evas_object_smart_data_get(obj);
if (!sd) return;
- evas_object_show(sd->icon_object);
+ if(sd->event_object)
+ evas_object_show(sd->icon_object);
+ if(sd->icon_object)
evas_object_show(sd->event_object);
}
sd = evas_object_smart_data_get(obj);
if (!sd) return;
+ if(sd->event_object)
evas_object_hide(sd->icon_object);
- evas_object_hide(sd->event_object);
+ if(sd->icon_object)
+ evas_object_hide(sd->event_object);
}
static void
edje_object_part_text_set(sd->icon_object, "icon_title", sd->file->name);
}
}
+
+static void
+_e_fm_icon_meta_fill(E_Fm_Icon_Metadata *m, E_Smart_Data *sd)
+{
+ m->x = sd->x;
+ m->y = sd->y;
+ m->w = sd->w;
+ m->h = sd->h;
+ m->name = strdup(sd->file->name);
+}
#ifdef E_TYPEDEFS
typedef enum _E_Fm_Icon_Type E_Fm_Icon_Type;
+typedef struct _E_Fm_Icon_Metadata E_Fm_Icon_Metadata;
#else
#ifndef E_FILEMAN_FILE_SMART_H
E_FM_ICON_LIST
};
-EAPI int e_fm_icon_init(void);
-EAPI int e_fm_icon_shutdown(void);
-EAPI Evas_Object *e_fm_icon_add(Evas *evas);
-EAPI E_Fm_File *e_fm_icon_file_get(Evas_Object *obj);
-EAPI void e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file);
-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);
-EAPI void e_fm_icon_size_min_calc(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
-
+struct _E_Fm_Icon_Metadata
+{
+ Evas_Coord x, y, w, h; /* geometry */
+ char *name; /* filename */
+};
+
+EAPI int e_fm_icon_init(void);
+EAPI int e_fm_icon_shutdown(void);
+EAPI Evas_Object *e_fm_icon_add(Evas *evas);
+EAPI E_Fm_File *e_fm_icon_file_get(Evas_Object *obj);
+EAPI void e_fm_icon_file_set(Evas_Object *obj, E_Fm_File *file);
+EAPI void e_fm_icon_appear_cb(Evas_Object *obj, void *data);
+EAPI void e_fm_icon_disappear_cb(Evas_Object *obj, void *data);
+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 E_Fm_Icon_Metadata *e_fm_icon_meta_generate(Evas_Object *obj);
+EAPI void e_fm_icon_meta_free(E_Fm_Icon_Metadata *m);
#endif
#endif
# define D(x) ((void) 0)
#endif
+#define NEWD(str, typ) \
+ eet_data_descriptor_new(str, sizeof(typ), \
+ (void *(*) (void *))evas_list_next, \
+ (void *(*) (void *, void *))evas_list_append, \
+ (void *(*) (void *))evas_list_data, \
+ (void *(*) (void *))evas_list_free, \
+ (void (*) (void *, int (*) (void *, const char *, void *, void *), void *))evas_hash_foreach, \
+ (void *(*) (void *, const char *, void *))evas_hash_add, \
+ (void (*) (void *))evas_hash_free)
+
+#define FREED(eed) \
+ if (eed) \
+ { \
+ eet_data_descriptor_free((eed)); \
+ (eed) = NULL; \
+ }
+#define INEWI(str, it, type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_icon_meta_edd, E_Fm_Icon_Metadata, str, it, type)
+#define NEWI(str, it, type) \
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm_dir_meta_edd, E_Fm_Dir_Metadata, str, it, type)
+#define NEWL(str, it, type) \
+ EET_DATA_DESCRIPTOR_ADD_LIST(_e_fm_icon_meta_edd, E_Fm_Dir_Metadata, str, it, type)
+
typedef struct _E_Fm_Smart_Data E_Fm_Smart_Data;
typedef struct _E_Fm_Icon E_Fm_Icon;
typedef struct _E_Fm_Icon_CFData E_Fm_Icon_CFData;
typedef struct _E_Fm_Config E_Fm_Config;
+typedef struct _E_Fm_Dir_Metadata E_Fm_Dir_Metadata;
typedef struct _E_Fm_Fake_Mouse_Up_Info E_Fm_Fake_Mouse_Up_Info;
typedef enum _E_Fm_Arrange E_Fm_Arrange;
int height;
};
+struct _E_Fm_Dir_Metadata
+{
+ char *name; /* dir name */
+ char *bg; /* dir's custom bg */
+ int view; /* dir's saved view type */
+ Evas_List *files; /* files in dir */
+
+ /* these are generated post-load */
+ Evas_Hash *files_hash; /* quick lookup hash */
+};
+
struct _E_Fm_Icon
{
E_Fm_File *file;
Evas_Object *object;
Evas_Object *entry_object;
+ E_Fm_Dir_Metadata *meta;
+
char *dir;
DIR *dir2;
static void _e_fm_selector_send_file (E_Fm_Icon *icon);
+static char *_e_fm_dir_meta_dir_id(char *dir);
+static int _e_fm_dir_meta_load(E_Fm_Smart_Data *sd);
+static int _e_fm_dir_meta_generate(E_Fm_Smart_Data *sd);
+static void _e_fm_dir_meta_free(E_Fm_Dir_Metadata *m);
+static int _e_fm_dir_meta_save(E_Fm_Smart_Data *sd);
+static void _e_fm_dir_meta_fill(E_Fm_Dir_Metadata *m, E_Fm_Smart_Data *sd);
+
+
static Ecore_Event_Handler *e_fm_mouse_up_handler = NULL;
static double e_fm_grab_time = 0;
static Evas_Smart *e_fm_smart = NULL;
+static char *meta_path = NULL;
+static Eet_Data_Descriptor *_e_fm_dir_meta_edd = NULL;
+static Eet_Data_Descriptor *_e_fm_icon_meta_edd = NULL;
/* externally accessible functions */
int
e_fm_init(void)
{
+ char *homedir;
+ char path[PATH_MAX];
+
+ homedir = e_user_homedir_get();
+ if (homedir)
+ {
+ snprintf(path, sizeof(path), "%s/.e/e/fileman/metadata", homedir);
+ if (!ecore_file_exists(path))
+ ecore_file_mkpath(path);
+ meta_path = strdup(path);
+ free(homedir);
+ }
+ else return 0;
+
e_fm_smart = evas_smart_new("e_fm",
_e_fm_smart_add, /* add */
_e_fm_smart_del, /* del */
_e_fm_smart_clip_unset, /* clip_unset */
NULL); /* data*/
+ _e_fm_icon_meta_edd = NEWD("E_Fm_Icon_Metadata", E_Fm_Icon_Metadata);
+ INEWI("x", x, EET_T_INT);
+ INEWI("y", y, EET_T_INT);
+ INEWI("w", w, EET_T_INT);
+ INEWI("h", h, EET_T_INT);
+ INEWI("nm", name, EET_T_STRING);
+
+ _e_fm_dir_meta_edd = NEWD("E_Fm_Dir_Metadata", E_Fm_Dir_Metadata);
+ NEWI("nm", name, EET_T_STRING);
+ NEWI("bg", bg, EET_T_STRING);
+ NEWI("vw", view, EET_T_INT);
+ NEWL("fl", files, _e_fm_icon_meta_edd);
+
E_EVENT_FM_RECONFIGURE = ecore_event_type_new();
E_EVENT_FM_DIRECTORY_CHANGE = ecore_event_type_new();
return 1;
int
e_fm_shutdown(void)
{
+ FREED(_e_fm_dir_meta_edd);
+ FREED(_e_fm_icon_meta_edd);
evas_smart_free(e_fm_smart);
return 1;
}
if (!sd) return;
sd->object = object;
+ sd->meta = NULL;
+
sd->icon_info.w = 64;
sd->icon_info.h = 64;
sd->icon_info.x_space = 12;
_e_fm_mouse_move_cb, sd);
sd->layout = e_icon_layout_add(sd->evas);
+ e_icon_layout_viewport_set(sd->layout, sd->edje_obj);
e_icon_layout_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space);
evas_object_show(sd->layout);
if (sd->dir) free (sd->dir);
sd->dir = strdup(dir);
+ if(sd->meta)
+ {
+ _e_fm_dir_meta_free(sd->meta);
+ sd->meta = NULL;
+ }
+
+ _e_fm_dir_meta_load(sd);
+
+ if(sd->meta)
+ {
+ Evas_List *l;
+ printf("Loaded meta! (%s) %p\n", sd->meta->name, sd->meta->files);
+ for(l = sd->meta->files; l; l = l->next)
+ {
+ E_Fm_Icon_Metadata *im;
+ im = l->data;
+ printf("META: file = %s\n", im->name);
+ }
+ }
+
+
+
/* Reset position */
sd->position = 0.0;
e_fm_icon_file_set(icon->icon_object, icon->file);
sd->files = evas_list_prepend(sd->files, icon);
e_icon_layout_pack(sd->layout, icon->icon_object);
+ e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, sd);
evas_object_show(icon->icon_object);
- e_icon_layout_pack(sd->layout, icon->icon_object);
+ e_icon_layout_pack(sd->layout, icon->icon_object);
+ e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
}
i++;
}
{
icon = l->data;
e_icon_layout_pack(sd->layout, icon->icon_object);
+ e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
}
e_icon_layout_thaw(sd->layout);
sd->timer = NULL;
+
+ if(!sd->meta)
+ {
+ printf("Generating Meta!\n");
+ _e_fm_dir_meta_generate(sd);
+ _e_fm_dir_meta_save(sd);
+ }
+
return 0;
}
else
//evas_object_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);
+ e_icon_layout_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon);
evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon);
{
icon->sd->selector_func(icon->sd->object, strdup(icon->file->path), icon->sd->selector_data);
}
+
+static char *
+_e_fm_dir_meta_dir_id(char *dir)
+{
+ char s[256], *sp;
+ const char *chmap =
+ "0123456789abcdef"
+ "ghijklmnopqrstuv"
+ "wxyz~!@#$%^&*()"
+ "[];',.{}<>?-=_+|";
+ unsigned int id[4], i;
+ struct stat st;
+
+ if (stat(dir, &st) < 0)
+ return NULL;
+
+ id[0] = st.st_ino;
+ id[1] = st.st_dev;
+ id[2] = (st.st_size & 0xffffffff);
+ id[3] = (st.st_mtime & 0xffffffff);
+
+ sp = s;
+ for (i = 0; i < 4; i++)
+ {
+ unsigned int t, tt;
+ int j;
+
+ t = id[i];
+ j = 32;
+ while (j > 0)
+ {
+ tt = t & ((1 << 6) - 1);
+ *sp = chmap[tt];
+ t >>= 6;
+ j -= 6;
+ sp++;
+ }
+ }
+ *sp = 0;
+ return strdup(s);
+}
+
+
+static int
+_e_fm_dir_meta_load(E_Fm_Smart_Data *sd)
+{
+ E_Fm_Dir_Metadata *m;
+ Eet_File *ef;
+ char buf[PATH_MAX];
+ char *hash;
+
+ if (!sd->dir) return 0;
+
+ hash = _e_fm_dir_meta_dir_id(sd->dir);
+ snprintf(buf, sizeof(buf), "%s/%s", meta_path, hash);
+ ef = eet_open(buf, EET_FILE_MODE_READ);
+ if (!ef) return 0;
+ m = eet_data_read(ef, _e_fm_dir_meta_edd, "metadata");
+ eet_close(ef);
+ if (m)
+ {
+ Evas_List *l;
+
+ for (l = m->files; l; l = l->next)
+ {
+ E_Fm_Icon_Metadata *im;
+
+ im = l->data;
+ printf("loading %s\n", im->name);
+ m->files = evas_list_append(m->files, im);
+ m->files_hash = evas_hash_add(m->files_hash, im->name, im);
+ }
+ }
+ free(hash);
+ sd->meta = m;
+ return 1;
+}
+
+static int
+_e_fm_dir_meta_generate(E_Fm_Smart_Data *sd)
+{
+ E_Fm_Dir_Metadata *m;
+ Evas_List *l;
+
+ if (!sd->dir) return 0;
+ m = calloc(1, sizeof(E_Fm_Dir_Metadata));
+ if (!m) return 0;
+ _e_fm_dir_meta_fill(m, sd);
+ for (l = sd->files; l; l = l->next)
+ {
+ E_Fm_Icon_Metadata *im;
+ E_Fm_Icon *icon;
+
+ icon = l->data;
+ im = e_fm_icon_meta_generate(icon->icon_object);
+ if (im)
+ {
+ printf("adding %s\n", im->name);
+ m->files = evas_list_append(m->files, im);
+ m->files_hash = evas_hash_add(m->files_hash, icon->file->name, im);
+ }
+ }
+ sd->meta = m;
+ return 1;
+}
+
+static void
+_e_fm_dir_meta_free(E_Fm_Dir_Metadata *m)
+{
+ if (!m) return;
+ E_FREE(m->name);
+ while (m->files)
+ {
+ E_Fm_Icon_Metadata *im;
+
+ im = m->files->data;
+ m->files = evas_list_remove_list(m->files, m->files);
+ e_fm_icon_meta_free(im);
+ }
+ evas_hash_free(m->files_hash);
+ free(m);
+}
+
+static int
+_e_fm_dir_meta_save(E_Fm_Smart_Data *sd)
+{
+ Eet_File *ef;
+ char *hash;
+ char buf[4096];
+ int ret;
+
+ if (!sd->meta) return 0;
+ hash = _e_fm_dir_meta_dir_id(sd->dir);
+ snprintf(buf, sizeof(buf), "%s/%s", meta_path, hash);
+ ef = eet_open(buf, EET_FILE_MODE_WRITE);
+ if (!ef) return 0;
+ ret = eet_data_write(ef, _e_fm_dir_meta_edd, "metadata", sd->meta, 1);
+ eet_close(ef);
+ free(hash);
+ return ret;
+}
+
+static void
+_e_fm_dir_meta_fill(E_Fm_Dir_Metadata *m, E_Fm_Smart_Data *sd)
+{
+ m->name = strdup(sd->dir);
+ m->bg = NULL;
+ m->view = 1;
+}
-#include <Evas.h>
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include "e.h"
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Icon_Layout_Item E_Icon_Layout_Item;
int clip_frozen;
int fixed;
unsigned char changed : 1;
- Evas_List *items;
+ Evas_List *items;
+
+ struct {
+ Evas_Object *obj;
+ Evas_Coord x, y, w, h;
+ } viewport;
};
struct _E_Icon_Layout_Item
E_Smart_Data *sd;
Evas_Coord x, y, w, h;
Evas_Object *obj;
+ void (*appear_func)(Evas_Object *obj, void *data);
+ void (*disappear_func)(Evas_Object *obj, void *data);
+ void *data;
};
/* local subsystem functions */
_e_icon_layout_smart_reconfigure(sd);
}
+void e_icon_layout_icon_callbacks_set(Evas_Object *child, void (*appear)(Evas_Object *obj, void *data), void (*disappear)(Evas_Object *obj, void *data), void *data)
+{
+ E_Icon_Layout_Item *li;
+
+ li = evas_object_data_get(child, "e_icon_layout_data");
+ if (!li) return;
+
+ li->appear_func = appear;
+ li->disappear_func = disappear;
+ li->data = data;
+}
void
e_icon_layout_pack(Evas_Object *obj, Evas_Object *child)
sd->yc += li->h + sd->ys;
sd->vw = sd->xc - sd->x;
}
+
+ if(sd->viewport.obj && li->appear_func && li->disappear_func)
+ {
+ if(E_INTERSECTS(sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h))
+ {
+ li->appear_func(obj, li->data);
+ printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h);
+ }
+ else
+ {
+ li->disappear_func(obj, li->data);
+ printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h);
+ }
+ }
+
_e_icon_layout_smart_move_resize_item(li);
}
sd->clip_frozen = 0;
}
+void
+e_icon_layout_viewport_set(Evas_Object *obj, Evas_Object *viewport)
+{
+ E_Smart_Data *sd;
+
+ if ((!obj) || !(sd = evas_object_smart_data_get(obj)))
+ return;
+
+ if(!viewport) return;
+ sd->viewport.obj = viewport;
+ evas_object_geometry_get(sd->viewport.obj, &(sd->viewport.x), &(sd->viewport.y),
+ &(sd->viewport.w), &(sd->viewport.h));
+ if (sd->frozen <= 0) _e_icon_layout_smart_reconfigure(sd);
+}
+
+Evas_Object *
+e_icon_layout_viewport_get(Evas_Object *obj)
+{
+ /* TODO */
+}
+
+
/* local subsystem functions */
static E_Icon_Layout_Item *
_e_icon_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
if (!li) return NULL;
li->sd = sd;
li->obj = obj;
+ li->appear_func = NULL;
+ li->disappear_func = NULL;
+ li->data = NULL;
evas_object_geometry_get(obj, NULL, NULL, &li->w, &li->h);
/* defaults */
li->x = 0;
li->x = x;
li->y = y;
-
+
+ if(sd->viewport.obj && li->appear_func && li->disappear_func)
+ {
+ if(E_INTERSECTS(sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h))
+ {
+ printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h);
+ li->appear_func(obj, li->data);
+ }
+ else
+ {
+ li->disappear_func(obj, li->data);
+ printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h);
+ }
+ }
_e_icon_layout_smart_move_resize_item(li);
x += li->w + sd->xs;
sd->mw = 0;
sd->mh = 0;
sd->fixed = 0;
+ sd->viewport.obj = NULL;
sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_move(sd->clip, 0, 0);
evas_object_resize(sd->clip, 0, 0);
if (!sd) return;
if ((x == sd->x) && (y == sd->y)) return;
if ((x == sd->x) && (y == sd->y)) return;
+ if(sd->viewport.obj)
+ evas_object_geometry_get(sd->viewport.obj,
+ &(sd->viewport.x), &(sd->viewport.y),
+ &(sd->viewport.w), &(sd->viewport.h));
/* FIXME: this will get slow with 1000's of objects. be smarter. */
{
for (l = sd->items; l; l = l->next)
{
Evas_Coord ox, oy;
+ E_Icon_Layout_Item *li;
- evas_object_geometry_get(l->data, &ox, &oy, NULL, NULL);
+ li = evas_object_data_get(l->data, "e_icon_layout_data");
+ evas_object_geometry_get(l->data, &ox, &oy, NULL, NULL);
evas_object_move(l->data, ox + dx, oy + dy);
+ if(sd->viewport.obj && li->appear_func && li->disappear_func)
+ {
+ if(E_INTERSECTS(sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ ox + dx, oy + dy, li->w, li->h))
+ {
+ printf("appear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ li->x, li->y, li->w, li->h);
+ li->appear_func(li->obj, li->data);
+ }
+ else
+ {
+ li->disappear_func(li->obj, li->data);
+ printf("disappear! %d %d %d %d - %d %d %d %d\n",sd->viewport.x, sd->viewport.y,
+ sd->viewport.w, sd->viewport.h,
+ ox + dx, oy + dy, li->w, li->h);
+ }
+ }
}
}
sd->x = x;
sd->w = w;
sd->h = h;
sd->changed = 1;
+ if(sd->viewport.obj)
+ evas_object_geometry_get(sd->viewport.obj,
+ &(sd->viewport.x), &(sd->viewport.y),
+ &(sd->viewport.w), &(sd->viewport.h));
_e_icon_layout_smart_reconfigure(sd);
}
#ifndef E_ICON_LAYOUT_H
#define E_ICON_LAYOUT_H
-EAPI Evas_Object *e_icon_layout_add (Evas *evas);
-EAPI int e_icon_layout_freeze (Evas_Object *obj);
-EAPI int e_icon_layout_thaw (Evas_Object *obj);
-EAPI void e_icon_layout_virtual_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
-EAPI void e_icon_layout_virtual_size_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
-EAPI void e_icon_layout_width_fix (Evas_Object *obj, Evas_Coord w);
-EAPI void e_icon_layout_height_fix (Evas_Object *obj, Evas_Coord h);
-EAPI void e_icon_layout_pack (Evas_Object *obj, Evas_Object *child);
-EAPI void e_icon_layout_child_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
-EAPI void e_icon_layout_unpack (Evas_Object *obj);
-EAPI void e_icon_layout_spacing_set(Evas_Object *obj, Evas_Coord xs, Evas_Coord ys);
-EAPI void e_icon_layout_redraw_force (Evas_Object *obj);
-EAPI void e_icon_layout_clip_freeze (Evas_Object *obj);
-EAPI void e_icon_layout_clip_thaw (Evas_Object *obj);
-EAPI void e_icon_layout_sort (Evas_Object *obj, int (*func)(void *d1, void *d2));
+EAPI Evas_Object *e_icon_layout_add (Evas *evas);
+EAPI int e_icon_layout_freeze (Evas_Object *obj);
+EAPI int e_icon_layout_thaw (Evas_Object *obj);
+EAPI void e_icon_layout_virtual_size_set (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+EAPI void e_icon_layout_virtual_size_get (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+EAPI void e_icon_layout_width_fix (Evas_Object *obj, Evas_Coord w);
+EAPI void e_icon_layout_height_fix (Evas_Object *obj, Evas_Coord h);
+EAPI void e_icon_layout_pack (Evas_Object *obj, Evas_Object *child);
+EAPI void e_icon_layout_child_resize (Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+EAPI void e_icon_layout_unpack (Evas_Object *obj);
+EAPI void e_icon_layout_spacing_set (Evas_Object *obj, Evas_Coord xs, Evas_Coord ys);
+EAPI void e_icon_layout_redraw_force (Evas_Object *obj);
+EAPI void e_icon_layout_clip_freeze (Evas_Object *obj);
+EAPI void e_icon_layout_clip_thaw (Evas_Object *obj);
+EAPI void e_icon_layout_viewport_set (Evas_Object *obj, Evas_Object *viewport);
+EAPI void e_icon_layout_sort (Evas_Object *obj, int (*func)(void *d1, void *d2));
+EAPI void e_icon_layout_icon_callbacks_set (Evas_Object *child, void (*appear)(Evas_Object *obj, void *data), void (*disappear)(Evas_Object *obj, void *data), void *data);
#endif
#endif