Add slideshow functionality, still needs some work.

SVN revision: 43064
v-1.6.0
titan 13 years ago committed by titan
parent 69c9bca326
commit 4e6e38a200
  1. 159
      data/themes/default/ephoto.edc
  2. 3
      data/themes/default/images/Makefile.am
  3. BIN
      data/themes/default/images/x-office-presentation.png
  4. 4
      src/bin/Makefile.am
  5. 13
      src/bin/ephoto.h
  6. 13
      src/bin/ephoto_flow.c
  7. 2
      src/bin/ephoto_main.c
  8. 310
      src/bin/ephoto_slide.c
  9. 26
      src/bin/ephoto_slideshow.c

@ -13,6 +13,7 @@ collections
image: "thumb_shadow.png" COMP;
image: "left_arrow.png" COMP;
image: "window_fullscreen.png" COMP;
image: "x-office-presentation.png" COMP;
}
group
{
@ -416,7 +417,26 @@ collections
color: 255 255 255 255;
image.normal: "left_arrow.png";
}
}
}
part
{
name: "ephoto.start.slideshow";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 1;
min: 32 32;
max: 32 32;
rel1.relative: 1.0 0.0;
rel1.offset: -65 45;
rel2.relative: 1.0 0.0;
rel2.offset: -1 -1;
color: 255 255 255 255;
image.normal: "x-office-presentation.png";
}
}
part
{
name: "ephoto.move.left";
@ -453,5 +473,142 @@ collections
}
}
}
group
{
name: "/ephoto/slide/view";
parts
{
part
{
name: "image_area";
type: RECT;
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 1;
rel1.relative: 0.0 0.0;
rel1.offset: 27 0;
rel2.relative: 1.0 1.0;
rel2.offset: -27 -1;
color: 255 255 255 255;
}
}
part
{
name: "ephoto.swallow.content";
type: SWALLOW;
mouse_events: 1;
clip_to: "image_area";
description
{
state: "default" 0.0;
visible: 1;
rel1.to: "image_area";
rel1.relative: 0.5 0.5;
rel1.offset: 0 0;
rel2.to: "image_area";
rel2.relative: 0.5 0.5;
rel2.offset: 0 0;
color: 255 255 255 255;
}
}
part
{
name: "ephoto.move.back";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
visible: 1;
min: 32 32;
max: 32 32;
rel1.relative: 0.0 0.0;
rel1.offset: 50 50;
rel2.relative: 0.0 0.0;
rel2.offset: -1 -1;
color: 255 255 255 255;
image.normal: "left_arrow.png";
}
}
}
}
group
{
name: "/ephoto/slide/images";
parts
{
part
{
name: "ephoto.image.one";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 255;
}
description
{
state: "fade" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
}
}
part
{
name: "ephoto.image.two";
type: IMAGE;
mouse_events: 1;
description
{
state: "default" 0.0;
color: 255 255 255 0;
}
description
{
state: "fade" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
}
programs
{
program
{
name: "fade";
signal: "ephoto.change.image";
source: "ephoto";
action: STATE_SET "default" 0.0;
target: "ephoto.image.one";
target: "ephoto.image.two";
after: "fade2";
}
program
{
name: "fade2";
action: STATE_SET "fade" 0.0;
target: "ephoto.image.one";
target: "ephoto.image.two";
transition: SINUSOIDAL 1.0;
after: "done";
}
program
{
name: "done";
action: STATE_SET "default" 0.0;
target: "ephoto.image.one";
target: "ephoto.image.two";
after: "signal_done";
}
program
{
name: "signal_done";
action: SIGNAL_EMIT "ephoto.transition.done" "ephoto";
}
}
}
}

@ -19,4 +19,5 @@ move_right.png \
selected.png \
thumb_shadow.png \
left_arrow.png \
window_fullscreen.png
window_fullscreen.png \
x-office-presentation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -13,7 +13,9 @@ ephoto_SOURCES = \
ephoto_image_browser.c \
ephoto_flow.c \
ephoto_flow_browser.c \
ephoto_table.c
ephoto_table.c \
ephoto_slideshow.c \
ephoto_slide.c
ephoto_CFLAGS = @EVAS_CFLAGS@ @EDJE_CFLAGS@ @EINA_CFLAGS@ @EFREET_MIME_CFLAGS@ @ETHUMB_CFLAGS@ -Wall -g
ephoto_LDADD = @EVAS_CFLAGS@ @EDJE_CFLAGS@ @EINA_LIBS@ @EFREET_MIME_LIBS@ @ETHUMB_LIBS@

