From b6aa138b092331352842e3950f84ce5cd7c62a82 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 14 Dec 2005 15:54:51 +0000 Subject: [PATCH] exebuf is ... well.. a bit better now SVN revision: 19015 --- data/themes/default_exebuf.edc | 861 ++++++++++++++++++++++-- data/themes/images/Makefile.am | 3 +- data/themes/images/e17_entry_cursor.png | Bin 0 -> 428 bytes src/bin/e_apps.c | 90 +++ src/bin/e_apps.h | 5 + src/bin/e_exebuf.c | 667 ++++++++++++++++-- src/bin/e_utils.c | 21 + src/bin/e_utils.h | 1 + src/bin/e_winlist.c | 3 + 9 files changed, 1541 insertions(+), 110 deletions(-) create mode 100644 data/themes/images/e17_entry_cursor.png diff --git a/data/themes/default_exebuf.edc b/data/themes/default_exebuf.edc index b78b6e123..3babbf083 100644 --- a/data/themes/default_exebuf.edc +++ b/data/themes/default_exebuf.edc @@ -8,6 +8,7 @@ images { image: "e17_pager_window.png" COMP; image: "e17_pager_window_shaded.png" COMP; image: "e17_pager_desk.png" COMP; + image: "e17_entry_cursor.png" COMP; } group { @@ -77,6 +78,45 @@ group { } } } + + part { + name: "eap_list_swallow"; + type: SWALLOW; + clip_to: "eap_list_clip"; + description { + state: "default" 0.0; + color: 0 0 0 0; + min: 32 64; + align: 0.5 0.0; + rel1 { + relative: 0.0 0.0; + offset: 16 16; + } + rel2 { + relative: 1.0 0.0; + offset: -17 -17; + to_y: "label"; + } + } + } + part { + name: "eap_list_clip"; + type: RECT; + description { + state: "default" 0.0; + color: 255 255 255 255; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to_y: "eap_list_swallow"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to_y: "eap_list_swallow"; + } + } + } part { name: "top"; mouse_events: 0; @@ -89,7 +129,7 @@ group { rel2 { relative: 1.0 0.0; offset: -2 16; - to_y: "label"; + to_y: "eap_list_swallow"; } image { normal: "e17_winlist_top.png"; @@ -100,6 +140,173 @@ group { } } } + part { + name: "bottom"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 1 -3; + to_y: "eap_list_swallow"; + } + rel2 { + relative: 1.0 1.0; + offset: -2 16; + to_y: "label"; + } + image { + normal: "e17_winlist_bottom.png"; + border: 0 0 4 0; + } + fill { + smooth: 0; + } + } + } + + part { + name: "exe_list_swallow"; + type: SWALLOW; + clip_to: "exe_list_clip"; + description { + state: "default" 0.0; + color: 0 0 0 0; + min: 32 64; + align: 0.5 1.0; + rel1 { + relative: 0.0 1.0; + offset: 16 16; + to_y: "label"; + } + rel2 { + relative: 1.0 1.0; + offset: -17 -17; + } + } + } + part { + name: "exe_list_clip"; + type: RECT; + description { + state: "default" 0.0; + color: 255 255 255 255; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to_y: "exe_list_swallow"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to_y: "exe_list_swallow"; + } + } + } + part { + name: "top2"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 1 -15; + to_y: "label"; + } + rel2 { + relative: 1.0 0.0; + offset: -2 16; + to_y: "exe_list_swallow"; + } + image { + normal: "e17_winlist_top.png"; + border: 0 0 0 19; + } + fill { + smooth: 0; + } + } + } + part { + name: "bottom2"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 1 -3; + to_y: "exe_list_swallow"; + } + rel2 { + relative: 1.0 1.0; + offset: -2 -2; + } + image { + normal: "e17_winlist_bottom.png"; + border: 0 0 4 0; + } + fill { + smooth: 0; + } + } + } + + + part { + name: "label"; + type: TEXT; + effect: SHADOW; + description { + state: "default" 0.0; + color: 0 0 0 255; + fixed: 0 1; + align: 0.0 0.5; + rel1 { + relative: 1.0 0.5; + offset: 16 0; + to_x: "icon_swallow"; + } + rel2 { + relative: 1.0 0.5; + offset: 16 0; + to_x: "icon_swallow"; + } + color: 0 0 0 255; + color3: 255 255 255 128; + text { + text: "COMMAND"; + font: "Edje-Vera-Bold"; + size: 16; + align: 0.0 0.5; + min: 1 1; + text_class: "exebuf_text"; + } + } + } + part { + name: "cursor"; + mouse_events: 0; + description { + state: "default" 0.0; + min: 18 18; + max: 18 18; + align: 0.0 0.5; + fixed: 1 1; + rel1 { + relative: 1.0 0.0; + offset: 3 0; + to: "label"; + } + rel2 { + relative: 1.0 1.0; + offset: 3 -1; + to: "label"; + } + image { + normal: "e17_entry_cursor.png"; + } + } + } part { name: "icon_swallow"; type: SWALLOW; @@ -108,16 +315,16 @@ group { color: 0 0 0 0; aspect: 1.0 1.0; align: 0.0 0.5; - min: 24 24; - fixed: 1 1; aspect_preference: VERTICAL; rel1 { relative: 0.0 0.0; - offset: 16 16; + offset: 16 -7; + to_y: "label"; } rel2 { - relative: 0.0 1.0; - offset: 16 -17; + relative: 1.0 1.0; + offset: 16 8; + to_y: "label"; } } } @@ -142,57 +349,6 @@ group { } } } - part { - name: "label"; - type: TEXT; - effect: SHADOW; - description { - state: "default" 0.0; - color: 0 0 0 255; - rel1 { - relative: 1.0 0.0; - offset: 16 24; - to_x: "icon_swallow"; - } - rel2 { - relative: 1.0 1.0; - offset: -17 -25; - } - color: 0 0 0 255; - color3: 255 255 255 128; - text { - text: "COMMAND"; - font: "Edje-Vera-Bold"; - size: 16; - align: 0.0 0.5; - min: 0 1; - text_class: "exebuf_text"; - } - } - } - part { - name: "bottom"; - mouse_events: 0; - description { - state: "default" 0.0; - rel1 { - relative: 0.0 1.0; - offset: 1 -3; - to_y: "label"; - } - rel2 { - relative: 1.0 1.0; - offset: -2 -2; - } - image { - normal: "e17_winlist_bottom.png"; - border: 0 0 4 0; - } - fill { - smooth: 0; - } - } - } } /* part { @@ -234,3 +390,594 @@ group { } */ } + +group { + name: "widgets/exebuf/item"; + parts { + part { + name: "title_outline"; + mouse_events: 0; + description { + state: "default" 0.0; + min: 14 14; + visible: 1; + rel1 { + relative: 1.0 0.0; + offset: 1 -1; + to_x: "icon_swallow"; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to_x: "type"; + } + image { + normal: "e17_titlebar_outline.png"; + border: 8 8 8 8; + middle: 0; + } + fill { + smooth: 0; + } + color: 255 255 255 255; + } + description { + state: "active" 0.0; + inherit: "default" 0.0; + color: 255 255 255 0; + } + } + part { + name: "title_shadow2"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar_shadow2.png"; + border: 8 8 8 8; + } + fill { + smooth: 0; + } + color: 255 255 255 0; + } + description { + state: "active" 0.0; + visible: 1; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar_shadow2.png"; + border: 8 8 8 8; + } + fill { + smooth: 0; + } + color: 255 255 255 255; + } + } + part { + name: "title_shadow1"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar_shadow1.png"; + border: 8 8 8 8; + } + fill { + smooth: 0; + } + color: 255 255 255 0; + } + description { + state: "active" 0.0; + visible: 1; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar_shadow1.png"; + border: 8 8 8 8; + } + fill { + smooth: 0; + } + color: 255 255 255 255; + } + } + part { + name: "title_bar"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar.png"; + border: 8 8 8 8; + } + color: 255 255 255 0; + } + description { + state: "active" 0.0; + visible: 1; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + to: "title_outline"; + } + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + to: "title_outline"; + } + image { + normal: "e17_titlebar.png"; + border: 8 8 8 8; + } + color: 255 255 255 255; + } + } + part { + name: "title2"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0.0; + align: 1.0 0.0; + visible: 0; + fixed: 1 1; + rel1 { + relative: 0.0 0.0; + offset: 0 6; + } + rel2 { + relative: 0.0 0.0; + offset: 0 6; + } + text { + text_source: "title_text"; + source: "title_text"; + min: 0 1; + text_class: "title_bar"; + } + } + } + part { + name: "title_text"; + type: TEXT; + effect: SHADOW; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + relative: 1.0 0.0; + offset: 9 6; + to_x: "icon_swallow"; + } + rel2 { + relative: 0.0 1.0; + offset: -8 -6; + to_x: "type"; + } + color: 0 0 0 255; + color3: 255 255 255 128; + text { + text: "Item Label"; + font: "Edje-Vera"; + size: 10; + min: 0 1; + align: 0.0 0.5; + text_class: "menu_item"; + } + } + } + part { + name: "title_glint_clip"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + offset: 3 3; + to: "title_bar"; + } + rel2 { + offset: -4 -4; + to: "title_bar"; + } + color: 255 255 255 255; + } + } + part { + name: "title_glint_1"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + align: 0.0 0.0; + max: 34 13; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + to: "title_bar"; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + to: "title_bar"; + } + image { + normal: "e17_titlebar_glint1.png"; + border: 5 0 5 0; + } + fill { + smooth: 0; + } + } + description { + state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { + name: "title_glint_2"; + mouse_events: 0; + clip_to: "title_glint_clip"; + description { + state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + align: 1.0 0.5; + max: 0 0; + rel1 { + relative: 0.0 0.0; + offset: 3 3; + to: "title_bar"; + } + rel2 { + relative: 0.0 1.0; + offset: 3 -4; + to: "title_bar"; + } + image { + normal: "e17_titlebar_glint2.png"; + border: 0 0 5 5; + } + fill { + smooth: 0; + } + } + description { + state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + max: 169 9999; + min: 169 8; + align: 0.5 0.5; + rel1 { + relative: 0.0 0.0; + offset: 3 3; + } + rel2 { + relative: 0.0 1.0; + offset: 3 -4; + } + } + description { + state: "active2" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 128; + max: 169 9999; + min: 169 8; + align: 0.5 0.5; + rel1 { + relative: 1.0 0.0; + offset: -4 3; + } + rel2 { + relative: 1.0 1.0; + offset: -4 -4; + } + } + description { + state: "active3" 0.0; + inherit: "default" 0.0; + visible: 0; + color: 255 255 255 0; + max: 169 9999; + min: 169 8; + align: 0.0 0.5; + rel1 { + relative: 1.0 0.0; + offset: -4 3; + } + rel2 { + relative: 1.0 1.0; + offset: -4 -4; + } + } + } + part { + name: "title_glint_3"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + align: 1.0 1.0; + max: 34 13; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + to: "title_bar"; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + to: "title_bar"; + } + image { + normal: "e17_titlebar_glint3.png"; + border: 0 5 0 5; + } + fill { + smooth: 0; + } + } + description { + state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { + name: "icon_swallow"; + type: SWALLOW; + description { + state: "default" 0.0; + color: 0 0 0 0; + aspect: 1.0 1.0; + align: 0.0 0.5; + aspect_preference: VERTICAL; + rel1 { + relative: 0.0 0.0; + offset: 1 1; + } + rel2 { + relative: 0.0 1.0; + offset: 1 4; + to_y: "title2"; + } + } + } + part { + name: "type"; + description { + state: "default" 0.0; + aspect: 1.0 1.0; + align: 1.0 0.5; + aspect_preference: VERTICAL; + rel1 { + relative: 1.0 0.0; + offset: -1 1; + } + rel2 { + relative: 1.0 1.0; + offset: -1 4; + to_y: "title2"; + } + image { + normal: "e17_pager_window.png"; + border: 6 13 7 5; + } + } + description { + state: "iconified" 0.0; + inherit: "default" 0.0; + visible: 0; + } + description { + state: "invisible" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_pager_desk.png"; + border: 2 2 2 2; + } + } + description { + state: "shaded" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_pager_window_shaded.png"; + border: 6 13 9 0; + } + } + } + } + programs { + program { + name: "type1"; + signal: "iconified"; + source: ""; + action: STATE_SET "iconified" 0.0; + target: "type"; + } + program { + name: "type2"; + signal: "invisible"; + source: ""; + action: STATE_SET "invisible" 0.0; + target: "type"; + } + program { + name: "type3"; + signal: "shaded"; + source: ""; + action: STATE_SET "shaded" 0.0; + target: "type"; + } + program { + name: "go_active_pre"; + signal: "active"; + source: ""; + action: STATE_SET "default" 0.0; + target: "title_outline"; + target: "title_bar"; + target: "title_shadow1"; + target: "title_shadow2"; + after: "go_active"; + } + program { + name: "go_active"; + action: STATE_SET "active" 0.0; + target: "title_outline"; + target: "title_bar"; + transition: LINEAR 0.05; + after: "go_active2"; + } + program { + name: "go_active2"; + action: STATE_SET "active" 0.0; + target: "title_shadow1"; + transition: LINEAR 0.05; + after: "go_active3"; + after: "go_active3b"; + } + program { + name: "go_active3"; + action: STATE_SET "active" 0.0; + target: "title_shadow2"; + transition: LINEAR 0.05; + } + program { + name: "go_active3b"; + action: STATE_SET "active" 0.0; + target: "title_glint_1"; + target: "title_glint_2"; + transition: LINEAR 0.05; + after: "go_active4"; + after: "go_active4b"; + } + program { + name: "go_active4"; + action: STATE_SET "active2" 0.0; + target: "title_glint_2"; + transition: LINEAR 0.2; + after: "go_active5"; + after: "go_active5b"; + } + program { + name: "go_active4b"; + action: STATE_SET "active" 0.0; + target: "title_glint_3"; + transition: LINEAR 0.2; + } + program { + name: "go_active5"; + action: STATE_SET "active3" 0.0; + target: "title_glint_2"; + transition: LINEAR 0.05; + } + program { + name: "go_active5b"; + action: STATE_SET "default" 0.0; + target: "title_glint_3"; + transition: LINEAR 0.1; + after: "go_active6"; + } + program { + name: "go_active6"; + action: STATE_SET "default" 0.0; + target: "title_glint_1"; + target: "title_glint_2"; + target: "title_glint_3"; + } + + program { + name: "go_passive_pre"; + signal: "passive"; + source: ""; + action: STATE_SET "active" 0.0; + target: "title_outline"; + target: "title_bar"; + target: "title_shadow1"; + target: "title_shadow2"; + after: "go_passive"; + } + program { + name: "go_passive"; + action: STATE_SET "default" 0.0; + target: "title_shadow2"; + transition: LINEAR 0.1; + after: "go_passive2"; + } + program { + name: "go_passive2"; + action: STATE_SET "default" 0.0; + target: "title_shadow1"; + transition: LINEAR 0.1; + after: "go_passive3"; + } + program { + name: "go_passive3"; + action: STATE_SET "default" 0.0; + target: "title_outline"; + target: "title_bar"; + transition: LINEAR 0.1; + } + } +} diff --git a/data/themes/images/Makefile.am b/data/themes/images/Makefile.am index efbd14f08..d0c0ad225 100644 --- a/data/themes/images/Makefile.am +++ b/data/themes/images/Makefile.am @@ -412,4 +412,5 @@ e17_ilist_bg0.png \ e17_ilist_bg1.png \ e17_slider_bt0.png \ e17_slider_bt1.png \ -e17_slider_bt_glow.png +e17_slider_bt_glow.png \ +e17_entry_cursor.png diff --git a/data/themes/images/e17_entry_cursor.png b/data/themes/images/e17_entry_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..5d8a87ffed35701d6c1a44dc0eb6f10082b3689a GIT binary patch literal 428 zcmV;d0aN~oP)gFbQ)o6-4)p*Pu}{t24??W)LsHGMok@hc$SFR2o+;BW9wB z1{;u@Y;kR!Bt>cD^$_?Pi?9yInZC>X7M|c8e6=d-jI7HntiVywIqbm&TtPHSS>;Bt zHty0ioMa~Z%q_4yz$>I|)Rh@!&;DitVFK*oN3Uj;r92Nk=TD z#-Dk#IU?5a1*+X^GK!|IXoK2YBjBsJ8P-t~zXDY+{bi)aha>8J@YiQVVcXE8ap7+$ WX+xg}#+~5+0000next) + { + E_App *a; + + a = l->data; + if (a->name) + { + if (e_util_glob_case_match(a->name, name)) + list = evas_list_append(list, a); + } + } + return list; +} + +Evas_List * +e_app_generic_glob_list(char *generic) +{ + Evas_List *l, *list = NULL; + + if (!generic) return NULL; + + for (l = _e_apps_list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->generic) + { + if (e_util_glob_case_match(a->generic, generic)) + list = evas_list_append(list, a); + } + } + return list; +} + +Evas_List * +e_app_exe_glob_list(char *exe) +{ + Evas_List *l, *list = NULL; + + if (!exe) return NULL; + + for (l = _e_apps_list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->exe) + { + if (e_util_glob_match(a->exe, exe)) + list = evas_list_append(list, a); + } + } + return list; +} + +Evas_List * +e_app_comment_glob_list(char *comment) +{ + Evas_List *l, *list = NULL; + + if (!comment) return NULL; + + for (l = _e_apps_list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->comment) + { + if (e_util_glob_case_match(a->comment, comment)) + list = evas_list_append(list, a); + } + } + return list; +} + + + + + void e_app_fields_fill(E_App *a, const char *path) { diff --git a/src/bin/e_apps.h b/src/bin/e_apps.h index 2e627dd4d..83c71e02f 100644 --- a/src/bin/e_apps.h +++ b/src/bin/e_apps.h @@ -101,6 +101,11 @@ EAPI E_App *e_app_name_find (char *name); EAPI E_App *e_app_generic_find (char *generic); EAPI E_App *e_app_exe_find (char *exe); +EAPI Evas_List *e_app_name_glob_list (char *name); +EAPI Evas_List *e_app_generic_glob_list (char *generic); +EAPI Evas_List *e_app_exe_glob_list (char *exe); +EAPI Evas_List *e_app_comment_glob_list (char *comment); + EAPI void e_app_fields_fill (E_App *a, const char *path); EAPI void e_app_fields_save (E_App *a); EAPI E_App *e_app_raw_new (void); diff --git a/src/bin/e_exebuf.c b/src/bin/e_exebuf.c index f3fb38ab8..85329a57b 100644 --- a/src/bin/e_exebuf.c +++ b/src/bin/e_exebuf.c @@ -6,6 +6,15 @@ /* currently default bind is alt+` buf alt+space has been suggested */ /* local subsystem functions */ +typedef struct _E_Exebuf_Exe E_Exebuf_Exe; + +struct _E_Exebuf_Exe +{ + Evas_Object *bg_object; + Evas_Object *icon_object; + E_App *app; + char *file; +}; static void _e_exebuf_matches_clear(void); static void _e_exebuf_update(void); @@ -19,18 +28,39 @@ static int _e_exebuf_cb_key_down(void *data, int type, void *event); static int _e_exebuf_cb_mouse_down(void *data, int type, void *event); static int _e_exebuf_cb_mouse_up(void *data, int type, void *event); static int _e_exebuf_cb_mouse_wheel(void *data, int type, void *event); +static int _e_exebuf_exe_scroll_timer(void *data); +static int _e_exebuf_eap_scroll_timer(void *data); +static int _e_exebuf_animator(void *data); /* local subsystem globals */ static E_Popup *exebuf = NULL; static Evas_Object *bg_object = NULL; +static Evas_Object *icon_object = NULL; +static Evas_Object *exe_list_object = NULL; +static Evas_Object *eap_list_object = NULL; static Evas_List *handlers = NULL; static Ecore_X_Window input_window = 0; static char *cmd_buf = NULL; static Evas_List *eap_matches = NULL; static Evas_List *exe_matches = NULL; -static E_App *eap_sel = NULL; static Ecore_List *exe_list = NULL; - +static Evas_List *exes = NULL; +static Evas_List *eaps = NULL; +#define NO_LIST 0 +#define EAP_LIST 1 +#define EXE_LIST 2 +static int which_list = NO_LIST; +static E_Exebuf_Exe *exe_sel = NULL; +static int exe_scroll_to = 0; +static double exe_scroll_align_to = 0.0; +static double exe_scroll_align = 0.0; +static Ecore_Timer *exe_scroll_timer = NULL; +static int eap_scroll_to = 0; +static double eap_scroll_align_to = 0.0; +static double eap_scroll_align = 0.0; +static Ecore_Timer *eap_scroll_timer = NULL; +static Ecore_Timer *animator = NULL; + #define EXEBUFLEN 2048 /* externally accessible functions */ @@ -56,7 +86,8 @@ e_exebuf_show(E_Zone *zone) E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - + + if (e_winlist_active_get()) return 0; if (exebuf) return 0; input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1); @@ -86,19 +117,45 @@ e_exebuf_show(E_Zone *zone) e_theme_edje_object_set(o, "base/theme/exebuf", "widgets/exebuf/main"); edje_object_part_text_set(o, "label", cmd_buf); + + o = e_box_add(exebuf->evas); + exe_list_object = o; + e_box_align_set(o, 0.5, 1.0); + e_box_orientation_set(o, 0); + e_box_homogenous_set(o, 1); + edje_object_part_swallow(bg_object, "exe_list_swallow", o); + evas_object_show(o); + + o = e_box_add(exebuf->evas); + eap_list_object = o; + e_box_align_set(o, 0.5, 0.0); + e_box_orientation_set(o, 0); + e_box_homogenous_set(o, 1); + edje_object_part_swallow(bg_object, "eap_list_swallow", o); + evas_object_show(o); + + o = bg_object; edje_object_size_min_calc(o, &mw, &mh); - x = zone->x + 20; - y = zone->y + 20 + ((zone->h - 20 - 20 - mh) / 2); - w = zone->w - 20 - 20; - h = mh; + w = (double)zone->w * e_config->winlist_pos_size_w; + if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w; + else if (w < e_config->winlist_pos_min_w) w = e_config->winlist_pos_min_w; + if (w < mw) w = mw; + if (w > zone->w) w = zone->w; + x = (double)(zone->w - w) * e_config->winlist_pos_align_x; + + h = (double)zone->h * e_config->winlist_pos_size_h; + if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h; + else if (h < e_config->winlist_pos_min_h) h = e_config->winlist_pos_min_h; + if (h < mh) h = mh; + if (h > zone->h) h = zone->h; + y = (double)(zone->h - h) * e_config->winlist_pos_align_y; e_popup_move_resize(exebuf, x, y, w, h); evas_object_move(o, 0, 0); evas_object_resize(o, w, h); evas_object_show(o); e_popup_edje_bg_object_set(exebuf, o); - evas_event_thaw(exebuf->evas); @@ -126,8 +183,19 @@ e_exebuf_hide(void) { if (!exebuf) return; + _e_exebuf_matches_clear(); evas_event_freeze(exebuf->evas); e_popup_hide(exebuf); + if (exe_scroll_timer) ecore_timer_del(exe_scroll_timer); + exe_scroll_timer = NULL; + if (eap_scroll_timer) ecore_timer_del(eap_scroll_timer); + eap_scroll_timer = NULL; + if (animator) ecore_animator_del(animator); + animator = NULL; + evas_object_del(eap_list_object); + eap_list_object = NULL; + evas_object_del(exe_list_object); + exe_list_object = NULL; evas_object_del(bg_object); bg_object = NULL; evas_event_thaw(exebuf->evas); @@ -148,7 +216,8 @@ e_exebuf_hide(void) ecore_list_destroy(exe_list); exe_list = NULL; } - _e_exebuf_matches_clear(); + which_list = NO_LIST; + exe_sel = NULL; } /* local subsystem functions */ @@ -166,25 +235,75 @@ _e_exebuf_matches_clear(void) free(exe_matches->data); exe_matches = evas_list_remove_list(exe_matches, exe_matches); } - eap_sel = NULL; + + e_box_freeze(exe_list_object); + while (exes) + { + E_Exebuf_Exe *exe; + + exe = exes->data; + if (exe->app) e_object_unref(E_OBJECT(exe->app)); + evas_object_del(exe->bg_object); + if (exe->icon_object) + evas_object_del(exe->icon_object); + free(exe); + exes = evas_list_remove_list(exes, exes); + } + e_box_thaw(exe_list_object); + + e_box_freeze(eap_list_object); + while (eaps) + { + E_Exebuf_Exe *exe; + + exe = eaps->data; + if (exe->app) e_object_unref(E_OBJECT(exe->app)); + evas_object_del(exe->bg_object); + if (exe->icon_object) + evas_object_del(exe->icon_object); + free(exe); + eaps = evas_list_remove_list(eaps, eaps); + } + e_box_thaw(eap_list_object); + + e_box_align_set(eap_list_object, 0.5, 0.0); + e_box_align_set(exe_list_object, 0.5, 1.0); + exe_sel = NULL; + which_list = NO_LIST; } static void _e_exebuf_update(void) { + E_App *a; + Evas_Object *o; + edje_object_part_text_set(bg_object, "label", cmd_buf); - /* FIXME: if cmd_buf is an exact match for an eap or exe display an icon - * to show it is */ - /* FIXME: display match lists. if match is exat match for cmd_buf dont - * list it as it will be matched and indicated - */ + if (icon_object) evas_object_del(icon_object); + icon_object == NULL; + a = e_app_exe_find(cmd_buf); + if (!a) a = e_app_name_find(cmd_buf); + if (!a) a = e_app_generic_find(cmd_buf); + if (a) + { + o = edje_object_add(exebuf->evas); + edje_object_file_set(o, a->path, "icon"); + icon_object = o; + edje_object_part_swallow(bg_object, "icon_swallow", o); + evas_object_show(o); + } } static void _e_exebuf_exec(void) { - if (eap_sel) - e_zone_app_exec(exebuf->zone, eap_sel); + if (exe_sel) + { + if (exe_sel->app) + e_zone_app_exec(exebuf->zone, exe_sel->app); + else + e_zone_exec(exebuf->zone, exe_sel->file); + } else e_zone_exec(exebuf->zone, cmd_buf); @@ -194,15 +313,108 @@ _e_exebuf_exec(void) static void _e_exebuf_next(void) { - char *exe = NULL; + E_Exebuf_Exe *exe; + Evas_List *l; + int i, n; - if (exe_matches) exe = exe_matches->data; - if (exe) + if (which_list == NO_LIST) { - if (strlen(exe < (EXEBUFLEN - 1))) + if (exes) { - strcpy(cmd_buf, exe); - _e_exebuf_update(); + exe_sel = exes->data; + which_list = EXE_LIST; + if (exe_sel) + { + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + e_box_align_set(exe_list_object, 0.5, 1.0); + } + } + } + else + { + if (which_list == EXE_LIST) + { + if (exe_sel) + { + n = evas_list_count(exes); + for (i = 0, l = exes; l; l = l->next, i++) + { + if (l->data == exe_sel) + { + if (l->next) + { + edje_object_signal_emit(exe_sel->bg_object, "passive", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "passive", ""); + exe_sel = l->next->data; + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + if (n > 1) + { + exe_scroll_align_to = (double)(i + 1) / (double)(n - 1); + if (e_config->winlist_scroll_animate) + { + exe_scroll_to = 1; + if (!exe_scroll_timer) + exe_scroll_timer = ecore_timer_add(0.01, _e_exebuf_exe_scroll_timer, NULL); + if (!animator) + animator = ecore_animator_add(_e_exebuf_animator, NULL); + } + else + { + exe_scroll_align = exe_scroll_align_to; + e_box_align_set(exe_list_object, 0.5, exe_scroll_align); + } + } + } + break; + } + } + } + } + else if (which_list == EAP_LIST) + { + if (exe_sel) + { + n = evas_list_count(eaps); + for (i = 0, l = eaps; l; l = l->next, i++) + { + if (l->data == exe_sel) + { + if (l->prev) + { + edje_object_signal_emit(exe_sel->bg_object, "passive", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "passive", ""); + exe_sel = l->prev->data; + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + if (n > 1) + { + eap_scroll_align_to = (double)(i - 1) / (double)(n - 1); + if (e_config->winlist_scroll_animate) + { + eap_scroll_to = 1; + if (!eap_scroll_timer) + eap_scroll_timer = ecore_timer_add(0.01, _e_exebuf_eap_scroll_timer, NULL); + if (!animator) + animator = ecore_animator_add(_e_exebuf_animator, NULL); + } + else + { + eap_scroll_align = eap_scroll_align_to; + e_box_align_set(eap_list_object, 0.5, eap_scroll_align); + } + } + } + break; + } + } + } } } } @@ -210,54 +422,174 @@ _e_exebuf_next(void) static void _e_exebuf_prev(void) { + E_Exebuf_Exe *exe; + Evas_List *l; + int i, n; + + if (which_list == NO_LIST) + { + if (eaps) + { + exe_sel = eaps->data; + which_list = EAP_LIST; + if (exe_sel) + { + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + e_box_align_set(eap_list_object, 0.5, 0.0); + } + } + } + else + { + if (which_list == EXE_LIST) + { + if (exe_sel) + { + n = evas_list_count(exes); + for (i = 0, l = exes; l; l = l->next, i++) + { + if (l->data == exe_sel) + { + if (l->prev) + { + edje_object_signal_emit(exe_sel->bg_object, "passive", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "passive", ""); + exe_sel = l->prev->data; + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + if (n > 1) + { + exe_scroll_align_to = (double)(i - 1) / (double)(n - 1); + if (e_config->winlist_scroll_animate) + { + exe_scroll_to = 1; + if (!exe_scroll_timer) + exe_scroll_timer = ecore_timer_add(0.01, _e_exebuf_exe_scroll_timer, NULL); + if (!animator) + animator = ecore_animator_add(_e_exebuf_animator, NULL); + } + else + { + exe_scroll_align = exe_scroll_align_to; + e_box_align_set(exe_list_object, 0.5, exe_scroll_align); + } + } + } + break; + } + } + } + } + else if (which_list == EAP_LIST) + { + if (exe_sel) + { + n = evas_list_count(eaps); + for (i = 0, l = eaps; l; l = l->next, i++) + { + if (l->data == exe_sel) + { + if (l->next) + { + edje_object_signal_emit(exe_sel->bg_object, "passive", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "passive", ""); + exe_sel = l->next->data; + edje_object_signal_emit(exe_sel->bg_object, "active", ""); + if (exe_sel->icon_object) + edje_object_signal_emit(exe_sel->icon_object, "active", ""); + if (n > 1) + { + eap_scroll_align_to = (double)(i + 1) / (double)(n - 1); + if (e_config->winlist_scroll_animate) + { + eap_scroll_to = 1; + if (!eap_scroll_timer) + eap_scroll_timer = ecore_timer_add(0.01, _e_exebuf_eap_scroll_timer, NULL); + if (!animator) + animator = ecore_animator_add(_e_exebuf_animator, NULL); + } + else + { + eap_scroll_align = eap_scroll_align_to; + e_box_align_set(eap_list_object, 0.5, eap_scroll_align); + } + } + } + break; + } + } + } + } + } } static void _e_exebuf_complete(void) { - char common[EXEBUFLEN], *exe; + char common[EXEBUFLEN], *exe = NULL; Evas_List *l; - int orig_len, common_len, exe_len, next_char, val, pos, matches; + int orig_len = 0, common_len = 0, exe_len, next_char, val, pos, matches; - strcpy(common, cmd_buf); - orig_len = common_len = strlen(common); - matches = 1; - while (matches) + if (exe_sel) { - next_char = 0; - matches = 0; - for (l = exe_matches; l; l = l->next) + if (exe_sel->app) { - matches = 1; - exe = l->data; - exe_len = strlen(exe); - if (exe_len > common_len) + strncpy(cmd_buf, exe_sel->app->name, EXEBUFLEN - 1); + cmd_buf[EXEBUFLEN - 1] = 0; + } + else if (exe_sel->file) + { + strncpy(cmd_buf, exe_sel->file, EXEBUFLEN - 1); + cmd_buf[EXEBUFLEN - 1] = 0; + } + } + else + { + strcpy(common, cmd_buf); + orig_len = common_len = strlen(common); + matches = 1; + while (matches) + { + next_char = 0; + matches = 0; + for (l = exe_matches; l; l = l->next) { - val = 0; - pos = evas_string_char_next_get(exe, common_len, &val); - if (!next_char) - next_char = val; - else if (next_char != val) + matches = 1; + exe = l->data; + exe_len = strlen(exe); + if (exe_len > common_len) + { + val = 0; + pos = evas_string_char_next_get(exe, common_len, &val); + if (!next_char) + next_char = val; + else if (next_char != val) + { + matches = 0; + break; + } + } + else { matches = 0; break; } } - else - { - matches = 0; - break; - } + if (matches) common_len++; } - if (matches) common_len++; } if ((exe) && (orig_len < common_len) && (common_len < (EXEBUFLEN - 1))) { strncpy(cmd_buf, exe, common_len); cmd_buf[common_len] = 0; - _e_exebuf_update(); - _e_exebuf_matches_update(); } + _e_exebuf_update(); + _e_exebuf_matches_update(); } static void @@ -273,6 +605,7 @@ _e_exebuf_backspace(void) { cmd_buf[pos] = 0; _e_exebuf_update(); + _e_exebuf_matches_update(); } } } @@ -282,6 +615,8 @@ _e_exebuf_matches_update(void) { char *path, *file, buf[4096]; Evas_Hash *added = NULL; + Evas_List *l, *list; + int i, max; /* how to match: * @@ -295,13 +630,89 @@ _e_exebuf_matches_update(void) * match cmd_buf* for all executables in $PATH (exclude duplicates in eap_matches) */ _e_exebuf_matches_clear(); + if (strlen(cmd_buf) == 0) return; + + snprintf(buf, sizeof(buf), "%s*", cmd_buf); + list = e_app_name_glob_list(buf); + for (l = list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->exe) + { + if (!evas_hash_find(added, a->exe)) + { + eap_matches = evas_list_append(eap_matches, a); + added = evas_hash_direct_add(added, a->exe, a->exe); + } + } + } + evas_list_free(list); + snprintf(buf, sizeof(buf), "%s*", cmd_buf); + list = e_app_exe_glob_list(buf); + for (l = list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->exe) + { + if (!evas_hash_find(added, a->exe)) + { + eap_matches = evas_list_append(eap_matches, a); + added = evas_hash_direct_add(added, a->exe, a->exe); + } + } + } + evas_list_free(list); + + snprintf(buf, sizeof(buf), "*%s*", cmd_buf); + list = e_app_generic_glob_list(buf); + for (l = list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->exe) + { + if (!evas_hash_find(added, a->exe)) + { + eap_matches = evas_list_append(eap_matches, a); + added = evas_hash_direct_add(added, a->exe, a->exe); + } + } + } + evas_list_free(list); + + snprintf(buf, sizeof(buf), "*%s*", cmd_buf); + list = e_app_comment_glob_list(buf); + for (l = list; l; l = l->next) + { + E_App *a; + + a = l->data; + if (a->exe) + { + if (!evas_hash_find(added, a->exe)) + { + eap_matches = evas_list_append(eap_matches, a); + added = evas_hash_direct_add(added, a->exe, a->exe); + } + } + } + evas_list_free(list); + + if (added) evas_hash_free(added); + added = NULL; + snprintf(buf, sizeof(buf), "%s*", cmd_buf); if (exe_list) { ecore_list_goto_first(exe_list); while ((path = ecore_list_next(exe_list)) != NULL) { - file = ecore_file_get_file(path); + file = (char *)ecore_file_get_file(path); if (file) { if (e_util_glob_match(file, buf)) @@ -316,6 +727,94 @@ _e_exebuf_matches_update(void) } } if (added) evas_hash_free(added); + added = NULL; + + max = 20; + e_box_freeze(eap_list_object); + for (i = 0, l = eap_matches; l && (i < max); l = l->next, i++) + { + E_Exebuf_Exe *exe; + Evas_Coord mw, mh; + Evas_Object *o; + + exe = calloc(1, sizeof(E_Exebuf_Exe)); + eaps = evas_list_append(eaps, exe); + exe->app = l->data; + /* no this is not a mistake - reference it twice */ + e_object_ref(E_OBJECT(exe->app)); + e_object_ref(E_OBJECT(exe->app)); + o = edje_object_add(exebuf->evas); + exe->bg_object = o; + e_theme_edje_object_set(o, "base/theme/exebuf", + "widgets/exebuf/item"); + edje_object_part_text_set(o, "title_text", exe->app->name); + evas_object_show(o); + if (edje_object_part_exists(exe->bg_object, "icon_swallow")) + { + o = edje_object_add(exebuf->evas); + edje_object_file_set(o, exe->app->path, "icon"); + exe->icon_object = o; + edje_object_part_swallow(exe->bg_object, "icon_swallow", o); + evas_object_show(o); + } + edje_object_size_min_calc(exe->bg_object, &mw, &mh); + e_box_pack_start(eap_list_object, exe->bg_object); + e_box_pack_options_set(exe->bg_object, + 1, 1, /* fill */ + 1, 0, /* expand */ + 0.5, 0.5, /* align */ + mw, mh, /* min */ + 9999, mh /* max */ + ); + } + e_box_thaw(eap_list_object); + /* FIXME: sort exe_matches and eap_matches in order of most recently used + * first, then shortest completions first + */ + max = 20; + e_box_freeze(exe_list_object); + for (i = 0, l = exe_matches; l && (i < max); l = l->next, i++) + { + E_Exebuf_Exe *exe; + Evas_Coord mw, mh; + Evas_Object *o; + + exe = calloc(1, sizeof(E_Exebuf_Exe)); + exe->file = l->data; + exes = evas_list_append(exes, exe); + o = edje_object_add(exebuf->evas); + exe->bg_object = o; + e_theme_edje_object_set(o, "base/theme/exebuf", + "widgets/exebuf/item"); + edje_object_part_text_set(o, "title_text", exe->file); + evas_object_show(o); + if (edje_object_part_exists(exe->bg_object, "icon_swallow")) + { + E_App *a; + + a = e_app_exe_find(exe->file); + if (a) + { + o = edje_object_add(exebuf->evas); + edje_object_file_set(o, a->path, "icon"); + exe->icon_object = o; + edje_object_part_swallow(exe->bg_object, "icon_swallow", o); + evas_object_show(o); + exe->app = a; + e_object_ref(E_OBJECT(exe->app)); + } + } + edje_object_size_min_calc(exe->bg_object, &mw, &mh); + e_box_pack_end(exe_list_object, exe->bg_object); + e_box_pack_options_set(exe->bg_object, + 1, 1, /* fill */ + 1, 0, /* expand */ + 0.5, 0.5, /* align */ + mw, mh, /* min */ + 9999, mh /* max */ + ); + } + e_box_thaw(exe_list_object); } static int @@ -395,13 +894,77 @@ _e_exebuf_cb_mouse_wheel(void *data, int type, void *event) { int i; - for (i = ev->z; i < 0; i++) e_exebuf_hide(); + for (i = ev->z; i < 0; i++) _e_exebuf_prev(); } else if (ev->z > 0) /* down */ { int i; - for (i = ev->z; i > 0; i--) e_exebuf_hide(); + for (i = ev->z; i > 0; i--) _e_exebuf_next(); } return 1; } + +static int +_e_exebuf_exe_scroll_timer(void *data) +{ + if (exe_scroll_to) + { + double spd; + + spd = e_config->winlist_scroll_speed; + exe_scroll_align = (exe_scroll_align * (1.0 - spd)) + (exe_scroll_align_to * spd); + return 1; + } + exe_scroll_timer = NULL; + return 0; +} + +static int +_e_exebuf_eap_scroll_timer(void *data) +{ + if (eap_scroll_to) + { + double spd; + + spd = e_config->winlist_scroll_speed; + eap_scroll_align = (eap_scroll_align * (1.0 - spd)) + (eap_scroll_align_to * spd); + return 1; + } + eap_scroll_timer = NULL; + return 0; +} + +static int +_e_exebuf_animator(void *data) +{ + if (exe_scroll_to) + { + double da; + + da = exe_scroll_align - exe_scroll_align_to; + if (da < 0.0) da = -da; + if (da < 0.01) + { + exe_scroll_align = exe_scroll_align_to; + exe_scroll_to = 0; + } + e_box_align_set(exe_list_object, 0.5, 1.0 - exe_scroll_align); + } + if (eap_scroll_to) + { + double da; + + da = eap_scroll_align - eap_scroll_align_to; + if (da < 0.0) da = -da; + if (da < 0.01) + { + eap_scroll_align = eap_scroll_align_to; + eap_scroll_to = 0; + } + e_box_align_set(eap_list_object, 0.5, eap_scroll_align); + } + if ((exe_scroll_to) || (eap_scroll_to)) return 1; + animator = NULL; + return 0; +} diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index 50e985fff..f99c4714e 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -156,6 +156,27 @@ e_util_glob_match(const char *str, const char *glob) return 0; } +int +e_util_glob_case_match(const char *str, const char *glob) +{ + char *tstr, *tglob, *p, *tp; + + if (glob[0] == 0) + { + if (str[0] == 0) return 1; + return 0; + } + if (!strcmp(glob, "*")) return 1; + tstr = alloca(strlen(str) + 1); + for (tp = tstr, p = str; *p != 0; p++, tp++) *tp = tolower(*p); + *tp = 0; + tglob = alloca(strlen(glob) + 1); + for (tp = tglob, p = glob; *p != 0; p++, tp++) *tp = tolower(*p); + *tp = 0; + if (!fnmatch(tglob, tstr, 0)) return 1; + return 0; +} + E_Container * e_util_container_number_get(int num) { diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h index b9c5734f2..e35cb1007 100644 --- a/src/bin/e_utils.h +++ b/src/bin/e_utils.h @@ -14,6 +14,7 @@ EAPI E_Zone *e_util_zone_current_get(E_Manager *man); EAPI int e_util_utils_installed(void); EAPI int e_util_app_installed(char *app); EAPI int e_util_glob_match(const char *str, const char *glob); +EAPI int e_util_glob_case_match(const char *str, const char *glob); EAPI E_Container *e_util_container_number_get(int num); EAPI E_Zone *e_util_container_zone_number_get(int con_num, int zone_num); EAPI int e_util_head_exec(int head, char *cmd); diff --git a/src/bin/e_winlist.c b/src/bin/e_winlist.c index 16a6f37c8..42c2949fb 100644 --- a/src/bin/e_winlist.c +++ b/src/bin/e_winlist.c @@ -514,6 +514,7 @@ _e_winlist_activate(void) if (!win_selected) return; ww = win_selected->data; edje_object_signal_emit(ww->bg_object, "active", ""); + if (ww->icon_object) edje_object_signal_emit(ww->icon_object, "active", ""); ok = 0; if ((ww->border->iconic) && @@ -608,6 +609,7 @@ _e_winlist_deactivate(void) } edje_object_part_text_set(bg_object, "title_text", ""); edje_object_signal_emit(ww->bg_object, "passive", ""); + if (ww->icon_object) edje_object_signal_emit(ww->icon_object, "passive", ""); if (!ww->border->lock_focus_in) e_border_focus_set(ww->border, 0, 0); } @@ -636,6 +638,7 @@ _e_winlist_show_active(void) } else { + scroll_align = scroll_align_to; e_box_align_set(list_object, 0.5, scroll_align); } }