diff --git a/src/bin/e_fileman.c b/src/bin/e_fileman.c index ff73a0447..42bbc4409 100644 --- a/src/bin/e_fileman.c +++ b/src/bin/e_fileman.c @@ -17,6 +17,7 @@ static void _e_fileman_vscrollbar_drag_cb(Evas_Object *object, double value, voi static void _e_fileman_reconf_cb(void *data, int type, void *event); static void _e_fileman_cb_resize(E_Win *win); static void _e_fileman_cb_delete(E_Win *win); +static void _e_fileman_vscrollbar_show_cb(void *data, Evas_Object *obj, void *ev); static void _e_fileman_free(E_Fileman *fileman); E_Fileman * @@ -68,6 +69,7 @@ e_fileman_new(E_Container *con) fileman->vscrollbar = e_scrollbar_add(fileman->evas); e_scrollbar_direction_set(fileman->vscrollbar, E_SCROLLBAR_VERTICAL); e_scrollbar_callback_drag_add(fileman->vscrollbar, _e_fileman_vscrollbar_drag_cb, fileman); + evas_object_event_callback_add(fileman->vscrollbar, EVAS_CALLBACK_SHOW, _e_fileman_vscrollbar_show_cb,fileman); e_win_resize_callback_set(fileman->win, _e_fileman_cb_resize); e_win_resize(fileman->win, 640, 480); @@ -111,12 +113,12 @@ e_fileman_hide(E_Fileman *fileman) static void _e_fileman_free(E_Fileman *fileman) { - e_object_unref(E_OBJECT(fileman->con)); evas_object_del(fileman->vscrollbar); evas_object_del(fileman->smart); evas_object_del(fileman->main); e_object_del(E_OBJECT(fileman->win)); - free(fileman); + return; + //free(fileman); } static void @@ -129,7 +131,7 @@ _e_fileman_cb_resize(E_Win *win) evas_object_resize(fileman->main, win->w, win->h); e_fm_geometry_virtual_get(fileman->smart, &w, &h); - evas_event_freeze(fileman->evas); + e_fm_freeze(fileman->smart); if (h > win->h) edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar); @@ -139,7 +141,7 @@ _e_fileman_cb_resize(E_Win *win) evas_object_hide(fileman->vscrollbar); } - evas_event_thaw(fileman->evas); + e_fm_thaw(fileman->smart); } static void @@ -166,13 +168,14 @@ _e_fileman_reconf_cb(void *data, int type, void *event) { E_Event_Fm_Reconfigure *ev; E_Fileman *fileman; + + if(!data || !event) + return; fileman = data; ev = event; - - return; - - evas_event_freeze(fileman->evas); + + e_fm_freeze(fileman->smart); if (ev->h > fileman->win->h) edje_object_part_swallow(fileman->main, "vscrollbar", fileman->vscrollbar); @@ -180,7 +183,15 @@ _e_fileman_reconf_cb(void *data, int type, void *event) { edje_object_part_unswallow(fileman->main, fileman->vscrollbar); evas_object_hide(fileman->vscrollbar); - } - - evas_event_thaw(fileman->evas); + } +} + +static void +_e_fileman_vscrollbar_show_cb(void *data, Evas_Object *obj, void *ev) +{ + E_Fileman *fileman; + + fileman = data; + + e_fm_thaw(fileman->smart); } diff --git a/src/bin/e_fileman_smart.c b/src/bin/e_fileman_smart.c index 31cb0297a..a4c59b5d8 100644 --- a/src/bin/e_fileman_smart.c +++ b/src/bin/e_fileman_smart.c @@ -185,8 +185,7 @@ struct _E_Fm_Smart_Data Ecore_File_Monitor *monitor; int arrange; - int file_offset; - int visible_files; + int frozen; double position; Evas_Coord x, y, w, h; @@ -252,7 +251,6 @@ static void _e_fm_smart_hide(Evas_Object *object); static void _e_fm_redraw_new(E_Fm_Smart_Data *sd); static void _e_fm_redraw(E_Fm_Smart_Data *sd); -static void _e_fm_size_calc(E_Fm_Smart_Data *sd); static void _e_fm_stat_to_attr(struct stat st, E_Fm_File_Attributes *attr, char *name); static void _e_fm_selections_clear(E_Fm_Smart_Data *sd); static void _e_fm_selections_add(E_Fm_File *file); @@ -435,31 +433,47 @@ e_fm_scroll_vertical(Evas_Object *object, double percent) { E_Fm_Smart_Data *sd; int offsetpx; - Evas_Coord bx, by, bw, bh; + Evas_Coord x, y, w, h; if ((!object) || !(sd = evas_object_smart_data_get(object))) return; - - offsetpx = (sd->position - percent) * (sd->max.h - sd->h); + sd->position = percent; - if (offsetpx > 0) // moving up - { - Evas_Coord x, y, w, h; - evas_object_geometry_get(sd->layout, &x, &h, NULL, NULL); - offsetpx = abs(offsetpx); - e_icon_layout_clip_freeze(sd->layout); - evas_object_move(sd->layout, x, h + offsetpx); - e_icon_layout_clip_thaw(sd->layout); - } else if (offsetpx < 0) // moving down - { - Evas_Coord x, y, w, h; - evas_object_geometry_get(sd->layout, &x, &h, NULL, NULL); - offsetpx = abs(offsetpx); - e_icon_layout_clip_freeze(sd->layout); - evas_object_move(sd->layout, x, h - offsetpx); - e_icon_layout_clip_thaw(sd->layout); - } + offsetpx = (percent) * (sd->max.h - sd->h); + + evas_object_geometry_get(sd->layout, &x, &y, &w, &h); + e_icon_layout_clip_freeze(sd->layout); + evas_object_move(sd->layout, x, sd->y - offsetpx); + e_icon_layout_clip_thaw(sd->layout); +} + +int +e_fm_freeze(Evas_Object *object) +{ + E_Fm_Smart_Data *sd; + + if ((!object) || !(sd = evas_object_smart_data_get(object))) + return; + + sd->frozen++; + evas_event_freeze(sd->evas); + return sd->frozen; +} + +int +e_fm_thaw(Evas_Object *object) +{ + E_Fm_Smart_Data *sd; + + if ((!object) || !(sd = evas_object_smart_data_get(object))) + return; + + if(!sd->frozen) return 0; + + sd->frozen--; + evas_event_thaw(sd->evas); + return sd->frozen; } void @@ -494,6 +508,8 @@ _e_fm_smart_add(Evas_Object *object) if (!sd) return; sd->object = object; + + sd->frozen = 0; sd->bg = evas_object_rectangle_add(evas); // this should become an edje evas_object_color_set(sd->bg, 0, 0, 0, 0); @@ -527,7 +543,6 @@ _e_fm_smart_add(Evas_Object *object) sd->icon_info.y_space = 15; sd->monitor = NULL; - sd->file_offset = 0; sd->position = 0; sd->evas = evas; sd->pending_thumbs = NULL; @@ -768,9 +783,11 @@ _e_fm_smart_resize(Evas_Object *object, Evas_Coord w, Evas_Coord h) // optimize // _e_fm_redraw(sd); // no new - if(sd->position > 0) + if(sd->position > 0.0) e_fm_scroll_vertical(object, sd->position); + if(sd->frozen) + return; ev = E_NEW(E_Event_Fm_Reconfigure, 1); if (ev) @@ -778,12 +795,11 @@ _e_fm_smart_resize(Evas_Object *object, Evas_Coord w, Evas_Coord h) Evas_Coord w, h; evas_object_geometry_get(sd->layout, NULL, NULL, &w, &h); - ev->object = sd->object; ev->w = sd->max.w; ev->h = sd->max.h; ecore_event_add(E_EVENT_FM_RECONFIGURE, ev, NULL, NULL); - } + } } static void @@ -897,6 +913,9 @@ _e_fm_redraw_new(E_Fm_Smart_Data *sd) } e_icon_layout_thaw(sd->layout); + + if(sd->frozen) + return; ev = E_NEW(E_Event_Fm_Reconfigure, 1); if (ev) @@ -904,7 +923,6 @@ _e_fm_redraw_new(E_Fm_Smart_Data *sd) Evas_Coord w, h; evas_object_geometry_get(sd->layout, NULL, NULL, &w, &h); - ev->object = sd->object; ev->w = sd->max.w; ev->h = sd->max.h; @@ -919,12 +937,14 @@ _e_fm_redraw(E_Fm_Smart_Data *sd) E_Event_Fm_Reconfigure *ev; e_icon_layout_redraw_force(sd->layout); - + + if(sd->frozen) + return; + ev = E_NEW(E_Event_Fm_Reconfigure, 1); if (ev) { Evas_Coord w, h; - evas_object_geometry_get(sd->layout, NULL, NULL, &w, &h); ev->object = sd->object; @@ -934,70 +954,6 @@ _e_fm_redraw(E_Fm_Smart_Data *sd) } } -// when this is enabled, the thumbnailer is broken, double check if its -// still broken. seems ok. -static void -_e_fm_size_calc(E_Fm_Smart_Data *sd) -{ - Evas_List *dirs = NULL; - Evas_Coord xbg, x, y, w, h; - E_Fm_File *file; - E_Fm_File_Attributes *attr; - - if (!sd->dir) - return; - - evas_object_geometry_get(sd->bg, &x, &y, &w, &h); - xbg = x; - x = 0; - y = 0; - - dirs = sd->files_raw; - - attr = E_NEW(E_Fm_File_Attributes, 1); - attr->mode = 0040000; - snprintf(attr->name, PATH_MAX, ".."); - - dirs = evas_list_prepend(dirs, attr); - - while (dirs) - { - int icon_w, icon_h; - - attr = evas_list_data(dirs); - - file = E_NEW(E_Fm_File, 1); - file->icon = edje_object_add(sd->evas);; - e_theme_edje_object_set(file->icon, "base/theme/fileman", "fileman/icon"); - file->attr = attr; - file->sd = sd; - file->icon_img = _e_fm_file_icon_get(file); // this might be causing borkage - edje_object_part_swallow(file->icon, "icon_swallow", file->icon_img); - edje_object_part_text_set(file->icon, "icon_title", attr->name); - edje_object_size_min_calc(file->icon, &icon_w, &icon_h); - - if ((x > w) || ((x + icon_w) > w)) - { - x = sd->icon_info.x_space; - y += icon_h + sd->icon_info.y_space; - } - - x += icon_w + sd->icon_info.x_space; - - edje_object_part_unswallow(file->icon, file->icon_img); - evas_object_del(file->icon_img); - evas_object_del(file->icon); - file->attr = NULL; - file->sd = NULL; - free(file); - - dirs = dirs->next; - } - - sd->max.w = xbg; - sd->max.h = y; -} - static void _e_fm_selections_clear(E_Fm_Smart_Data *sd) { @@ -2286,7 +2242,6 @@ _e_fm_file_icon_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event file->sd->drag.y = -1; file->sd->drag.x = -1; file->sd->drag.file = file; - printf("drag file: %s\n", file->attr->name); if (!file->state.selected) { diff --git a/src/bin/e_fileman_smart.h b/src/bin/e_fileman_smart.h index f412b0634..69b3dace0 100644 --- a/src/bin/e_fileman_smart.h +++ b/src/bin/e_fileman_smart.h @@ -26,6 +26,8 @@ EAPI void e_fm_scroll_horizontal(Evas_Object *object, double pe EAPI void e_fm_scroll_vertical(Evas_Object *object, double percent); EAPI void e_fm_geometry_virtual_get(Evas_Object *object, Evas_Coord *w, Evas_Coord *h); EAPI void e_fm_reconfigure_callback_add(Evas_Object *object, void (*func)(void *data, Evas_Object *obj, E_Event_Fm_Reconfigure *ev), void *data); +EAPI int e_fm_freeze(Evas_Object *freeze); +EAPI int e_fm_thaw(Evas_Object *freeze); extern int E_EVENT_FM_RECONFIGURE; #endif diff --git a/src/bin/e_icon_layout.c b/src/bin/e_icon_layout.c index 0bd7f8b26..06cf27d02 100644 --- a/src/bin/e_icon_layout.c +++ b/src/bin/e_icon_layout.c @@ -582,6 +582,7 @@ _e_icon_layout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); + if (!sd) return; if ((x == sd->x) && (y == sd->y)) return; if ((x == sd->x) && (y == sd->y)) return;