been playing.. :)

SVN revision: 4379
This commit is contained in:
Carsten Haitzler 2001-03-16 01:14:42 +00:00
parent fffdf4722d
commit d1077ae93e
6 changed files with 216 additions and 117 deletions

View File

@ -28,5 +28,5 @@ util.c \
view.c \
e.h
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm $(INTLLIBS)
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm $(INTLLIBS) $(LDADD_FLAGS)

View File

@ -10,6 +10,7 @@ static void e_idle(void *data);
static void
e_idle(void *data)
{
printf("idle...\n");
e_db_flush();
return;
UN(data);
@ -166,7 +167,7 @@ e_desktops_init_file_display(E_Desktop *desk)
desk->view->bg->image = strdup(PACKAGE_DATA_DIR"/data/images/bg.jpg");
/* fixme later */
/* uncomment this and comment out the next line for some tress testing */
/* desk->view->dir = strdup("/dev");*/
/* desk->view->dir = strdup("/dev"); */
desk->view->dir = strdup(e_file_home());
e_view_realize(desk->view);
if (desk->view->options.back_pixmap) e_view_update(desk->view);

15
src/e.h
View File

@ -315,6 +315,14 @@ struct _E_View
struct {
Evas_Render_Method render_method;
int back_pixmap;
struct {
int method;
struct {
int dir;
int w, h;
int next_pos;
} grid;
} arrange;
} options;
Evas evas;
@ -380,11 +388,16 @@ struct _E_Icon
char *selected;
char *clicked;
} icon;
struct {
int have;
int x, y;
} coord;
int ready;
} info;
struct {
int x, y, w, h;
int x, y;
int ix, iy, tx, ty, iw, ih, tw, th, w, h;
struct {
int text_location;
int show_text;

110
src/fs.c
View File

@ -6,27 +6,27 @@ static Evas_List fs_handlers = NULL;
static void _e_fs_fd_handle(int fd);
static void
_e_fs_fd_handle_a_la_cK(int fd)
_e_fs_fd_handle(int fd)
{
EfsdEvent ev;
Evas_List l;
Evas_List events = NULL;
double start, current;
printf("############## fs event...\n");
start = e_get_time();
while ((ec) && efsd_events_pending(ec))
{
ZERO(&ev, EfsdEvent, 1);
{
EfsdEvent *ev;
if (efsd_next_event(ec, &ev) >= 0)
ev = NEW(EfsdEvent, 1);
ZERO(ev, EfsdEvent, 1);
if (efsd_next_event(ec, ev) >= 0)
{
for (l = fs_handlers; l; l = l->next)
{
void (*func) (EfsdEvent *ev);
func = l->data;
func(&ev);
}
events = evas_list_append(events, ev);
}
else
{
FREE(ev);
efsd_close(ec);
e_del_event_fd(fd);
ec = NULL;
@ -35,63 +35,37 @@ _e_fs_fd_handle_a_la_cK(int fd)
printf("EEEEEEEEEEK efsd went wonky\n");
}
efsd_event_cleanup(&ev);
}
}
static void
_e_fs_fd_handle(int fd)
{
EfsdEvent ev;
int i = 1;
/* VERY nasty - sicne efas has no way of checkign If an event is in the */
/* event queue waiting to be picked up - i cant loop and get the events */
printf("_e_fs_fd_handle(%i)\n", fd);
while (i >= 0)
{
fd_set fdset;
struct timeval tv;
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
tv.tv_sec = 0;
tv.tv_usec = 0;
select(fd + 1, &fdset, NULL, NULL, &tv);
if (FD_ISSET(fd, &fdset))
/* spent more thna 1/20th of a second here.. get out */
current = e_get_time();
if ((current - start) > 0.05)
{
i = efsd_next_event(ec, &ev);
if (i < 0)
{
efsd_close(ec);
e_del_event_fd(fd);
/* FIXME: need to queue a popup dialog here saying */
/* efsd went wonky */
printf("EEEEEEEEEEK efsd went wonky\n");
/*
ec = efsd_open();
if (ec)
e_add_event_fd(efsd_get_connection_fd(ec),
_e_fs_fd_handle);
*/
}
if (i >= 0)
{
Evas_List l;
for (l = fs_handlers; l; l = l->next)
{
void (*func) (EfsdEvent *ev);
func = l->data;
func(&ev);
}
efsd_event_cleanup(&ev);
}
printf("fs... too much time spent..\n");
break;
}
else
i = -1;
}
if (events)
{
Evas_List l;
for (l = events; l; l = l->next)
{
Evas_List ll;
EfsdEvent *ev;
ev = l->data;
for (ll = fs_handlers; ll; ll = ll->next)
{
void (*func) (EfsdEvent *ev);
func = ll->data;
func(ev);
}
efsd_event_cleanup(ev);
FREE(ev);
}
evas_list_free(events);
}
printf("############## fs done\n");
}
void
@ -125,7 +99,7 @@ e_fs_init(void)
fprintf(stderr, "efsd is not running - please run efsd.\n");
exit(-1);
}
e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle_a_la_cK);
e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle);
}
EfsdConnection *

