Ephoto: Add in the new changes k-s and I have been working on.

SVN revision: 59474
v-1.6.0
Stephen Houston 12 years ago
parent aa06f2b4fd
commit 4b8960b931
  1. 472
      data/themes/default/ephoto.edc
  2. 3
      data/themes/default/images/Makefile.am
  3. BIN
      data/themes/default/images/thumb_shadow.png
  4. 162
      mkinstalldirs~
  5. 5
      po/POTFILES.in
  6. 9
      src/bin/Makefile.am
  7. 54
      src/bin/ephoto.h
  8. 619
      src/bin/ephoto_flow_browser.c
  9. 321
      src/bin/ephoto_list_browser.c
  10. 339
      src/bin/ephoto_main.c
  11. 189
      src/bin/ephoto_preferences.c
  12. 738
      src/bin/ephoto_single_browser.c
  13. 192
      src/bin/ephoto_slideshow.c
  14. 290
      src/bin/ephoto_thumb_browser.c

@ -5,143 +5,6 @@ external: "elm";
collections {
images
{
image: "thumb_shadow.png" COMP;
}
group
{
name: "ephoto/layout/simple";
parts
{
part
{
name: "layout";
type: RECT;
description
{
state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel1.offset: 0 0;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
color: 255 255 255 0;
}
}
part
{
name: "ephoto.content.swallow";
type: SWALLOW;
description
{
rel1.to_y: "ephoto.toolbar.swallow";
rel1.relative: 0.0 1.0;
rel1.offset: -1 1;
}
}
part
{
name: "ephoto.toolbar.swallow";
type: SWALLOW;
description
{
state: "default" 0.0;
align: 0.5 0.0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 0.0;
rel2.offset: -1 47;
fixed: 1 1;
}
}
}
}
group
{
name: "ephoto/layout/simple/autohide";
parts
{
part
{
name: "layout";
type: RECT;
description
{
state: "default" 0.0;
rel1.relative: 0.0 0.0;
rel1.offset: 0 0;
rel2.relative: 1.0 1.0;
rel2.offset: -1 -1;
color: 255 255 255 0;
}
}
part
{
name: "ephoto.content.swallow";
type: SWALLOW;
description
{
rel1.to: "layout";
rel2.to: "layout";
}
}
part
{
name: "ephoto.toolbar.swallow";
type: SWALLOW;
description
{
state: "default" 0.0;
align: 0.5 1.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
fixed: 1 1;
visible: 0;
}
description
{
state: "visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 255;
visible: 1;
}
}
part
{
name: "toolbar_event";
type: RECT;
mouse_events: 1;
repeat_events: 1;
description
{
state: "default" 0.0;
align: 0.5 1.0;
rel1.to: "ephoto.toolbar.swallow";
rel2.to: "ephoto.toolbar.swallow";
color: 255 255 255 0;
}
}
}
programs
{
program
{
name: "go_visible";
signal: "mouse,clicked,1";
source: "toolbar_event";
filter: "ephoto.toolbar.swallow" "default" 0.0;
action: STATE_SET "visible" 0.0;
transition: LINEAR 0.4;
target: "ephoto.toolbar.swallow";
}
program
{
name: "go_hidden";
signal: "hide";
source: "toolbar_event";
filter: "ephoto.toolbar.swallow" "visible" 0.0;
action: STATE_SET "default" 0.0;
transition: LINEAR 0.4;
target: "ephoto.toolbar.swallow";
}
}
}
group
{
@ -327,339 +190,4 @@ collections {
}
}
}
group
{
name: "flow_image";
parts
{
part
{
name: "event";
type: RECT;
repeat_events: 1;
description
{
state: "default" 0.0;
color: 0 0 0 0;
}
}
part
{
name: "border-shadow";
type: IMAGE;
mouse_events: 0;
description
{
state: "default" 0.0;
rel1
{
to: "image";
offset: -18 -18;
}
rel2
{
to: "image";
offset: 17 17;
}
image
{
normal: "thumb_shadow.png";
border: 17 17 17 17;
middle: NONE;
}
}
}
part
{
name: "border";
type: RECT;
mouse_events: 0;
description
{
state: "default" 0.0;
rel1
{
to: "border-shadow";
offset: 16 16;
}
rel2
{
to: "border-shadow";
offset: -15 -15;
}
}
}
part
{
name: "image";
type: SWALLOW;
mouse_events: 0;
description
{
state: "default" 0.0;
aspect_preference: BOTH;
aspect: 1.0 1.0;
rel1.offset : 0 8;
rel2.offset : -1 -2;
}
}
}
}
group
{
name: "flow";
parts
{
part
{
name: "offscreen_left";
type: SWALLOW;
mouse_events: 1;
description
{
state: default 0.0;
fixed: 1 1;
visible: 0;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.0 0.7;
rel2.offset : 0 0;
}
description
{
state: right 0.0;
visible: 1;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.2 0.7;
rel2.offset : 0 0;
}
description
{
state: left 0.0;
visible: 0;
rel1.relative : 1.0 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
}
part
{
name: "left";
type: SWALLOW;
mouse_events: 1;
description
{
state: default 0.0;
visible: 1;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.2 0.7;
rel2.offset : 0 0;
}
description
{
state: right 0.0;
rel1.relative : 0.2 0.2;
rel1.offset : 0 0;
rel2.relative : 0.8 0.8;
rel2.offset : 0 0;
}
description
{
state: left 0.0;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.0 0.7;
rel2.offset : 0 0;
}
description
{
state: full 0.0;
inherit: default 0.0;
visible: 0;
}
}
part
{
name: "offscreen_right";
type: SWALLOW;
mouse_events: 1;
description
{
state: default 0.0;
fixed: 1 1;
visible: 0;
rel1.relative : 1.0 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
description
{
state: right 0.0;
visible: 0;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.0 0.7;
rel2.offset : 0 0;
}
description
{
state: left 0.0;
visible: 1;
rel1.relative : 0.8 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
}
part
{
name: "right";
type: SWALLOW;
mouse_events: 1;
description
{
state: default 0.0;
visible: 1;
rel1.relative : 0.8 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
description
{
state: right 0.0;
rel1.relative : 1.0 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
description
{
state: left 0.0;
rel1.relative : 0.2 0.2;
rel1.offset : 0 0;
rel2.relative : 0.8 0.8;
rel2.offset : 0 0;
}
description
{
state: full 0.0;
inherit: default 0.0;
visible: 0;
}
}
part
{
name: "center";
type: SWALLOW;
mouse_events: 1;
description
{
state: default 0.0;
rel1.relative : 0.2 0.2;
rel1.offset : 0 0;
rel2.relative : 0.8 0.8;
rel2.offset : 0 0;
}
description
{
state: right 0.0;
rel1.relative : 0.8 0.3;
rel1.offset : 0 0;
rel2.relative : 1.0 0.7;
rel2.offset : 0 0;
}
description
{
state: left 0.0;
rel1.relative : 0.0 0.3;
rel1.offset : 0 0;
rel2.relative : 0.2 0.7;
rel2.offset : 0 0;
}
description
{
state: full 0.0;
rel1.relative : 0.0 0.0;
rel1.offset : 0 0;
rel2.relative : 1.0 1.0;
rel2.offset : -1 -1;
}
}
}
programs
{
program
{
name: "right";
signal: "right";
source: "ephoto";
action: STATE_SET right 0.0;
transition: LINEAR 0.4;
target: "offscreen_right";
target: "right";
target: "center";
target: "left";
target: "offscreen_left";
after: "done";
}
program
{
name: "left";
signal: "left";
source: "ephoto";
action: STATE_SET left 0.0;
transition: LINEAR 0.4;
target: "offscreen_left";
target: "left";
target: "center";
target: "right";
target: "offscreen_right";
after: "done";
}
program
{
name: "full";
signal: "full";
source: "ephoto";
action: STATE_SET full 0.0;
transition: LINEAR 0.2;
target: "left";
target: "right";
target: "center";
}
program
{
name: "full_reset";
signal: "full_reset";
source: "ephoto";
action: STATE_SET default 0.0;
transition: LINEAR 0.2;
target: "left";
target: "right";
target: "center";
}
program
{
name: "done";
action: SIGNAL_EMIT "done" "ephoto";
}
program
{
name: "reset";
signal: "reset";
source: "ephoto";
action: STATE_SET default 0.0;
target: "offscreen_right";
target: "right";
target: "center";
target: "left";
target: "offscreen_left";
}
}
}
}

@ -1,5 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = \
thumb_shadow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,162 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

@ -1,5 +1,6 @@
src/bin/ephoto.c
src/bin/ephoto_flow_browser.c
src/bin/ephoto_config.c
src/bin/ephoto_main.c
src/bin/ephoto_slideshow.c
src/bin/ephoto_list_browser.c
src/bin/ephoto_thumb_browser.c
src/bin/ephoto_single_browser.c

@ -17,11 +17,10 @@ _sources = \
ephoto.c \
ephoto_main.c \
ephoto_config.c \
ephoto_preferences.c \
ephoto_thumb_browser.c \
ephoto_single_browser.c \
ephoto_flow_browser.c \
ephoto_slideshow.c
ephoto_list_browser.c \
ephoto_thumb_browser.c \
ephoto_single_browser.c
_libs = @ELEMENTARY_LIBS@ @EFREET_MIME_LIBS@ @EIO_LIBS@ @EXIF_LIBS@ @EET_LIBS@

@ -39,8 +39,11 @@ void ephoto_title_set(Ephoto *ephoto, const char *title);
void ephoto_thumb_size_set(Ephoto *ephoto, int size);
Evas_Object *ephoto_thumb_add(Ephoto *ephoto, Evas_Object *parent, const char *path);
void ephoto_thumb_path_set(Evas_Object *o, const char *path);
Evas_Object *ephoto_list_icon_add(Ephoto *ephoto, Evas_Object *parent, const char *standard);
void ephoto_directory_set(Ephoto *ephoto, const char *path);
void ephoto_auto_hide_toolbar(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__);
void ephoto_promote_list_browser(Ephoto *ephoto);
void ephoto_promote_thumb_browser(Ephoto *ephoto);
void ephoto_promote_single_browser(Ephoto *ephoto, Ephoto_Entry *e);
/*Get the exif orientation of a JPEG*/
Ephoto_Orient ephoto_file_orient_get(const char *path);
@ -50,43 +53,24 @@ Eina_Bool ephoto_config_init(Ephoto *em);
void ephoto_config_save(Ephoto *em, Eina_Bool instant);
void ephoto_config_free(Ephoto *em);
/*Single Browser Functions/Callbacks*/
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path);
/* smart callbacks called:
* "back" - the user wants to go back to the previous screen.
* "slideshow" - the user wants to view a slideshow.
*/
/*Flow Browser Functions/Callbacks*/
Evas_Object *ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent);
void ephoto_flow_browser_entry_set(Evas_Object *obj __UNUSED__, Ephoto_Entry *entry);
/* smart callbacks called:
* "back" - the user wants to go back to the previous screen.
* "slideshow" - the user wants to view a slideshow.
*/
/*Slideshow Functions/Callbacks*/
Evas_Object *ephoto_slideshow_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_slideshow_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/* smart callbacks called:
* "back" - the user want to go back to the previous screen.
*/
/*Main Thumb Browser Function*/
/*List Browser*/
Evas_Object *ephoto_list_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_list_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/*Thumb Browser*/
Evas_Object *ephoto_thumb_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_thumb_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
/* smart callbacks called:
* "selected" - an item in the thumb browser is selected. The selected Ephoto_Entry is passed as event_info argument.
*/
/*Single Browser*/
Evas_Object *ephoto_single_browser_add(Ephoto *ephoto, Evas_Object *parent);
void ephoto_single_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry);
void ephoto_single_browser_path_pending_set(Evas_Object *obj, const char *path);
/*Ephoto View*/
enum _Ephoto_State
{
EPHOTO_STATE_LIST,
EPHOTO_STATE_THUMB,
EPHOTO_STATE_FLOW,
EPHOTO_STATE_SINGLE,
EPHOTO_STATE_SLIDESHOW
};
@ -122,15 +106,19 @@ struct _Ephoto
{
Evas_Object *win;
Evas_Object *bg;
Evas_Object *layout;
Evas_Object *edje;
Evas_Object *pager;
Evas_Object *help_but;
Evas_Object *list_browser;
Evas_Object *thumb_browser;
Evas_Object *flow_browser;
Evas_Object *single_browser;
Evas_Object *slideshow;
Eina_List *entries;
Eina_List *thumbs;
Eina_List *dirs;
int thumb_gen_size;
struct {
@ -156,6 +144,7 @@ struct _Ephoto_Entry
const char *label;
Ephoto *ephoto;
Elm_Gengrid_Item *item;
Elm_Genlist_Item *list_item;
Eina_List *free_listeners;
};
@ -210,7 +199,8 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
}
/*Ephoto Event Handlers*/
extern int EPHOTO_EVENT_ENTRY_CREATE;
extern int EPHOTO_EVENT_ENTRY_CREATE_DIR;
extern int EPHOTO_EVENT_ENTRY_CREATE_THUMB;
extern int EPHOTO_EVENT_POPULATE_START;
extern int EPHOTO_EVENT_POPULATE_END;
extern int EPHOTO_EVENT_POPULATE_ERROR;

@ -1,619 +0,0 @@
#include "ephoto.h"
static Elm_Genlist_Item_Class egli;
typedef struct _Ephoto_Flow_Browser Ephoto_Flow_Browser;
struct _Ephoto_Flow_Browser
{
Eina_Bool key_down;
Eina_Bool mouse_wheel;
Eina_List *current_index;
Eina_List *items;
Elm_Genlist_Item *egi;
Evas_Object *box;
Evas_Object *edje;
Evas_Object *layout;
Evas_Object *list;
Evas_Object *main_layout;
Evas_Object *images[5];
Evas_Object *img_edje[5];
Evas_Object *toolbar;
Ephoto_Entry *entry;
Ephoto *ephoto;
char *swallows[5];
int flow_direct;
int selected_handled;
struct {
Elm_Toolbar_Item *go_back;
Elm_Toolbar_Item *go_prev;
Elm_Toolbar_Item *go_next;
Elm_Toolbar_Item *slideshow;
} action;
};
static void
_entry_free(void *data, const Ephoto_Entry *entry __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
efb->entry = NULL;
}
static Evas_Object *
_add_image_edje(const char *swallow, Evas_Object *parent)
{
Evas_Object *o;
o = elm_layout_add(parent);
elm_layout_file_set
(o, THEME_FILE, "flow_image");
elm_layout_content_set(parent, swallow, o);
evas_object_show(o);
return o;
}
static Evas_Object *
_add_image(Evas_Object *swallow, Evas_Object *parent)
{
Evas_Object *o;
o = elm_thumb_add(parent);
elm_object_style_set(o, "noframe");
elm_layout_content_set(swallow, "image", o);
evas_object_show(o);
return o;
}
static void
_flow_browser_image_set(Ephoto_Flow_Browser *efb)
{
Eina_List *prevv, *prev, *next, *nextt;
Ephoto_Entry *pp, *p, *n, *nn, *c;
int i;
prev = eina_list_prev(efb->current_index);
if (!eina_list_data_get(prev))
prev = eina_list_last(efb->items);
prevv = eina_list_prev(prev);
if (!eina_list_data_get(prevv))
prevv = eina_list_last(efb->items);
next = eina_list_next(efb->current_index);
if (!eina_list_data_get(next))
next = eina_list_nth_list(efb->items, 0);
nextt = eina_list_next(next);
if (!eina_list_data_get(nextt))
nextt = eina_list_nth_list(efb->items, 0);
pp = eina_list_data_get(prevv);
p = eina_list_data_get(prev);
c = eina_list_data_get(efb->current_index);
n = eina_list_data_get(next);
nn = eina_list_data_get(nextt);
for (i = 0; i < 5; i++)
{
elm_layout_content_unset(efb->layout, efb->swallows[i]);
elm_layout_content_unset(efb->img_edje[i], "image");
}
elm_thumb_file_set(efb->images[0], pp->path, NULL);
elm_layout_content_set(efb->img_edje[0], "image", efb->images[0]);
elm_layout_content_set(efb->layout, "offscreen_left", efb->img_edje[0]);
elm_thumb_file_set(efb->images[1], p->path, NULL);
elm_layout_content_set(efb->img_edje[1], "image", efb->images[1]);
elm_layout_content_set(efb->layout, "left", efb->img_edje[1]);
elm_thumb_file_set(efb->images[2], c->path, NULL);
elm_layout_content_set(efb->img_edje[2], "image", efb->images[2]);
elm_layout_content_set(efb->layout, "center", efb->img_edje[2]);
elm_thumb_file_set(efb->images[3], n->path, NULL);
elm_layout_content_set(efb->img_edje[3], "image", efb->images[3]);
elm_layout_content_set(efb->layout, "right", efb->img_edje[3]);
elm_thumb_file_set(efb->images[4], nn->path, NULL);
elm_layout_content_set(efb->img_edje[4], "image", efb->images[4]);
elm_layout_content_set(efb->layout, "offscreen_right", efb->img_edje[4]);
elm_object_focus(efb->main_layout);
}
static void
_flow_done(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
Evas_Object *edje;
edje = elm_layout_edje_get(efb->layout);
edje_object_freeze(edje);
if (efb->flow_direct == 0)
{
efb->current_index = eina_list_prev(efb->current_index);
if (!eina_list_data_get(efb->current_index))
efb->current_index = eina_list_last(efb->items);
_flow_browser_image_set(efb);
}
else
{
efb->current_index = eina_list_next(efb->current_index);
if (!eina_list_data_get(efb->current_index))
efb->current_index = eina_list_nth_list(efb->items, 0);
_flow_browser_image_set(efb);
}
edje_object_signal_emit(edje, "reset", "ephoto");
edje_object_thaw(edje);
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_FALSE);
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_FALSE);
elm_genlist_no_select_mode_set(efb->list, EINA_FALSE);
efb->mouse_wheel = EINA_FALSE;
efb->key_down = EINA_FALSE;
efb->selected_handled = 0;
}
static void
_flow_back(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
elm_toolbar_item_selected_set(efb->action.go_back, EINA_FALSE);
evas_object_key_ungrab(efb->main_layout, "Escape", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Left", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Right", 0, 0);
evas_object_key_ungrab(efb->main_layout, "BackSpace", 0, 0);
evas_object_key_ungrab(efb->main_layout, "space", 0, 0);
efb->entry = eina_list_data_get(efb->current_index);
elm_object_unfocus(efb->main_layout);
evas_object_smart_callback_call(efb->main_layout, "back", efb->entry);
}
static void
_flow_prev(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Elm_Genlist_Item *egi;
Ephoto_Flow_Browser *efb = data;
Evas_Object *edje;
elm_toolbar_item_selected_set(efb->action.go_prev, EINA_FALSE);
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_TRUE);
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_TRUE);
efb->mouse_wheel = EINA_TRUE;
efb->key_down = EINA_TRUE;
edje = elm_layout_edje_get(efb->layout);
egi = elm_genlist_item_prev_get(efb->egi);
if (!egi)
egi = elm_genlist_last_item_get(efb->list);
elm_genlist_item_bring_in(egi);
efb->egi = egi;
efb->selected_handled = 1;
elm_genlist_item_selected_set(egi, EINA_TRUE);
elm_genlist_no_select_mode_set(efb->list, EINA_TRUE);
efb->flow_direct = 0;
edje_object_signal_emit(edje, "right", "ephoto");
}
static void
_flow_next(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Elm_Genlist_Item *egi;
Ephoto_Flow_Browser *efb = data;
Evas_Object *edje;
elm_toolbar_item_selected_set(efb->action.go_next, EINA_FALSE);
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_TRUE);
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_TRUE);
efb->mouse_wheel = EINA_TRUE;
efb->key_down = EINA_TRUE;
edje = elm_layout_edje_get(efb->layout);
egi = elm_genlist_item_next_get(efb->egi);
if (!egi)
egi = elm_genlist_first_item_get(efb->list);
elm_genlist_item_bring_in(egi);
efb->egi = egi;
efb->selected_handled = 1;
elm_genlist_item_selected_set(egi, EINA_TRUE);
elm_genlist_no_select_mode_set(efb->list, EINA_TRUE);
efb->flow_direct = 1;
edje_object_signal_emit(edje, "left", "ephoto");
}
static void
_center_image_clicked(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
evas_object_key_ungrab(efb->main_layout, "Escape", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Left", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Right", 0, 0);
evas_object_key_ungrab(efb->main_layout, "BackSpace", 0, 0);
evas_object_key_ungrab(efb->main_layout, "space", 0, 0);
efb->entry = eina_list_data_get(efb->current_index);
elm_object_unfocus(efb->main_layout);
evas_object_smart_callback_call(efb->main_layout, "single", efb->entry);
}
static void
_flow_single(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
evas_object_key_ungrab(efb->main_layout, "Escape", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Left", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Right", 0, 0);
evas_object_key_ungrab(efb->main_layout, "BackSpace", 0, 0);
evas_object_key_ungrab(efb->main_layout, "space", 0, 0);
efb->entry = eina_list_data_get(efb->current_index);
elm_object_unfocus(efb->main_layout);
evas_object_smart_callback_call(efb->main_layout, "single", efb->entry);
}
static void
_show_slideshow(void *data, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
elm_toolbar_item_selected_set(efb->action.slideshow, EINA_FALSE);
evas_object_key_ungrab(efb->main_layout, "Escape", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Left", 0, 0);
evas_object_key_ungrab(efb->main_layout, "Right", 0, 0);
evas_object_key_ungrab(efb->main_layout, "BackSpace", 0, 0);
evas_object_key_ungrab(efb->main_layout, "space", 0, 0);
elm_object_unfocus(efb->main_layout);
evas_object_smart_callback_call(efb->main_layout, "slideshow", efb->entry);
}
static void
_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto_Flow_Browser *efb = data;
Evas_Event_Key_Down *ev = event_info;
const char *k = ev->keyname;
if (efb->key_down)
return;
efb->key_down = EINA_TRUE;
if (!strcmp(k, "Escape"))
_flow_back(efb, NULL, NULL);
if (!strcmp(k, "Left") || !strcmp(k, "BackSpace"))
_flow_prev(efb, NULL, NULL);
if (!strcmp(k, "Right") || !strcmp(k, "space"))
_flow_next(efb, NULL, NULL);
}
static void
_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
Ephoto_Flow_Browser *efb = data;
Evas_Event_Mouse_Wheel *ev = event_info;
if (efb->mouse_wheel)
return;
efb->mouse_wheel = EINA_TRUE;
if (ev->z > 0)
_flow_next(efb, NULL, NULL);
else
_flow_prev(efb, NULL, NULL);
}
static void
_layout_del(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
{
Ephoto_Flow_Browser *efb = data;
if (efb->entry)
ephoto_entry_free_listener_del(efb->entry, _entry_free, efb);
free(efb);
}
static Elm_Toolbar_Item *
_toolbar_item_add(Ephoto_Flow_Browser *efb, const char *icon, const char *label, int priority, Evas_Smart_Cb cb)
{
Elm_Toolbar_Item *item = elm_toolbar_item_append(efb->toolbar, icon, label,
cb, efb);
elm_toolbar_item_priority_set(item, priority);
return item;
}
static char *
_gl_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
Ephoto_Entry *en = data;
char *label = (char *)en->basename;
return strdup(label);
}
static Evas_Object *
_gl_icon_get(void *data __UNUSED__, Evas_Object *obj, const char *part)
{
Evas_Object *o = NULL;
if (!strcmp(part, "elm.swallow.end"))
return o;
o = elm_icon_add(obj);
elm_icon_standard_set(o, "image");
evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
return o;
}
static Eina_Bool
_gl_state_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
{
return EINA_FALSE;
}
static void
_gl_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
{
}
static int
_entry_cmp(const void *pa, const void *pb)
{
const Ephoto_Entry *a = pa, *b = pb;
int ret, s;
s = strcmp(a->basename, b->basename);
if (s > 0)
ret = 1;
else if (s < 0)
ret = -1;
else
ret = 0;
return ret;
}
static void
_gl_sel(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Elm_Genlist_Item *egi, *egip, *egin;
Ephoto_Entry *en;
Ephoto_Flow_Browser *efb = data;
egi = event_info;
if (!efb->egi || efb->selected_handled)
{
efb->selected_handled = 0;
return;
}
egin = elm_genlist_item_next_get(efb->egi);
if (!egin)
egin = elm_genlist_first_item_get(efb->list);
egip = elm_genlist_item_prev_get(efb->egi);
if (!egip)
egip = elm_genlist_last_item_get(efb->list);
if (egi == egin)
_flow_next(efb, NULL, NULL);
else if (egi == egip)
_flow_prev(efb, NULL, NULL);
else
{
en = elm_genlist_item_data_get(egi);
efb->current_index = eina_list_search_sorted_list
(efb->items, _entry_cmp, en);
efb->egi = egi;
_flow_browser_image_set(efb);
}
}
Evas_Object *
ephoto_flow_browser_add(Ephoto *e, Evas_Object *parent)
{
Ephoto_Flow_Browser *efb;
int i;
efb = calloc(1, sizeof(Ephoto_Flow_Browser));
efb->swallows[0] = "offscreen_left";
efb->swallows[1] = "left";
efb->swallows[2] = "center";
efb->swallows[3] = "right";
efb->swallows[4] = "offscreen_right";
efb->key_down = EINA_FALSE;
efb->mouse_wheel = EINA_FALSE;
efb->ephoto = e;
efb->selected_handled = 0;
egli.item_style = "default";
egli.func.label_get = _gl_label_get;
egli.func.icon_get = _gl_icon_get;
egli.func.state_get = _gl_state_get;
egli.func.del = _gl_del;
efb->main_layout = elm_layout_add(parent);
efb->edje = elm_layout_edje_get(efb->main_layout);
evas_object_event_callback_add
(efb->main_layout, EVAS_CALLBACK_DEL, _layout_del, efb);
evas_object_event_callback_add
(efb->main_layout, EVAS_CALLBACK_KEY_DOWN, _key_down, efb);
evas_object_data_set(efb->main_layout, "flow_browser", efb);
if (efb->ephoto->config->autohide_toolbar)
{
edje_object_signal_callback_add
(efb->edje, "mouse,clicked,1", "toolbar_event",
ephoto_auto_hide_toolbar, efb->ephoto);
if (!elm_layout_file_set
(efb->main_layout, THEME_FILE, "ephoto/layout/simple/autohide"))
{
ERR("could not load style 'ephoto/layout/simple/autohide' from theme");
goto error;
}
}
else
{
if (!elm_layout_file_set
(efb->main_layout, THEME_FILE, "ephoto/layout/simple"))
{
ERR("could not load style 'ephoto/layout/simple' from theme");
goto error;
}
}
efb->toolbar = elm_toolbar_add(efb->main_layout);
elm_toolbar_homogenous_set(efb->toolbar, EINA_TRUE);
elm_toolbar_mode_shrink_set(efb->toolbar, ELM_TOOLBAR_SHRINK_MENU);
elm_toolbar_menu_parent_set(efb->toolbar, parent);
evas_object_size_hint_weight_set(efb->toolbar, 0.0, 0.0);
evas_object_size_hint_align_set(efb->toolbar, EVAS_HINT_FILL, 0.0);
efb->action.go_back = _toolbar_item_add
(efb, "edit-undo", "Back", 120, _flow_back);
efb->action.go_prev = _toolbar_item_add
(efb, "go-previous", "Previous", 100, _flow_prev);
efb->action.go_next = _toolbar_item_add
(efb, "go-next", "Next", 80, _flow_next);
efb->action.slideshow = _toolbar_item_add
(efb, "media-playback-start", "Slideshow", 70, _show_slideshow);
elm_layout_content_set
(efb->main_layout, "ephoto.toolbar.swallow", efb->toolbar);
evas_object_show(efb->toolbar);
efb->box = elm_panes_add(efb->main_layout);
elm_panes_horizontal_set(efb->box, EINA_TRUE);
evas_object_size_hint_weight_set
(efb->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(efb->box);
efb->layout = elm_layout_add(efb->main_layout);
elm_layout_file_set
(efb->layout, THEME_FILE, "flow");
evas_object_size_hint_weight_set
(efb->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set
(efb->layout, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
elm_panes_content_left_set(efb->box, efb->layout);
evas_object_show(efb->layout);
evas_object_event_callback_add
(efb->layout, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, efb);
edje_object_signal_callback_add
(elm_layout_edje_get(efb->layout), "done", "ephoto", _flow_done, efb);
efb->list = elm_genlist_add(efb->main_layout);
elm_genlist_bounce_set(efb->list, EINA_FALSE, EINA_TRUE);
elm_genlist_height_for_width_mode_set(efb->list, EINA_TRUE);
elm_genlist_compress_mode_set(efb->list, EINA_TRUE);
elm_genlist_longpress_timeout_set(efb->list, 0.5);
evas_object_size_hint_weight_set(efb->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(efb->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_panes_content_right_set(efb->box, efb->list);
evas_object_show(efb->list);
elm_panes_content_left_size_set(efb->box, 0.4);
elm_layout_content_set
(efb->main_layout, "ephoto.content.swallow", efb->box);
for (i = 0; i < 5; i++)
{
efb->img_edje[i] = _add_image_edje(efb->swallows[i], efb->layout);
efb->images[i] = _add_image(efb->img_edje[i], efb->layout);
if (i == 2)
evas_object_event_callback_add
(efb->img_edje[2], EVAS_CALLBACK_MOUSE_DOWN, _center_image_clicked, efb);
}
elm_object_focus_custom_chain_append(efb->main_layout, efb->layout, NULL);
return efb->main_layout;
error:
evas_object_del(efb->main_layout);
return NULL;
}
void
ephoto_flow_browser_entry_set(Evas_Object *obj, Ephoto_Entry *entry)
{
Ephoto_Flow_Browser *efb = evas_object_data_get(obj, "flow_browser");
Eina_Bool same_file = EINA_FALSE;
Eina_List *l;
Ephoto_Entry *itr;
if (!evas_object_key_grab(efb->main_layout, "Escape", 0, 0, 1))
printf("Couldn't grab Escape key\n");
if (!evas_object_key_grab(efb->main_layout, "Left", 0, 0, 1))
printf("Couldn't grab Left key\n");
if (!evas_object_key_grab(efb->main_layout, "Right", 0, 0, 1))
printf("Couldn't grab Right key\n");
if (!evas_object_key_grab(efb->main_layout, "BackSpace", 0, 0, 1))
printf("Couldn't grab BackSpace key\n");
if (!evas_object_key_grab(efb->main_layout, "space", 0, 0, 1))
printf("Couldn't grab space key\n");
if (efb->entry)
{
ephoto_entry_free_listener_del(efb->entry, _entry_free, efb);
if (entry && entry->path == efb->entry->path)
same_file = EINA_TRUE;
}
efb->entry = entry;
if (entry)
ephoto_entry_free_listener_add(entry, _entry_free, efb);
if (!efb->entry)
{
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_TRUE);
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_TRUE);
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_TRUE);
return;
}
else
{
elm_toolbar_item_disabled_set(efb->action.go_prev, EINA_FALSE);
elm_toolbar_item_disabled_set(efb->action.go_next, EINA_FALSE);
elm_toolbar_item_disabled_set(efb->action.slideshow, EINA_FALSE);
}
elm_genlist_clear(efb->list);
eina_list_free(efb->items);
efb->items = NULL;
EINA_LIST_FOREACH(efb->ephoto->entries, l, itr)
{
Elm_Genlist_Item *egi;
egi = elm_genlist_item_append(efb->list, &egli,
(void *)itr,
NULL, ELM_GENLIST_ITEM_NONE,
_gl_sel, efb);
evas_object_smart_callback_add
(efb->list, "clicked", _flow_single, efb);
efb->items = eina_list_append(efb->items, itr);
if (itr == entry)
{
efb->current_index = eina_list_last(efb->items);
elm_genlist_item_bring_in(egi);
elm_genlist_item_selected_set(egi, EINA_TRUE);
efb->egi = egi;
}
}
_flow_browser_image_set(efb);
}

@ -0,0 +1,321 @@
#include "ephoto.h"
#define TODO_ITEM_MIN_BATCH 16
#define PARENT_DIR "Up"
typedef struct _Ephoto_List_Browser Ephoto_List_Browser;
struct _Ephoto_List_Browser
{
Ephoto *ephoto;
Ephoto_Entry *entry;
Evas_Object *list;
Eio_File *ls;
Eina_List *todo_items;
Eina_List *list_items;
Eina_List *handlers;
struct {
Ecore_Animator *todo_items;
} animator;
Eina_Bool list_deleted : 1;
};
static Elm_Genlist_Item_Class _ephoto_list_item_class;
static Elm_Genlist_Item_Class _ephoto_list_up_item_class;
static Ephoto_Entry *up_entry;
static void
_todo_items_free(Ephoto_List_Browser *lb)
{
eina_list_free(lb->todo_items);
lb->todo_items = NULL;
}
static void
_list_items_free(Ephoto_List_Browser *lb)
{
eina_list_free(lb->list_items);
lb->list_items = NULL;
}