diff --git a/data/themes/default_fileman.edc b/data/themes/default_fileman.edc index b0ecf9f55..5a0b4e585 100644 --- a/data/themes/default_fileman.edc +++ b/data/themes/default_fileman.edc @@ -4801,6 +4801,750 @@ group { + +images { + image: "e17_ibar_over_v.png" COMP; + image: "e17_sb_btd1.png" COMP; + image: "e17_sb_btd2.png" COMP; + image: "e17_sb_btu1.png" COMP; + image: "e17_sb_btu2.png" COMP; + image: "e17_sb_btl1.png" COMP; + image: "e17_sb_btl2.png" COMP; + image: "e17_sb_btr1.png" COMP; + image: "e17_sb_btr2.png" COMP; + image: "e17_sb_btu1.png" COMP; + image: "e17_sb_barh1.png" COMP; + image: "e17_sb_barh2.png" COMP; + image: "e17_sb_barv1.png" COMP; + image: "e17_sb_barv2.png" COMP; + image: "e17_sb_runnerh.png" COMP; + image: "e17_sb_runnerv.png" COMP; + image: "e17_scrollbar_hdrag_thumb.png" COMP; + image: "e17_scrollbar_vdrag_thumb.png" COMP; +} + +group { + name: "e/fileman/scrollframe/default"; + parts { + part { + name: "bg"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + } + } + part { + name: "clipper"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + } + rel2 { + to: "bg"; + } + } + } + part { + name: "e.swallow.content"; + clip_to: "clipper"; + type: SWALLOW; + mouse_events: 0; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel2 { + relative: 0.0 0.0; + offset: -1 -1; + to_x: "sb_vbar"; + to_y: "sb_hbar"; + } + } + } + part { + name: "conf_over"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + offset: -5 -5; + } + rel2 { + to: "bg"; + offset: 4 4; + } + image { + normal: "e17_ibar_over_v.png"; + border: 13 13 13 13; + middle: 0; + } + fill { + smooth : 0; + } + } + } + part { + name: "sb_vbar"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + min: 16 16; + align: 1.0 0.0; + rel1 { + to: "bg"; + relative: 1.0 0.0; + offset: -1 0; + } + rel2 { + to: "bg"; + relative: 1.0 0.0; + offset: -1 -1; + to_y: "sb_hbar"; + } + } + description { + state: "hidden" 0.0; + visible: 0; + max: 0 99999; + rel1 { + to: "bg"; + relative: 1.0 0.0; + offset: 0 0; + } + rel2 { + to: "bg"; + relative: 1.0 0.0; + offset: 0 -1; + to_y: "sb_hbar"; + } + } + } + part { + name: "sb_vbar_base"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + to: "sb_vbar_a1"; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + to: "sb_vbar_a2"; + } + } + } + part { + name: "sb_vbar_runner"; + clip_to: "sb_vbar"; + mouse_events: 0; + description { + state: "default" 0.0; + max: 2 99999; + rel1 { + to: "sb_vbar_base"; + } + rel2 { + to: "sb_vbar_base"; + } + image { + normal: "e17_sb_runnerv.png"; + border: 0 0 4 4; + } + fill { + smooth: 0; + } + } + } + part { + name: "sb_vbar_p1"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + to: "sb_vbar_a1"; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + to: "e.dragable.vbar"; + } + } + } + part { + name: "sb_vbar_p2"; + type: RECT; + clip_to: "sb_vbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 0.0 1.0; + offset: 0 0; + to: "e.dragable.vbar"; + } + rel2 { + relative: 1.0 0.0; + offset: -1 -1; + to: "sb_vbar_a2"; + } + } + } + part { + name: "e.dragable.vbar"; + clip_to: "sb_vbar"; + mouse_events: 1; + dragable { + x: 0 0 0; + y: 1 1 0; + confine: "sb_vbar_base"; + } + description { + state: "default" 0.0; + min: 16 16; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar_base"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_vbar_base"; + } + image { + normal: "e17_sb_barv1.png"; + border: 5 5 5 5; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_barv2.png"; + } + } + } + part { + name: "vbar_bar_thumb"; + clip_to: "sb_vbar"; + mouse_events: 0; + description { + state: "default" 0.0; + max: 8 8; + min: 8 8; + rel1 { + to: "e.dragable.vbar"; + } + rel2 { + to: "e.dragable.vbar"; + } + image { + normal: "e17_scrollbar_vdrag_thumb.png"; + } + } + } + part { + name: "sb_vbar_a1"; + type: IMAGE; + mouse_events: 1; + clip_to: "sb_vbar"; + description { + state: "default" 0.0; + align: 0.5 0.0; + aspect: 1.0 1.0; + aspect_preference: HORIZONTAL; + rel1 { + to: "sb_vbar"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + to: "sb_vbar"; + relative: 1.0 0.0; + offset: -1 0; + } + image { + normal: "e17_sb_btu1.png"; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_btu2.png"; + } + } + } + part { + name: "sb_vbar_a2"; + type: IMAGE; + mouse_events: 1; + clip_to: "sb_vbar"; + description { + state: "default" 0.0; + align: 0.5 1.0; + aspect: 1.0 1.0; + aspect_preference: HORIZONTAL; + rel1 { + to: "sb_vbar"; + relative: 0.0 1.0; + offset: 0 -1; + } + rel2 { + to: "sb_vbar"; + relative: 1.0 1.0; + offset: -1 -1; + } + image { + normal: "e17_sb_btd1.png"; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_btd2.png"; + } + } + } + part { + name: "sb_hbar"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + min: 16 16; + align: 0.0 1.0; + rel1 { + to: "bg"; + relative: 0.0 1.0; + offset: 0 -1; + } + rel2 { + to: "bg"; + relative: 0.0 1.0; + offset: -1 -1; + to_x: "sb_vbar"; + } + } + description { + state: "hidden" 0.0; + visible: 0; + rel1 { + to: "bg"; + relative: 0.0 1.0; + offset: 0 0; + } + rel2 { + to: "bg"; + relative: 0.0 1.0; + offset: -1 0; + to_x: "sb_vbar"; + } + } + } + part { + name: "sb_hbar_base"; + type: RECT; + clip_to: "sb_hbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 1.0 0.0; + offset: 0 0; + to: "sb_hbar_a1"; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to: "sb_hbar_a2"; + } + } + } + part { + name: "sb_hbar_runner"; + clip_to: "sb_hbar"; + mouse_events: 0; + description { + state: "default" 0.0; + max: 99999 2; + rel1 { + to: "sb_hbar_base"; + } + rel2 { + to: "sb_hbar_base"; + } + image { + normal: "e17_sb_runnerh.png"; + border: 4 4 0 0; + } + fill { + smooth: 0; + } + } + } + part { + name: "sb_hbar_p1"; + type: RECT; + clip_to: "sb_hbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 1.0 0.0; + offset: 0 0; + to: "sb_hbar_a1"; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to: "e.dragable.hbar"; + } + } + } + part { + name: "sb_hbar_p2"; + type: RECT; + clip_to: "sb_hbar"; + mouse_events: 1; + description { + state: "default" 0.0; + color: 0 0 0 0; + rel1 { + relative: 1.0 0.0; + offset: 0 0; + to: "e.dragable.hbar"; + } + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to: "sb_hbar_a2"; + } + } + } + part { + name: "e.dragable.hbar"; + clip_to: "sb_hbar"; + mouse_events: 1; + dragable { + x: 1 1 0; + y: 0 0 0; + confine: "sb_hbar_base"; + } + description { + state: "default" 0.0; + min: 16 16; + rel1 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar_base"; + } + rel2 { + relative: 0.5 0.5; + offset: 0 0; + to: "sb_hbar_base"; + } + image { + normal: "e17_sb_barh1.png"; + border: 5 5 5 5; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_barh2.png"; + } + } + } + part { + name: "hbar_bar_thumb"; + clip_to: "sb_hbar"; + mouse_events: 0; + description { + state: "default" 0.0; + max: 8 8; + min: 8 8; + rel1 { + to: "e.dragable.hbar"; + } + rel2 { + to: "e.dragable.hbar"; + } + image { + normal: "e17_scrollbar_hdrag_thumb.png"; + } + } + } + part { + name: "sb_hbar_a1"; + type: IMAGE; + mouse_events: 1; + clip_to: "sb_hbar"; + description { + state: "default" 0.0; + align: 0.0 0.5; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel1 { + to: "sb_hbar"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + to: "sb_hbar"; + relative: 0.0 1.0; + offset: 0 -1; + } + image { + normal: "e17_sb_btl1.png"; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_btl2.png"; + } + } + } + part { + name: "sb_hbar_a2"; + type: IMAGE; + mouse_events: 1; + clip_to: "sb_hbar"; + description { + state: "default" 0.0; + align: 1.0 0.5; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel1 { + to: "sb_hbar"; + relative: 1.0 0.0; + offset: -1 0; + } + rel2 { + to: "sb_hbar"; + relative: 1.0 1.0; + offset: -1 -1; + } + image { + normal: "e17_sb_btr1.png"; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image { + normal: "e17_sb_btr2.png"; + } + } + } + } + programs { + program { + name: "sb_vbar_show"; + signal: "e,action,show,vbar"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "sb_vbar"; + } + program { + name: "sb_vbar_hide"; + signal: "e,action,hide,vbar"; + source: "e"; + action: STATE_SET "hidden" 0.0; + target: "sb_vbar"; + } + program { + name: "sb_hbar_show"; + signal: "e,action,show,hbar"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "sb_hbar"; + } + program { + name: "sb_hbar_hide"; + signal: "e,action,hide,hbar"; + source: "e"; + action: STATE_SET "hidden" 0.0; + target: "sb_hbar"; + } + + program { + name: "sb_vbar_a1_down"; + signal: "mouse,down,1"; + source: "sb_vbar_a1"; + action: STATE_SET "clicked" 0.0; + target: "sb_vbar_a1"; + } + program { + name: "sb_vbar_a1_down2"; + signal: "mouse,down,1"; + source: "sb_vbar_a1"; + action: DRAG_VAL_STEP 0.0 -1.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_vbar_a1_up"; + signal: "mouse,up,1"; + source: "sb_vbar_a1"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_a1"; + } + program { + name: "sb_vbar_a2_down"; + signal: "mouse,down,1"; + source: "sb_vbar_a2"; + action: STATE_SET "clicked" 0.0; + target: "sb_vbar_a2"; + } + program { + name: "sb_vbar_a2_down2"; + signal: "mouse,down,1"; + source: "sb_vbar_a2"; + action: DRAG_VAL_STEP 0.0 1.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_vbar_a2_up"; + signal: "mouse,up,1"; + source: "sb_vbar_a2"; + action: STATE_SET "default" 0.0; + target: "sb_vbar_a2"; + } + program { + name: "sb_vbar_p1_down"; + signal: "mouse,down,1"; + source: "sb_vbar_p1"; + action: DRAG_VAL_PAGE 0.0 -1.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_vbar_p2_down"; + signal: "mouse,down,1"; + source: "sb_vbar_p2"; + action: DRAG_VAL_PAGE 0.0 1.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_vbar_down"; + signal: "mouse,down,1"; + source: "e.dragable.vbar"; + action: STATE_SET "clicked" 0.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_vbar_up"; + signal: "mouse,up,1"; + source: "e.dragable.vbar"; + action: STATE_SET "default" 0.0; + target: "e.dragable.vbar"; + } + program { + name: "sb_hbar_a1_down"; + signal: "mouse,down,1"; + source: "sb_hbar_a1"; + action: STATE_SET "clicked" 0.0; + target: "sb_hbar_a1"; + } + program { + name: "sb_hbar_a1_down2"; + signal: "mouse,down,1"; + source: "sb_hbar_a1"; + action: DRAG_VAL_STEP -1.0 0.0; + target: "e.dragable.hbar"; + } + program { + name: "sb_hbar_a1_up"; + signal: "mouse,up,1"; + source: "sb_hbar_a1"; + action: STATE_SET "default" 0.0; + target: "sb_hbar_a1"; + } + program { + name: "sb_hbar_a2_down"; + signal: "mouse,down,1"; + source: "sb_hbar_a2"; + action: STATE_SET "clicked" 0.0; + target: "sb_hbar_a2"; + } + program { + name: "sb_hbar_a2_down2"; + signal: "mouse,down,1"; + source: "sb_hbar_a2"; + action: DRAG_VAL_STEP 1.0 0.0; + target: "e.dragable.hbar"; + } + program { + name: "sb_hbar_a2_up"; + signal: "mouse,up,1"; + source: "sb_hbar_a2"; + action: STATE_SET "default" 0.0; + target: "sb_hbar_a2"; + } + program { + name: "sb_hbar_p1_down"; + signal: "mouse,down,1"; + source: "sb_hbar_p1"; + action: DRAG_VAL_PAGE -1.0 0.0; + target: "e.dragable.hbar"; + } + program { + name: "sb_hbar_p2_down"; + signal: "mouse,down,1"; + source: "sb_hbar_p2"; + action: DRAG_VAL_PAGE 1.0 0.0; + target: "e.dragable.hbar"; + } + program { + name: "sb_hbar_down"; + signal: "mouse,down,1"; + source: "e.dragable.hbar"; + action: STATE_SET "clicked" 0.0; + target: "e.dragable.hbar"; + } + program { + name: "sb_hbar_up"; + signal: "mouse,up,1"; + source: "e.dragable.hbar"; + action: STATE_SET "default" 0.0; + target: "e.dragable.hbar"; + } + } +} + + + + + + + + + + + diff --git a/data/themes/default_preview.edc b/data/themes/default_preview.edc index 8ba6be0a9..34ccf5a9b 100644 --- a/data/themes/default_preview.edc +++ b/data/themes/default_preview.edc @@ -72,6 +72,7 @@ group { image { normal: "e17_ibar_over_v.png"; border: 13 13 13 13; + middle: 0; } fill { smooth : 0; diff --git a/data/themes/default_scrollframe.edc b/data/themes/default_scrollframe.edc index bc59e2408..ee074b74a 100644 --- a/data/themes/default_scrollframe.edc +++ b/data/themes/default_scrollframe.edc @@ -87,6 +87,7 @@ group { image { normal: "e17_ibar_over_v.png"; border: 13 13 13 13; + middle: 0; } fill { smooth : 0; diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 97a23a3e1..0e4e8e68a 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -5,8 +5,17 @@ #define OVERCLIP 128 -/* FIXME: this is NOT complete. dnd doesnt work. only list view works. - * in icon view it needs to be much better about placement of icons and +/* FIXME: display symlinks in icons somehow */ +/* FIXME: bug: drag multiple files doesnt display all files being dragged + only 1 icon shown to be dragged (instead of at least a group) */ +/* FIXME: need a mapping of mimietype to actions to do on the file + * (e actions like import as wallpaper etc. as well as execute app + * X on the file based on what mimetypes the app handles) */ +/* FIXME: use edje messages & embryo for scrolling of bg's */ +/* FIXME: put in code to allow for custom icons per file/dir somehow */ + +/* FIXME: this is NOT complete. dnd not complete (started). only list view + * works. in icon view it needs to be much better about placement of icons and * being able to save/load icon placement. it doesn't support backgrounds or * custom frames or icons yet */ @@ -119,6 +128,7 @@ struct _E_Fm2_Icon unsigned char saved_pos : 1; unsigned char odd : 1; unsigned char deleted : 1; + unsigned char down_sel : 1; }; static const char *_e_fm2_dev_path_map(const char *dev, const char *path); @@ -1357,7 +1367,24 @@ _e_fm2_icon_new(E_Fm2_Smart_Data *sd, char *file) lnk = ecore_file_readlink(buf); if (lnk) { - ic->info.link = evas_stringshare_add(lnk); + if (lnk[0] == '/') + { + ic->info.link = evas_stringshare_add(lnk); + ic->info.real_link = evas_stringshare_add(lnk); + } + else + { + char *rp; + + snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, lnk); + rp = ecore_file_realpath(buf); + if (rp) + { + ic->info.link = evas_stringshare_add(rp); + free(rp); + } + ic->info.real_link = evas_stringshare_add(lnk); + } free(lnk); } @@ -1487,6 +1514,7 @@ _e_fm2_icon_free(E_Fm2_Icon *ic) if (ic->info.generic) evas_stringshare_del(ic->info.generic); if (ic->info.icon) evas_stringshare_del(ic->info.icon); if (ic->info.link) evas_stringshare_del(ic->info.link); + if (ic->info.real_link) evas_stringshare_del(ic->info.real_link); if (ic->info.pseudo_dir) evas_stringshare_del(ic->info.pseudo_dir); free(ic); } @@ -1755,15 +1783,15 @@ _e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, void (*gen_func) (vo } else { + if (ic->info.pseudo_link) + snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); + else + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); /* fallback */ if ( (e_util_glob_case_match(ic->info.file, "*.edj")) ) { - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); oic = e_thumb_icon_add(evas_object_evas_get(o)); if (ic->sd->config->icon.key_hint) e_thumb_icon_file_set(oic, buf, ic->sd->config->icon.key_hint); @@ -1788,10 +1816,6 @@ _e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, void (*gen_func) (vo { E_App *app; - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); /* FIXME FIXME FIXME: e_app_new() is SLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOW. it can * be a complete hog. this destroys performance in fm2. :(:(:( */ @@ -1816,6 +1840,36 @@ _e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, void (*gen_func) (vo _e_fm2_icon_thumb(ic, oic, force_gen); */ } + else if (S_ISCHR(ic->info.statinfo.st_mode)) + { + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", + "e/icons/fileman/file"); + } + else if (S_ISBLK(ic->info.statinfo.st_mode)) + { + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", + "e/icons/fileman/file"); + } + else if (S_ISFIFO(ic->info.statinfo.st_mode)) + { + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", + "e/icons/fileman/file"); + } + else if (S_ISSOCK(ic->info.statinfo.st_mode)) + { + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", + "e/icons/fileman/file"); + } + else if (ecore_file_can_exec(buf)) + { + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", + "e/icons/fileman/file"); + } else { oic = edje_object_add(evas_object_evas_get(o)); @@ -2894,7 +2948,113 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) for (l = _e_fm2_list; l; l = l->next) _e_fm2_dnd_finish(l->data, refresh); } - + +/* FIXME: prototype */ +static void +_e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers) +{ + Evas_List *l; + E_Fm2_Icon *ic2; + + int multi_sel = 0, range_sel = 0, seen = 0; + + if (ic->sd->config->selection.windows_modifiers) + { + if (evas_key_modifier_is_set(modifiers, "Shift")) + range_sel = 1; + else if (evas_key_modifier_is_set(modifiers, "Control")) + multi_sel = 1; + } + else + { + if (evas_key_modifier_is_set(modifiers, "Control")) + range_sel = 1; + else if (evas_key_modifier_is_set(modifiers, "Shift")) + multi_sel = 1; + } + if (ic->sd->config->selection.single) + { + multi_sel = 0; + range_sel = 0; + } + if (range_sel) + { + /* find last selected - if any, and select all icons between */ + for (l = ic->sd->icons; l; l = l->next) + { + ic2 = l->data; + if (ic2 == ic) seen = 1; + if (ic2->last_selected) + { + ic2->last_selected = 0; + if (seen) + { + for (; (l) && (l->data != ic); l = l->prev) + { + ic2 = l->data; + _e_fm2_icon_select(ic2); + ic2->last_selected = 0; + } + } + else + { + for (; (l) && (l->data != ic); l = l->next) + { + ic2 = l->data; + _e_fm2_icon_select(ic2); + ic2->last_selected = 0; + } + } + break; + } + } + } + else if (!multi_sel) + { + /* desel others */ + for (l = ic->sd->icons; l; l = l->next) + { + ic2 = l->data; + if (ic2 != ic) + { + if (ic2->selected) _e_fm2_icon_deselect(ic2); + } + } + } + else + { + for (l = ic->sd->icons; l; l = l->next) + { + ic2 = l->data; + ic2->last_selected = 0; + } + } + printf("multi_sel=%i, selected=%i up=%i, dnd=%i\n", + multi_sel, (ic->selected), + up, (int)ic->drag.dnd); + if ((multi_sel) && (ic->selected)) + { + if ((up) && (!ic->drag.dnd) && (!ic->down_sel)) + _e_fm2_icon_deselect(ic); + } + else + { + if (!up) + { + _e_fm2_icon_select(ic); + ic->down_sel = 1; + } + } + evas_object_smart_callback_call(ic->sd->obj, "selection_change", NULL); + if ((!(S_ISDIR(ic->info.statinfo.st_mode)) || + (ic->sd->config->view.no_subdir_jump)) && + (ic->sd->config->view.single_click) + ) + { + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + } +} + static void _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -2947,89 +3107,7 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf ic->drag.start = 1; ic->drag.dnd = 0; } - if (ic->sd->config->selection.windows_modifiers) - { - if (evas_key_modifier_is_set(ev->modifiers, "Shift")) - range_sel = 1; - else if (evas_key_modifier_is_set(ev->modifiers, "Control")) - multi_sel = 1; - } - else - { - if (evas_key_modifier_is_set(ev->modifiers, "Control")) - range_sel = 1; - else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) - multi_sel = 1; - } - if (ic->sd->config->selection.single) - { - multi_sel = 0; - range_sel = 0; - } - if (range_sel) - { - /* find last selected - if any, and select all icons between */ - for (l = ic->sd->icons; l; l = l->next) - { - ic2 = l->data; - if (ic2 == ic) seen = 1; - if (ic2->last_selected) - { - ic2->last_selected = 0; - if (seen) - { - for (; (l) && (l->data != ic); l = l->prev) - { - ic2 = l->data; - _e_fm2_icon_select(ic2); - ic2->last_selected = 0; - } - } - else - { - for (; (l) && (l->data != ic); l = l->next) - { - ic2 = l->data; - _e_fm2_icon_select(ic2); - ic2->last_selected = 0; - } - } - break; - } - } - } - else if (!multi_sel) - { - /* desel others */ - for (l = ic->sd->icons; l; l = l->next) - { - ic2 = l->data; - if (ic2 != ic) - { - if (ic2->selected) _e_fm2_icon_deselect(ic2); - } - } - } - else - { - for (l = ic->sd->icons; l; l = l->next) - { - ic2 = l->data; - ic2->last_selected = 0; - } - } - if ((multi_sel) && (ic->selected)) - _e_fm2_icon_deselect(ic); - else - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(ic->sd->obj, "selection_change", NULL); - if ((!(S_ISDIR(ic->info.statinfo.st_mode)) || - (ic->sd->config->view.no_subdir_jump)) && - (ic->sd->config->view.single_click) - ) - { - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); - } + _e_fm2_mouse_1_handler(ic, 0, ev->modifiers); } else if (ev->button == 3) { @@ -3051,9 +3129,11 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) ev = event_info; if ((ev->button == 1) && (!ic->drag.dnd)) { + _e_fm2_mouse_1_handler(ic, 1, ev->modifiers); ic->drag.start = 0; ic->drag.dnd = 0; } + ic->down_sel = 0; } static void @@ -3076,6 +3156,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf { Evas_Event_Mouse_Move *ev; E_Fm2_Icon *ic; + E_Fm2_Icon_Info *ici; ic = data; ev = event_info; @@ -3124,11 +3205,12 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf sl = e_fm2_selected_list_get(ic->sd->obj); for (l = sl, i = 0; l; l = l->next, i++) { + ici = l->data; /* FIXME: URI - needs to be file:/..... (can't remember 1 or 2 /'s) */ if (!strcmp(realpath, "/")) - snprintf(buf, sizeof(buf), "/%s", ic->info.file); + snprintf(buf, sizeof(buf), "/%s", ici->file); else - snprintf(buf, sizeof(buf), "%s/%s", realpath, ic->info.file); + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); fsel = evas_list_append(fsel, strdup(buf)); } evas_list_free(sl); @@ -3938,6 +4020,13 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp) mn = e_menu_new(); e_menu_category_set(mn, "e/fileman/action"); + if (sd->icon_menu.start.func) + { + sd->icon_menu.start.func(sd->icon_menu.start.data, sd->obj, mn, NULL); + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + } + mi = e_menu_item_new(mn); e_menu_item_label_set(mi, _("Refresh View")); e_menu_item_icon_edje_set(mi, @@ -3970,6 +4059,13 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp) e_menu_item_callback_set(mi, _e_fm2_new_directory, sd); } + if (sd->icon_menu.end.func) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); + sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, NULL); + } + man = e_manager_current_get(); if (!man) { @@ -4123,9 +4219,9 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) if (sd->icon_menu.end.func) { - sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info)); mi = e_menu_item_new(mn); e_menu_item_separator_set(mi, 1); + sd->icon_menu.end.func(sd->icon_menu.end.data, sd->obj, mn, &(ic->info)); } man = e_manager_current_get(); diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index 57631c8d7..292f6414a 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -94,6 +94,7 @@ struct _E_Fm2_Icon_Info const char *generic; const char *icon; const char *link; + const char *real_link; const char *pseudo_dir; struct stat statinfo; unsigned char mount : 1; diff --git a/src/bin/e_fwin.c b/src/bin/e_fwin.c index 8ab8974d3..99edcc721 100644 --- a/src/bin/e_fwin.c +++ b/src/bin/e_fwin.c @@ -14,6 +14,8 @@ static void _e_fwin_cb_delete(E_Win *win); static void _e_fwin_cb_resize(E_Win *win); static void _e_fwin_changed(void *data, Evas_Object *obj, void *event_info); static void _e_fwin_selected(void *data, Evas_Object *obj, void *event_info); +static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info); +static void _e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi); /* local subsystem globals */ static Evas_List *fwins = NULL; @@ -35,7 +37,8 @@ EAPI E_Fwin * e_fwin_new(E_Container *con, const char *dev, const char *path) { E_Fwin *fwin; - char buf[4096], *file; + char buf[4096]; + const char *file; Evas_Object *o; E_Fm2_Config fmc; @@ -53,14 +56,9 @@ e_fwin_new(E_Container *con, const char *dev, const char *path) fwin->win->data = fwin; /* fm issues: */ - /* FIXME: need a way of going to parent dir (menu extn.) */ - /* FIXME: bug: drop on file on another dir doesnt do drop all */ - /* FIXME: bug: on shift-click then drag - don't deselect */ - /* FIXME: bug: drag multiple files doesnt work */ + /* FIXME: "select" of a file opens that file based on mimetype etc. */ + /* FIXME: if file executable - run it */ - /* FIXME: temporary - a white bg until we have a proper fm specific - * scrollframe etc. - */ o = evas_object_rectangle_add(e_win_evas_get(fwin->win)); evas_object_color_set(o, 255, 255, 255, 255); evas_object_show(o); @@ -90,23 +88,35 @@ e_fwin_new(E_Container *con, const char *dev, const char *path) evas_object_smart_callback_add(o, "selected", _e_fwin_selected, fwin); e_fm2_path_set(o, dev, path); - evas_object_move(o, 0, 0); + e_fm2_icon_menu_end_extend_callback_set(o, _e_fwin_menu_extend, fwin); evas_object_show(o); - o = e_widget_scrollframe_pan_add(e_win_evas_get(fwin->win), fwin->fm_obj, - e_fm2_pan_set, - e_fm2_pan_get, - e_fm2_pan_max_get, - e_fm2_pan_child_size_get); + o = e_scrollframe_add(e_win_evas_get(fwin->win)); + /* FIXME: this theme object will have more versions and options later + * for things like swallowing widgets/buttons ot providing them - a + * gadcon for starters for fm widgets. need to register the owning + * e_object of the gadcon so gadcon clients can get it and thus do + * things like find out what dirs/path the fwin is for etc. this will + * probably be how you add optional gadgets to fwin views like empty/full + * meters for disk usage, and other dir info/stats or controls. also it + * might be possible that we can have custom frames per dir later so need + * a way to set an edje file directly + */ + e_scrollframe_custom_theme_set(o, "base/theme/fileman", + "e/fileman/scrollframe/default"); + e_scrollframe_extern_pan_set(o, fwin->fm_obj, + e_fm2_pan_set, + e_fm2_pan_get, + e_fm2_pan_max_get, + e_fm2_pan_child_size_get); evas_object_propagate_events_set(fwin->fm_obj, 0); - e_widget_scrollframe_focus_object_set(o, fwin->fm_obj); fwin->scrollframe_obj = o; evas_object_move(o, 0, 0); evas_object_show(o); e_fm2_window_object_set(fwin->fm_obj, E_OBJECT(fwin->win)); - e_widget_focus_set(fwin->scrollframe_obj, 1); + evas_object_focus_set(fwin->fm_obj, 1); snprintf(buf, sizeof(buf), "_fwin::/%s", e_fm2_real_path_get(fwin->fm_obj)); e_win_name_class_set(fwin->win, "E", buf); @@ -158,7 +168,7 @@ _e_fwin_changed(void *data, Evas_Object *obj, void *event_info) fwin = data; if (fwin->scrollframe_obj) - e_widget_scrollframe_child_pos_set(fwin->scrollframe_obj, 0, 0); + e_scrollframe_child_pos_set(fwin->scrollframe_obj, 0, 0); } static void @@ -177,12 +187,53 @@ _e_fwin_selected(void *data, Evas_Object *obj, void *event_info) if ((ici->link) && (ici->mount)) e_fwin_new(fwin->win->container, ici->link, "/"); else if (ici->link) - e_fwin_new(fwin->win->container, NULL, ici->link); + { + if (S_ISDIR(ici->statinfo.st_mode)) + e_fwin_new(fwin->win->container, NULL, ici->link); + else + { + /* FIXME: link to file - open file */ + } + } else { snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), ici->file); - e_fwin_new(fwin->win->container, NULL, buf); + if (S_ISDIR(ici->statinfo.st_mode)) + e_fwin_new(fwin->win->container, NULL, buf); + else + { + /* FIXME: file - open file */ + } } evas_list_free(selected); } + +static void +_e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info) +{ + E_Fwin *fwin; + E_Menu_Item *mi; + + fwin = data; + if (e_fm2_has_parent_get(obj)) + { + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Go to Parent Directory")); + e_menu_item_icon_edje_set(mi, + e_theme_edje_file_get("base/theme/fileman", + "e/fileman/button/parent"), + "e/fileman/button/parent"); + e_menu_item_callback_set(mi, _e_fwin_parent, obj); + } + /* FIXME: if info != null then check mime type and offer options based + * on that + */ +} + +static void +_e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi) +{ + e_fm2_parent_go(data); +} + diff --git a/src/bin/e_int_config_apps.c b/src/bin/e_int_config_apps.c index 3133ca3ad..23ce705be 100644 --- a/src/bin/e_int_config_apps.c +++ b/src/bin/e_int_config_apps.c @@ -371,6 +371,7 @@ _cb_files_add_edited(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *i E_Menu_Item *mi; cfdata = data; + if (!info) return; /* We need to get this info data to the menu callback, all this is created on the fly when user right clicks. */ cfdata->info = info; mi = e_menu_item_new(m); diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c index 151830296..f3adf180c 100644 --- a/src/bin/e_int_menus.c +++ b/src/bin/e_int_menus.c @@ -655,11 +655,17 @@ _e_int_menus_applications_item_cb(void *data, E_Menu *m, E_Menu_Item *mi) } static void -_e_int_menus_fileman_item_cb(void *data, E_Menu *m, E_Menu_Item *mi) +_e_int_menus_fwin_home_item_cb(void *data, E_Menu *m, E_Menu_Item *mi) { e_fwin_new(m->zone->container, "~/", "/"); } +static void +_e_int_menus_fwin_favorites_item_cb(void *data, E_Menu *m, E_Menu_Item *mi) +{ + e_fwin_new(m->zone->container, "favorites", "/"); +} + static void _e_int_menus_config_pre_cb(void *data, E_Menu *m) { @@ -700,9 +706,14 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m) e_menu_item_separator_set(mi, 1); mi = e_menu_item_new(m); - e_menu_item_label_set(mi, _("Filemanager")); + e_menu_item_label_set(mi, _("Home Directory")); e_util_menu_item_edje_icon_set(mi, "enlightenment/fileman"); - e_menu_item_callback_set(mi, _e_int_menus_fileman_item_cb, NULL); + e_menu_item_callback_set(mi, _e_int_menus_fwin_home_item_cb, NULL); + + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Favorite Links")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/fileman"); + e_menu_item_callback_set(mi, _e_int_menus_fwin_favorites_item_cb, NULL); l = evas_hash_find(_e_int_menus_augmentation, "config"); if (l)