View File

@ -79,10 +79,113 @@ e_icon_new(void)
return icon;
}
void
e_icon_place_grid(E_Icon *icon)
{
int x, y;
if (icon->view->options.arrange.grid.dir == 0) /* h */
{
int gw;
if (icon->view->options.arrange.grid.w > 0)
gw = icon->view->size.w / icon->view->options.arrange.grid.w;
else gw = 1;
y = icon->view->options.arrange.grid.next_pos / gw;
x = icon->view->options.arrange.grid.next_pos - (y * gw);
x *= icon->view->options.arrange.grid.w;
y *= icon->view->options.arrange.grid.h;
e_icon_set_xy(icon, x, y);
printf("GRID PLACE at %i %i\n", x, y);
icon->view->options.arrange.grid.next_pos++;
}
else /* v */
{
}
}
void
e_icon_pre_show(E_Icon *icon)
{
int x, y;
if (icon->info.ready) return;
printf("*********!!!!!!!!!!!!!!!********* update from e_icon_pre_show()\n");
e_icon_update(icon);
icon->info.ready = 1;
if (icon->info.coord.have)
{
x = icon->info.coord.x;
y = icon->info.coord.y;
e_icon_set_xy(icon, x, y);
}
else
{
if (icon->view->options.arrange.method == 0) /* grid */
{
/* need to redo whole grid... */
if ((icon->current.w > icon->view->options.arrange.grid.w) ||
(icon->current.h > icon->view->options.arrange.grid.h))
{
Evas_List l;
icon->view->options.arrange.grid.next_pos = 0;
icon->view->options.arrange.grid.w = icon->current.w;
icon->view->options.arrange.grid.h = icon->current.h;
for (l = icon->view->icons; l; l = l->next)
{
E_Icon *ic;
ic = l->data;
if (ic->info.ready)
e_icon_place_grid(ic);
}
}
else
e_icon_place_grid(icon);
}
}
e_icon_show(icon);
}
void
e_icon_calulcate_geometry(E_Icon *icon)
{
int iw, ih, tw, th;
double dtw, dth;
if (!icon->view) return;
dtw = 0; dth = 0; iw = 0; ih = 0;
evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &dtw, &dth);
tw = (int)dtw;
th = (int)dth;
evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
if (tw < iw)
{
icon->current.ix = icon->current.x;
icon->current.iy = icon->current.y;
icon->current.tx = icon->current.x + ((iw - tw) / 2);
icon->current.ty = icon->current.y + ih;
icon->current.w = iw;
icon->current.h = ih + th;
icon->current.iw = iw;
icon->current.ih = ih;
icon->current.tw = tw;
icon->current.th = th;
}
else
{
icon->current.ix = icon->current.x + ((tw - iw) / 2);
icon->current.iy = icon->current.y;
icon->current.tx = icon->current.x;
icon->current.ty = icon->current.y + ih;
icon->current.w = tw;
icon->current.h = ih + th;
icon->current.iw = iw;
icon->current.ih = ih;
icon->current.tw = tw;
icon->current.th = th;
}
}
void
@ -90,10 +193,10 @@ e_icon_realize(E_Icon *icon)
{
icon->obj.sel1 = evas_add_rectangle(icon->view->evas);
icon->obj.sel2 = evas_add_rectangle(icon->view->evas);
evas_set_layer(icon->view->evas, icon->obj.sel1, 11);
evas_set_layer(icon->view->evas, icon->obj.sel2, 11);
evas_set_color(icon->view->evas, icon->obj.sel1, 0, 0, 0, 0);
evas_set_color(icon->view->evas, icon->obj.sel2, 0, 0, 0, 0);
evas_set_layer(icon->view->evas, icon->obj.sel1, 11);
evas_set_layer(icon->view->evas, icon->obj.sel2, 11);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_IN, e_icon_in_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_OUT, e_icon_out_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, icon);
@ -169,7 +272,6 @@ void
e_icon_set_filename(E_Icon *icon, char *file)
{
IF_FREE(icon->file);
printf("e_icon_set_filename(%s)\n", file);
icon->file = strdup(file);
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
@ -181,6 +283,7 @@ e_icon_update(E_Icon *icon)
int obj_new = 0;
if (!icon->changed) return;
printf("icon (%s).. update\n", icon->file);
if (icon->current.state.clicked)
{
if (icon->info.icon.clicked)
@ -203,15 +306,19 @@ e_icon_update(E_Icon *icon)
}
if ((!icon->current.state.selected) && (icon->obj.sel_icon))
{
printf("no\n");
ebits_hide(icon->obj.sel_icon);
ebits_free(icon->obj.sel_icon);
icon->obj.sel_icon = NULL;
}
if (icon->obj.icon)
if ((icon->obj.icon) &&
(icon->current.icon) &&
((!icon->previous.icon) ||
((icon->previous.icon) &&
(!strcmp(icon->current.icon, icon->previous.icon)))))
{
int iw, ih;
printf("set file etc.\n");
evas_set_image_file(icon->view->evas, icon->obj.icon, icon->current.icon);
evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
evas_set_image_fill(icon->view->evas, icon->obj.icon, 0, 0, iw, ih);
@ -257,50 +364,50 @@ e_icon_update(E_Icon *icon)
}
}
if ((icon->previous.x != icon->current.x) ||
(icon->previous.y != icon->current.y))
(icon->previous.y != icon->current.y) ||
(icon->current.visible != icon->previous.visible) ||
(obj_new))
{
int fx, fy;
int iw, ih;
double tw, th;
evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &tw, &th);
evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
fx = icon->current.x + ((iw - tw) / 2);
fy = icon->current.y + ih;
evas_move(icon->view->evas, icon->obj.icon, icon->current.x, icon->current.y);
evas_move(icon->view->evas, icon->obj.filename, fx, fy);
evas_move(icon->view->evas, icon->obj.sel1, icon->current.x, icon->current.y);
evas_resize(icon->view->evas, icon->obj.sel1, iw, ih);
evas_move(icon->view->evas, icon->obj.sel2, fx, fy);
evas_resize(icon->view->evas, icon->obj.sel2, tw, th);
e_icon_calulcate_geometry(icon);
/* HRRRM - must optimize this*/
evas_move(icon->view->evas, icon->obj.icon, icon->current.ix, icon->current.iy);
evas_move(icon->view->evas, icon->obj.filename, icon->current.tx, icon->current.ty);
evas_move(icon->view->evas, icon->obj.sel1, icon->current.ix, icon->current.iy);
evas_resize(icon->view->evas, icon->obj.sel1, icon->current.iw, icon->current.ih);
evas_move(icon->view->evas, icon->obj.sel2, icon->current.tx, icon->current.ty);
evas_resize(icon->view->evas, icon->obj.sel2, icon->current.tw, icon->current.th);
evas_set_color(icon->view->evas, icon->obj.filename, 0, 0, 0, 255);
if (icon->obj.sel_icon)
/**/ if (icon->obj.sel_icon)
{
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;
ebits_get_insets(icon->obj.sel_icon, &pl, &pr, &pt, &pb);
ebits_move(icon->obj.sel_icon, icon->current.x - pl, icon->current.y - pt);
ebits_resize(icon->obj.sel_icon, iw + pl + pr, ih + pt + pb);
ebits_move(icon->obj.sel_icon, icon->current.ix - pl, icon->current.iy - pt);
ebits_resize(icon->obj.sel_icon, icon->current.iw + pl + pr, icon->current.ih + pt + pb);
}
}
if (icon->current.visible)
if (icon->current.visible != icon->previous.visible)
{
evas_show(icon->view->evas, icon->obj.icon);
evas_show(icon->view->evas, icon->obj.filename);
evas_show(icon->view->evas, icon->obj.sel1);
evas_show(icon->view->evas, icon->obj.sel2);
if (icon->obj.sel_icon) ebits_show(icon->obj.sel_icon);
}
else
{
evas_hide(icon->view->evas, icon->obj.icon);
evas_hide(icon->view->evas, icon->obj.filename);
evas_hide(icon->view->evas, icon->obj.sel1);
evas_hide(icon->view->evas, icon->obj.sel2);
if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon);
if (icon->current.visible)
{
evas_show(icon->view->evas, icon->obj.icon);
evas_show(icon->view->evas, icon->obj.filename);
evas_show(icon->view->evas, icon->obj.sel1);
evas_show(icon->view->evas, icon->obj.sel2);
if (icon->obj.sel_icon) ebits_show(icon->obj.sel_icon);
}
else
{
evas_hide(icon->view->evas, icon->obj.icon);
evas_hide(icon->view->evas, icon->obj.filename);
evas_hide(icon->view->evas, icon->obj.sel1);
evas_hide(icon->view->evas, icon->obj.sel2);
if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon);
}
}
icon->previous = icon->current;
icon->changed = 0;
printf("... done\n");
}