@ -63,6 +63,18 @@ void ephoto_table_viewport_set(Evas_Object *obj, int w, int h);
void ephoto_table_next_page(Evas_Object *obj);
void ephoto_table_prev_page(Evas_Object *obj);
/*Ephoto Slideshow*/
void add_slideshow(void);
void show_slideshow(Eina_List *node, Eina_List *list);
void hide_slideshow(void);
/*Ephoto Slide*/
Evas_Object *ephoto_slide_add(Evas *e);
void ephoto_slide_current_node_set(Evas_Object *obj, Eina_List *node);
void ephoto_slide_item_list_set(Evas_Object *obj, Eina_List *list);
void ephoto_slide_start(Evas_Object *obj);
void ephoto_slide_stop(Evas_Object *obj);
typedef struct _Ephoto Ephoto;
struct _Ephoto
{
@ -73,6 +85,7 @@ struct _Ephoto
Evas_Object *image_browser;
Evas_Object *flow;
Evas_Object *sel;
Evas_Object *slideshow;
Eina_List *images;
int width, height;
};

@ -31,6 +31,7 @@ static void _flow_smart_clip_unset(Evas_Object *obj);
static void move_left(void *data, Evas_Object *obj, const char *emission, const char *source);
static void move_right(void *data, Evas_Object *obj, const char *emission, const char *source);
static void go_back(void *data, Evas_Object *obj, const char *emission, const char *source);
static void start_slideshow(void *data, Evas_Object *obj, const char *emission, const char *source);
static void move_left(void *data, Evas_Object *obj, const char *emission, const char *source)
{
@ -64,6 +65,16 @@ static void go_back(void *data, Evas_Object *obj, const char *emission, const ch
show_image_browser();
}
static void start_slideshow(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Smart_Data *sd;
sd = data;
hide_flow_view();
show_slideshow(sd->current_node, sd->list);
}
Evas_Object *ephoto_flow_add(Evas *e)
{
_flow_smart_init();
@ -162,6 +173,8 @@ static void _flow_smart_add(Evas_Object *obj)
edje_object_signal_callback_add(sd->obj, "mouse,up,1", "ephoto.move.back", go_back, sd);
edje_object_signal_callback_add(sd->obj, "mouse,up,1", "ephoto.start.slideshow", start_slideshow, sd);
sd->center_image = ephoto_image_add();
edje_object_part_swallow(sd->obj, "ephoto.swallow.content", sd->center_image);
}

@ -42,6 +42,7 @@ window_shown(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
add_image_browser();
add_flow_view();
add_slideshow();
show_image_browser();
evas_object_event_callback_del(em->bg, EVAS_CALLBACK_SHOW, window_shown);
}
@ -51,6 +52,7 @@ static void window_close(Ecore_Evas *ee)
{
evas_object_del(em->image_browser);
evas_object_del(em->flow);
evas_object_del(em->slideshow);
if (em->images)
eina_list_free(em->images);
free(em);

@ -0,0 +1,310 @@
#include "ephoto.h"
typedef struct _Smart_Data Smart_Data;
struct _Smart_Data
{
Evas_Object *obj;
Evas_Object *images;
int x;
int y;
int w;
int h;
Evas_Object *center_image_one;
Evas_Object *center_image_two;
Eina_List *current_node;
Eina_List *list;
Ecore_Timer *timer;
};
static Evas_Smart *_smart = NULL;
static void _slide_smart_reconfigure(Smart_Data *sd);
static void _slide_smart_init(void);
static void _slide_smart_add(Evas_Object *obj);
static void _slide_smart_del(Evas_Object *obj);
static void _slide_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _slide_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _slide_smart_show(Evas_Object *obj);
static void _slide_smart_hide(Evas_Object *obj);
static void _slide_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _slide_smart_clip_set(Evas_Object *obj, Evas_Object *clip);
static void _slide_smart_clip_unset(Evas_Object *obj);
static int change_image(void *data);
static void go_back(void *data, Evas_Object *obj, const char *emission, const char *source);
static void done(void *data, Evas_Object *obj, const char *emission, const char *source);
static int change_image(void *data)
{
char *center;
Smart_Data *sd;
sd = data;
done(sd, sd->obj, NULL, NULL);
if (sd->current_node->next)
sd->current_node = sd->current_node->next;
else
sd->current_node = sd->list;
center = sd->current_node->data;
evas_object_image_file_set(sd->center_image_two, center, NULL);
edje_object_signal_emit(sd->images, "ephoto.change.image", "ephoto");
return 1;
}
static void go_back(void *data, Evas_Object *obj, const char *emission, const char *source)
{
Smart_Data *sd;
sd = data;
ephoto_slide_stop(obj);
hide_slideshow();
show_flow_view(sd->current_node, sd->list);
}
static void done(void *data, Evas_Object *obj, const char *emission, const char *source)
{
char *center;
Smart_Data *sd;
sd = data;
center = sd->current_node->data;
evas_object_image_file_set(sd->center_image_one, center, NULL);
}
Evas_Object *ephoto_slide_add(Evas *e)
{
_slide_smart_init();
return evas_object_smart_add(e, _smart);
}
void ephoto_slide_current_node_set(Evas_Object *obj, Eina_List *node)
{
char *center;
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
sd->current_node = node;
center = sd->current_node->data;
evas_object_image_file_set(sd->center_image_one, center, NULL);
return;
}
void ephoto_slide_item_list_set(Evas_Object *obj, Eina_List *list)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
sd->list = list;
return;
}
void ephoto_slide_start(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
sd->timer = ecore_timer_add(3, change_image, sd);
}
void ephoto_slide_stop(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
ecore_timer_del(sd->timer);
}
static void _slide_smart_reconfigure(Smart_Data *sd)
{
int w, h, nw, nh;
evas_object_geometry_get(sd->obj, 0, 0, &w, &h);
nw = w/1.2;
nh = h/1.2;
edje_object_part_unswallow(sd->obj, sd->images);
evas_object_image_load_size_set(sd->center_image_one, nw, nh);
evas_object_image_load_size_set(sd->center_image_two, nw, nh);
evas_object_resize(sd->center_image_one, nw, nh);
evas_object_resize(sd->center_image_two, nw, nh);
evas_object_resize(sd->images, nw, nh);
evas_object_size_hint_min_set(sd->images, nw, nh);
evas_object_size_hint_max_set(sd->images, nw, nh);
edje_object_part_swallow(sd->obj, "ephoto.swallow.content", sd->images);
return;
}
static void _slide_smart_init(void)
{
if (_smart)
return;
{
static const Evas_Smart_Class sc =
{
"ephoto_slide",
EVAS_SMART_CLASS_VERSION,
_slide_smart_add,
_slide_smart_del,
_slide_smart_move,
_slide_smart_resize,
_slide_smart_show,
_slide_smart_hide,
_slide_smart_color_set,
_slide_smart_clip_set,
_slide_smart_clip_unset,
NULL,
NULL
};
_smart = evas_smart_class_new(&sc);
}
}
static void _slide_smart_add(Evas_Object *obj)
{
Smart_Data *sd;
sd = calloc(1, sizeof(Smart_Data));
if (!sd)
return;
sd->w = 0;
sd->h = 0;
sd->x = 0;
sd->y = 0;
sd->obj = edje_object_add(em->e);
edje_object_file_set(sd->obj, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "/ephoto/slide/view");
evas_object_smart_data_set(obj, sd);
sd->images = edje_object_add(em->e);
edje_object_file_set(sd->images, PACKAGE_DATA_DIR "/themes/default/ephoto.edj", "/ephoto/slide/images");
edje_object_part_swallow(sd->obj, "ephoto.swallow.content", sd->images);
sd->center_image_one = (Evas_Object *)edje_object_part_object_get(sd->images, "ephoto.image.one");
evas_object_image_filled_set(sd->center_image_one, EINA_FALSE);
evas_object_image_smooth_scale_set(sd->center_image_one, EINA_TRUE);
sd->center_image_two = (Evas_Object *)edje_object_part_object_get(sd->images, "ephoto.image.two");
evas_object_image_filled_set(sd->center_image_two, EINA_TRUE);
evas_object_image_smooth_scale_set(sd->center_image_two, EINA_FALSE);
edje_object_signal_callback_add(sd->obj, "mouse,up,1", "ephoto.move.back", go_back, sd);
edje_object_signal_callback_add(sd->images, "ephoto.transition.done", "ephoto", done, sd);
}
static void _slide_smart_del(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_del(sd->images);
evas_object_del(sd->obj);
free(sd);
}
static void _slide_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
if ((x == sd->x) && (y == sd->y))
return;
sd->x = x;
sd->y = y;
evas_object_move(sd->obj, x, y);
_slide_smart_reconfigure(sd);
}
static void _slide_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
if ((w == sd->w) && (h == sd->h))
return;
sd->w = w;
sd->h = h;
evas_object_resize(sd->obj, w, h);
_slide_smart_reconfigure(sd);
}
static void _slide_smart_show(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_show(sd->obj);
evas_object_show(sd->images);
}
static void _slide_smart_hide(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_hide(sd->obj);
evas_object_hide(sd->images);
}
static void _slide_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_color_set(sd->obj, r, g, b, a);
}
static void _slide_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_clip_set(sd->obj, clip);
return;
}
static void _slide_smart_clip_unset(Evas_Object *obj)
{
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd)
return;
evas_object_clip_unset(sd->obj);
return;
}

@ -0,0 +1,26 @@
#include "ephoto.h"
void add_slideshow(void)
{
Evas_Object *o;
o = ephoto_slide_add(em->e);
em->slideshow = o;
}
void show_slideshow(Eina_List *node, Eina_List *list)
{
ephoto_slide_current_node_set(em->slideshow, node);
ephoto_slide_item_list_set(em->slideshow, list);
evas_object_show(em->slideshow);
edje_object_part_swallow(em->bg, "ephoto.swallow.content", em->slideshow);
ephoto_slide_start(em->slideshow);
}
void hide_slideshow(void)
{
ephoto_slide_stop(em->slideshow);
evas_object_hide(em->slideshow);
edje_object_part_unswallow(em->bg, em->slideshow);
}
Loading…
Cancel
Save