aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac30
-rw-r--r--data/themes/default/ephoto.edc73
-rw-r--r--src/bin/Makefile.am7
-rw-r--r--src/bin/ephoto.h9
-rw-r--r--src/bin/ephoto_flow_browser.c139
5 files changed, 246 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 8a768ff..5f14a83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,34 @@ PKG_CHECK_MODULES([EIO], eio,
]
)
+AC_ARG_ENABLE([libexif],
+ [AC_HELP_STRING([--enable-libexif], [enable libexif support @<:@default=yes@:>@])],
+ [
+ if test "x${enableval}" = "xyes" ; then
+ _ephoto_enable_libexif="yes"
+ else
+ _ephoto_enable_libexif="no"
+ fi
+ ],
+ [_ephoto_enable_libexif="yes"]
+)
+
+AC_MSG_CHECKING([whether ethumb is built])
+AC_MSG_RESULT([${_ephoto_enable_libexif}])
+
+have_libexif="no"
+
+if test "x${_ephoto_enable_libexif}" = "xyes" ; then
+ PKG_CHECK_MODULES(EXIF, libexif, [
+ have_libexif="yes"
+ AC_DEFINE(HAVE_LIBEXIF, 1, [have libexif support])
+ ],[
+ have_libexif="no"
+ ])
+fi
+
+AM_CONDITIONAL(BUILD_LIBEXIF, test $have_libexif = yes)
+
AC_OUTPUT([
Makefile
ephoto.spec
@@ -220,7 +248,7 @@ echo " Eina.............: $have_eina"
echo " Ethumb...........: $have_ethumb"
echo " Elementary.......: $have_elementary"
echo " Eio..............: $have_eio"
-echo " Libexif .........: $have_exif"
+echo " Libexif .........: $have_libexif"
echo
echo "Installation Path.........: $prefix"
echo
diff --git a/data/themes/default/ephoto.edc b/data/themes/default/ephoto.edc
index fadbd52..a07f65e 100644
--- a/data/themes/default/ephoto.edc
+++ b/data/themes/default/ephoto.edc
@@ -460,6 +460,45 @@ collections
state: "default" 0.0;
rel2.to: "ephoto.toolbar.swallow";
rel2.relative: 1 0;
+ map {
+ on: 1;
+ }
+ }
+ description {
+ state: "rotate_0" 0.0;
+ inherit: "default" 0.0;
+ map {
+ rotation {
+ z: 0;
+ }
+ }
+ }
+ description {
+ state: "rotate_90" 0.0;
+ inherit: "default" 0.0;
+ map {
+ rotation {
+ z: 90;
+ }
+ }
+ }
+ description {
+ state: "rotate_180" 0.0;
+ inherit: "default" 0.0;
+ map {
+ rotation {
+ z: 180;
+ }
+ }
+ }
+ description {
+ state: "rotate_270" 0.0;
+ inherit: "default" 0.0;
+ map {
+ rotation {
+ z: 270;
+ }
+ }
}
}
part {
@@ -473,6 +512,40 @@ collections
}
}
}
+ programs {
+ program {
+ name: "go_rotate_0";
+ signal: "ef,state,rotate,0";
+ source: "ef";
+ action: STATE_SET "rotate_0" 0.0;
+ transition: SINUSOIDAL 0.2;
+ target: "ephoto.flow.swallow";
+ }
+ program {
+ name: "go_rotate_90";
+ signal: "ef,state,rotate,90";
+ source: "ef";
+ action: STATE_SET "rotate_90" 0.0;
+ transition: SINUSOIDAL 0.2;
+ target: "ephoto.flow.swallow";
+ }
+ program {
+ name: "go_rotate_180";
+ signal: "ef,state,rotate,180";
+ source: "ef";
+ action: STATE_SET "rotate_180" 0.0;
+ transition: SINUSOIDAL 0.2;
+ target: "ephoto.flow.swallow";
+ }
+ program {
+ name: "go_rotate_270";
+ signal: "ef,state,rotate,270";
+ source: "ef";
+ action: STATE_SET "rotate_270" 0.0;
+ transition: SINUSOIDAL 0.2;
+ target: "ephoto.flow.swallow";
+ }
+ }
}
}
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index d3e7065..49ec7ac 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -17,3 +17,10 @@ ephoto_SOURCES = \
ephoto_CFLAGS = @EET_CFLAGS@ @EVAS_CFLAGS@ @EDJE_CFLAGS@ @EINA_CFLAGS@ @EFREET_MIME_CFLAGS@ @ETHUMB_CFLAGS@ @ELEMENTARY_CFLAGS@ @EIO_CFLAGS@ -Wall -g
ephoto_LDADD = @EET_LIBS@ @EVAS_LIBS@ @EDJE_LIBS@ @EINA_LIBS@ @EFREET_MIME_LIBS@ @ETHUMB_LIBS@ @ELEMENTARY_LIBS@ @EIO_LIBS@
+if BUILD_LIBEXIF
+ephoto_CFLAGS += @EXIF_CFLAGS@
+endif
+
+if BUILD_LIBEXIF
+ephoto_LDADD += @EXIF_LIBS@
+endif
diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h
index 41c1bf8..505fa04 100644
--- a/src/bin/ephoto.h
+++ b/src/bin/ephoto.h
@@ -27,6 +27,7 @@ typedef struct _Ephoto_Config Ephoto_Config;
typedef struct _Ephoto Ephoto;
typedef enum _Ephoto_State Ephoto_State;
+typedef enum _Ephoto_Orient Ephoto_Orient;
/*Main Functions*/
void ephoto_create_main_window(const char *directory, const char *image);
@@ -66,6 +67,14 @@ enum _Ephoto_State
EPHOTO_STATE_SLIDESHOW
};
+enum _Ephoto_Orient
+{
+ EPHOTO_ORIENT_0,
+ EPHOTO_ORIENT_90,
+ EPHOTO_ORIENT_180,
+ EPHOTO_ORIENT_270
+};
+
struct _Ephoto_Config
{
int config_version;
diff --git a/src/bin/ephoto_flow_browser.c b/src/bin/ephoto_flow_browser.c
index ce9f375..bb5fa47 100644
--- a/src/bin/ephoto_flow_browser.c
+++ b/src/bin/ephoto_flow_browser.c
@@ -1,5 +1,10 @@
#include "ephoto.h"
+#ifdef HAVE_LIBEXIF
+ #include <libexif/exif-data.h>
+#endif
+
+
/*Callbacks*/
static void _ephoto_go_back(void *data, Evas_Object *obj, void *event_info);
static void _ephoto_go_first(void *data, Evas_Object *obj, void *event_info);
@@ -7,6 +12,8 @@ static void _ephoto_go_last(void *data, Evas_Object *obj, void *event_info);
static void _ephoto_go_next(void *data, Evas_Object *obj, void *event_info);
static void _ephoto_go_previous(void *data, Evas_Object *obj, void *event_info);
static void _ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info);
+static void _ephoto_go_rotate_counterclockwise(void *data, Evas_Object *obj, void *event_info);
+static void _ephoto_go_rotate_clockwise(void *data, Evas_Object *obj, void *event_info);
static void _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _ephoto_flow_browser_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _ephoto_flow_browser_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
@@ -21,6 +28,8 @@ struct _Ephoto_Flow_Browser
Evas_Object *image2;
Evas_Object *toolbar;
const char *cur_image;
+
+ Ephoto_Orient orient;
};
static const char *toolbar_items[] = {
@@ -47,8 +56,7 @@ static void
_ephoto_go_update(Ephoto_Flow_Browser *ef)
{
const char *file_type;
- char *buffer;
- int length;
+ int success = 0;
efreet_mime_init();
@@ -60,23 +68,76 @@ _ephoto_go_update(Ephoto_Flow_Browser *ef)
file_type = efreet_mime_type_get(ef->cur_image);
if (file_type && !strcmp(file_type, "image/jpeg"))
{
- elm_photocam_file_set(ef->image, ef->cur_image);
+ success = elm_photocam_file_set(ef->image, ef->cur_image);
elm_layout_content_set(ef->flow_browser, "ephoto.flow.swallow", ef->image);
evas_object_show(ef->image);
} else {
- elm_image_file_set(ef->image2, ef->cur_image, NULL);
+ success = elm_image_file_set(ef->image2, ef->cur_image, NULL);
elm_layout_content_set(ef->flow_browser, "ephoto.flow.swallow", ef->image2);
evas_object_show(ef->image2);
}
- elm_toolbar_item_unselect_all(ef->toolbar);
+ if (success)
+ {
+ char *buffer;
+ int length;
+#ifdef HAVE_LIBEXIF
+ int orientation = 0;
+
+ ExifData *exif = exif_data_new_from_file(ef->cur_image);
+ ExifEntry *entry = NULL;
+ ExifByteOrder bo;
+
+ if (exif)
+ {
+ entry = exif_data_get_entry(exif, EXIF_TAG_ORIENTATION);
+ if (entry)
+ {
+ bo = exif_data_get_byte_order(exif);
+ orientation = exif_get_short(entry->data, bo);
+ }
+ exif_data_free(exif);
+ }
- efreet_mime_shutdown();
+ if (orientation > 1 && orientation < 9)
+ {
+ Evas_Object *o = elm_layout_edje_get(ef->flow_browser);
+
+ switch (orientation)
+ {
+ case 2: /* Horizontal flip */
+ break;
+ case 3: /* Rotate 180 clockwise */
+ ef->orient = EPHOTO_ORIENT_180;
+ edje_object_signal_emit(o, "ef,state,rotate,180", "ef");
+ break;
+ case 4: /* Vertical flip */
+ break;
+ case 5: /* Transpose */
+ break;
+ case 6: /* Rotate 90 clockwise */
+ ef->orient = EPHOTO_ORIENT_90;
+ edje_object_signal_emit(o, "ef,state,rotate,90", "ef");
+ break;
+ case 7: /* Transverse */
+ break;
+ case 8: /* Rotate 90 counter-clockwise */
+ ef->orient = EPHOTO_ORIENT_270;
+ edje_object_signal_emit(o, "ef,state,rotate,270", "ef");
+ break;
+ }
+ }
+#endif
- length = strlen(ef->cur_image) + strlen("Ephoto - ") + 1;
- buffer = alloca(length);
- snprintf(buffer, length, "Ephoto - %s", ef->cur_image);
- elm_win_title_set(em->win, buffer);
+ length = strlen(ef->cur_image) + strlen("Ephoto - ") + 1;
+ buffer = alloca(length);
+ snprintf(buffer, length, "Ephoto - %s", ef->cur_image);
+ elm_win_title_set(em->win, buffer);
+ }
+
+ elm_toolbar_item_unselect_all(ef->toolbar);
+
+ efreet_mime_shutdown();
}
/*Create the flow browser*/
@@ -174,7 +235,7 @@ ephoto_flow_browser_image_set(Evas_Object *obj, const char *current_image)
elm_toolbar_item_disabled_set(o, !ef->iter ? EINA_TRUE : EINA_FALSE);
}
- fprintf(stderr, "iter: %p\n", ef->iter);
+ DBG("iter: %p", ef->iter);
_ephoto_go_update(ef);
}
@@ -221,6 +282,8 @@ static const struct
{ "Right", _ephoto_go_next },
{ "space", _ephoto_go_next },
{ "Escape", _ephoto_go_back },
+ { "bracketleft", _ephoto_go_rotate_counterclockwise },
+ { "bracketright", _ephoto_go_rotate_clockwise },
{ NULL, NULL }
};
@@ -232,6 +295,7 @@ _ephoto_key_pressed(void *data, Evas *e, Evas_Object *obj, void *event_data)
int i;
eku = (Evas_Event_Key_Up *)event_data;
+ DBG("Key name: %s", eku->keyname);
for (i = 0; keys[i].name; ++i)
if (!strcmp(eku->keyname, keys[i].name))
keys[i].func(ef, NULL, NULL);
@@ -317,3 +381,56 @@ _ephoto_go_slideshow(void *data, Evas_Object *obj, void *event_info)
elm_toolbar_item_unselect_all(ef->toolbar);
}
+static void
+_ephoto_go_rotate_counterclockwise(void *data, Evas_Object *obj, void *event_info)
+{
+ Ephoto_Flow_Browser *ef = data;
+ Evas_Object *o = elm_layout_edje_get(ef->flow_browser);
+
+ switch(ef->orient)
+ {
+ case EPHOTO_ORIENT_0:
+ ef->orient = EPHOTO_ORIENT_270;
+ edje_object_signal_emit(o, "ef,state,rotate,270", "ef");
+ break;
+ case EPHOTO_ORIENT_90:
+ ef->orient = EPHOTO_ORIENT_0;
+ edje_object_signal_emit(o, "ef,state,rotate,0", "ef");
+ break;
+ case EPHOTO_ORIENT_180:
+ ef->orient = EPHOTO_ORIENT_90;
+ edje_object_signal_emit(o, "ef,state,rotate,90", "ef");
+ break;
+ case EPHOTO_ORIENT_270:
+ ef->orient = EPHOTO_ORIENT_180;
+ edje_object_signal_emit(o, "ef,state,rotate,180", "ef");
+ break;
+ }
+}
+
+static void
+_ephoto_go_rotate_clockwise(void *data, Evas_Object *obj, void *event_info)
+{
+ Ephoto_Flow_Browser *ef = data;
+ Evas_Object *o = elm_layout_edje_get(ef->flow_browser);
+
+ switch(ef->orient)
+ {
+ case EPHOTO_ORIENT_0:
+ ef->orient = EPHOTO_ORIENT_90;
+ edje_object_signal_emit(o, "ef,state,rotate,90", "ef");
+ break;
+ case EPHOTO_ORIENT_90:
+ ef->orient = EPHOTO_ORIENT_180;
+ edje_object_signal_emit(o, "ef,state,rotate,180", "ef");
+ break;
+ case EPHOTO_ORIENT_180:
+ ef->orient = EPHOTO_ORIENT_270;
+ edje_object_signal_emit(o, "ef,state,rotate,270", "ef");
+ break;
+ case EPHOTO_ORIENT_270:
+ ef->orient = EPHOTO_ORIENT_0;
+ edje_object_signal_emit(o, "ef,state,rotate,0", "ef");
+ break;
+ }
+}