From f4915164a9fcfa04564f1632b7174b4b9f444b52 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Thu, 27 Aug 2009 10:35:32 +0000 Subject: [PATCH] 'everything' - removed old list view. both is in thumb view now. toggle them with ctrl+2 - removed o_icon and o_bg memebers from Evry_Item, those didnt belong there.. - moved some stuff into evry_util.c SVN revision: 42031 --- data/themes/default.edc | 195 ++++++- src/modules/everything/Evry.h | 2 - src/modules/everything/Makefile.am | 1 + .../everything/actions/evry_plug_wallpaper.c | 9 +- src/modules/everything/e_mod_main.c | 84 +-- src/modules/everything/evry.c | 220 +------- src/modules/everything/evry_util.c | 278 ++++++++++ .../everything/sources/evry_plug_apps.c | 63 ++- src/modules/everything/views/Makefile.am | 7 - .../everything/views/evry_plug_view_list.c | 477 ------------------ .../everything/views/evry_plug_view_thumb.c | 255 +++++----- 11 files changed, 665 insertions(+), 926 deletions(-) create mode 100644 src/modules/everything/evry_util.c delete mode 100644 src/modules/everything/views/evry_plug_view_list.c diff --git a/data/themes/default.edc b/data/themes/default.edc index c65e410be..59b559b51 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -26581,7 +26581,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); ///////////////////////////////////////////////////////////////////////////// /*** MOD: EVERYTHING ***/ - /* #define DROP_SHADOW 1 */ + #define DROP_SHADOW 1 ICON("everything-launch","icon_advanced.png",64) @@ -26614,7 +26614,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); border: 50 50 50 50; } fill.smooth: 0; - color: 255 255 255 200; + color: 255 255 255 220; } } part { name: "bg"; @@ -26806,7 +26806,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); clip_to: "clip"; mouse_events: 0; description { state: "default" 0.0; - color: 255 255 255 32; + color: 255 255 255 96; //32; rel1.offset: 2 2; rel2.offset: -3 -3; image { @@ -27038,7 +27038,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); border: 50 50 50 50; } fill.smooth: 0; - color: 255 255 255 100; + color: 255 255 255 140; } description { state: "visible" 0.0; rel1.offset: 0 -50; @@ -27052,7 +27052,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); border: 50 50 50 50; } fill.smooth: 0; - color: 255 255 255 200; + color: 255 255 255 255; } } part { name: "base"; @@ -28101,7 +28101,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); } } - group { name: "e/modules/everything/thumbview/main/mini"; + group { name: "e/modules/everything/thumbview/item/thumb"; images { image: "e17_mini_button_shadow2.png" COMP; image: "everything_item_bg.png" COMP; @@ -28275,6 +28275,189 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128); } } + group { name: "e/modules/everything/thumbview/item/list"; + images { + image: "e17_mini_button_shadow2.png" COMP; + image: "everything_item_bg.png" COMP; + } + parts { + part { name: "bg"; + mouse_events: 0; + description { state: "default" 0.0; + rel1 { + to: "base"; + offset: -1 -3; + } + rel2 { + to: "base"; + offset: -2 2; + } + fill.smooth: 0; + image { + normal: "everything_item_bg.png"; + border: 5 5 5 5; + } + color: 255 255 255 32; + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 255 255 255 128; + } + } + part { name: "base"; + mouse_events: 0; + type: RECT; + description { state: "default" 0.0; + visible: 0; + rel1 { + relative: 0.0 0.0; + offset: 0 3; + } + rel2 { + relative: 1.0 1.0; + offset: -5 -4; + } + color: 255 255 255 0; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "clip"; + mouse_events: 0; + type: RECT; + /* clip_to: "base"; */ + description { state: "default" 0.0; + + rel1 { + to: "base"; + relative: 0.0 0.0; + offset: 2 0; + } + rel2 { + to: "base"; + relative: 0.0 1.0; + offset: 36 -1; + } + + color: 235 235 235 255; + } + description { state: "selected" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "e.swallow.icon"; + clip_to: "clip"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + to: "clip"; + } + rel2 { + to: "clip"; + } + } + } + part { name: "e.swallow.thumb"; + clip_to: "clip"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 { + to: "clip"; + } + rel2 { + to: "clip"; + } + } + } + part { name: "e.text.label"; + type: TEXT; + clip_to: "base"; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to_x: "clip"; + to_y: "base"; + offset: 5 6; + relative: 1.0 0.5; + } + rel2 { + relative: 1.0 0.5; + offset: -2 -1; + to: "base"; + } + + color: 210 210 210 255; + color3: 0 0 0 0; + text { + font: "Sans"; + size: 11; + min: 0 1; + align: 0.0 0.5; + } + } + } + } + programs { + program { name: "sel"; + signal: "e,state,selected"; + source: "e"; + action: STATE_SET "selected" 0.0; + /* transition: LINEAR 0.04; */ + target: "bg"; + target: "clip"; + } + program { name: "unsel"; + signal: "e,state,unselected"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.1; + target: "bg"; + target: "clip"; + } + program { name: "thumb_gen"; + signal: "e,action,thumb,gen"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.0; + target: "base"; + after: "thumb_ungen"; + } + program { name: "thumb_ungen"; + signal: "e,action,thumb,ungen"; + source: "e"; + action: STATE_SET "visible" 0.0; + transition: SINUSOIDAL 0.15; + target: "base"; + } + program { name: "thumb_show_delayed"; + signal: "e,action,thumb,show_delayed"; + source: "e"; + action: STATE_SET "default" 0.2; + target: "base"; + after: "thumb_show_delayed2"; + } + program { name: "thumb_show_delayed2"; + action: STATE_SET "visible" 0.0; + transition: SINUSOIDAL 0.6; + target: "base"; + } + program { name: "thumb_show"; + signal: "e,action,thumb,show"; + source: "e"; + action: STATE_SET "visible" 0.0; + transition: SINUSOIDAL 0.1; + target: "base"; + } + } + } + group { name: "e/modules/everything/thumbview/main/scrollframe"; images { image: "arrow_up.png" COMP; diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 5f9907a18..a85a5d984 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -85,8 +85,6 @@ struct _Evry_Item /* do not set by plugin! */ Evry_Plugin *plugin; - Evas_Object *o_icon; - Evas_Object *o_bg; int ref; void (*free) (Evry_Item *item); }; diff --git a/src/modules/everything/Makefile.am b/src/modules/everything/Makefile.am index 49a25e652..fa3a3ba2d 100644 --- a/src/modules/everything/Makefile.am +++ b/src/modules/everything/Makefile.am @@ -30,6 +30,7 @@ module_la_SOURCES = $(EVRYHEADERS) \ e_mod_main.h \ evry.c \ evry_config.c \ + evry_util.c \ evry_plug_aggregator.c \ evry_plug_actions.c \ evry_view_plugin_tabs.c diff --git a/src/modules/everything/actions/evry_plug_wallpaper.c b/src/modules/everything/actions/evry_plug_wallpaper.c index 3a53b6448..4af88311f 100644 --- a/src/modules/everything/actions/evry_plug_wallpaper.c +++ b/src/modules/everything/actions/evry_plug_wallpaper.c @@ -29,7 +29,6 @@ struct _Import Ecore_Event_Handler *exe_handler; char *tmpf; char *fdest; - Evas *evas; }; struct _Item @@ -187,7 +186,6 @@ _action(Evry_Plugin *plugin, const Evry_Item *item) import->file = p->prev->file->uri; import->quality = 100; import->external = 0; - import->evas = evas_object_evas_get(item->o_bg); /* Eeek! */ _import_edj_gen(import); return 1; @@ -233,8 +231,8 @@ EINA_MODULE_SHUTDOWN(_shutdown); static void _import_edj_gen(Import *import) { - Evas *evas = import->evas; - + Ecore_Evas *ee = ecore_evas_buffer_new(100, 100); + Evas *evas = ecore_evas_get(ee); Evas_Object *img; int fd, num = 1; int w = 0, h = 0; @@ -285,7 +283,10 @@ _import_edj_gen(Import *import) evas_object_image_file_set(img, import->file, NULL); evas_object_image_size_get(img, &w, &h); evas_object_del(img); + ecore_evas_free(ee); + printf("w%d h%d\n", w, h); + if (import->external) { fstrip = strdup(e_util_filename_escape(import->file)); diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 0c83c2d0d..a45f669dd 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -479,6 +479,10 @@ _evry_cb_view_sort(const void *data1, const void *data2) void evry_view_register(Evry_View *view, int priority) { + /* XXX remove: ignore old list view, some people might + forget to do make uninstall */ + if (!strcmp(view->name, "List View")) return; + view->priority = priority; evry_conf->views = eina_list_append(evry_conf->views, view); @@ -495,83 +499,3 @@ evry_view_unregister(Evry_View *view) } -/* taken from e_utils. just changed 48 to 72.. we need - evry_icon_theme_set(Evas_Object *obj, const char *icon, - size:small, mid, large) imo */ -static int -_evry_icon_theme_set(Evas_Object *obj, const char *icon) -{ - const char *file; - char buf[4096]; - - if ((!icon) || (!icon[0])) return 0; - snprintf(buf, sizeof(buf), "e/icons/%s", icon); - file = e_theme_edje_file_get("base/theme/icons", buf); - if (file[0]) - { - e_icon_file_edje_set(obj, file, buf); - return 1; - } - return 0; -} - -static int -_evry_icon_fdo_set(Evas_Object *obj, const char *icon) -{ - char *path = NULL; - unsigned int size; - - if ((!icon) || (!icon[0])) return 0; - size = e_util_icon_size_normalize(72 * e_scale); - path = efreet_icon_path_find(e_config->icon_theme, icon, size); - - if (!path) return 0; - e_icon_file_set(obj, path); - E_FREE(path); - return 1; -} - -Evas_Object * -evry_icon_theme_get(const char *icon, Evas *e) -{ - Evas_Object *o = e_icon_add(e); - - if (e_config->icon_theme_overrides) - { - if (_evry_icon_fdo_set(o, icon) || - _evry_icon_theme_set(o, icon)) - return o; - } - else - { - if (_evry_icon_theme_set(o, icon) || - _evry_icon_fdo_set(o, icon)) - return o; - } - - evas_object_del(o); - - return NULL; -} - -Evas_Object * -evry_icon_mime_get(const char *mime, Evas *e) -{ - Evas_Object *o = NULL; - char *icon; - - icon = efreet_mime_type_icon_get(mime, e_config->icon_theme, 64); - - if (icon) - { - o = e_util_icon_add(icon, e); - free(icon); - } - else - { - o = evry_icon_theme_get("none", e); - } - - return o; -} - diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 7b493db5d..c4828990b 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -10,8 +10,6 @@ */ #define INPUTLEN 40 #define MATCH_LAG 0.33 -#define MAX_FUZZ 100 -#define MAX_WORDS 5 @@ -158,6 +156,7 @@ evry_show(E_Zone *zone, const char *params) Evry_State *s = selector->state; s->view = view->create(view, s, list->o_main); + _evry_view_show(s->view); } else goto error; @@ -250,7 +249,9 @@ evry_clear_input(void) } -/* static int item_cnt = 0; */ +#ifdef CECHK_REFS +static int item_cnt = 0; +#endif EAPI Evry_Item * evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label, void (*cb_free) (Evry_Item *item)) @@ -272,7 +273,9 @@ evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label, void (*cb_free it->ref = 1; - /* item_cnt++; */ +#ifdef CHECK_REFS + item_cnt++; +#endif return it; } @@ -284,16 +287,17 @@ evry_item_free(Evry_Item *it) it->ref--; +#ifdef CHECK_REFS + printf("%d, %d\t free: %s\n", it->ref, item_cnt - 1, it->label); +#endif + if (it->ref > 0) return; - /* printf("%d, %d\t free: %s\n", - * it->ref, item_cnt - 1, - * it->label); - * item_cnt--; */ +#ifdef CHECK_REFS + item_cnt--; +#endif if (it->label) eina_stringshare_del(it->label); - if (it->o_bg) evas_object_del(it->o_bg); - if (it->o_icon) evas_object_del(it->o_icon); if (it->free) it->free(it); @@ -407,196 +411,6 @@ evry_plugin_async_update(Evry_Plugin *p, int action) } } -EAPI int -evry_fuzzy_match(const char *str, const char *match) -{ - const char *p, *m, *next; - int sum = 0; - - unsigned int last = 0; - unsigned int offset = 0; - unsigned int min = 0; - unsigned char first = 0; - /* ignore punctuation */ - unsigned char ip = 1; - - unsigned int cnt = 0; - /* words in match */ - unsigned int m_num = 0; - unsigned int m_cnt = 0; - unsigned int m_min[MAX_WORDS]; - unsigned int m_len = 0; - - if (!match || !str) return 0; - - /* remove white spaces at the beginning */ - for (; (*match != 0) && isspace(*match); match++); - for (; (*str != 0) && isspace(*str); str++); - - /* count words in match */ - for (m = match; (*m != 0) && (m_num < MAX_WORDS);) - { - for (; (*m != 0) && !isspace(*m); m++); - for (; (*m != 0) && isspace(*m); m++); - m_min[m_num++] = MAX_FUZZ; - } - for (m = match; ip && (*m != 0); m++) - if (ip && ispunct(*m)) ip = 0; - - m_len = strlen(match); - - /* with less than 3 chars match must be a prefix */ - if (m_len < 3) m_len = 0; - - next = str; - m = match; - - while((m_cnt < m_num) && (*next != 0)) - { - /* reset match */ - if (m_cnt == 0) m = match; - - /* end of matching */ - if (*m == 0) break; - - offset = 0; - last = 0; - min = 1; - first = 0; - - /* match current word of string against current match */ - for (p = next; *next != 0; p++) - { - /* new word of string begins */ - if ((*p == 0) || isspace(*p) || (ip && ispunct(*p))) - { - if (m_cnt < m_num - 1) - { - /* test next match */ - for (; (*m != 0) && !isspace(*m); m++); - for (; (*m != 0) && isspace(*m); m++); - m_cnt++; - break; - } - else - { - /* go to next word */ - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); - cnt++; - next = p; - m_cnt = 0; - break; - } - } - - /* current char matches? */ - if (tolower(*p) != tolower(*m)) - { - if (!first) - offset += 1; - else - offset += 3; - - if (offset <= m_len * 3) - continue; - } - - if (min < MAX_FUZZ && offset <= m_len * 3) - { - /* first offset of match in word */ - if (!first) - { - first = 1; - last = offset; - } - - min += offset + (offset - last) * 5; - last = offset; - - /* try next char of match */ - if (*(++m) != 0 && !isspace(*m)) - continue; - - /* end of match: store min weight of match */ - min += (cnt - m_cnt) > 0 ? (cnt - m_cnt) : 0; - - if (min < m_min[m_cnt]) - m_min[m_cnt] = min; - } - else - { - /* go to next match */ - for (; (*m != 0) && !isspace(*m); m++); - } - - if (m_cnt < m_num - 1) - { - /* test next match */ - for (; (*m != 0) && isspace(*m); m++); - m_cnt++; - break; - } - else if(*p != 0) - { - /* go to next word */ - for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++); - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); - cnt++; - next = p; - m_cnt = 0; - break; - } - else - { - next = p; - break; - } - } - } - - for (m_cnt = 0; m_cnt < m_num; m_cnt++) - { - sum += m_min[m_cnt]; - - if (sum >= MAX_FUZZ) - { - sum = 0; - break; - } - } - - return sum; -} - -static int -_evry_fuzzy_match_sort_cb(const void *data1, const void *data2) -{ - const Evry_Item *it1 = data1; - const Evry_Item *it2 = data2; - - if (it1->priority - it2->priority) - return (it1->priority - it2->priority); - - if (it1->fuzzy_match || it2->fuzzy_match) - { - if (it1->fuzzy_match && !it2->fuzzy_match) - return -1; - - if (!it1->fuzzy_match && it2->fuzzy_match) - return 1; - - if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); - } - - return 0; -} - -EAPI Eina_List * -evry_fuzzy_match_sort(Eina_List *items) -{ - return eina_list_sort(items, eina_list_count(items), _evry_fuzzy_match_sort_cb); -} /* local subsystem functions */ @@ -1155,12 +969,12 @@ _evry_state_pop(Evry_Selector *sel) free(s->input); - EINA_LIST_FREE(s->plugins, p) - p->cleanup(p); - if (s->view) s->view->destroy(s->view); + EINA_LIST_FREE(s->plugins, p) + p->cleanup(p); + E_FREE(s); sel->states = eina_list_remove_list(sel->states, sel->states); diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c new file mode 100644 index 000000000..f96ddf482 --- /dev/null +++ b/src/modules/everything/evry_util.c @@ -0,0 +1,278 @@ +#include "Evry.h" + +#define MAX_FUZZ 100 +#define MAX_WORDS 5 + + +EAPI int +evry_fuzzy_match(const char *str, const char *match) +{ + const char *p, *m, *next; + int sum = 0; + + unsigned int last = 0; + unsigned int offset = 0; + unsigned int min = 0; + unsigned char first = 0; + /* ignore punctuation */ + unsigned char ip = 1; + + unsigned int cnt = 0; + /* words in match */ + unsigned int m_num = 0; + unsigned int m_cnt = 0; + unsigned int m_min[MAX_WORDS]; + unsigned int m_len = 0; + + if (!match || !str) return 0; + + /* remove white spaces at the beginning */ + for (; (*match != 0) && isspace(*match); match++); + for (; (*str != 0) && isspace(*str); str++); + + /* count words in match */ + for (m = match; (*m != 0) && (m_num < MAX_WORDS);) + { + for (; (*m != 0) && !isspace(*m); m++); + for (; (*m != 0) && isspace(*m); m++); + m_min[m_num++] = MAX_FUZZ; + } + for (m = match; ip && (*m != 0); m++) + if (ip && ispunct(*m)) ip = 0; + + m_len = strlen(match); + + /* with less than 3 chars match must be a prefix */ + if (m_len < 3) m_len = 0; + + next = str; + m = match; + + while((m_cnt < m_num) && (*next != 0)) + { + /* reset match */ + if (m_cnt == 0) m = match; + + /* end of matching */ + if (*m == 0) break; + + offset = 0; + last = 0; + min = 1; + first = 0; + + /* match current word of string against current match */ + for (p = next; *next != 0; p++) + { + /* new word of string begins */ + if ((*p == 0) || isspace(*p) || (ip && ispunct(*p))) + { + if (m_cnt < m_num - 1) + { + /* test next match */ + for (; (*m != 0) && !isspace(*m); m++); + for (; (*m != 0) && isspace(*m); m++); + m_cnt++; + break; + } + else + { + /* go to next word */ + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); + cnt++; + next = p; + m_cnt = 0; + break; + } + } + + /* current char matches? */ + if (tolower(*p) != tolower(*m)) + { + if (!first) + offset += 1; + else + offset += 3; + + if (offset <= m_len * 3) + continue; + } + + if (min < MAX_FUZZ && offset <= m_len * 3) + { + /* first offset of match in word */ + if (!first) + { + first = 1; + last = offset; + } + + min += offset + (offset - last) * 5; + last = offset; + + /* try next char of match */ + if (*(++m) != 0 && !isspace(*m)) + continue; + + /* end of match: store min weight of match */ + min += (cnt - m_cnt) > 0 ? (cnt - m_cnt) : 0; + + if (min < m_min[m_cnt]) + m_min[m_cnt] = min; + } + else + { + /* go to next match */ + for (; (*m != 0) && !isspace(*m); m++); + } + + if (m_cnt < m_num - 1) + { + /* test next match */ + for (; (*m != 0) && isspace(*m); m++); + m_cnt++; + break; + } + else if(*p != 0) + { + /* go to next word */ + for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++); + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); + cnt++; + next = p; + m_cnt = 0; + break; + } + else + { + next = p; + break; + } + } + } + + for (m_cnt = 0; m_cnt < m_num; m_cnt++) + { + sum += m_min[m_cnt]; + + if (sum >= MAX_FUZZ) + { + sum = 0; + break; + } + } + + return sum; +} + +static int +_evry_fuzzy_match_sort_cb(const void *data1, const void *data2) +{ + const Evry_Item *it1 = data1; + const Evry_Item *it2 = data2; + + if (it1->priority - it2->priority) + return (it1->priority - it2->priority); + + if (it1->fuzzy_match || it2->fuzzy_match) + { + if (it1->fuzzy_match && !it2->fuzzy_match) + return -1; + + if (!it1->fuzzy_match && it2->fuzzy_match) + return 1; + + if (it1->fuzzy_match - it2->fuzzy_match) + return (it1->fuzzy_match - it2->fuzzy_match); + } + + return 0; +} + +EAPI Eina_List * +evry_fuzzy_match_sort(Eina_List *items) +{ + return eina_list_sort(items, eina_list_count(items), _evry_fuzzy_match_sort_cb); +} + + +/* taken from e_utils. just changed 48 to 72.. we need + evry_icon_theme_set(Evas_Object *obj, const char *icon, + size:small, mid, large) imo */ +static int +_evry_icon_theme_set(Evas_Object *obj, const char *icon) +{ + const char *file; + char buf[4096]; + + if ((!icon) || (!icon[0])) return 0; + snprintf(buf, sizeof(buf), "e/icons/%s", icon); + file = e_theme_edje_file_get("base/theme/icons", buf); + if (file[0]) + { + e_icon_file_edje_set(obj, file, buf); + return 1; + } + return 0; +} + +static int +_evry_icon_fdo_set(Evas_Object *obj, const char *icon) +{ + char *path = NULL; + unsigned int size; + + if ((!icon) || (!icon[0])) return 0; + size = e_util_icon_size_normalize(72 * e_scale); + path = efreet_icon_path_find(e_config->icon_theme, icon, size); + + if (!path) return 0; + e_icon_file_set(obj, path); + E_FREE(path); + return 1; +} + +EAPI Evas_Object * +evry_icon_theme_get(const char *icon, Evas *e) +{ + Evas_Object *o = e_icon_add(e); + + if (e_config->icon_theme_overrides) + { + if (_evry_icon_fdo_set(o, icon) || + _evry_icon_theme_set(o, icon)) + return o; + } + else + { + if (_evry_icon_theme_set(o, icon) || + _evry_icon_fdo_set(o, icon)) + return o; + } + + evas_object_del(o); + + return NULL; +} + +EAPI Evas_Object * +evry_icon_mime_get(const char *mime, Evas *e) +{ + Evas_Object *o = NULL; + char *icon; + + icon = efreet_mime_type_icon_get(mime, e_config->icon_theme, 64); + + if (icon) + { + o = e_util_icon_add(icon, e); + free(icon); + } + else + { + o = evry_icon_theme_get("none", e); + } + + return o; +} + diff --git a/src/modules/everything/sources/evry_plug_apps.c b/src/modules/everything/sources/evry_plug_apps.c index d7f8862a3..1212bc581 100644 --- a/src/modules/everything/sources/evry_plug_apps.c +++ b/src/modules/everything/sources/evry_plug_apps.c @@ -32,6 +32,7 @@ static Evry_Action *act2 = NULL; static Evry_Action *act3 = NULL; static Evry_Action *act4 = NULL; static Evry_Action *act5 = NULL; +static Evry_Action *act6 = NULL; static Eina_List *exe_path = NULL; static Ecore_Idler *exe_scan_idler = NULL; @@ -578,18 +579,23 @@ _exec_app_action(Evry_Action *act) return _app_action(act->item1, act->item2); } +/* TODO config option for terminal and shell! */ static int _exec_term_action(Evry_Action *act) { ITEM_APP(app, act->item1); - Evry_Item_App *fake = E_NEW(Evry_Item_App, 1); + Evry_Item_App *tmp; char buf[1024]; - snprintf(buf, sizeof(buf), "xterm -hold -e '%s'", app->file); - fake->file = buf; - - return _app_action(EVRY_ITEM(fake), NULL); + int ret; - E_FREE(fake); + tmp = E_NEW(Evry_Item_App, 1); + snprintf(buf, sizeof(buf), "/usr/bin/xterm -hold -e '%s'", app->file); + tmp->file = buf; + ret = _app_action(EVRY_ITEM(tmp), NULL); + + E_FREE(tmp); + + return ret; } static int @@ -614,6 +620,42 @@ _open_with_action(Evry_Plugin *plugin, const Evry_Item *it) return 0; } +static int +_open_term_action(Evry_Action *act) +{ + ITEM_FILE(file, act->item1); + Evry_Item_App *tmp; + char buf[1024]; + char *dir, *path; + int ret = 0; + + if (act->item1->browseable) + { + path = ecore_file_escape_name(file->uri); + } + else + { + dir = ecore_file_dir_get(file->uri); + if (!dir) return 0; + path = ecore_file_escape_name(dir); + + free(dir); + } + + if (path) + { + tmp = E_NEW(Evry_Item_App, 1); + snprintf(buf, sizeof(buf), "/usr/bin/xterm -e \'cd %s && /bin/bash\'", path); + tmp->file = buf; + ret = _app_action(EVRY_ITEM(tmp), NULL); + E_FREE(tmp); + free(path); + } + + return ret; +} + + static int _edit_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) { @@ -735,8 +777,6 @@ _exec_border_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) static int _exec_border_action(Evry_Action *act) { - /* ITEM_APP(app, act->item1); */ - return _app_action(act->item1, act->item2); } @@ -805,10 +845,16 @@ _init(void) "system-run", _exec_term_action, _exec_term_check_item, NULL, NULL, NULL); + + act6 = evry_action_new("Open Terminal here", "FILE", NULL, NULL, + "system-run", + _open_term_action, NULL, NULL, NULL, NULL); + evry_action_register(act); evry_action_register(act1); evry_action_register(act5); + evry_action_register(act6); evry_action_register(act2); evry_action_register(act3); evry_action_register(act4); @@ -843,6 +889,7 @@ _shutdown(void) evry_action_free(act3); evry_action_free(act4); evry_action_free(act5); + evry_action_free(act6); E_CONFIG_DD_FREE(exelist_edd); E_CONFIG_DD_FREE(exelist_exe_edd); diff --git a/src/modules/everything/views/Makefile.am b/src/modules/everything/views/Makefile.am index 794e648f1..2b06243d9 100644 --- a/src/modules/everything/views/Makefile.am +++ b/src/modules/everything/views/Makefile.am @@ -19,13 +19,6 @@ evry_plug_preview_la_LIBADD = @e_libs@ evry_plug_preview_la_LDFLAGS = -no-undefined -module -avoid-version evry_plug_preview_la_LIBTOOLFLAGS = --tag=disable-static -evry_plug_view_listdir = $(plugindir) -evry_plug_view_list_LTLIBRARIES = evry_plug_view_list.la -evry_plug_view_list_la_SOURCES = evry_plug_view_list.c -evry_plug_view_list_la_LIBADD = @e_libs@ -evry_plug_view_list_la_LDFLAGS = -no-undefined -module -avoid-version -evry_plug_view_list_la_LIBTOOLFLAGS = --tag=disable-static - evry_plug_view_helpdir = $(plugindir) evry_plug_view_help_LTLIBRARIES = evry_plug_view_help.la evry_plug_view_help_la_SOURCES = evry_plug_view_help.c diff --git a/src/modules/everything/views/evry_plug_view_list.c b/src/modules/everything/views/evry_plug_view_list.c deleted file mode 100644 index 629c66183..000000000 --- a/src/modules/everything/views/evry_plug_view_list.c +++ /dev/null @@ -1,477 +0,0 @@ -#include "e_mod_main.h" - -typedef struct _View View; - -struct _View -{ - Evry_View view; - Evas *evas; - const Evry_State *state; - Tab_View *tabs; - - Evas_Object *o_list; - Eina_List *items; - - - Ecore_Idle_Enterer *item_idler; - - double scroll_align_to; - double scroll_align; - - - - /* int ev_last_is_mouse; - * Evry_Item *item_mouseover; */ - /* Ecore_Timer *scroll_timer; */ - /* Ecore_Animator *scroll_animator; */ -}; - - -static Evry_View *view = NULL; - - -static void -_list_clear(View *v) -{ - Evry_Item *it; - - if (v->item_idler) - { - ecore_idle_enterer_del(v->item_idler); - v->item_idler = NULL; - } - - /* if (v->scroll_timer) - * { - * ecore_timer_del(v->scroll_timer); - * v->scroll_timer = NULL; - * } - * - * if (v->scroll_animator) - * { - * ecore_animator_del(v->scroll_animator); - * v->scroll_animator = NULL; - * } */ - - /* v->scroll_align = 0; */ - - if (!v->items) return; - - evas_event_freeze(v->evas); - e_box_freeze(v->o_list); - - EINA_LIST_FREE(v->items, it) - { - if (it->o_bg) - { - e_box_unpack(it->o_bg); - evas_object_hide(it->o_bg); - } - - if (it->o_icon) - evas_object_hide(it->o_icon); - - evry_item_free(it); - } - - e_box_thaw(v->o_list); - evas_event_thaw(v->evas); -} - -static void -_list_scroll_to(View *v, const Evry_Item *it) -{ - int n, h, mh, i = 0; - Eina_List *l; - - if (!it) return; - - for(l = v->items; l; l = l->next, i++) - if (l->data == it) break; - n = eina_list_count(v->items); - - e_box_min_size_get(v->o_list, NULL, &mh); - evas_object_geometry_get(v->o_list, NULL, NULL, NULL, &h); - - if (mh <= h) - { - e_box_align_set(v->o_list, 0.5, 0.0); - return; - } - - /* FIXME: how to get size of list before it is completely shown? */ - if (n > 6) - { - v->scroll_align_to = (double)i / (double)(n - 1); - { - v->scroll_align = v->scroll_align_to; - e_box_align_set(v->o_list, 0.5, 1.0 - v->scroll_align); - } - } - else - e_box_align_set(v->o_list, 0.5, 0.0); -} - -static int -_list_item_idler(void *data) -{ - View *v = data; - Evry_Plugin *p = v->state->plugin; - Eina_List *l; - Evry_Item *it; - int cnt = 5; - - if (!v->item_idler) return 0; - - if (!p->icon_get) goto end; - e_box_freeze(v->o_list); - - EINA_LIST_FOREACH(v->items, l, it) - { - if (it->o_icon) continue; - - it->o_icon = p->icon_get(p, it, v->evas); - - if (it->o_icon) - { - edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon); - evas_object_show(it->o_icon); - cnt--; - } - - if (cnt == 0) break; - } - e_box_thaw(v->o_list); - - e_util_wakeup(); - - if (cnt == 0) return 1; - end: - v->item_idler = NULL; - return 0; -} - -static void -_list_item_set_selected(const Evry_Item *it) -{ - if (it->o_bg) - edje_object_signal_emit(it->o_bg, "e,state,selected", "e"); - if (it->o_icon) - edje_object_signal_emit(it->o_icon, "e,state,selected", "e"); - if (it->browseable) - edje_object_signal_emit(it->o_bg, "e,state,arrow_show", "e"); -} - -static void -_list_item_set_unselected(const Evry_Item *it) -{ - if (it->o_bg) - edje_object_signal_emit(it->o_bg, "e,state,unselected", "e"); - if (it->o_icon) - edje_object_signal_emit(it->o_icon, "e,state,unselected", "e"); -} - -static int -_list_update(View *v) -{ - Evry_Item *it; - Eina_List *l; - int mw = -1, mh; - Evas_Object *o; - int divider = 1; - - _list_clear(v); - - if (!v->state->plugin) - return 1; - - evas_event_freeze(v->evas); - e_box_freeze(v->o_list); - - EINA_LIST_FOREACH(v->state->plugin->items, l, it) - { - o = it->o_bg; - - if (!o) - { - o = edje_object_add(v->evas); - it->o_bg = o; - e_theme_edje_object_set(o, "base/theme/everything", - "e/modules/everything/item"); - - edje_object_part_text_set(o, "e.text.title", it->label); - } - - if (mw < 0) edje_object_size_min_get(o, &mw, &mh); - - e_box_pack_end(v->o_list, o); - e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); - evas_object_show(o); - - if (divider) - edje_object_signal_emit(it->o_bg, "e,state,odd", "e"); - else - edje_object_signal_emit(it->o_bg, "e,state,even", "e"); - - divider = divider ? 0 : 1; - - if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons")) - { - edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); - evas_object_show(it->o_icon); - } - - if (it == v->state->sel_item) - _list_item_set_selected(it); - else - _list_item_set_unselected(it); - - evry_item_ref(it); - v->items = eina_list_append(v->items, it); - } - - e_box_thaw(v->o_list); - evas_event_thaw(v->evas); - - _list_scroll_to(v, v->state->sel_item); - - v->item_idler = ecore_idle_enterer_add(_list_item_idler, v); - - return 1; -} - - -static void -_list_item_sel(View *v, const Evry_Item *it) -{ - if (v->state->sel_item) - { - Evry_Item *it2 = v->state->sel_item; - - if (it == it2) return; - _list_item_set_unselected(it2); - } - - _list_item_set_selected(it); - _list_scroll_to(v, it); -} - -static void -_list_item_next(View *v) -{ - Eina_List *l; - Evry_Item *it; - - EINA_LIST_FOREACH (v->items, l, it) - { - if (it != v->state->sel_item) continue; - - if (l->next) - { - it = l->next->data; - _list_item_sel(v, it); - evry_item_select(v->state, it); - } - break; - } -} - -static void -_list_item_prev(View *v) -{ - Eina_List *l; - Evry_Item *it; - - EINA_LIST_FOREACH (v->items, l, it) - { - if (it != v->state->sel_item) continue; - - if (l->prev) - { - it = l->prev->data; - _list_item_sel(v, it); - evry_item_select(v->state, it); - return; - } - break; - } - - evry_list_win_hide(); -} - -static void -_list_item_first(View *v) -{ - Evry_Item *it; - - if (!v->items) return; - - it = v->items->data; - _list_item_sel(v, it); - evry_item_select(v->state, it); -} - -static void -_list_item_last(View *v) -{ - Evry_Item *it; - - if (!v->items) return; - - it = eina_list_last(v->items)->data; - _list_item_sel(v, it); - evry_item_select(v->state, it); -} - -static int -_update(Evry_View *view) -{ - VIEW(v, view); - - v->tabs->update(v->tabs); - _list_update(v); - - return 1; -} - -static void -_clear(Evry_View *view) -{ - VIEW(v, view); - - v->tabs->clear(v->tabs); - _list_clear(v); -} - -static int -_cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) -{ - VIEW(v, view); - - const char *key = ev->key; - - if (v->tabs->key_down(v->tabs, ev)) - { - _list_update(v); - return 1; - } - else if (!strcmp(key, "Up")) - _list_item_prev(v); - else if (!strcmp(key, "Down")) - _list_item_next(v); - else if (!strcmp(key, "End")) - _list_item_last(v); - else if (!strcmp(key, "Home")) - _list_item_first(v); - else return 0; - - return 1; -} - -static Evry_View * -_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) -{ - View *v; - Evas_Object *o; - - v = E_NEW(View, 1); - v->view = *view; - v->evas = evas_object_evas_get(swallow); - v->state = s; - - o = e_box_add(v->evas); - e_box_orientation_set(o, 0); - e_box_homogenous_set(o, 1); - v->view.o_list = o; - v->o_list = o; - - v->tabs = evry_tab_view_new(s, v->evas); - v->view.o_bar = v->tabs->o_tabs; - - return EVRY_VIEW(v); -} - -static void -_destroy(Evry_View *view) -{ - VIEW(v, view); - - _clear(view); - evas_object_del(v->o_list); - evry_tab_view_free(v->tabs); - - E_FREE(v); -} - -static Eina_Bool -_init(void) -{ - view = E_NEW(Evry_View, 1); - view->id = view; - view->name = "List View"; - view->create = &_create; - view->destroy = &_destroy; - view->update = &_update; - view->clear = &_clear; - view->cb_key_down = &_cb_key_down; - evry_view_register(view, 1); - - return EINA_TRUE; -} - -static void -_shutdown(void) -{ - evry_view_unregister(view); - E_FREE(view); -} - - -EINA_MODULE_INIT(_init); -EINA_MODULE_SHUTDOWN(_shutdown); - - - -/* static int - * _list_scroll_timer(void *data __UNUSED__) - * { - * if (v->scroll_animator) - * { - * double spd; - * spd = evry_conf->scroll_speed; - * v->scroll_align = (v->scroll_align * (1.0 - spd)) + - * (v->scroll_align_to * spd); - * return 1; - * } - * v->scroll_timer = NULL; - * return 0; - * } - * - * static int - * _list_animator(void *data __UNUSED__) - * { - * double da; - * Eina_Bool scroll_to = 1; - * - * da = v->scroll_align - v->scroll_align_to; - * if (da < 0.0) da = -da; - * if (da < 0.01) - * { - * v->scroll_align = v->scroll_align_to; - * scroll_to = 0; - * } - * e_box_align_set(v->o_list, 0.5, 1.0 - v->scroll_align); - * if (scroll_to) return 1; - * v->scroll_animator = NULL; - * return 0; - * } */ - -/* if (evry_conf->scroll_animate) - * { - * if (!v->scroll_timer) - * v->scroll_timer = ecore_timer_add(0.01, _list_scroll_timer, NULL); - * if (!v->scroll_animator) - * v->scroll_animator = ecore_animator_add(_list_animator, NULL); - * } - * else */ - diff --git a/src/modules/everything/views/evry_plug_view_thumb.c b/src/modules/everything/views/evry_plug_view_thumb.c index 698eb5895..5043fb152 100644 --- a/src/modules/everything/views/evry_plug_view_thumb.c +++ b/src/modules/everything/views/evry_plug_view_thumb.c @@ -13,6 +13,7 @@ struct _View Evas_Object *bg, *sframe, *span; int iw, ih; + Eina_Bool list_mode : 1; }; /* smart object based on wallpaper module */ @@ -29,7 +30,6 @@ struct _Smart_Data Evas_Coord sx, sy; double selmove; Eina_Bool update : 1; - int zoom; }; @@ -117,23 +117,28 @@ _e_smart_reconfigure_do(void *data) Item *it; int iw, redo = 0, changed = 0; static int recursion = 0; - Evas_Coord x, y, xx, yy, ww, hh, mw, mh, ox, oy, dd; + Evas_Coord x, y, xx, yy, ww, hh, mw, mh, ox, oy; //, dd; + Evas_Coord aspect_w, aspect_h; if (!sd) return 0; if (sd->cx > (sd->cw - sd->w)) sd->cx = sd->cw - sd->w; if (sd->cy > (sd->ch - sd->h)) sd->cy = sd->ch - sd->h; if (sd->cx < 0) sd->cx = 0; if (sd->cy < 0) sd->cy = 0; - e_scrollframe_child_viewport_size_get(sd->view->sframe, - &sd->view->iw, - &sd->view->ih); - if (sd->zoom == 0) + aspect_w = sd->w; + aspect_h = sd->h; + + if (sd->view->list_mode) + { + iw = sd->w; + } + else if (sd->zoom == 0) { int cnt = eina_list_count(sd->items); - sd->view->iw *= 3; - sd->view->iw /= 4; + aspect_w *= 3; + aspect_w /= 4; if (cnt < 3) iw = (double)sd->w / 2.5; @@ -144,8 +149,8 @@ _e_smart_reconfigure_do(void *data) } else if (sd->zoom == 1) { - sd->view->iw *= 2; - sd->view->iw /= 3; + aspect_w *= 2; + aspect_w /= 3; iw = sd->w / 3; } else /* if (sd->zoom == 2) */ @@ -153,38 +158,37 @@ _e_smart_reconfigure_do(void *data) iw = sd->w; } - if (sd->view->iw <= 0) sd->view->iw = 1; - if (sd->view->ih <= 0) sd->view->ih = 1; + if (aspect_w <= 0) aspect_w = 1; + if (aspect_h <= 0) aspect_h = 1; x = 0; y = 0; ww = iw; - hh = (sd->view->ih * iw) / (sd->view->iw); + if (sd->view->list_mode) + hh = 32; + else + hh = (aspect_h * iw) / (aspect_w); mw = mh = 0; EINA_LIST_FOREACH(sd->items, l, it) { - /* xx = sd->x - sd->cx + x; */ if (x > (sd->w - ww)) { x = 0; y += hh; xx = sd->x - sd->cx + x; } - /* yy = sd->y - sd->cy + y; */ + it->x = x; it->y = y; it->w = ww; it->h = hh; - if (it->selected) - { - sd->sx = it->x + (it->w / 2); - sd->sy = it->y + (it->h / 2); - } - if ((x + ww) > mw)mw = x + ww; + + if ((x + ww) > mw) mw = x + ww; if ((y + hh) > mh) mh = y + hh; x += ww; } + if ((mw != sd->cw) || (mh != sd->ch)) { sd->cw = mw; @@ -210,127 +214,66 @@ _e_smart_reconfigure_do(void *data) redo = 1; } if (redo) - { - recursion = 1; - _e_smart_reconfigure_do(obj); - recursion = 0; - } + { + recursion = 1; + _e_smart_reconfigure_do(obj); + recursion = 0; + } changed = 1; } - ox = 0; - if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2; - oy = 0; - if (sd->h > sd->ch) oy = (sd->h - sd->ch) / 2; - - if (sd->sel_item && !sd->update) + if (sd->view->list_mode) { - int y, h; + ox = 0; + oy = 0; + } + else + { + if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2; + if (sd->h > sd->ch) oy = (sd->h - sd->ch) / 2; + } + + if (sd->sel_item) + { + int align = -1; it = sd->sel_item; - e_scrollframe_child_pos_get(sd->view->sframe, NULL, &y); - e_scrollframe_child_viewport_size_get(sd->view->sframe, NULL, &h); + if (sd->view->list_mode) + align = it->y - (double)it->y / (double)sd->ch * (sd->h - it->h); + else if ((it->y + it->h) - sd->cy > sd->h) + align = it->y - (2 - sd->zoom) * it->h; + else if (it->y < sd->cy) + align = it->y; - if ((it->y + it->h) - y > h) - e_scrollframe_child_pos_set(sd->view->sframe, 0, it->y - (2 - sd->zoom) * it->h); - else if (it->y < y) - e_scrollframe_child_pos_set(sd->view->sframe, 0, it->y); + if (align >= 0) + e_scrollframe_child_pos_set(sd->view->sframe, 0, align); } EINA_LIST_FOREACH(sd->items, l, it) { - Evas_Coord dx, dy, vw, vh; + Evas_Coord vw, vh; - dx = dy = 0; - if ((sd->sx >= 0) && - (sd->selmove > 0.0)) - { - double a, d; - - // -----0X0+++++ - dx = (it->x + (it->w / 2)) - sd->sx; - dy = (it->y + (it->h / 2)) - sd->sy; - if (dx > 0) - { - /* |/ - * +-- */ - if (dy < 0) - a = -atan(-(double)dy / (double)dx); - /* +-- - * |\ */ - else - a = atan((double)dy / (double)dx); - } - else if (dx == 0) - { - /* | - * + */ - if (dy < 0) a = -M_PI / 2; - /* + - * | */ - else a = M_PI / 2; - } - else - { - /* \| - * --+ */ - if (dy < 0) - a = -M_PI + atan((double)dy / (double)dx); - /* --+ - * /| */ - else - a = M_PI - atan(-(double)dy / (double)dx); - } - d = sqrt((double)(dx * dx) + (double)(dy * dy)); - /* dy = 0; */ - - xx = sd->sx - sd->cx + ox; - yy = sd->sy - sd->cy + oy; - - if (xx < (sd->w / 2)) - dx = sd->w - xx; - else - dx = xx; - - if (yy < (sd->h / 2)) - dy = sd->h - yy; - else - dy = yy; - - dd = dx - d; - if (dy > dx) dd = dy - d; - if (dd < 0) dd = 0; - dy = sin(a) * sd->selmove * (dd * 0.9); - dx = cos(a) * sd->selmove * (dd * 0.9); - } xx = sd->x - sd->cx + it->x + ox; yy = sd->y - sd->cy + it->y + oy; evas_output_viewport_get(evas_object_evas_get(obj), NULL, NULL, &vw, &vh); + if (E_INTERSECTS(xx, yy, it->w, it->h, 0, 0, vw, vh)) { if (!it->visible) { it->frame = edje_object_add(sd->view->evas); - - e_theme_edje_object_set(it->frame, "base/theme/widgets", - "e/modules/everything/thumbview/main/mini"); + if (sd->view->list_mode) + e_theme_edje_object_set(it->frame, "base/theme/widgets", + "e/modules/everything/thumbview/item/list"); + else + e_theme_edje_object_set(it->frame, "base/theme/widgets", + "e/modules/everything/thumbview/item/thumb"); evas_object_smart_member_add(it->frame, obj); evas_object_clip_set(it->frame, evas_object_clip_get(obj)); edje_object_part_text_set(it->frame, "e.text.label", it->item->label); - - if (!it->image && !it->have_thumb && - it->item->plugin && it->item->plugin->icon_get) - { - it->image = it->item->plugin->icon_get - (it->item->plugin, it->item, sd->view->evas); - - edje_object_part_swallow(it->frame, "e.swallow.icon", it->image); - evas_object_show(it->image); - } - evas_object_show(it->frame); if (sd->update && !it->visible) @@ -341,16 +284,32 @@ _e_smart_reconfigure_do(void *data) it->visible = EINA_TRUE; } + /* hmmm somehow this should be moved up to !it->visible */ if (it->selected && sd->zoom < 2) edje_object_signal_emit(it->frame, "e,state,selected", "e"); + else + edje_object_signal_emit(it->frame, "e,state,unselected", "e"); - evas_object_move(it->frame, xx + dx, yy + dy); + if (!it->image && !it->have_thumb && + it->item->plugin && it->item->plugin->icon_get) + { + it->image = it->item->plugin->icon_get + (it->item->plugin, it->item, sd->view->evas); + + if (it->image) + { + edje_object_part_swallow(it->frame, "e.swallow.icon", it->image); + evas_object_show(it->image); + } + } + + evas_object_move(it->frame, xx, yy); evas_object_resize(it->frame, it->w, it->h); - + if (it->get_thumb && !it->thumb) { it->thumb = e_thumb_icon_add(sd->view->evas); - + if (!sd->thumb_idler) sd->thumb_idler = ecore_idle_enterer_before_add(_thumb_idler, sd); } @@ -764,6 +723,28 @@ _view_update(Evry_View *view) return 1; } +static void +_clear_items(Evas_Object *obj) +{ + Smart_Data *sd = evas_object_smart_data_get(obj); + Eina_List *l; + Item *it; + + EINA_LIST_FOREACH(sd->items, l, it) + { + if (it->do_thumb) + e_thumb_icon_end(it->thumb); + if (it->frame) evas_object_del(it->frame); + if (it->image) evas_object_del(it->image); + if (it->thumb) evas_object_del(it->thumb); + it->frame = NULL; + it->image = NULL; + it->thumb = NULL; + it->have_thumb = EINA_FALSE; + it->do_thumb = EINA_FALSE; + it->visible = EINA_FALSE; + } +} static int _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) @@ -777,6 +758,18 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) return 0; if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (!strcmp(ev->key, "2"))) + { + v->list_mode = v->list_mode ? EINA_FALSE : EINA_TRUE; + + e_scrollframe_child_pos_set(sd->view->sframe, 0, sd->h); + + _clear_items(v->span); + + if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter); + sd->idle_enter = ecore_idle_enterer_add(_e_smart_reconfigure_do, v->span); + } + else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && ((!strcmp(ev->key, "plus")) || (!strcmp(ev->key, "z")))) { @@ -784,25 +777,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) if (sd->zoom > 2) sd->zoom = 0; if (sd->zoom == 2) - { - EINA_LIST_FOREACH(sd->items, l, it) - { - if (it->have_thumb) - { - evas_object_del(it->thumb); - it->thumb = NULL; - it->have_thumb = EINA_FALSE; - } - else if (it->do_thumb) - { - e_thumb_icon_end(it->thumb); - evas_object_del(it->thumb); - it->thumb = NULL; - it->do_thumb = EINA_FALSE; - } - } - } - + _clear_items(v->span); if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter); sd->idle_enter = ecore_idle_enterer_add(_e_smart_reconfigure_do, v->span); @@ -927,6 +902,9 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) EVRY_VIEW(v)->o_list = v->bg; + v->list_mode = EINA_TRUE; + + v->tabs = evry_tab_view_new(s, v->evas); v->view.o_bar = v->tabs->o_tabs; @@ -977,4 +955,3 @@ _shutdown(void) EINA_MODULE_INIT(_init); EINA_MODULE_SHUTDOWN(_shutdown); -