Enlightenment CVS committal Author : codewarrior Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: Makefile.am e_configure.c e_fileman.c e_fileman_icon.c e_fileman_smart.c e_fileman_smart.h e_icon.c e_icon.h e_includes.h e_int_menus.c e_thumb.c e_thumb.h e_widget_image.c e_widget_image.h Added Files: e_icon_grid.c e_icon_grid.h e_int_config_background.c e_int_config_background.h Removed Files: e_icon_layout.c e_icon_layout.h Log Message: - make e_thumb fork internally - add queue / dequeue calls to e_thumb - change e_icon_layout to e_icon_grid - add e_icon_canvas which will eventually allow for free icon placement and optimized scrolling using a tiles principle - add new calls to e_widget_image - add new bg selector (broken because of a segv on cancel press, needs fixing) NOTES: - bg selector needs fixing. - efm still needs work, will segv if you scroll while files are generated - other efm bugs exist so I would advise that you dont use it atm - if we dont need e_icon_grid (strict grid layout) we should remove it. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/Makefile.am,v retrieving revision 1.82 retrieving revision 1.83 diff -u -3 -r1.82 -r1.83 --- Makefile.am 21 Nov 2005 12:44:19 -0000 1.82 +++ Makefile.am 22 Nov 2005 09:27:25 -0000 1.83 @@ -97,9 +97,10 @@ e_widget_image.h \ e_config_dialog.h \ e_int_config_focus.h \ +e_icon_grid.h \ +e_icon_canvas.h \ e_int_config_desks.h \ e_configure.h \ -e_icon_layout.h \ e_int_border_locks.h \ e_thumb.h \ e_int_border_remember.h \ @@ -117,7 +118,8 @@ e_slider.h \ e_widget_slider.h \ e_int_config_window_manipulation.h \ -e_int_config_window_display.h +e_int_config_window_display.h \ +e_int_config_background.h enlightenment_src = \ e_user.c \ @@ -195,9 +197,10 @@ e_widget_image.c \ e_config_dialog.c \ e_int_config_focus.c \ +e_icon_grid.c \ +e_icon_canvas.c \ e_int_config_desks.c \ e_configure.c \ -e_icon_layout.c \ e_int_border_locks.c \ e_thumb.c \ e_int_border_remember.c \ @@ -216,6 +219,7 @@ e_widget_slider.c \ e_int_config_window_manipulation.c \ e_int_config_window_display.c \ +e_int_config_background.c \ $(ENLIGHTENMENTHEADERS) enlightenment_SOURCES = \ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_configure.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- e_configure.c 21 Nov 2005 12:44:19 -0000 1.13 +++ e_configure.c 22 Nov 2005 09:27:25 -0000 1.14 @@ -62,6 +62,7 @@ e_configure_standard_item_add(eco, "enlightenment/e", _("Desktop Settings"), e_int_config_desks); e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation); e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display); + //e_configure_standard_item_add(eco, "enlightenment/desktops", _("Background Settings"), e_int_config_background); /* FIXME: we should have a way for modules to hook in here and add their * own entries =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_fileman.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- e_fileman.c 9 Nov 2005 02:00:33 -0000 1.26 +++ e_fileman.c 22 Nov 2005 09:27:25 -0000 1.27 @@ -88,7 +88,6 @@ evas_event_freeze(fileman->evas); fileman->smart = e_fm_add(fileman->evas); e_fm_e_win_set(fileman->smart, fileman->win); - e_fm_dir_set(fileman->smart, dir); fileman->main = e_scrollframe_add(fileman->evas); e_scrollframe_custom_theme_set(fileman->main, "base/themes/fileman", @@ -102,6 +101,8 @@ e_win_resize_callback_set(fileman->win, _e_fileman_resize_cb); e_win_resize(fileman->win, 570, 355); + e_fm_dir_set(fileman->smart, dir); + ecore_x_dnd_aware_set(fileman->win->evas_win, 1); evas_event_thaw(fileman->evas); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_fileman_icon.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- e_fileman_icon.c 10 Nov 2005 11:52:26 -0000 1.23 +++ e_fileman_icon.c 22 Nov 2005 09:27:25 -0000 1.24 @@ -26,6 +26,8 @@ unsigned char visible : 1; int type; + + E_Fm_Icon_Metadata *meta; }; /* local subsystem functions */ @@ -40,13 +42,9 @@ /* Create icons */ static void _e_fm_icon_icon_mime_get(E_Smart_Data *sd); - -static void _e_fm_icon_thumb_generate(void); -static int _e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event); - -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); +static void _e_fm_icon_thumb_generate_cb(Evas_Object *obj, void *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; @@ -62,10 +60,6 @@ int e_fm_icon_init(void) { - event_handlers = evas_list_append(event_handlers, - ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, - _e_fm_icon_thumb_cb_exe_exit, - NULL)); return 1; } @@ -177,8 +171,12 @@ } else { - thumb_files = evas_list_append(thumb_files, sd); - if (pid == -1) _e_fm_icon_thumb_generate(); + sd->thumb_object = e_thumb_generate_begin(sd->file->path, sd->iw, + sd->ih, sd->evas, + &sd->thumb_object, + _e_fm_icon_thumb_generate_cb, + sd); + _e_fm_icon_icon_mime_get(sd); } } @@ -238,6 +236,17 @@ E_FREE(sd->saved_title); } +char * +e_fm_icon_title_get(Evas_Object *obj) +{ + E_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + + return edje_object_part_text_get(sd->icon_object, "icon_title"); +} + void e_fm_icon_title_set(Evas_Object *obj, const char *title) { @@ -321,6 +330,8 @@ if (!m) return NULL; _e_fm_icon_meta_fill(m, sd); + sd->meta = m; + return m; } @@ -361,6 +372,7 @@ sd->iw = 48; sd->ih = 48; sd->file = NULL; + sd->meta = NULL; sd->icon_object = edje_object_add(sd->evas); evas_object_smart_member_add(sd->icon_object, obj); @@ -404,6 +416,12 @@ evas_object_move(sd->event_object, x, y); if(sd->icon_object) evas_object_move(sd->icon_object, x, y); + if(sd->meta) + { + //printf("update meta for %s: x=%d y=%d\n", sd->file->name, x, y); + sd->meta->x = x; + sd->meta->y = y; + } } static void @@ -419,7 +437,13 @@ 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); + evas_object_resize(sd->icon_object, sd->w, sd->h); + if(sd->meta) + { + printf("update meta: w=%d h=%d\n", w, h); + sd->meta->w = w; + sd->meta->h = h; + } } static void @@ -506,43 +530,13 @@ sd->image_object); } -static void -_e_fm_icon_thumb_generate(void) -{ - E_Smart_Data *sd; - - if ((!thumb_files) || (pid != -1)) return; - - pid = fork(); - if (pid == 0) - { - /* reset signal handlers for the child */ - signal(SIGSEGV, SIG_DFL); - signal(SIGILL, SIG_DFL); - signal(SIGFPE, SIG_DFL); - signal(SIGBUS, SIG_DFL); - - sd = thumb_files->data; - if (!e_thumb_exists(sd->file->path)) - e_thumb_create(sd->file->path, 48, 48); // thumbnail size - eet_cacheburst(0); - exit(0); - } -} - -static int -_e_fm_icon_thumb_cb_exe_exit(void *data, int type, void *event) +void +_e_fm_icon_thumb_generate_cb(Evas_Object *obj, void *data) { - Ecore_Event_Exe_Exit *ev; E_Smart_Data *sd; char *ext; - ev = event; - if (ev->pid != pid) return 1; - if (!thumb_files) return 1; - - sd = thumb_files->data; - thumb_files = evas_list_remove_list(thumb_files, thumb_files); + sd = data; ext = strrchr(sd->file->name, '.'); if ((ext) && (strcasecmp(ext, ".eap"))) @@ -559,9 +553,7 @@ sd->iw, sd->ih, 1); -// evas_object_geometry_get(sd->thumb_object, NULL, NULL, &icon_w, &icon_h); -// sd->iw = icon_w; -// sd->ih = icon_h; + sd->image_object = edje_object_add(sd->evas); e_theme_edje_object_set(sd->image_object, "base/theme/fileman", "fileman/icon_thumb"); @@ -579,10 +571,6 @@ edje_object_part_swallow(sd->icon_object, "icon_swallow", sd->image_object); } - - pid = -1; - _e_fm_icon_thumb_generate(); - return 1; } static void @@ -678,5 +666,5 @@ m->y = sd->y; m->w = sd->w; m->h = sd->h; - m->name = strdup(sd->file->name); + m->name = strdup(sd->file->name); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_fileman_smart.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -3 -r1.107 -r1.108 --- e_fileman_smart.c 10 Nov 2005 11:52:26 -0000 1.107 +++ e_fileman_smart.c 22 Nov 2005 09:27:25 -0000 1.108 @@ -12,6 +12,16 @@ /* TODO: * + * - if we resize efm while we're generating files, we crash + * + * - convert current layout scheme to canvas layout (AmigaOS style) + * + * - begin configuration dialogs + * + * - allow per dir bg + * + * - allow custom icon images + * * - add ability to have icons on desktop (this works, but we need some fixes) * files should go on ~/.e/e/desktop for example. * @@ -24,9 +34,6 @@ * * - allow for icon movement inside the canvas * - * - add metadata system which allows us to save icon positions and will - * eventually allow us to have custom icon sizes, custom bgs per dir... - * * - double check dir monitoring. note: when we are in a dir that is constantly * changing, we cant keep calling redraw_new as it will kill us. * @@ -34,8 +41,6 @@ /* BUGS: * - * - we need to look at the deletion / free'ing routines. - * * - Closing Efm window while its thumbnailing causes a segv * * - Deleting a dir causes a segv @@ -103,7 +108,7 @@ struct _E_Fm_Icon { E_Fm_File *file; - Evas_Object *icon_object; + Evas_Object *icon_obj; E_Fm_Smart_Data *sd; struct { @@ -152,7 +157,7 @@ Evas_Object *clip_obj; Evas_Object *layout; Evas_Object *object; - Evas_Object *entry_object; + Evas_Object *entry_obj; E_Fm_Dir_Metadata *meta; @@ -184,7 +189,7 @@ Ecore_Evas *ecore_evas; Evas *evas; Ecore_X_Window win; - E_Fm_Icon *icon_object; + E_Fm_Icon *icon_obj; Evas_Object *image_object; } drag; @@ -436,10 +441,9 @@ sd->child.x = x; sd->child.y = y; - e_icon_layout_clip_freeze(sd->layout); + e_icon_canvas_xy_freeze(sd->layout); evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y); - e_icon_layout_clip_thaw(sd->layout); - + e_icon_canvas_xy_thaw(sd->layout); evas_object_smart_callback_call(sd->object, "changed", NULL); } @@ -460,8 +464,7 @@ { if (sd->h < sd->child.h) *y = sd->child.h - sd->h; else *y = 0; - } - + } } void @@ -476,7 +479,6 @@ if (y) *y = sd->child.y; } - void e_fm_geometry_virtual_get(Evas_Object *object, Evas_Coord *w, Evas_Coord *h) { @@ -577,6 +579,35 @@ edje_object_part_swallow(sd->edje_obj, "background", bg); } +Evas_Object * +e_fm_icon_create(void *data) +{ + E_Fm_Icon *icon; + + if(!data) return NULL; + icon = data; + + icon->icon_obj = e_fm_icon_add(icon->sd->evas); + e_fm_icon_file_set(icon->icon_obj, icon->file); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, icon->sd); + evas_object_show(icon->icon_obj); + return icon->icon_obj; +} + +void +e_fm_icon_destroy(Evas_Object *obj, void *data) +{ + E_Fm_Icon *icon; + + icon = data; + e_thumb_generate_end(icon->file->path); + evas_object_del(icon->icon_obj); +} + /* local subsystem functions */ static void _e_fm_smart_add(Evas_Object *object) @@ -595,6 +626,9 @@ sd->icon_info.x_space = 12; sd->icon_info.y_space = 10; + sd->child.x = 0; + sd->child.y = 0; + sd->timer_int = 0.001; sd->timer = NULL; @@ -621,9 +655,9 @@ evas_object_event_callback_add(sd->event_obj, EVAS_CALLBACK_MOUSE_MOVE, _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); + sd->layout = e_icon_canvas_add(sd->evas); + e_icon_canvas_viewport_set(sd->layout, sd->edje_obj); + e_icon_canvas_spacing_set(sd->layout, sd->icon_info.x_space, sd->icon_info.y_space); evas_object_show(sd->layout); sd->clip_obj = evas_object_rectangle_add(sd->evas); @@ -692,9 +726,6 @@ } evas_object_smart_data_set(object, sd); - - if (getcwd(dir, sizeof(dir))) - _e_fm_dir_set(sd, dir); } static void @@ -735,7 +766,7 @@ evas_object_del(sd->clip_obj); evas_object_del(sd->edje_obj); evas_object_del(sd->layout); - if (sd->entry_object) evas_object_del(sd->entry_object); + if (sd->entry_obj) evas_object_del(sd->entry_obj); if (sd->menu) e_object_del(E_OBJECT(sd->menu)); evas_event_thaw(evas_object_evas_get(object)); @@ -757,7 +788,6 @@ evas_object_move(sd->edje_obj, x, y); evas_object_move(sd->clip_obj, x, y); evas_object_move(sd->event_obj, x, y); -// evas_object_move(sd->layout, sd->x - sd->child.x, sd->y - sd->child.y); } static void @@ -772,9 +802,8 @@ evas_object_resize(sd->edje_obj, w, h); evas_object_resize(sd->clip_obj, w, h); evas_object_resize(sd->event_obj, w, h); -// evas_object_resize(sd->layout, w, h); - e_icon_layout_width_fix(sd->layout, w); - e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h); +// e_icon_canvas_width_fix(sd->layout, w); +// e_icon_canvas_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h); sd->conf.main->width = w; sd->conf.main->height = h; @@ -808,7 +837,6 @@ return; evas_object_show(sd->edje_obj); -// evas_object_show(sd->layout); evas_object_show(sd->clip_obj); } @@ -861,7 +889,7 @@ { E_Event_Fm_Reconfigure *ev; - e_icon_layout_redraw_force(sd->layout); + e_icon_canvas_redraw_force(sd->layout); if(sd->frozen) return; @@ -887,7 +915,7 @@ if (e_fm_file_rename(icon->file, name)) { - e_fm_icon_title_set(icon->icon_object, name); + e_fm_icon_title_set(icon->icon_obj, name); } } @@ -910,9 +938,9 @@ } icon->sd->files = evas_list_remove(icon->sd->files, icon); - e_icon_layout_freeze(icon->sd->layout); - e_icon_layout_unpack(icon->icon_object); - e_icon_layout_thaw(icon->sd->layout); + e_icon_canvas_freeze(icon->sd->layout); + e_icon_canvas_unpack(icon->icon_obj); + e_icon_canvas_thaw(icon->sd->layout); _e_fm_redraw(icon->sd); _e_fm_file_free(icon); } @@ -969,19 +997,19 @@ icon = data; - icon->sd->entry_object = e_entry_add(icon->sd->evas); - evas_object_focus_set(icon->sd->entry_object, 1); - evas_object_show(icon->sd->entry_object); - e_entry_cursor_show(icon->sd->entry_object); + icon->sd->entry_obj = e_entry_add(icon->sd->evas); + evas_object_focus_set(icon->sd->entry_obj, 1); + evas_object_show(icon->sd->entry_obj); + e_entry_cursor_show(icon->sd->entry_obj); - e_fm_icon_edit_entry_set(icon->icon_object, icon->sd->entry_object); - e_fm_icon_title_set(icon->icon_object, ""); + e_fm_icon_edit_entry_set(icon->icon_obj, icon->sd->entry_obj); + e_fm_icon_title_set(icon->icon_obj, ""); e_fm_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _e_fm_win_mouse_up_cb, icon); e_grabinput_get(icon->sd->win->evas_win, 1, icon->sd->win->evas_win); - e_entry_cursor_move_at_start(icon->sd->entry_object); - e_entry_text_set(icon->sd->entry_object, icon->file->name); + e_entry_cursor_move_at_start(icon->sd->entry_obj); + e_entry_text_set(icon->sd->entry_obj, icon->file->name); e_fm_grab_time = ecore_time_get(); } @@ -1444,7 +1472,7 @@ list = ecore_list_new(); ecore_list_set_free_cb(list, free); /* TODO: use sorting function here */ - heap = ecore_sheap_new(ECORE_COMPARE_CB(strcmp), ecore_list_nodes(list)); + heap = ecore_sheap_new(ECORE_COMPARE_CB(strcasecmp), ecore_list_nodes(list)); while(dp = readdir(dir2)) { if ((!strcmp(dp->d_name, ".") || (!strcmp (dp->d_name, "..")))) continue; @@ -1477,15 +1505,16 @@ 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); } } - + else + e_icon_canvas_width_fix(sd->layout, sd->w); + /* Reset position */ sd->position = 0.0; @@ -1498,7 +1527,7 @@ _e_fm_file_free(sd->files->data); sd->files = evas_list_remove_list(sd->files, sd->files); } - e_icon_layout_reset(sd->layout); + e_icon_canvas_reset(sd->layout); /* Get new files */ if (sd->monitor) ecore_file_monitor_del(sd->monitor); @@ -1517,16 +1546,15 @@ icon->file = e_fm_file_new(path); icon->file->mode = 0040000; icon->file->type = E_FM_FILE_TYPE_DIRECTORY; - icon->icon_object = e_fm_icon_add(sd->evas); + icon->icon_obj = e_fm_icon_add(sd->evas); icon->sd = sd; - e_fm_icon_file_set(icon->icon_object, icon->file); + e_fm_icon_file_set(icon->icon_obj, 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); + e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon); } } @@ -1550,7 +1578,7 @@ i = 0; sd = data; - e_icon_layout_freeze(sd->layout); + e_icon_canvas_freeze(sd->layout); while (i < 2) { @@ -1569,36 +1597,67 @@ } else { - icon->icon_object = e_fm_icon_add(sd->evas); + icon->icon_obj = e_fm_icon_add(sd->evas); icon->sd = sd; - e_fm_icon_file_set(icon->icon_object, icon->file); + e_fm_icon_file_set(icon->icon_obj, icon->file); sd->files = evas_list_append(sd->files, icon); - 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_icon_callbacks_set(icon->icon_object, e_fm_icon_appear_cb, e_fm_icon_disappear_cb, NULL); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_MOVE, _e_fm_icon_mouse_move_cb, sd); + evas_object_show(icon->icon_obj); + if(sd->meta) + { + E_Fm_Icon_Metadata *im; + if((im = evas_hash_find(sd->meta->files_hash, icon->file->name)) != NULL) + { + //printf("packing old icon at %d %d\n", im->x, im->y); + e_icon_canvas_pack_at_location(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon, im->x, im->y); + } + else + { + E_Fm_Icon_Metadata *im; + + //printf("packing new icon!\n"); + im = e_fm_icon_meta_generate(icon->icon_obj); + if (im) + { + sd->meta->files = evas_list_append(sd->meta->files, im); + sd->meta->files_hash = evas_hash_add(sd->meta->files_hash, icon->file->name, im); + } + e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon); + } + } + else + { + E_Fm_Icon_Metadata *im; + + //printf("packing new icon!\n"); + sd->meta = calloc(1, sizeof(E_Fm_Dir_Metadata)); + sd->meta->files = NULL; + im = e_fm_icon_meta_generate(icon->icon_obj); + if (im) + { + sd->meta->files = evas_list_append(sd->meta->files, im); + sd->meta->files_hash = evas_hash_add(sd->meta->files_hash, icon->file->name, im); + } + e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon); + } } i++; sd->files_raw = evas_list_remove_list(sd->files_raw, sd->files_raw); } - e_icon_layout_thaw(sd->layout); + e_icon_canvas_thaw(sd->layout); - e_icon_layout_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h); + e_icon_canvas_virtual_size_get(sd->layout, &sd->child.w, &sd->child.h); evas_object_smart_callback_call(sd->object, "changed", NULL); if(!sd->files_raw) { sd->timer = NULL; - if(!sd->meta) - { - printf("Generating Meta!\n"); - _e_fm_dir_meta_generate(sd); - _e_fm_dir_meta_save(sd); - } + if(sd->meta) + _e_fm_dir_meta_save(sd); return 0; } @@ -1613,9 +1672,7 @@ _e_fm_dir_pop(const char *path) { char *start, *end, *dir; - int i; - i = 0; start = strchr(path, '/'); end = strrchr(path ,'/'); @@ -1671,19 +1728,17 @@ free(icon); return; } - icon->icon_object = e_fm_icon_add(sd->evas); + icon->icon_obj = e_fm_icon_add(sd->evas); 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_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); - evas_object_event_callback_add(icon->icon_object, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon); - e_icon_layout_thaw(sd->layout); + e_icon_canvas_freeze(sd->layout); + e_fm_icon_file_set(icon->icon_obj, icon->file); + evas_object_show(icon->icon_obj); + e_icon_canvas_pack(sd->layout, icon->icon_obj, e_fm_icon_create, e_fm_icon_destroy, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm_icon_mouse_down_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_UP, _e_fm_icon_mouse_up_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_IN, _e_fm_icon_mouse_in_cb, icon); + evas_object_event_callback_add(icon->icon_obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm_icon_mouse_out_cb, icon); + e_icon_canvas_thaw(sd->layout); sd->files = evas_list_prepend(sd->files, icon); _e_fm_redraw(sd); break; @@ -1696,9 +1751,9 @@ if (!strcmp(icon->file->path, path)) { sd->files = evas_list_remove_list(sd->files, l); - e_icon_layout_freeze(sd->layout); - e_icon_layout_unpack(icon->icon_object); - e_icon_layout_thaw(sd->layout); + e_icon_canvas_freeze(sd->layout); + e_icon_canvas_unpack(icon->icon_obj); + e_icon_canvas_thaw(sd->layout); _e_fm_file_free(icon); _e_fm_redraw(sd); break; @@ -1711,8 +1766,8 @@ static void _e_fm_file_free(E_Fm_Icon *icon) { - e_icon_layout_unpack(icon->icon_object); - evas_object_del(icon->icon_object); + e_icon_canvas_unpack(icon->icon_obj); + evas_object_del(icon->icon_obj); e_object_del(E_OBJECT(icon->file)); /* if (file->menu) @@ -1732,7 +1787,7 @@ E_Fm_Icon *icon; icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "unclicked", ""); + e_fm_icon_signal_emit(icon->icon_obj, "unclicked", ""); icon->state.selected = 0; } sd->selection.files = evas_list_free(sd->selection.files); @@ -1747,7 +1802,7 @@ icon->sd->selection.current.file = icon; icon->sd->selection.current.ptr = icon_ptr; if (icon->state.selected) return; - e_fm_icon_signal_emit(icon->icon_object, "clicked", ""); + e_fm_icon_signal_emit(icon->icon_obj, "clicked", ""); icon->sd->selection.files = evas_list_append(icon->sd->selection.files, icon); icon->state.selected = 1; } @@ -1758,7 +1813,7 @@ icon->sd->selection.current.file = icon; icon->sd->selection.current.ptr = icon_ptr; if (icon->state.selected) return; - e_fm_icon_signal_emit(icon->icon_object, "hilight", ""); + e_fm_icon_signal_emit(icon->icon_obj, "hilight", ""); } static void @@ -1773,7 +1828,7 @@ icon = l->data; - evas_object_geometry_get(icon->icon_object, &xx, &yy, &ww, &hh); + evas_object_geometry_get(icon->icon_obj, &xx, &yy, &ww, &hh); if (E_INTERSECTS(x, y, w, h, xx, yy, ww, hh)) { if (!evas_list_find(icon->sd->selection.band.files, icon)) @@ -1803,7 +1858,7 @@ _e_fm_selections_del(E_Fm_Icon *icon) { if (!icon->state.selected) return; - e_fm_icon_signal_emit(icon->icon_object, "unclicked", ""); + e_fm_icon_signal_emit(icon->icon_obj, "unclicked", ""); icon->sd->selection.files = evas_list_remove(icon->sd->selection.files, icon); if (icon->sd->selection.current.file == icon) { @@ -1870,7 +1925,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); } edje_object_signal_emit(sd->edje_obj, "default", ""); } @@ -2086,8 +2141,6 @@ } } -// TODO: -// - send signals to edje for animations etc... static void _e_fm_icon_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -2148,7 +2201,7 @@ icon->sd->drag.start = 1; icon->sd->drag.x = icon->sd->win->x + ev->canvas.x; icon->sd->drag.y = icon->sd->win->y + ev->canvas.y; - icon->sd->drag.icon_object = icon; + icon->sd->drag.icon_obj = icon; } if (!icon->state.selected) @@ -2272,7 +2325,7 @@ for (l = icon->sd->files; l; l = l->next) { i = l->data; - e_fm_icon_signal_emit(i->icon_object, "default", ""); + e_fm_icon_signal_emit(i->icon_obj, "default", ""); } edje_object_signal_emit(icon->sd->edje_obj, "default", ""); } @@ -2290,7 +2343,7 @@ ev = event_info; icon = data; - e_fm_icon_signal_emit(icon->icon_object, "mousein", ""); + e_fm_icon_signal_emit(icon->icon_obj, "mousein", ""); } static void @@ -2302,7 +2355,7 @@ ev = event_info; icon = data; - e_fm_icon_signal_emit(icon->icon_object, "mouseout", ""); + e_fm_icon_signal_emit(icon->icon_obj, "mouseout", ""); } static void @@ -2316,7 +2369,7 @@ sd = data; if(sd->win) - icon = sd->drag.icon_object; + icon = sd->drag.icon_obj; if (!icon) return; @@ -2346,7 +2399,7 @@ snprintf(data, sizeof(data), "file://%s", icon->file->path); ecore_evas_geometry_get(sd->win->ecore_evas, &cx, &cy, NULL, NULL); - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); drag = e_drag_new(sd->win->container, cx + x, cy + y, drop_types, 1, strdup(data), strlen(data), _e_fm_drop_done_cb); @@ -2390,11 +2443,11 @@ t = ecore_time_get() - e_fm_grab_time; if (t < 1.0) return 1; - name = e_entry_text_get(icon->sd->entry_object); - e_fm_icon_edit_entry_set(icon->icon_object, NULL); - evas_object_focus_set(icon->sd->entry_object, 0); - evas_object_del(icon->sd->entry_object); - icon->sd->entry_object = NULL; + name = e_entry_text_get(icon->sd->entry_obj); + e_fm_icon_edit_entry_set(icon->icon_obj, NULL); + evas_object_focus_set(icon->sd->entry_obj, 0); + evas_object_del(icon->sd->entry_obj); + icon->sd->entry_obj = NULL; _e_fm_file_rename(icon, name); @@ -2470,7 +2523,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "disable", ""); + e_fm_icon_signal_emit(icon->icon_obj, "disable", ""); } return; } @@ -2486,10 +2539,10 @@ if(!strcmp(icon->file->name, file)) { _e_fm_selections_add(l->data, l); - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); if(!anchor) { - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { @@ -2562,7 +2615,7 @@ { Evas_Coord x, y, w, h; icon = l->data; - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { E_Event_Fm_Reconfigure *ev; @@ -2593,13 +2646,13 @@ l = sd->selection.current.ptr; icon = l->data; - evas_object_geometry_get(icon->icon_object, &x, &y, NULL, NULL); + evas_object_geometry_get(icon->icon_obj, &x, &y, NULL, NULL); x2 = x + 1; l = l->prev; while(l && x != x2) { icon = l->data; - evas_object_geometry_get(icon->icon_object, &x2, &y2, NULL, NULL); + evas_object_geometry_get(icon->icon_obj, &x2, &y2, NULL, NULL); if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control")) { if(icon->state.selected) @@ -2630,7 +2683,7 @@ E_Fm_Icon *icon; Evas_Coord x, y, w, h; icon = l->data; - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { E_Event_Fm_Reconfigure *ev; @@ -2664,13 +2717,13 @@ l = sd->selection.current.ptr; icon = l->data; - evas_object_geometry_get(icon->icon_object, &x, &y, NULL, NULL); + evas_object_geometry_get(icon->icon_obj, &x, &y, NULL, NULL); x2 = x + 1; l = l->next; while(l && x != x2) { icon = l->data; - evas_object_geometry_get(icon->icon_object, &x2, &y2, NULL, NULL); + evas_object_geometry_get(icon->icon_obj, &x2, &y2, NULL, NULL); if (evas_key_modifier_is_set(evas_key_modifier_get(sd->evas), "Control")) { if(icon->state.selected) @@ -2702,7 +2755,7 @@ Evas_Coord x, y, w, h; icon = l->data; - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { E_Event_Fm_Reconfigure *ev; @@ -2755,7 +2808,7 @@ E_Fm_Icon *icon; Evas_Coord x, y, w, h; icon = prev->data; - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if(!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { E_Event_Fm_Reconfigure *ev; @@ -2810,7 +2863,7 @@ E_Fm_Icon *icon; Evas_Coord x, y, w, h; icon = next->data; - evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); + evas_object_geometry_get(icon->icon_obj, &x, &y, &w, &h); if (!E_CONTAINS(sd->x, sd->y, sd->w, sd->h, x, y, w, h)) { E_Event_Fm_Reconfigure *ev; @@ -2904,7 +2957,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); } edje_object_signal_emit(sd->edje_obj, "default", ""); } @@ -2920,7 +2973,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); } edje_object_signal_emit(sd->edje_obj, "default", ""); } @@ -2950,7 +3003,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); } edje_object_signal_emit(sd->edje_obj, "default", ""); } @@ -2964,7 +3017,7 @@ for (l = sd->files; l; l = l->next) { icon = l->data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_obj, "default", ""); } edje_object_signal_emit(sd->edje_obj, "default", ""); } @@ -3267,7 +3320,7 @@ E_Fm_Icon *icon; icon = l->data; - im = e_fm_icon_meta_generate(icon->icon_object); + im = e_fm_icon_meta_generate(icon->icon_obj); if (im) { m->files = evas_list_append(m->files, im); @@ -3304,6 +3357,20 @@ int ret; if (!sd->meta) return 0; + + + { + Evas_List *l; + + for(l = sd->meta->files; l; l = l->next) + { + E_Fm_Icon_Metadata *m; + + m = l->data; + //printf("Saving meta: %d %d\n", m->x, m->y); + } + } + 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); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_fileman_smart.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- e_fileman_smart.h 5 Nov 2005 01:01:26 -0000 1.12 +++ e_fileman_smart.h 22 Nov 2005 09:27:25 -0000 1.13 @@ -46,6 +46,9 @@ EAPI void e_fm_selector_enable(Evas_Object *object, void (*func)(Evas_Object *object, char *file, void *data), void *data); EAPI void e_fm_background_set(Evas_Object *object, Evas_Object *bg); +EAPI Evas_Object *e_fm_icon_create(void *data); +EAPI void e_fm_icon_destroy(Evas_Object *obj, void *data); + extern int E_EVENT_FM_RECONFIGURE; extern int E_EVENT_FM_DIRECTORY_CHANGE; #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_icon.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_icon.c 6 Nov 2005 03:40:24 -0000 1.9 +++ e_icon.c 22 Nov 2005 09:27:25 -0000 1.10 @@ -71,6 +71,18 @@ _e_icon_smart_reconfigure(sd); } +void +e_icon_object_set(Evas_Object *obj, Evas_Object *o) +{ + E_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + /* smart code here */ + if (sd->obj) evas_object_del(sd->obj); + sd->obj = o; + _e_icon_smart_reconfigure(sd); +} + const char * e_icon_file_get(Evas_Object *obj) { =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_icon.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- e_icon.h 4 Nov 2005 03:33:23 -0000 1.8 +++ e_icon.h 22 Nov 2005 09:27:25 -0000 1.9 @@ -10,6 +10,7 @@ EAPI void e_icon_file_set (Evas_Object *obj, const char *file); EAPI void e_icon_file_key_set (Evas_Object *obj, const char *file, const char *key); EAPI void e_icon_file_edje_set (Evas_Object *obj, const char *file, const char *part); +EAPI void e_icon_object_set(Evas_Object *obj, Evas_Object *o); EAPI const char *e_icon_file_get (Evas_Object *obj); EAPI void e_icon_smooth_scale_set (Evas_Object *obj, int smooth); EAPI int e_icon_smooth_scale_get (Evas_Object *obj); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_includes.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -3 -r1.66 -r1.67 --- e_includes.h 21 Nov 2005 12:44:19 -0000 1.66 +++ e_includes.h 22 Nov 2005 09:27:25 -0000 1.67 @@ -79,8 +79,9 @@ #include "e_widget_iconsel.h" #include "e_config_dialog.h" #include "e_int_config_focus.h" +#include "e_icon_grid.h" +#include "e_icon_canvas.h" #include "e_int_config_desks.h" -#include "e_icon_layout.h" #include "e_int_border_locks.h" #include "e_thumb.h" #include "e_int_border_remember.h" @@ -98,3 +99,4 @@ #include "e_widget_slider.h" #include "e_int_config_window_manipulation.h" #include "e_int_config_window_display.h" +#include "e_int_config_background.h" =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -3 -r1.112 -r1.113 --- e_int_menus.c 12 Nov 2005 05:27:58 -0000 1.112 +++ e_int_menus.c 22 Nov 2005 09:27:25 -0000 1.113 @@ -865,6 +865,10 @@ if (themes) { char *theme, *deftheme = NULL; + char fulltheme[PATH_MAX]; + Evas_Object *o; + Ecore_Evas *eebuf; + Evas *evasbuf; Evas_List *l; for (l = e_config->themes; l; l = l->next) @@ -886,14 +890,20 @@ e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL); num++; + eebuf = ecore_evas_buffer_new(1, 1); + evasbuf = ecore_evas_get(eebuf); + o = edje_object_add(evasbuf); + while ((theme = ecore_list_next(themes))) { - char *ext; + char *ext; - ext = strrchr(theme, '.'); - if (ecore_file_is_dir(theme) || (!ext)) + snprintf(fulltheme, sizeof(fulltheme), "%s/%s", buf, theme); + if (ecore_file_is_dir(fulltheme)) continue; - if (!strcasecmp(ext, ".edj")) + + /* minimum theme requirements */ + if(edje_object_file_set(o, fulltheme, "widgets/border/default/border")) { mi = e_menu_item_new(m); e_menu_item_radio_set(mi, 1); @@ -903,12 +913,14 @@ if (!strcmp(theme, deftheme)) e_menu_item_toggle_set(mi, 1); } - *ext = 0; e_menu_item_label_set(mi, theme); e_menu_item_callback_set(mi, _e_int_menus_themes_edit_mode_cb, NULL); num++; } } + + evas_object_del(o); + ecore_evas_free(eebuf); ecore_list_destroy(themes); } } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_thumb.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_thumb.c 4 Nov 2005 17:02:42 -0000 1.14 +++ e_thumb.c 22 Nov 2005 09:27:25 -0000 1.15 @@ -10,9 +10,26 @@ # define D(x) ((void) 0) #endif +typedef struct _E_Thumb_Item E_Thumb_Item; + static char *_e_thumb_file_id(char *file); +static void _e_thumb_generate(void); +static int _e_thumb_cb_exe_exit(void *data, int type, void *event); static char *thumb_path = NULL; +static Evas_List *thumb_files = NULL; +static Evas_List *event_handlers = NULL; +static pid_t pid = -1; + +struct _E_Thumb_Item +{ + char path[PATH_MAX]; + Evas_Object *obj; + Evas *evas; + Evas_Coord w, h; + void (*cb)(Evas_Object *obj, void *data); + void *data; +}; int e_thumb_init(void) @@ -31,6 +48,11 @@ } else return 0; + event_handlers = + evas_list_append(event_handlers, + ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, + _e_thumb_cb_exe_exit, + NULL)); return 1; } @@ -38,6 +60,13 @@ e_thumb_shutdown(void) { E_FREE(thumb_path); + while (event_handlers) + { + ecore_event_handler_del(event_handlers->data); + event_handlers = evas_list_remove_list(event_handlers, event_handlers); + } + evas_list_free(thumb_files); + return 1; } @@ -48,6 +77,53 @@ return thumb_path; } +/* queue an image for thumbnailing or return the thumb if it exists */ +Evas_Object * +e_thumb_generate_begin(char *path, Evas_Coord w, Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data) +{ + E_Thumb_Item *t; + + if(!ecore_file_exists(path)) return *tmp; + if (e_thumb_exists(path)) + { + evas_object_del(*tmp); + *tmp = e_thumb_evas_object_get(path, evas, w, h, 1); + return *tmp; + } + + t = E_NEW(E_Thumb_Item, 1); + t->w = w; + t->h = h; + t->evas = evas; + t->cb = cb; + t->data = data; + *tmp = e_icon_add(evas); + t->obj = *tmp; + snprintf(t->path, sizeof(t->path), "%s", path); + thumb_files = evas_list_append(thumb_files, t); + if (pid == -1) _e_thumb_generate(); + + return *tmp; +} + +/* delete an image from the thumb queue */ +void +e_thumb_generate_end(char *path) +{ + Evas_List *l; + E_Thumb_Item *t; + + for(l = thumb_files; l; l = l->next) + { + t = l->data; + if(!strcmp(path, t->path)) + { + thumb_files = evas_list_remove_list(thumb_files, l); + break; + } + } +} + /* return hashed path of thumb */ char * e_thumb_file_get(char *file) @@ -411,3 +487,70 @@ *sp = 0; return strdup(s); } + +/* generate a thumb from the list of queued thumbs */ +static void +_e_thumb_generate(void) +{ + E_Thumb_Item *t; + + if ((!thumb_files) || (pid != -1)) return; + pid = fork(); + if (pid == 0) + { + /* reset signal handlers for the child */ + signal(SIGSEGV, SIG_DFL); + signal(SIGILL, SIG_DFL); + signal(SIGFPE, SIG_DFL); + signal(SIGBUS, SIG_DFL); + + t = thumb_files->data; + if (!e_thumb_exists(t->path)) + e_thumb_create(t->path, t->w, t->h); + eet_cacheburst(0); + exit(0); + } +} + +/* called when a thumb is generated */ +static int +_e_thumb_cb_exe_exit(void *data, int type, void *event) +{ + Ecore_Event_Exe_Exit *ev; + E_Thumb_Item *t; + char *ext; + + ev = event; + if (ev->pid != pid) return 1; + if (!thumb_files) return 1; + + t = thumb_files->data; + thumb_files = evas_list_remove_list(thumb_files, thumb_files); + + ext = strrchr(t->path, '.'); + if ((ext) && (strcasecmp(ext, ".eap"))) + ext = NULL; + + if ((ext) || (ecore_file_exists(t->path))) + { + Evas_Coord w, h; + Evas_Object *tmp; + void *data; + + tmp = e_thumb_evas_object_get(t->path, + t->evas, + t->w, + t->h, + 1); + data = e_icon_data_get(tmp, &w, &h); + e_icon_data_set(t->obj, data, w, h); + evas_object_del(tmp); + if(t->cb) + t->cb(t->obj, t->data); + free(t); + } + + pid = -1; + _e_thumb_generate(); + return 1; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_thumb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_thumb.h 4 Nov 2005 03:33:23 -0000 1.3 +++ e_thumb.h 22 Nov 2005 09:27:25 -0000 1.4 @@ -15,6 +15,8 @@ EAPI int e_thumb_exists(char *file); EAPI int e_thumb_create(char *file, Evas_Coord w, Evas_Coord h); EAPI Evas_Object *e_thumb_evas_object_get(char *file, Evas *evas, Evas_Coord width, Evas_Coord height, int shrink); - +EAPI Evas_Object *e_thumb_generate_begin(char *path, Evas_Coord w, Evas_Coord h, Evas *evas, Evas_Object **tmp, void (*cb)(Evas_Object *obj, void *data), void *data); +EAPI void e_thumb_generate_end(char *path); + #endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_widget_image.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_widget_image.c 26 Oct 2005 20:36:09 -0000 1.4 +++ e_widget_image.c 22 Nov 2005 09:27:25 -0000 1.5 @@ -2,22 +2,34 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ #include "e.h" - + +typedef struct _E_Widget_Data E_Widget_Data; +struct _E_Widget_Data +{ + Evas_Object *img; +}; + /* local subsystem functions */ /* externally accessible functions */ Evas_Object * e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh) { - Evas_Object *obj; + Evas_Object *obj, *o; + E_Widget_Data *wd; obj = e_widget_add(evas); - + wd = calloc(1, sizeof(E_Widget_Data)); + evas_object_show(object); + o = e_icon_add(evas); + e_icon_object_set(o, object); + wd->img = o; + e_widget_data_set(obj, wd); e_widget_can_focus_set(obj, 0); e_widget_min_size_set(obj, minw, minh); - e_widget_sub_object_add(obj, object); - e_widget_resize_object_set(obj, object); + e_widget_sub_object_add(obj, o); + e_widget_resize_object_set(obj, o); return obj; } @@ -25,13 +37,18 @@ Evas_Object * e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh) { - Evas_Object *obj, *o; + Evas_Object *obj, *o, *o2; + E_Widget_Data *wd; obj = e_widget_add(evas); + wd = calloc(1, sizeof(E_Widget_Data)); - o = evas_object_image_add(evas); - evas_object_image_file_set(o, file, NULL); + o = e_icon_add(evas); + o2 = evas_object_image_add(evas); + evas_object_image_file_set(o2, file, NULL); + e_icon_object_set(o, o2); + wd->img = o; evas_object_show(o); e_widget_can_focus_set(obj, 0); e_widget_min_size_set(obj, minw, minh); @@ -40,3 +57,43 @@ return obj; } + +void +e_widget_image_edje_set(Evas_Object *obj, char *file, char *part) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + e_icon_file_edje_set(wd->img, file, part); + evas_object_show(wd->img); +} + +void +e_widget_image_file_set(Evas_Object *obj, char *file) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + e_icon_file_set(wd->img, file); + evas_object_show(wd->img); +} + +void +e_widget_image_file_key_set(Evas_Object *obj, char *file, char *key) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + e_icon_file_key_set(wd->img, file, key); + evas_object_show(wd->img); +} + +void +e_widget_image_object_set(Evas_Object *obj, Evas_Object *o) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + e_icon_object_set(wd->img, o); + evas_object_show(wd->img); +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_widget_image.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- e_widget_image.h 24 Oct 2005 16:19:17 -0000 1.1 +++ e_widget_image.h 22 Nov 2005 09:27:25 -0000 1.2 @@ -7,7 +7,11 @@ #define E_WIDGET_IMAGE_H EAPI Evas_Object *e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh); -EAPI Evas_Object *e_widget_image_add_from_file(Evas *evas, char *file, int aspect, int minh); - +EAPI Evas_Object *e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh); +EAPI void e_widget_image_edje_set(Evas_Object *obj, char *file, char *part); +EAPI void e_widget_image_file_set(Evas_Object *obj, char *file); +EAPI void e_widget_image_file_key_set(Evas_Object *obj, char *file, char *key); +EAPI void e_widget_image_object_set(Evas_Object *obj, Evas_Object *o); + #endif #endif ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs