Ephoto: Use select mode with control. On DND, don't build icons, only use one under cursor to save resources.

v-1.6.0
Stephen Houston 7 years ago
parent 7682ab5665
commit bfe51ff0f8
  1. 56
      src/bin/ephoto_thumb_browser.c

@ -4,7 +4,7 @@
#define ZOOM_MIN 128
#define ZOOM_STEP 32
#define TODO_ITEM_MIN_BATCH 16
#define TODO_ITEM_MIN_BATCH 5
#define FILESEP "file://"
#define FILESEP_LEN sizeof(FILESEP) - 1
@ -2020,7 +2020,6 @@ _dnd_drag_data_build(Eina_List **items)
{
strcat((char *) drag_data, FILESEP);
strcat((char *) drag_data, e->path);
strcat((char *) drag_data, "\n");
}
}
}
@ -2059,55 +2058,6 @@ _dnd_create_icon(void *data, Evas_Object *win, Evas_Coord *xoff,
return icon;
}
static Eina_List *
_dnd_icons_get(void *data)
{
Eina_List *l;
Eina_List *icons = NULL;
Evas_Coord xm, ym;
evas_pointer_canvas_xy_get(evas_object_evas_get(data), &xm, &ym);
Eina_List *items = eina_list_clone(elm_gengrid_selected_items_get(data));
Elm_Object_Item *gli = elm_gengrid_at_xy_item_get(data, xm, ym, 0, 0);
if (gli)
{
void *p = eina_list_search_sorted(items,
_entry_cmp_grid_alpha_asc, gli);
if (!p)
items = eina_list_append(items, gli);
}
EINA_LIST_FOREACH(items, l, gli)
{
Evas_Object *o =
elm_object_item_part_content_get(gli, "elm.swallow.icon");
if (o)
{
int x, y, w, h;
const char *f, *g;
elm_image_file_get(o, &f, &g);
Evas_Object *ic = elm_icon_add(data);
elm_image_file_set(ic, f, g);
evas_object_geometry_get(o, &x, &y, &w, &h);
evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_move(ic, x, y);
evas_object_resize(ic, w, h);
evas_object_show(ic);
icons = eina_list_append(icons, ic);
}
}
eina_list_free(items);
return icons;
}
static const char *
_dnd_get_drag_data(Evas_Object *obj, Elm_Object_Item *it, Eina_List **items)
{
@ -2142,7 +2092,7 @@ _dnd_item_data_get(Evas_Object *obj, Elm_Object_Item *it,
info->createicon = _dnd_create_icon;
info->createdata = it;
info->dragstart = _dnd_drag_start;
info->icons = _dnd_icons_get(obj);
info->icons = NULL;
info->dragdone = _dnd_drag_done;
info->data = _dnd_get_drag_data(obj, it, (Eina_List **) & info->donecbdata);
info->acceptdata = info->donecbdata;
@ -3467,7 +3417,7 @@ ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent)
elm_gengrid_align_set(tb->grid, 0.5, 0.0);
elm_gengrid_multi_select_set(tb->grid, EINA_TRUE);
elm_gengrid_multi_select_mode_set(tb->grid,
ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT);
ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL);
elm_scroller_bounce_set(tb->grid, EINA_FALSE, EINA_TRUE);
evas_object_smart_callback_add(tb->grid, "activated",
_ephoto_thumb_activated, tb);

Loading…
Cancel
Save