diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 90aeb0d20..d23c70ca8 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -137,14 +137,16 @@ struct _Evry_View { Evry_View *id; const char *name; + const char *trigger; + int active; Evas_Object *o_list; Evas_Object *o_bar; - Evry_View *(*create) (const Evry_View *view, const Evry_State *s, const Evas_Object *swallow); - void (*destroy) (const Evry_View *view); - int (*cb_key_down) (const Evry_View *view, const Ecore_Event_Key *ev); - int (*update) (const Evry_View *view); - void (*clear) (const Evry_View *view); + Evry_View *(*create) (Evry_View *view, const Evry_State *s, const Evas_Object *swallow); + void (*destroy) (Evry_View *view); + int (*cb_key_down) (Evry_View *view, const Ecore_Event_Key *ev); + int (*update) (Evry_View *view); + void (*clear) (Evry_View *view); int priority; }; diff --git a/src/modules/everything/Makefile.am b/src/modules/everything/Makefile.am index 4ec707f01..278b1bdec 100644 --- a/src/modules/everything/Makefile.am +++ b/src/modules/everything/Makefile.am @@ -119,6 +119,13 @@ 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 +evry_plug_view_help_la_LIBADD = @e_libs@ +evry_plug_view_help_la_LDFLAGS = -no-undefined -module -avoid-version +evry_plug_view_help_la_LIBTOOLFLAGS = --tag=disable-static + uninstall: rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE) diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 4e5618ecf..9349e0137 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -95,7 +95,7 @@ static void _evry_view_clear(Evry_State *s); static void _evry_list_win_update(Evry_State *s); static void _evry_view_update(Evry_State *s, Evry_Plugin *plugin); static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev); -static int _evry_view_toggle(Evry_State *s); +static int _evry_view_toggle(Evry_State *s, const char *trigger); static void _evry_view_show(Evry_View *v); static void _evry_view_hide(Evry_View *v); @@ -455,7 +455,7 @@ evry_fuzzy_match(const char *str, const char *match) for (; (*m != 0) && isspace(*m); m++); m_min[m_num++] = MAX_FUZZ; } - for (m = match; (*m != 0) && (m_num < MAX_WORDS); m++) + for (m = match; ip && (*m != 0); m++) if (ip && ispunct(*m)) ip = 0; next = str; @@ -491,7 +491,7 @@ evry_fuzzy_match(const char *str, const char *match) else { /* 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; @@ -549,8 +549,8 @@ evry_fuzzy_match(const char *str, const char *match) 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++); + for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++); + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); cnt++; next = p; m_cnt = 0; @@ -1182,7 +1182,7 @@ _evry_selectors_switch(void) } } - static int +static int _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Event_Key *ev; @@ -1235,7 +1235,7 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) _evry_browse_back(selector); } else if (!strcmp(key, "1")) - _evry_view_toggle(s); + _evry_view_toggle(s, NULL); else if (!strcmp(key, "Return")) _evry_plugin_action(selector, 0); else if (!strcmp(key, "v")) @@ -1272,10 +1272,17 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) goto end; else if ((ev->compose && !(ev->modifiers & ECORE_EVENT_MODIFIER_ALT))) { - if (strlen(s->input) < (INPUTLEN - strlen(ev->compose))) + int len = strlen(s->input); + if (len < (INPUTLEN - strlen(ev->compose))) { strcat(s->input, ev->compose); - if (isspace(*ev->compose)) + /* if ((len == 0) && isspace(s->input[0])) + * _evry_show_triggers(); */ + if ((len == 1) && + (isspace(s->input[0])) && + (_evry_view_toggle(s, s->input + 1))) + _evry_update(s, 0); + else if (isspace(*ev->compose)) _evry_update(s, 0); else _evry_update(s, 1); @@ -1494,36 +1501,58 @@ _evry_view_clear(Evry_State *s) static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev) { - if (!s || !s->view) return 0; + if (!s || !s->view || !s->view->cb_key_down) return 0; return s->view->cb_key_down(s->view, ev); } static int -_evry_view_toggle(Evry_State *s) +_evry_view_toggle(Evry_State *s, const char *trigger) { - Evry_View *view, *v; + Evry_View *view, *v = NULL; Eina_List *l, *ll; - _evry_list_win_show(); - - l = eina_list_data_find_list(evry_conf->views, s->view->id); - - if (l && l->next) - l = l->next; - else - l = evry_conf->views; - - EINA_LIST_FOREACH(l, ll, view) + if (trigger) { - if ((view != s->view->id) && - (v = view->create(view, s, list->o_main))) - break; + EINA_LIST_FOREACH(evry_conf->views, ll, view) + { + if (view->trigger && !strncmp(trigger, view->trigger, 1) && + (v = view->create(view, s, list->o_main))) + break; + } + } + else + { + l = eina_list_data_find_list(evry_conf->views, s->view->id); + + if (l && l->next) + l = l->next; + else + l = evry_conf->views; + + EINA_LIST_FOREACH(l, ll, view) + { + if ((!view->trigger) && + ((view == s->view->id) || + (v = view->create(view, s, list->o_main)))) + goto found; + } + + EINA_LIST_FOREACH(evry_conf->views, ll, view) + { + if ((!view->trigger) && + ((view == s->view->id) || + (v = view->create(view, s, list->o_main)))) + goto found; + } } + found: if (!v) return 0; + _evry_list_win_show(); + if (s->view) { _evry_view_hide(s->view); @@ -1531,8 +1560,8 @@ _evry_view_toggle(Evry_State *s) } s->view = v; - v->update(v); _evry_view_show(v); + v->update(v); return 1; } diff --git a/src/modules/everything/evry_plug_preview.c b/src/modules/everything/evry_plug_preview.c index 2c24a82f5..4d3f2953c 100644 --- a/src/modules/everything/evry_plug_preview.c +++ b/src/modules/everything/evry_plug_preview.c @@ -91,7 +91,7 @@ _show_item(Image_View *v, const Evry_Item *it, int dir) } static int -_cb_key_down(const Evry_View *view, const Ecore_Event_Key *ev) +_cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) { Image_View *v = (Image_View *) view; @@ -141,7 +141,7 @@ _cb_key_down(const Evry_View *view, const Ecore_Event_Key *ev) } static void -_view_clear(const Evry_View *view) +_view_clear(Evry_View *view) { Image_View *v = (Image_View *) view; @@ -169,7 +169,7 @@ _get_list(const Evry_State *s) } static int -_view_update(const Evry_View *view) +_view_update(Evry_View *view) { Image_View *v = (Image_View *) view; Evry_Item *it; @@ -190,7 +190,7 @@ _view_update(const Evry_View *view) } static Evry_View * -_view_create(const Evry_View *view, const Evry_State *s, const Evas_Object *swallow) +_view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) { Image_View *v; int w, h, x, y; @@ -216,7 +216,7 @@ _view_create(const Evry_View *view, const Evry_State *s, const Evas_Object *swal } static void -_view_destroy(const Evry_View *view) +_view_destroy(Evry_View *view) { Image_View *v = (Image_View *) view; diff --git a/src/modules/everything/evry_plug_view_help.c b/src/modules/everything/evry_plug_view_help.c new file mode 100644 index 000000000..267483c1b --- /dev/null +++ b/src/modules/everything/evry_plug_view_help.c @@ -0,0 +1,137 @@ +#include "Evry.h" + +static Evry_View *view; +static Evas_Object *o_text = NULL; + +static void +_view_clear(Evry_View *v) +{ + v->active = 0; + evas_object_del(v->o_list); + evas_object_del(o_text); + o_text = NULL; +} + + +static int +_view_update(Evry_View *v) +{ + return 1; +} + +static int +_cb_key_down(Evry_View *v, const Ecore_Event_Key *ev) +{ + Evas_Object *o; + double align; + int h; + + if (!strcmp(ev->key, "Down")) + { + o = v->o_list; + evas_object_geometry_get(o, NULL, NULL, NULL, &h); + e_box_align_get(o, NULL, &align); + + align = align - (double)10/(double)h; + if (align < 0.0) align = 0.0; + + e_box_align_set(v->o_list, 0.5, align); + + return 1; + } + else if (!strcmp(ev->key, "Up")) + { + o = v->o_list; + evas_object_geometry_get(o, NULL, NULL, NULL, &h); + e_box_align_get(o, NULL, &align); + + align = align + (double)10/(double)h; + if (align > 1.0) align = 1.0; + + e_box_align_set(v->o_list, 0.5, align); + return 1; + } + + return 0; +} + +static Evry_View * +_view_create(Evry_View *v, const Evry_State *s, const Evas_Object *swallow) +{ + Evas_Object *o; + int mw, mh; + + char *text = + "