From 9bcb821d091eb1255495604e9104fb64d7ad7773 Mon Sep 17 00:00:00 2001 From: codewarrior Date: Wed, 9 Nov 2005 02:00:33 +0000 Subject: [PATCH] - add more signals to icons / bg (need to properly rename them to make more sense) - add dynamic glob matches to typebuffer (can get slow with 10,000 files, as expected, should be faster when we optimize e_icon_layout) - add ability to start efm from e_remote (thanks ngc) - add some edje effects. - add a test idea for dynamic selection: when you bring up the typebuffer, everything goes into "dark mode", and your searches light up dynamically as they are found while you type. - question: should A be equal to *A* in the typebuffer? ngc and rephorm suggested this could be an option and if we do add a * manually then this case will be invalidated. - note: when browsing 10,000+ files, the slowness of the dir loading occurs due to the fact that ecore_file's monitor will loop thru all the files and do an insertion sort. raster said we can fix this with some work on the monitor code. SVN revision: 18390 --- data/themes/default_fileman.edc | 159 ++++++++++++++++++++++++-------- src/bin/e_fileman.c | 23 ++++- src/bin/e_fileman.h | 1 + src/bin/e_fileman_smart.c | 77 +++++++++++++--- src/bin/e_ipc_handlers.h | 16 +++- src/bin/e_ipc_handlers_list.h | 2 + 6 files changed, 224 insertions(+), 54 deletions(-) diff --git a/data/themes/default_fileman.edc b/data/themes/default_fileman.edc index caa66648b..b6b34086a 100644 --- a/data/themes/default_fileman.edc +++ b/data/themes/default_fileman.edc @@ -37,6 +37,29 @@ group { \ normal: "e17_icon_fileman_"TYPE".png"; \ } \ } \ + description { \ + state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + color: 128 128 128 255; \ + } \ + } \ + } \ + programs { \ + program { \ + name: "disable"; \ + signal: "disable"; \ + source: ""; \ + action: STATE_SET "disabled" 0.0; \ + transition: LINEAR 0.1; \ + target: "icon"; \ + } \ + program { \ + name: "default"; \ + signal: "default"; \ + source: ""; \ + action: STATE_SET "default" 0.0; \ + transition: LINEAR 0.1; \ + target: "icon"; \ } \ } \ } \ @@ -64,6 +87,11 @@ group { \ normal: "e17_icon_fileman_"TYPE"_clicked.png"; \ } \ } \ + description { \ + state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + color: 128 128 128 255; \ + } \ } \ } \ programs { \ @@ -81,6 +109,22 @@ group { \ action: STATE_SET "default" 0.0; \ target: "icon"; \ } \ + program { \ + name: "disable"; \ + signal: "disable"; \ + source: ""; \ + action: STATE_SET "disabled" 0.0; \ + transition: LINEAR 0.1; \ + target: "icon"; \ + } \ + program { \ + name: "default"; \ + signal: "default"; \ + source: ""; \ + action: STATE_SET "default" 0.0; \ + transition: LINEAR 0.1; \ + target: "icon"; \ + } \ } \ } \ @@ -171,17 +215,30 @@ group { type: SWALLOW; description { state: "default" 0.0; - } + } + } + part { + name: "background_overlay"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + } + description { + state: "selecting" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 0 0 0 128; + } } - part { name: "icons"; type: SWALLOW; description { state: "default" 0.0; } - } - + } part { name: "typebuffer"; mouse_events: 0; @@ -252,8 +309,24 @@ group { action: STATE_SET "default" 0.0; transition: LINEAR 0.2; target: "typebuffer"; - target: "text"; + target: "text"; } + program { + name: "default"; + signal: "default"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.1; + target: "background_overlay"; + } + program { + name: "selecting"; + signal: "selecting"; + source: ""; + action: STATE_SET "selecting" 0.0; + transition: LINEAR 0.1; + target: "background_overlay"; + } } } } @@ -1015,7 +1088,6 @@ group { mouse_events: 1; description { state: "default" 0.0; - visible: 0; rel1 { relative: 0.0 0.0; offset: 0 0; @@ -1028,11 +1100,12 @@ group { normal: "e17_button.png"; border: 8 8 8 8; } + color: 255 255 255 0; } description { state: "clicked" 0.0; inherit: "default" 0.0; - visible: 1; + color: 255 255 255 255; } } part { @@ -1138,6 +1211,7 @@ group { signal: "clicked"; source: ""; action: STATE_SET "clicked" 0.0; + transition: LINEAR 0.2; target: "icon_title"; target: "icon_overlay"; } @@ -1145,7 +1219,8 @@ group { name: "unclicked"; signal: "unclicked"; source: ""; - action: STATE_SET "default" 0.0; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.2; target: "icon_title"; target: "icon_overlay"; } @@ -1235,15 +1310,52 @@ group { to: "icon_box_bg"; } } + } + part { + name: "icon_overlay"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + rel1 { + to: "icon_box_bg"; + } + rel2 { + to: "icon_box_bg"; + } + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 0 0 0 128; + } } } + programs { + program { + name: "disable"; + signal: "disable"; + source: ""; + action: STATE_SET "disabled" 0.0; + transition: LINEAR 0.1; + target: "icon_overlay"; + } + program { + name: "default"; + signal: "default"; + source: ""; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.1; + target: "icon_overlay"; + } + } } group { name: "fileman/icon_list"; -// min: 12 12; -// max: 12 12; parts { part { name: "icon_swallow"; @@ -1251,8 +1363,6 @@ group { mouse_events: 0; description { state: "default" 0.0; - //min: 16 16; - //max: 16 16; align: 1.0 1.0; fixed: 1 1; rel1 { @@ -1271,7 +1381,6 @@ group { effect: SHADOW; description { state: "default" 0.0; - //min: 16 16; rel1 { to_x: "icon_swallow"; relative: 1.0 0.0; @@ -1301,31 +1410,7 @@ group { state: "default" 0.0; color: 0 0 0 0; } - } -/* - part { - name: "icon_title"; - type: TEXTBLOCK; - effect: NONE; - description { - rel1 { - relative: 0.0 1.0; - offset: 5 -20; - } - rel2 { - relative: 1.0 1.0; - offset: -6 1000; - } - color: 0 0 0 255; - //color3: 0 0 0 32; - text { - text: "No Title"; - style: "fileman_icon_style"; - min: 1 1; - } - } } -*/ part { name: "icon_title_edit_swallow"; type: SWALLOW; diff --git a/src/bin/e_fileman.c b/src/bin/e_fileman.c index 721b78df0..603cce0b8 100644 --- a/src/bin/e_fileman.c +++ b/src/bin/e_fileman.c @@ -28,9 +28,19 @@ static void _e_fileman_scroll_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coor static void _e_fileman_scroll_child_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); static int _e_fileman_reconfigure_cb(void *data, int type, void *event); - E_Fileman * e_fileman_new(E_Container *con) +{ + char dir[PATH_MAX]; + + if (!getcwd(dir, sizeof(dir))) + return NULL; + + return e_fileman_new_to_dir(con, dir); +} + +E_Fileman * +e_fileman_new_to_dir(E_Container *con, char *path) { E_Fileman *fileman; E_Manager *man; @@ -44,8 +54,12 @@ e_fileman_new(E_Container *con) if (!con) con = e_container_number_get(man, 0); if (!con) return NULL; } - if (!getcwd(dir, sizeof(dir))) - return NULL; + + snprintf(dir, PATH_MAX, "%s", path); + + if(!ecore_file_is_dir(dir)) + if (!getcwd(dir, sizeof(dir))) + return NULL; fileman = E_OBJECT_ALLOC(E_Fileman, E_FILEMAN_TYPE, _e_fileman_free); if (!fileman) return NULL; @@ -72,8 +86,9 @@ e_fileman_new(E_Container *con) e_win_title_set(fileman->win, dir); evas_event_freeze(fileman->evas); - fileman->smart = e_fm_add(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", diff --git a/src/bin/e_fileman.h b/src/bin/e_fileman.h index 01de3dbfb..28b3121c6 100644 --- a/src/bin/e_fileman.h +++ b/src/bin/e_fileman.h @@ -38,6 +38,7 @@ struct _E_Fileman }; EAPI E_Fileman *e_fileman_new(E_Container *con); +EAPI E_Fileman *e_fileman_new_to_dir(E_Container *con, char *path); EAPI void e_fileman_show(E_Fileman *fileman); EAPI void e_fileman_hide(E_Fileman *fileman); EAPI void e_fileman_selector_enable(E_Fileman *fileman, void (*func)(E_Fileman *fileman, char *file, void *data), void *data); diff --git a/src/bin/e_fileman_smart.c b/src/bin/e_fileman_smart.c index 0885687e7..3b3bcd2d2 100644 --- a/src/bin/e_fileman_smart.c +++ b/src/bin/e_fileman_smart.c @@ -237,6 +237,7 @@ static int _e_fm_win_mouse_up_cb (void *data, int type, void static void _e_fm_string_replace(const char *src, const char *key, const char *replacement, char *result, size_t resultsize); +static void _e_fm_autocomplete(E_Fm_Smart_Data *sd); static void _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb); static void _e_fm_icon_select_up(E_Fm_Smart_Data *sd); static void _e_fm_icon_select_down(E_Fm_Smart_Data *sd); @@ -2154,7 +2155,7 @@ _e_fm_icon_mouse_in_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) ev = event_info; icon = data; - e_fm_icon_signal_emit(icon->icon_object, "hilight", ""); + e_fm_icon_signal_emit(icon->icon_object, "mousein", ""); } static void @@ -2166,7 +2167,7 @@ _e_fm_icon_mouse_out_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) ev = event_info; icon = data; - e_fm_icon_signal_emit(icon->icon_object, "default", ""); + e_fm_icon_signal_emit(icon->icon_object, "mouseout", ""); } static void @@ -2303,6 +2304,12 @@ _e_fm_string_replace(const char *src, const char *key, const char *replacement, result[resultlen] = '\0'; } +static void +_e_fm_autocomplete(E_Fm_Smart_Data *sd) +{ + /* TODO */ +} + static void _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb) { @@ -2318,10 +2325,21 @@ _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb) ev = NULL; glbpath = E_NEW(char, strlen(sd->dir) + strlen(glb) + 2); snprintf(glbpath, strlen(sd->dir) + strlen(glb) + 2, "%s/%s", sd->dir, glb); - if(glob(glbpath, 0, NULL, &globbuf)) - return; _e_fm_selections_clear(sd); + + edje_object_signal_emit(sd->edje_obj, "selecting", ""); + + if(glob(glbpath, 0, NULL, &globbuf)) + { + for (l = sd->files; l; l = l->next) + { + icon = l->data; + e_fm_icon_signal_emit(icon->icon_object, "disable", ""); + } + return; + } + for (l = sd->files; l; l = l->next) { icon = l->data; @@ -2333,6 +2351,7 @@ _e_fm_icon_select_glob(E_Fm_Smart_Data *sd, char *glb) if(!strcmp(icon->file->name, file)) { _e_fm_selections_add(l->data, l); + e_fm_icon_signal_emit(icon->icon_object, "default", ""); if(!anchor) { evas_object_geometry_get(icon->icon_object, &x, &y, &w, &h); @@ -2727,16 +2746,32 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { Evas_Event_Key_Down *ev; E_Fm_Smart_Data *sd; + Evas_List *l; + E_Fm_Icon *icon; ev = event_info; sd = data; + if (!strcmp(ev->keyname, "Tab")) + { + if(strcmp(edje_object_part_state_get(sd->edje_obj, "typebuffer", NULL), "shown")) + { + + _e_fm_autocomplete(sd); + } + } if (!strcmp(ev->keyname, "Up")) { if(!strcmp(edje_object_part_state_get(sd->edje_obj, "typebuffer", NULL), "shown")) - { + { edje_object_signal_emit(sd->edje_obj, "typebuf_hide", ""); - edje_object_part_text_set(sd->edje_obj, "text", ""); + edje_object_part_text_set(sd->edje_obj, "text", ""); + for (l = sd->files; l; l = l->next) + { + icon = l->data; + e_fm_icon_signal_emit(icon->icon_object, "default", ""); + } + edje_object_signal_emit(sd->edje_obj, "default", ""); } else _e_fm_icon_select_up(sd); @@ -2746,7 +2781,13 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) if(!strcmp(edje_object_part_state_get(sd->edje_obj, "typebuffer", NULL), "shown")) { edje_object_signal_emit(sd->edje_obj, "typebuf_hide", ""); - edje_object_part_text_set(sd->edje_obj, "text", ""); + edje_object_part_text_set(sd->edje_obj, "text", ""); + for (l = sd->files; l; l = l->next) + { + icon = l->data; + e_fm_icon_signal_emit(icon->icon_object, "default", ""); + } + edje_object_signal_emit(sd->edje_obj, "default", ""); } else _e_fm_icon_select_down(sd); @@ -2771,19 +2812,26 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { edje_object_signal_emit(sd->edje_obj, "typebuf_hide", ""); edje_object_part_text_set(sd->edje_obj, "text", ""); + for (l = sd->files; l; l = l->next) + { + icon = l->data; + e_fm_icon_signal_emit(icon->icon_object, "default", ""); + } + edje_object_signal_emit(sd->edje_obj, "default", ""); } } else if (!strcmp(ev->keyname, "Return")) { if(!strcmp(edje_object_part_state_get(sd->edje_obj, "typebuffer", NULL), "shown")) { - char *buf; - edje_object_signal_emit(sd->edje_obj, "typebuf_hide", ""); - buf = strdup(edje_object_part_text_get(sd->edje_obj, "text")); edje_object_part_text_set(sd->edje_obj, "text", ""); - if(strcmp(buf, "")) - _e_fm_icon_select_glob(sd, buf); + for (l = sd->files; l; l = l->next) + { + icon = l->data; + e_fm_icon_signal_emit(icon->icon_object, "default", ""); + } + edje_object_signal_emit(sd->edje_obj, "default", ""); } else _e_fm_icon_run(sd); @@ -2803,6 +2851,8 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) buf = calloc(size , sizeof(char)); snprintf(buf, size, "%s", str); edje_object_part_text_set(sd->edje_obj, "text", buf); + _e_fm_icon_select_glob(sd, buf); + E_FREE(buf); } } else @@ -2832,10 +2882,13 @@ _e_fm_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) buf = calloc(size, sizeof(char)); snprintf(buf, size, "%s%s", str, ev->string); edje_object_part_text_set(sd->edje_obj, "text", buf); + _e_fm_icon_select_glob(sd, buf); + E_FREE(buf); } else { edje_object_part_text_set(sd->edje_obj, "text", ev->string); + _e_fm_icon_select_glob(sd, ev->string); } if(strcmp(edje_object_part_state_get(sd->edje_obj, "typebuffer", NULL), "shown")) diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h index c5f055bdc..5c6917e0c 100644 --- a/src/bin/e_ipc_handlers.h +++ b/src/bin/e_ipc_handlers.h @@ -840,7 +840,21 @@ break; * E_LIB_IN * ... */ - +/****************************************************************************/ +#define HDL E_IPC_EFM_START +#if (TYPE == E_REMOTE_OPTIONS) + OP("-start-efm", 1, "Starts the E File Manager in Directory 'OPT1'", 0, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_STRING(params[0], HDL); +#elif (TYPE == E_WM_IN) + STRING(s, HDL); + E_Fileman *fileman; + fileman = e_fileman_new_to_dir(e_container_current_get(e_manager_current_get()), s); + e_fileman_show (fileman); + END_STRING(s); +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL /****************************************************************************/ #define HDL E_IPC_OP_MODULE_LOAD #if (TYPE == E_REMOTE_OPTIONS) diff --git a/src/bin/e_ipc_handlers_list.h b/src/bin/e_ipc_handlers_list.h index 442c2f61b..ba562e23b 100644 --- a/src/bin/e_ipc_handlers_list.h +++ b/src/bin/e_ipc_handlers_list.h @@ -338,3 +338,5 @@ #define E_IPC_OP_FULLSCREEN_POLICY_SET 320 #define E_IPC_OP_FULLSCREEN_POLICY_GET 321 #define E_IPC_OP_FULLSCREEN_POLICY_GET_REPLY 322 + +#define E_IPC_EFM_START 323