View File

@ -415,8 +415,6 @@ e_view_file_added(int id, char *file)
if (!e_view_filter_file(v, file)) return;
icon = e_icon_new();
e_icon_set_filename(icon, file);
e_icon_set_xy(icon, rand()%(v->size.w - 60), rand()%(v->size.h - 60));
e_icon_show(icon);
e_view_add_icon(v, icon);
sprintf(buf, "%s/%s", v->dir, file);
if (efsd_ready(e_fs_get_connection()))
@ -426,7 +424,7 @@ e_view_file_added(int id, char *file)
}
else
{
printf("Efsd not ready.\n");
printf("*********** EEEEEEEEEEEEEEEEEK Efsd not ready.\n");
}
v->changed = 1;
}
@ -616,7 +614,8 @@ e_view_handle_fs(EfsdEvent *ev)
}
icon->changed = 1;
icon->view->changed = 1;
if (!icon->info.link_get_id) icon->info.ready = 1;
if (!icon->info.link_get_id)
e_icon_pre_show(icon);
}
}
break;
@ -646,7 +645,8 @@ e_view_handle_fs(EfsdEvent *ev)
memcpy(icon->info.link, (char*)ev->efsd_reply_event.data, ev->efsd_reply_event.data_len);
icon->info.link[ev->efsd_reply_event.data_len] = 0;
icon->info.link_get_id = 0;
if (!icon->info.link_get_id) icon->info.ready = 1;
if (!icon->info.link_get_id)
e_icon_pre_show(icon);
icon->changed = 1;
icon->view->changed = 1;
printf("link_to = %s\n", icon->info.link);
@ -726,7 +726,8 @@ e_view_new(void)
#endif
#endif
views = evas_list_append(views, v);
/*
{
E_Shelf *sh;
@ -738,7 +739,7 @@ e_view_new(void)
e_shelf_resize(sh, 500, 350);
v->shelves = evas_list_append(v->shelves, sh);
}
*/
return v;
}
@ -785,14 +786,14 @@ e_view_add_icon(E_View *v, E_Icon *icon)
e_icon_realize(icon);
v->changed = 1;
v->icons = evas_list_append(v->icons, icon);
e_shelf_add_icon(v->shelves->data, icon);
/* e_shelf_add_icon(v->shelves->data, icon); */
}
void
e_view_del_icon(E_View *v, E_Icon *icon)
{
if (!icon->view) return;
e_shelf_del_icon(v->shelves->data, icon);
/* e_shelf_del_icon(v->shelves->data, icon); */
e_icon_unrealize(icon);
OBJ_UNREF(icon);
icon->view = NULL;
@ -823,6 +824,7 @@ e_view_realize(E_View *v)
image_cache,
font_dir);
v->win.main = evas_get_window(v->evas);
evas_event_move(v->evas, -999999, -999999);
e_add_child(v->win.base, v->win.main);
if (v->options.back_pixmap)
{
@ -905,6 +907,7 @@ e_view_update(E_View *v)
{
Evas_List l;
printf("view update\n");
if (v->changed)
{
for (l = v->icons; l; l = l->next)
@ -915,6 +918,7 @@ e_view_update(E_View *v)
e_icon_update(icon);
}
}
printf("done\n");
if (v->options.back_pixmap)
{
Imlib_Updates up;