From 86e401ab9d10301a69dce2b6d8d313624c2349a7 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 16 Mar 2001 20:12:03 +0000 Subject: [PATCH] some optimizations... and fixes :) thats all SVN revision: 4381 --- src/desktops.c | 1 - src/e.h | 6 ++++ src/fs.c | 4 +-- src/icons.c | 88 +++++++++++++++++++++++++++----------------------- src/view.c | 2 -- 5 files changed, 56 insertions(+), 45 deletions(-) diff --git a/src/desktops.c b/src/desktops.c index 78b329bbb..133fb7655 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -10,7 +10,6 @@ static void e_idle(void *data); static void e_idle(void *data) { - printf("idle...\n"); e_db_flush(); return; UN(data); diff --git a/src/e.h b/src/e.h index 2ba767e76..b7132080d 100644 --- a/src/e.h +++ b/src/e.h @@ -99,6 +99,11 @@ void (*e_obj_free) (void *e_obj); _e_obj->references = 1; \ _e_obj->e_obj_free = (void *) _e_obj_free_func; \ } +#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \ +((x < (xx + ww)) && \ +(y < (yy + hh)) && \ +((x + w) > xx) && \ +((y + h) > yy)) #define SPANS_COMMON(x1, w1, x2, w2) \ (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) @@ -410,6 +415,7 @@ struct _E_Icon } state; char *icon; int visible; + int viewable; } current, previous; struct { diff --git a/src/fs.c b/src/fs.c index e5554abc4..fc3677190 100644 --- a/src/fs.c +++ b/src/fs.c @@ -11,7 +11,7 @@ _e_fs_fd_handle(int fd) Evas_List events = NULL; double start, current; - printf("############## fs event...\n"); +/* printf("############## fs event...\n");*/ start = e_get_time(); while ((ec) && efsd_events_pending(ec)) { @@ -65,7 +65,7 @@ _e_fs_fd_handle(int fd) } evas_list_free(events); } - printf("############## fs done\n"); +/* printf("############## fs done\n");*/ } void diff --git a/src/icons.c b/src/icons.c index 1e46d9426..47e005f1e 100644 --- a/src/icons.c +++ b/src/icons.c @@ -63,6 +63,7 @@ e_icon_free(E_Icon *icon) IF_FREE(icon->info.link); IF_FREE(icon->info.mime.base); IF_FREE(icon->info.mime.type); + IF_FREE(icon->previous.icon); FREE(icon); } @@ -95,6 +96,8 @@ e_icon_place_grid(E_Icon *icon) x = icon->view->options.arrange.grid.next_pos - (y * gw); x *= icon->view->options.arrange.grid.w; y *= icon->view->options.arrange.grid.h; + x += (icon->view->options.arrange.grid.w - icon->current.w) / 2; + y += (icon->view->options.arrange.grid.h - icon->current.h); e_icon_set_xy(icon, x, y); printf("GRID PLACE at %i %i\n", x, y); icon->view->options.arrange.grid.next_pos++; @@ -186,6 +189,11 @@ e_icon_calulcate_geometry(E_Icon *icon) icon->current.tw = tw; icon->current.th = th; } + if (INTERSECTS(0, 0, icon->view->size.w, icon->view->size.h, + icon->current.x, icon->current.y, icon->current.w, icon->current.h)) + icon->current.viewable = 1; + else + icon->current.viewable = 0; } void @@ -310,21 +318,6 @@ e_icon_update(E_Icon *icon) ebits_free(icon->obj.sel_icon); icon->obj.sel_icon = NULL; } - 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); - evas_resize(icon->view->evas, icon->obj.icon, iw, ih); - icon->previous.x = icon->current.x - 1; - } if (!icon->obj.filename) { icon->obj.filename = evas_add_text(icon->view->evas, "borzoib", 8, icon->file); @@ -333,13 +326,24 @@ e_icon_update(E_Icon *icon) icon->previous.visible = icon->current.visible - 1; obj_new = 1; } - if (!icon->obj.icon) + if (((icon->previous.icon) && (icon->current.icon) && + (strcmp(icon->current.icon, icon->previous.icon))) || + ((!icon->previous.icon) && (icon->current.icon))) { - icon->obj.icon = evas_add_image_from_file(icon->view->evas, icon->current.icon); - evas_set_layer(icon->view->evas, icon->obj.icon, 10); - icon->previous.x = icon->current.x - 1; - icon->previous.visible = icon->current.visible - 1; - obj_new = 1; + int iw, ih; + + if (!icon->obj.icon) + { + icon->obj.icon = evas_add_image_from_file(icon->view->evas, icon->current.icon); + evas_set_layer(icon->view->evas, icon->obj.icon, 10); + obj_new = 1; + } + else + 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); + evas_resize(icon->view->evas, icon->obj.icon, iw, ih); + icon->previous.x = icon->current.x - 1; } if ((!icon->obj.sel_icon) && (icon->current.state.selected)) { @@ -369,28 +373,30 @@ e_icon_update(E_Icon *icon) (obj_new)) { 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->current.viewable) { - 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.ix - pl, icon->current.iy - pt); - ebits_resize(icon->obj.sel_icon, icon->current.iw + pl + pr, icon->current.ih + pt + pb); - } - + 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) + { + 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.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 != icon->previous.visible) + if ((icon->current.visible != icon->previous.visible) || (obj_new) || + (icon->current.viewable != icon->previous.viewable)) { - if (icon->current.visible) + if ((icon->current.visible) && (icon->current.viewable)) { evas_show(icon->view->evas, icon->obj.icon); evas_show(icon->view->evas, icon->obj.filename); @@ -407,7 +413,9 @@ e_icon_update(E_Icon *icon) if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon); } } + IF_FREE(icon->previous.icon); icon->previous = icon->current; + icon->previous.icon = strdup(icon->current.icon); icon->changed = 0; printf("... done\n"); } diff --git a/src/view.c b/src/view.c index e7eed2c3e..69ea42941 100644 --- a/src/view.c +++ b/src/view.c @@ -907,7 +907,6 @@ e_view_update(E_View *v) { Evas_List l; - printf("view update\n"); if (v->changed) { for (l = v->icons; l; l = l->next) @@ -918,7 +917,6 @@ e_view_update(E_View *v) e_icon_update(icon); } } - printf("done\n"); if (v->options.back_pixmap) { Imlib_Updates up;