Enlightenment CVS committal Author : devilhorns Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_fm.c Log Message: Added basic rubber band support to efm. Still needs a little work. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v retrieving revision 1.200 retrieving revision 1.201 diff -u -3 -r1.200 -r1.201 --- e_fm.c 10 Sep 2007 23:28:48 -0000 1.200 +++ e_fm.c 19 Sep 2007 19:39:00 -0000 1.201 @@ -40,6 +40,7 @@ Evas_Object *overlay; Evas_Object *drop; Evas_Object *drop_in; + Evas_Object *sel_rect; const char *dev; const char *path; const char *realpath; @@ -77,7 +78,7 @@ unsigned char typebuf_visible : 1; unsigned char show_hidden_files : 1; unsigned char listing : 1; - + E_Fm2_Config *config; const char *custom_theme; const char *custom_theme_content; @@ -111,6 +112,12 @@ unsigned char drop_in_show : 1; unsigned char drop_all : 1; unsigned char drag : 1; + unsigned char selecting : 1; + struct + { + int ox, oy; + int x, y, w, h; + } selrect; }; struct _E_Fm2_Region @@ -335,6 +342,7 @@ static void _e_fm2_client_file_copy(int id, const char *path, const char *dest, const char *rel, int rel_to, int x, int y, int res_w, int res_h); static void _e_fm2_client_mount(const char *udi, const char *mountpoint); static void _e_fm2_client_unmount(const char *udi); +static void _e_fm2_sel_rect_update(void *data); static char *_e_fm2_meta_path = NULL; static Evas_Smart *_e_fm2_smart = NULL; @@ -5782,6 +5790,13 @@ } if (sel_change) evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + + if (!sd->config->selection.single) + { + sd->selrect.ox = ev->canvas.x; + sd->selrect.oy = ev->canvas.y; + sd->selecting = 1; + } } else if (ev->button == 3) { @@ -5799,6 +5814,11 @@ sd = data; ev = event_info; + if (!sd->selecting) return; + sd->selecting = 0; + sd->selrect.ox = 0; + sd->selrect.oy = 0; + evas_object_hide(sd->sel_rect); } static void @@ -5809,8 +5829,70 @@ sd = data; ev = event_info; + if (!sd->selecting) return; + + if (ev->cur.canvas.x < sd->selrect.ox) + { + sd->selrect.x = ev->cur.canvas.x; + sd->selrect.w = (sd->selrect.ox - sd->selrect.x); + } + else + { + sd->selrect.x = MIN(sd->selrect.ox, ev->cur.canvas.x); + sd->selrect.w = abs(sd->selrect.x - ev->cur.canvas.x); + } + if (ev->cur.canvas.y < sd->selrect.oy) + { + sd->selrect.y = ev->cur.canvas.y; + sd->selrect.h = (sd->selrect.oy - sd->selrect.y); + } + else + { + sd->selrect.y = MIN(sd->selrect.oy, ev->cur.canvas.y); + sd->selrect.h = abs(sd->selrect.y - ev->cur.canvas.y); + } + + _e_fm2_sel_rect_update(sd); } - + +static void +_e_fm2_sel_rect_update(void *data) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l = NULL; + int sel_change = 0; + + sd = data; + evas_object_move(sd->sel_rect, sd->selrect.x, sd->selrect.y); + evas_object_resize(sd->sel_rect, sd->selrect.w, sd->selrect.h); + evas_object_show(sd->sel_rect); + for (l = sd->icons; l; l = l->next) + { + E_Fm2_Icon *ic; + + ic = l->data; + if E_INTERSECTS(sd->selrect.x, sd->selrect.y, sd->selrect.w, sd->selrect.h, + ic->x, ic->y, ic->w, ic->h) + { + if (!ic->selected) + { + _e_fm2_icon_select(ic); + sel_change = 1; + } + } + else + { + if (ic->selected) + { + _e_fm2_icon_deselect(ic); + sel_change = 1; + } + } + } + if (sel_change) + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); +} + static void _e_fm2_cb_scroll_job(void *data) { @@ -6093,6 +6175,12 @@ "overlay"); evas_object_smart_member_add(sd->overlay, obj); evas_object_show(sd->overlay); + + sd->sel_rect = edje_object_add(evas_object_evas_get(obj)); + evas_object_clip_set(sd->sel_rect, sd->clip); + _e_fm2_theme_edje_object_set(sd, sd->sel_rect, "base/theme/fileman", + "rubberband"); + evas_object_smart_member_add(sd->sel_rect, obj); evas_object_smart_data_set(obj, sd); evas_object_move(obj, 0, 0); @@ -6150,6 +6238,7 @@ evas_object_del(sd->overlay); evas_object_del(sd->drop); evas_object_del(sd->drop_in); + evas_object_del(sd->sel_rect); evas_object_del(sd->clip); if (sd->drop_handler) e_drop_handler_del(sd->drop_handler); if (_e_fm2_list_walking == 0) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs