The more panel should be changed when the theme is changed.
[framework/uifw/elementary.git] / src / lib / elm_photocam.c
index dbbdae3..021ddcf 100644 (file)
@@ -1,48 +1,16 @@
 #include <Elementary.h>
 #include "elm_priv.h"
+#include "els_scroller.h"
 
-/**
- * @defgroup Photocam Photocam
- *
- * This is a widget specifically for displaying high-resolution digital
- * camera photos giving speedy feedback (fast load), low memory footprint
- * and zooming and panning as well as fitting logic. It is entirely focused
- * on jpeg images, and takes advantage of properties of the jpeg format (via
- * evas loader features in the jpeg loader).
- *
- * Signals that you can add callbacks for are:
- *
- * "clicked" - This is called when a user has clicked the photo without dragging
- *             around.
- * "press" - This is called when a user has pressed down on the photo.
- * "longpressed" - This is called when a user has pressed down on the photo for
- *                 a long time without dragging around.
- * "clicked,double" - This is called when a user has double-clicked the photo.
- * "load" - Photo load begins.
- * "loaded" - This is called when the image file load is complete for the first
- *            view (low resolution blurry version).
- * "load,details" - Photo detailed data load begins.
- * "loaded,details" - This is called when the image file load is complete for the
- *                    detailed image data (full resolution needed).
- * "zoom,start" - Zoom animation started.
- * "zoom,stop" - Zoom animation stopped.
- * "zoom,change" - Zoom changed when using an auto zoom mode.
- * "scroll" - the content has been scrolled (moved)
- * "scroll,anim,start" - scrolling animation has started
- * "scroll,anim,stop" - scrolling animation has stopped
- * "scroll,drag,start" - dragging the contents around has started
- * "scroll,drag,stop" - dragging the contents around has stopped
- *
- * ---
- *
+/*
  * TODO (maybe - optional future stuff):
  *
  * 1. wrap photo in theme edje so u can have styling around photo (like white
  *    photo bordering).
  * 2. exif handling
  * 3. rotation flags in exif handling (nasty! should have rot in evas)
- *
  */
+
 typedef struct _Widget_Data Widget_Data;
 typedef struct _Pan Pan;
 typedef struct _Grid Grid;
@@ -76,11 +44,27 @@ struct _Widget_Data
    Evas_Object *obj;
    Evas_Object *scr;
    Evas_Object *pan_smart;
+   Evas_Object *gest;
+   double       gest_start;
+
    Pan *pan;
    Evas_Coord pan_x, pan_y, minw, minh;
 
    double zoom;
    Elm_Photocam_Zoom_Mode mode;
+   Evas_Coord pvx, pvy, px, py, zoom_point_x, zoom_point_y;
+   struct
+   {
+      int imx, imy;
+      struct
+      {
+         int x_start, y_start;
+         int x_end, y_end;
+         double t_start;
+         double t_end;
+         Ecore_Animator *animator;
+      } bounce;
+   } gzoom;
    const char *file;
 
    Ecore_Job *calc_job;
@@ -113,6 +97,9 @@ struct _Widget_Data
    Eina_Bool longpressed : 1;
    Eina_Bool on_hold : 1;
    Eina_Bool paused : 1;
+   Eina_Bool do_region : 1;
+   Eina_Bool do_gesture : 1;
+   Eina_Bool zoom_gest : 1;
 };
 
 struct _Pan
@@ -135,6 +122,44 @@ static void grid_clear(Evas_Object *obj, Grid *g);
 static Grid *grid_create(Evas_Object *obj);
 static void grid_load(Evas_Object *obj, Grid *g);
 
+static const char SIG_CLICKED[] = "clicked";
+static const char SIG_PRESS[] = "press";
+static const char SIG_LONGPRESSED[] = "longpressed";
+static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
+static const char SIG_LOAD[] = "load";
+static const char SIG_LOADED[] = "loaded";
+static const char SIG_LOAD_DETAIL[] = "load,detail";
+static const char SIG_LOADED_DETAIL[] = "loaded,detail";
+static const char SIG_ZOOM_START[] = "zoom,start";
+static const char SIG_ZOOM_STOP[] = "zoom,stop";
+static const char SIG_ZOOM_CHANGE[] = "zoom,change";
+static const char SIG_SCROLL[] = "scroll";
+static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
+static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
+static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
+static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
+
+static const Evas_Smart_Cb_Description _signals[] = {
+   {SIG_CLICKED, ""},
+   {SIG_PRESS, ""},
+   {SIG_LONGPRESSED, ""},
+   {SIG_CLICKED_DOUBLE, ""},
+   {SIG_LOAD, ""},
+   {SIG_LOADED, ""},
+   {SIG_LOAD_DETAIL, ""},
+   {SIG_LOADED_DETAIL, ""},
+   {SIG_ZOOM_START, ""},
+   {SIG_ZOOM_STOP, ""},
+   {SIG_ZOOM_CHANGE, ""},
+   {SIG_SCROLL, ""},
+   {SIG_SCROLL_ANIM_START, ""},
+   {SIG_SCROLL_ANIM_STOP, ""},
+   {SIG_SCROLL_DRAG_START, ""},
+   {SIG_SCROLL_DRAG_STOP, ""},
+   {NULL, NULL}
+};
+
+
 static int
 nearest_pow2(int num)
 {
@@ -157,8 +182,11 @@ img_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Co
    ay = 0;
    gw = wd->size.w;
    gh = wd->size.h;
-   if (ow > gw) ax = (ow - gw) / 2;
-   if (oh > gh) ay = (oh - gh) / 2;
+   if (!wd->zoom_gest)
+     {
+        if (ow > gw) ax = (ow - gw) / 2;
+        if (oh > gh) ay = (oh - gh) / 2;
+     }
    evas_object_move(wd->img, ox + 0 - px + ax, oy + 0 - py + ay);
    evas_object_resize(wd->img, gw, gh);
 
@@ -180,8 +208,11 @@ grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord o
    ay = 0;
    gw = wd->size.w;
    gh = wd->size.h;
-   if (ow > gw) ax = (ow - gw) / 2;
-   if (oh > gh) ay = (oh - gh) / 2;
+   if (!wd->zoom_gest)
+     {
+        if (ow > gw) ax = (ow - gw) / 2;
+        if (oh > gh) ay = (oh - gh) / 2;
+     }
    for (y = 0; y < g->gh; y++)
      {
         for (x = 0; x < g->gw; x++)
@@ -235,7 +266,7 @@ grid_clear(Evas_Object *obj, Grid *g)
                     {
                        edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
                                                "elm,state,busy,stop", "elm");
-                       evas_object_smart_callback_call(obj, "loaded,detail", NULL);
+                       evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL);
                     }
                }
           }
@@ -261,7 +292,7 @@ _tile_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void
           {
              edje_object_signal_emit(elm_smart_scroller_edje_object_get(git->wd->scr),
                                      "elm,state,busy,stop", "elm");
-             evas_object_smart_callback_call(git->wd->obj, "loaded,detail", NULL);
+             evas_object_smart_callback_call(git->wd->obj, SIG_LOADED_DETAIL, NULL);
           }
      }
 }
@@ -283,6 +314,7 @@ grid_create(Evas_Object *obj)
 
    if (!wd) return NULL;
    g = calloc(1, sizeof(Grid));
+   if (!g) return NULL;
 
    g->zoom = grid_zoom_calc(wd->zoom);
    g->tsize = wd->tsize;
@@ -291,9 +323,21 @@ grid_create(Evas_Object *obj)
 
    g->w = g->iw / g->zoom;
    g->h = g->ih / g->zoom;
-   if (g->zoom >= 8) return NULL;
-   g->gw = (g->w + g->tsize - 1) / g->tsize;
-   g->gh = (g->h + g->tsize - 1) / g->tsize;
+   if (g->zoom >= 8)
+     {
+        free(g);
+        return NULL;
+     }
+   if (wd->do_region)
+     {
+        g->gw = (g->w + g->tsize - 1) / g->tsize;
+        g->gh = (g->h + g->tsize - 1) / g->tsize;
+     }
+   else
+     {
+        g->gw = 1;
+        g->gh = 1;
+     }
    g->grid = calloc(1, sizeof(Grid_Item) * g->gw * g->gh);
    if (!g->grid)
      {
@@ -327,6 +371,7 @@ grid_create(Evas_Object *obj)
              g->grid[tn].wd = wd;
              g->grid[tn].img =
                 evas_object_image_add(evas_object_evas_get(obj));
+             evas_object_image_load_orientation_set(g->grid[tn].img, EINA_TRUE);
              evas_object_image_scale_hint_set
                 (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
              evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
@@ -401,7 +446,7 @@ grid_load(Evas_Object *obj, Grid *g)
                     {
                        edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
                                                "elm,state,busy,start", "elm");
-                       evas_object_smart_callback_call(obj, "load,detail", NULL);
+                       evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL);
                     }
                }
              else if ((g->grid[tn].want) && (!visible))
@@ -411,7 +456,7 @@ grid_load(Evas_Object *obj, Grid *g)
                     {
                        edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
                                                "elm,state,busy,stop", "elm");
-                       evas_object_smart_callback_call(obj, "loaded,detail", NULL);
+                       evas_object_smart_callback_call(obj, SIG_LOADED_DETAIL, NULL);
                     }
                   g->grid[tn].want = 0;
                   evas_object_hide(g->grid[tn].img);
@@ -525,13 +570,13 @@ _main_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void
      }
    if (wd->calc_job) ecore_job_del(wd->calc_job);
    wd->calc_job = ecore_job_add(_calc_job, wd);
-   evas_object_smart_callback_call(data, "loaded", NULL);
+   evas_object_smart_callback_call(data, SIG_LOADED, NULL);
    wd->preload_num--;
    if (!wd->preload_num)
      {
         edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
                                 "elm,state,busy,stop", "elm");
-        evas_object_smart_callback_call(obj, "loaded,detail", NULL);
+        evas_object_smart_callback_call(obj, SIG_LOADED_DETAIL, NULL);
      }
 }
 
@@ -602,7 +647,7 @@ _zoom_anim(void *data)
         wd->nosmooth--;
         if (!wd->nosmooth) _smooth_update(data);
         wd->zoom_animator = NULL;
-        evas_object_smart_callback_call(obj, "zoom,stop", NULL);
+        evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL);
      }
    return go;
 }
@@ -622,7 +667,7 @@ _long_press(void *data)
    if (!wd) return ECORE_CALLBACK_CANCEL;
    wd->long_timer = NULL;
    wd->longpressed = EINA_TRUE;
-   evas_object_smart_callback_call(data, "longpressed", NULL);
+   evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
    return ECORE_CALLBACK_CANCEL;
 }
 
@@ -636,9 +681,9 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
    else wd->on_hold = EINA_FALSE;
    if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
-     evas_object_smart_callback_call(data, "clicked,double", NULL);
+     evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
    else
-     evas_object_smart_callback_call(data, "press", NULL);
+     evas_object_smart_callback_call(data, SIG_PRESS, NULL);
    wd->longpressed = EINA_FALSE;
    if (wd->long_timer) ecore_timer_del(wd->long_timer);
    wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
@@ -659,7 +704,7 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *
         wd->long_timer = NULL;
      }
    if (!wd->on_hold)
-     evas_object_smart_callback_call(data, "clicked", NULL);
+     evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
    wd->on_hold = EINA_FALSE;
 }
 
@@ -682,6 +727,7 @@ _del_hook(Evas_Object *obj)
    if (wd->calc_job) ecore_job_del(wd->calc_job);
    if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
    if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator);
+   if (wd->gzoom.bounce.animator) ecore_animator_del(wd->gzoom.bounce.animator);
    if (wd->long_timer) ecore_timer_del(wd->long_timer);
    free(wd);
 }
@@ -693,12 +739,12 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
    if (!wd) return;
    if (elm_widget_focus_get(obj))
      {
-        edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
+        edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,focus", "elm");
         evas_object_focus_set(wd->obj, EINA_TRUE);
      }
    else
      {
-        edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
+        edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr), "elm,action,unfocus", "elm");
         evas_object_focus_set(wd->obj, EINA_FALSE);
      }
 }
@@ -865,11 +911,13 @@ _pan_calculate(Evas_Object *obj)
    Grid *g;
    if (!sd) return;
    evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
-   img_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
+   img_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y,
+             ox - sd->wd->gzoom.imx, oy - sd->wd->gzoom.imy, ow, oh);
    EINA_LIST_FOREACH(sd->wd->grids, l, g)
      {
         grid_load(sd->wd->obj, g);
-        grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
+        grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y,
+                   ox - sd->wd->gzoom.imx, oy - sd->wd->gzoom.imy, ow, oh);
      }
 }
 
@@ -917,31 +965,31 @@ _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__
 static void
 _scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,anim,start", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
 }
 
 static void
 _scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,anim,stop", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
 }
 
 static void
 _scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
 }
 
 static void
 _scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
 }
 
 static void
 _scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
 }
 
 static Eina_Bool
@@ -970,27 +1018,27 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
    elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
 
    if ((!strcmp(ev->keyname, "Left")) ||
-       (!strcmp(ev->keyname, "KP_Left")))
+       ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
      {
         x -= step_x;
      }
    else if ((!strcmp(ev->keyname, "Right")) ||
-            (!strcmp(ev->keyname, "KP_Right")))
+            ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
      {
         x += step_x;
      }
    else if ((!strcmp(ev->keyname, "Up"))  ||
-            (!strcmp(ev->keyname, "KP_Up")))
+            ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
      {
         y -= step_y;
      }
    else if ((!strcmp(ev->keyname, "Down")) ||
-            (!strcmp(ev->keyname, "KP_Down")))
+            ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
      {
         y += step_y;
      }
    else if ((!strcmp(ev->keyname, "Prior")) ||
-            (!strcmp(ev->keyname, "KP_Prior")))
+            ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string)))
      {
         if (page_y < 0)
           y -= -(page_y * v_h) / 100;
@@ -998,7 +1046,7 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
           y -= page_y;
      }
    else if ((!strcmp(ev->keyname, "Next")) ||
-            (!strcmp(ev->keyname, "KP_Next")))
+            ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string)))
      {
         if (page_y < 0)
           y += -(page_y * v_h) / 100;
@@ -1029,14 +1077,245 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
    return EINA_TRUE;
 }
 
-/**
- * Add a new Photocam object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Photocam
- */
+Eina_Bool
+_bounce_eval(void *_wd)
+{
+   Widget_Data *wd = (Widget_Data *)_wd;
+   double t, tt;
+
+   if (!wd) return ECORE_CALLBACK_CANCEL;
+   if ((wd->gzoom.imx == wd->gzoom.bounce.x_end) &&
+       (wd->gzoom.imy == wd->gzoom.bounce.y_end))
+     {
+        wd->gzoom.imx = 0;
+        wd->gzoom.imy = 0;
+        wd->zoom_gest = EINA_FALSE;
+        wd->gzoom.bounce.animator = NULL;
+        _freeze_off(NULL, wd->obj, NULL);
+        return ECORE_CALLBACK_CANCEL;
+     }
+
+   t = ecore_loop_time_get();
+   tt = (t - wd->gzoom.bounce.t_start) / (wd->gzoom.bounce.t_end - wd->gzoom.bounce.t_start);
+   tt = 1.0 - tt;
+   tt = 1.0 - (tt * tt);
+
+   if (t > wd->gzoom.bounce.t_end)
+     {
+        wd->gzoom.imx = 0;
+        wd->gzoom.imy = 0;
+        wd->zoom_gest = EINA_FALSE;
+        _freeze_off(NULL, wd->obj, NULL);
+        zoom_do(wd->obj, 1.0);
+        wd->gzoom.bounce.animator = NULL;
+        return ECORE_CALLBACK_CANCEL;
+     }
+
+   if (wd->gzoom.imx != wd->gzoom.bounce.x_end)
+     wd->gzoom.imx = wd->gzoom.bounce.x_start * (1.0 - tt) + wd->gzoom.bounce.x_end * tt;
+
+   if (wd->gzoom.imy != wd->gzoom.bounce.y_end)
+     wd->gzoom.imy = wd->gzoom.bounce.y_start * (1.0 - tt) + wd->gzoom.bounce.y_end * tt;
+
+   zoom_do(wd->obj, 1.0 - (1.0 - tt));
+   return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_gzoom(Widget_Data *_wd, Evas_Coord px, Evas_Coord py, Elm_Gesture_Zoom_Info* gest)
+{
+   Widget_Data *wd = (Widget_Data *)_wd;
+   Evas_Coord rx, ry, rw, rh;
+   int regx, regy, regw, regh, ix, iy, iw, ih;
+   int xx, yy;
+
+   if (!wd) return;
+   wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
+   wd->zoom = wd->gest_start / gest->zoom;
+   wd->size.ow = wd->size.w;
+   wd->size.oh = wd->size.h;
+   elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry);
+   elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
+   if ((rw <= 0) || (rh <= 0)) return;
+
+   wd->size.nw = (double)wd->size.imw / wd->zoom;
+   wd->size.nh = (double)wd->size.imh / wd->zoom;
+
+   elm_photocam_image_region_get(wd->obj, &regx, &regy, &regw, &regh);
+   evas_object_geometry_get(wd->img, &ix, &iy, &iw, &ih);
+
+   wd->pvx = gest->x;
+   wd->pvy = gest->y;
+
+   xx = (px / wd->zoom) - wd->pvx;
+   yy = (py / wd->zoom) - wd->pvy;
+   wd->gzoom.imx = 0;
+   wd->gzoom.imy = 0;
+
+   if ((xx < 0) || (rw > wd->size.nw))
+     {
+        wd->gzoom.imx = xx;
+        xx = 0;
+     }
+   else if ((xx + rw) > wd->size.nw)
+     {
+        wd->gzoom.imx = xx + rw - wd->size.nw;
+        xx = wd->size.nw - rw;
+     }
+
+   if ((yy < 0) || (rh > wd->size.nh))
+     {
+        wd->gzoom.imy = yy;
+        yy = 0;
+     }
+   else if ((yy + rh) > wd->size.nh)
+     {
+        wd->gzoom.imy = yy + rh - wd->size.nh;
+        yy = wd->size.nh - rh;
+     }
+
+   wd->size.spos.x = (double)(xx + (rw / 2)) / (double)(wd->size.nw);
+   wd->size.spos.y = (double)(yy + (rh / 2)) / (double)(wd->size.nh);
+
+   zoom_do(wd->obj, 1.0);
+}
+
+static Evas_Event_Flags
+_gzoom_start(void *_wd, void *event_info)
+{
+   Widget_Data *wd = (Widget_Data *)_wd;
+   Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
+   Evas_Coord rw, rh;
+   int x,y,w,h;
+   double marginx = 0, marginy = 0;
+
+   if (wd->gzoom.bounce.animator)
+     {
+        ecore_animator_del(wd->gzoom.bounce.animator);
+        wd->gzoom.bounce.animator = NULL;
+     }
+   wd->zoom_gest = EINA_TRUE;
+   _freeze_on(NULL, wd->obj, NULL);
+
+   elm_photocam_image_region_get(wd->obj, &x, &y, &w, &h);
+   elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
+
+   if (rw > wd->size.nw)
+     marginx = (rw - wd->size.nw) / 2;
+   if (rh > wd->size.nh)
+     marginy = (rh - wd->size.nh) / 2;
+
+   wd->gest_start = wd->zoom;
+
+   wd->zoom_point_x = x + ((p->x - marginx) * wd->zoom) + wd->gzoom.imx;
+   wd->zoom_point_y = y + ((p->y - marginy) * wd->zoom) + wd->gzoom.imy;
+
+   return EVAS_EVENT_FLAG_NONE;
+}
+
+static Evas_Event_Flags
+_gzoom_move(void *_wd, void *event_info)
+{
+   Widget_Data *wd = (Widget_Data *)_wd;
+   Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
+
+   _gzoom(wd, wd->zoom_point_x, wd->zoom_point_y, p);
+   return EVAS_EVENT_FLAG_NONE;
+}
+
+static Evas_Event_Flags
+_gzoom_end(void *_wd, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = (Widget_Data *)_wd;
+   Evas_Coord rw, rh;
+
+   elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
+   wd->gest_start = 1.0;
+
+   if (wd->gzoom.imx || wd->gzoom.imy)
+     {
+        double t;
+
+        t = ecore_loop_time_get();
+        wd->gzoom.bounce.x_start = wd->gzoom.imx;
+        wd->gzoom.bounce.y_start = wd->gzoom.imy;
+        wd->gzoom.bounce.x_end = 0;
+        wd->gzoom.bounce.y_end = 0;
+
+        if (rw > wd->size.nw &&
+            rh > wd->size.nh)
+          {
+             Evas_Coord pw, ph;
+             double z;
+
+             if ((wd->size.imw < rw) && (wd->size.imh < rh))
+               {
+                  wd->zoom = 1;
+                  wd->size.nw = wd->size.imw;
+                  wd->size.nh = wd->size.imh;
+               }
+             else
+               {
+                  ph = (wd->size.imh * rw) / wd->size.imw;
+                  if (ph > rh)
+                    {
+                       pw = (wd->size.imw * rh) / wd->size.imh;
+                       ph = rh;
+                    }
+                  else
+                    {
+                       pw = rw;
+                    }
+                  if (wd->size.imw > wd->size.imh)
+                    z = (double)wd->size.imw / pw;
+                  else
+                    z = (double)wd->size.imh / ph;
+
+                  wd->zoom = z;
+                  wd->size.nw = pw;
+                  wd->size.nh = ph;
+               }
+             wd->gzoom.bounce.x_end = (wd->size.nw - rw) / 2;
+             wd->gzoom.bounce.y_end = (wd->size.nh - rh) / 2;
+          }
+        else
+          {
+             int xx, yy;
+
+             xx = (wd->zoom_point_x / wd->zoom) - wd->pvx;
+             yy = (wd->zoom_point_y / wd->zoom) - wd->pvy;
+
+             if (xx < 0) xx = 0;
+             if (yy < 0) yy = 0;
+
+             if (rw > wd->size.nw)
+               wd->gzoom.bounce.x_end = (wd->size.nw -rw) / 2;
+             if ((xx + rw) > wd->size.nw)
+               xx = wd->size.nw - rw;
+
+             if (rh > wd->size.nh)
+               wd->gzoom.bounce.y_end = (wd->size.nh - rh) / 2;
+             if ((yy + rh) > wd->size.nh)
+               yy = wd->size.nh - rh;
+
+             wd->size.spos.x = (double)(xx + (rw / 2)) / (double)(wd->size.nw);
+             wd->size.spos.y = (double)(yy + (rh / 2)) / (double)(wd->size.nh);
+          }
+
+        wd->gzoom.bounce.t_start = t;
+        wd->gzoom.bounce.t_end = t + _elm_config->page_scroll_friction;
+
+        wd->gzoom.bounce.animator = ecore_animator_add(_bounce_eval, wd);
+     }
+   else
+     {
+        _freeze_off(NULL, wd->obj, NULL);
+        wd->zoom_gest = EINA_FALSE;
+     }
+
+   return EVAS_EVENT_FLAG_NONE;
+}
+
 EAPI Evas_Object *
 elm_photocam_add(Evas_Object *parent)
 {
@@ -1107,12 +1386,14 @@ elm_photocam_add(Evas_Object *parent)
                                      _pan_set, _pan_get, _pan_max_get,
                                      _pan_min_get, _pan_child_size_get);
 
+   wd->zoom_gest = EINA_FALSE;
+   wd->gest_start = 1.0;
    wd->zoom = 1;
    wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
-
    wd->tsize = 512;
 
    wd->img = evas_object_image_add(e);
+   evas_object_image_load_orientation_set(wd->img, EINA_TRUE);
    evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
    evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_DOWN,
                                   _mouse_down, obj);
@@ -1131,26 +1412,12 @@ elm_photocam_add(Evas_Object *parent)
                              &minw, &minh);
    evas_object_size_hint_min_set(obj, minw, minh);
 
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
    _sizing_eval(obj);
    return obj;
 }
 
-/**
- * Set the photo file to be shown
- *
- * This sets (and shows) the specified file (with a relative or absolute path)
- * and will return a load error (same error that
- * evas_object_image_load_error_get() will return). The image will change and
- * adjust its size at this point and begin a background load process for this
- * photo that at some time in the future will be displayed at the full quality
- * needed.
- *
- * @param obj The photocam object
- * @param file The photo file
- * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
- *
- * @ingroup Photocam
- */
 EAPI Evas_Load_Error
 elm_photocam_file_set(Evas_Object *obj, const char *file)
 {
@@ -1167,10 +1434,16 @@ elm_photocam_file_set(Evas_Object *obj, const char *file)
    evas_object_image_load_scale_down_set(wd->img, 0);
    evas_object_image_file_set(wd->img, wd->file, NULL);
    evas_object_image_size_get(wd->img, &w, &h);
+   wd->do_region = evas_object_image_region_support_get(wd->img);
    wd->size.imw = w;
    wd->size.imh = h;
    wd->size.w = wd->size.imw / wd->zoom;
    wd->size.h = wd->size.imh / wd->zoom;
+   if (wd->gzoom.bounce.animator)
+     {
+        ecore_animator_del(wd->gzoom.bounce.animator);
+        wd->gzoom.bounce.animator = NULL;
+     }
    if (wd->zoom_animator)
      {
         wd->nosmooth--;
@@ -1185,30 +1458,22 @@ elm_photocam_file_set(Evas_Object *obj, const char *file)
    wd->main_load_pending = 1;
    if (wd->calc_job) ecore_job_del(wd->calc_job);
    wd->calc_job = ecore_job_add(_calc_job, wd);
-   evas_object_smart_callback_call(obj, "load", NULL);
+   evas_object_smart_callback_call(obj, SIG_LOAD, NULL);
    wd->preload_num++;
    if (wd->preload_num == 1)
      {
         edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
                                 "elm,state,busy,start", "elm");
-        evas_object_smart_callback_call(obj, "load,detail", NULL);
-     }
-     {
-        double tz = wd->zoom;
-        wd->zoom = 0.0;
-        elm_photocam_zoom_set(wd->obj, tz);
+        evas_object_smart_callback_call(obj, SIG_LOAD_DETAIL, NULL);
      }
+   {
+      double tz = wd->zoom;
+      wd->zoom = 0.0;
+      elm_photocam_zoom_set(wd->obj, tz);
+   }
    return evas_object_image_load_error_get(wd->img);
 }
 
-/*
- * Returns the path of the current image file
- *
- * @param obj The photocam object
- * @return Returns the path
- *
- * @ingroup Photocam
- */
 EAPI const char *
 elm_photocam_file_get(const Evas_Object *obj)
 {
@@ -1218,20 +1483,6 @@ elm_photocam_file_get(const Evas_Object *obj)
    return wd->file;
 }
 
-/**
- * Set the zoom level of the photo
- *
- * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
- * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
- * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
- * be greater than 0. It is usggested to stick to powers of 2. (1, 2, 4, 8,
- * 16, 32, etc.).
- *
- * @param obj The photocam object
- * @param zoom The zoom level to set
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_zoom_set(Evas_Object *obj, double zoom)
 {
@@ -1240,7 +1491,7 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
    Eina_List *l;
    Grid *g, *g_zoom = NULL;
    Evas_Coord pw, ph, rx, ry, rw, rh;
-   int z;
+   double z;
    int zoom_changed = 0, started = 0;
    Ecore_Animator *an;
    if (!wd) return;
@@ -1263,7 +1514,7 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
         if ((wd->size.imw < 1) || (wd->size.imh < 1))
           {
              wd->size.nw = 0;
-             wd->size.nw = 0;
+             wd->size.nh = 0;
           }
         else
           {
@@ -1278,14 +1529,11 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
                   pw = rw;
                }
              if (wd->size.imw > wd->size.imh)
-               z = wd->size.imw / pw;
+               z = (double)wd->size.imw / pw;
              else
-               z = wd->size.imh / ph;
-             if      (z >= 8) z = 8;
-             else if (z >= 4) z = 4;
-             else if (z >= 2) z = 2;
-             else             z = 1;
-             if (z != wd->zoom) zoom_changed = 1;
+               z = (double)wd->size.imh / ph;
+             if (z != wd->zoom)
+               zoom_changed = 1;
              wd->zoom = z;
              wd->size.nw = pw;
              wd->size.nh = ph;
@@ -1311,14 +1559,46 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
                   pw = rw;
                }
              if (wd->size.imw > wd->size.imh)
-               z = wd->size.imw / pw;
+               z = (double)wd->size.imw / pw;
+             else
+               z = (double)wd->size.imh / ph;
+             if (z != wd->zoom)
+               zoom_changed = 1;
+             wd->zoom = z;
+             wd->size.nw = pw;
+             wd->size.nh = ph;
+          }
+     }
+   else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT_IN)
+     {
+        if ((wd->size.imw < 1) || (wd->size.imh < 1))
+          {
+             wd->size.nw = 0;
+             wd->size.nh = 0;
+          }
+        else if ((wd->size.imw < rw) && (wd->size.imh < rh))
+          {
+             if (1 != wd->zoom) zoom_changed = 1;
+             wd->zoom = 1;
+             wd->size.nw = wd->size.imw;
+             wd->size.nh = wd->size.imh;
+          }
+        else
+          {
+             ph = (wd->size.imh * rw) / wd->size.imw;
+             if (ph > rh)
+               {
+                  pw = (wd->size.imw * rh) / wd->size.imh;
+                  ph = rh;
+               }
+             else
+               pw = rw;
+             if (wd->size.imw > wd->size.imh)
+               z = (double)wd->size.imw / pw;
              else
-               z = wd->size.imh / ph;
-             if      (z >= 8) z = 8;
-             else if (z >= 4) z = 4;
-             else if (z >= 2) z = 2;
-             else             z = 1;
-             if (z != wd->zoom) zoom_changed = 1;
+               z = (double)wd->size.imh / ph;
+             if (z != wd->zoom)
+               zoom_changed = 1;
              wd->zoom = z;
              wd->size.nw = pw;
              wd->size.nh = ph;
@@ -1364,7 +1644,7 @@ elm_photocam_zoom_set(Evas_Object *obj, double zoom)
              free(g);
           }
      }
-done:
+ done:
    wd->t_start = ecore_loop_time_get();
    wd->t_end = wd->t_start + _elm_config->zoom_friction;
    if ((wd->size.w > 0) && (wd->size.h > 0))
@@ -1409,27 +1689,14 @@ done:
    if (!wd->paused)
      {
         if (started)
-          evas_object_smart_callback_call(obj, "zoom,start", NULL);
+          evas_object_smart_callback_call(obj, SIG_ZOOM_START, NULL);
         if (!an)
-          evas_object_smart_callback_call(obj, "zoom,stop", NULL);
+          evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL);
      }
    if (zoom_changed)
-     evas_object_smart_callback_call(obj, "zoom,change", NULL);
+     evas_object_smart_callback_call(obj, SIG_ZOOM_CHANGE, NULL);
 }
 
-/**
- * Get the zoom level of the photo
- *
- * This returns the current zoom level of the photocam object. Note that if
- * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
- * (which is the default), the zoom level may be changed at any time by the
- * photocam object itself to account for photo size and photocam viewpoer size
- *
- * @param obj The photocam object
- * @return The current zoom level
- *
- * @ingroup Photocam
- */
 EAPI double
 elm_photocam_zoom_get(const Evas_Object *obj)
 {
@@ -1439,24 +1706,6 @@ elm_photocam_zoom_get(const Evas_Object *obj)
    return wd->zoom;
 }
 
-/**
- * Set the zoom mode
- *
- * This sets the zoom mode to manual or one of several automatic levels.
- * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
- * elm_photocam_zoom_set() and will stay at that level until changed by code
- * or until zoom mode is changed. This is the default mode.
- * The Automatic modes will allow the photocam object to automatically
- * adjust zoom mode based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will
- * adjust zoom so the photo fits EXACTLY inside the scroll frame with no pixels
- * outside this area. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but
- * ensure no pixels within the frame are left unfilled.
- *
- * @param obj The photocam object
- * @param mode The desired mode
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
 {
@@ -1465,23 +1714,13 @@ elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
    if (!wd) return;
    if (wd->mode == mode) return;
    wd->mode = mode;
-     {
-        double tz = wd->zoom;
-        wd->zoom = 0.0;
-        elm_photocam_zoom_set(wd->obj, tz);
-     }
+   {
+      double tz = wd->zoom;
+      wd->zoom = 0.0;
+      elm_photocam_zoom_set(wd->obj, tz);
+   }
 }
 
-/**
- * Get the zoom mode
- *
- * This gets the current zoom mode of the photocam object
- *
- * @param obj The photocam object
- * @return The current zoom mode
- *
- * @ingroup Photocam
- */
 EAPI Elm_Photocam_Zoom_Mode
 elm_photocam_zoom_mode_get(const Evas_Object *obj)
 {
@@ -1491,19 +1730,6 @@ elm_photocam_zoom_mode_get(const Evas_Object *obj)
    return wd->mode;
 }
 
-/**
- * Get the current image pixel width and height
- *
- * This gets the current photo pixel width and height (for the original).
- * The size will be returned in the integers @p w and @p h that are pointed
- * to.
- *
- * @param obj The photocam object
- * @param w A pointer to the width return
- * @param h A pointer to the height return
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
 {
@@ -1514,14 +1740,8 @@ elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
    if (h) *h = wd->size.imh;
 }
 
-/**
- * Get the current area of the image that is currently shown
- *
- * This gets the region
- *
- */
 EAPI void
-elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
+elm_photocam_image_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1535,7 +1755,6 @@ elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
           {
              *x = (wd->size.imw * sx) / wd->size.w;
              if (*x > wd->size.imw) *x = wd->size.imw;
-             else if (*x < 0) *x = 0;
           }
         if (w)
           {
@@ -1556,7 +1775,6 @@ elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
           {
              *y = (wd->size.imh * sy) / wd->size.h;
              if (*y > wd->size.imh) *y = wd->size.imh;
-             else if (*y < 0) *y = 0;
           }
         if (h)
           {
@@ -1572,19 +1790,6 @@ elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
      }
 }
 
-/**
- * Set the viewed portion of the image
- *
- * This sets the region of the image to be viewed
- *
- * @param obj The photocam object
- * @param x X-coordinate of region in image original pixels
- * @param y Y-coordinate of region in image original pixels
- * @param w Width of region in image original pixels
- * @param h Height of region in image original pixels
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
 {
@@ -1596,35 +1801,28 @@ elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UN
    rx = (x * wd->size.w) / wd->size.imw;
    ry = (y * wd->size.h) / wd->size.imh;
    rw = (w * wd->size.w) / wd->size.imw;
-   rh = (w * wd->size.h) / wd->size.imh;
+   rh = (h * wd->size.h) / wd->size.imh;
    if (rw < 1) rw = 1;
    if (rh < 1) rh = 1;
    if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
    if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
+   if (wd->gzoom.bounce.animator)
+     {
+        ecore_animator_del(wd->gzoom.bounce.animator);
+        wd->gzoom.bounce.animator = NULL;
+        zoom_do(obj, 1.0);
+     }
    if (wd->zoom_animator)
      {
         wd->nosmooth--;
         ecore_animator_del(wd->zoom_animator);
         wd->zoom_animator = NULL;
         zoom_do(obj, 1.0);
-        evas_object_smart_callback_call(obj, "zoom,stop", NULL);
+        evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL);
      }
    elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh);
 }
 
-/**
- * Bring in the viewed portion of the image
- *
- * This brings in the region of the image over time
- *
- * @param obj The photocam object
- * @param x X-coordinate of region in image original pixels
- * @param y Y-coordinate of region in image original pixels
- * @param w Width of region in image original pixels
- * @param h Height of region in image original pixels
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
 {
@@ -1636,11 +1834,17 @@ elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h
    rx = (x * wd->size.w) / wd->size.imw;
    ry = (y * wd->size.h) / wd->size.imh;
    rw = (w * wd->size.w) / wd->size.imw;
-   rh = (w * wd->size.h) / wd->size.imh;
+   rh = (h * wd->size.h) / wd->size.imh;
    if (rw < 1) rw = 1;
    if (rh < 1) rh = 1;
    if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
    if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
+   if (wd->gzoom.bounce.animator)
+     {
+        ecore_animator_del(wd->gzoom.bounce.animator);
+        wd->gzoom.bounce.animator = NULL;
+        zoom_do(obj, 1.0);
+     }
    if (wd->zoom_animator)
      {
         wd->nosmooth--;
@@ -1648,23 +1852,11 @@ elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h
         ecore_animator_del(wd->zoom_animator);
         wd->zoom_animator = NULL;
         zoom_do(obj, 1.0);
-        evas_object_smart_callback_call(obj, "zoom,stop", NULL);
+        evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL);
      }
    elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh);
 }
 
-/**
- * Set the paused state for photocam
- *
- * This sets the paused state to on (1) or off (0) for photocam. The default
- * is on. This will stop zooming using animation ch change zoom levels and
- * change instantly. This will stop any existing animations that are running.
- *
- * @param obj The photocam object
- * @param paused The pause state to set
- *
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
 {
@@ -1675,26 +1867,22 @@ elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
    wd->paused = paused;
    if (wd->paused)
      {
+        if (wd->gzoom.bounce.animator)
+          {
+             ecore_animator_del(wd->gzoom.bounce.animator);
+             wd->gzoom.bounce.animator = NULL;
+             zoom_do(obj, 1.0);
+          }
         if (wd->zoom_animator)
           {
              ecore_animator_del(wd->zoom_animator);
              wd->zoom_animator = NULL;
              zoom_do(obj, 1.0);
-             evas_object_smart_callback_call(obj, "zoom,stop", NULL);
+             evas_object_smart_callback_call(obj, SIG_ZOOM_STOP, NULL);
           }
      }
 }
 
-/**
- * Get the paused state for photocam
- *
- * This gets the current paused state for the photocam object.
- *
- * @param obj The photocam object
- * @return The current paused state
- *
- * @ingroup Photocam
- */
 EAPI Eina_Bool
 elm_photocam_paused_get(const Evas_Object *obj)
 {
@@ -1704,18 +1892,6 @@ elm_photocam_paused_get(const Evas_Object *obj)
    return wd->paused;
 }
 
-/**
- * Get the internal low-res image used for photocam
- *
- * This gets the internal image object inside photocam. Do not modify it. It
- * is for inspection only, and hooking callbacks to. Nothing else. It may be
- * deleted at any time as well.
- *
- * @param obj The photocam object
- * @return The internal image object handle, or NULL if none exists
- *
- * @ingroup Photocam
- */
 EAPI Evas_Object *
 elm_photocam_internal_image_get(const Evas_Object *obj)
 {
@@ -1725,14 +1901,6 @@ elm_photocam_internal_image_get(const Evas_Object *obj)
    return wd->img;
 }
 
-/**
- * Set the photocam scrolling bouncing.
- *
- * @param obj The photocam object
- * @param h_bounce bouncing for horizontal
- * @param v_bounce bouncing for vertical
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
 {
@@ -1742,15 +1910,6 @@ elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce
    elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
 }
 
-
-/**
- * Get the photocam scrolling bouncing.
- *
- * @param obj The photocam object
- * @param h_bounce bouncing for horizontal
- * @param v_bounce bouncing for vertical
- * @ingroup Photocam
- */
 EAPI void
 elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
 {
@@ -1760,3 +1919,44 @@ elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *
    elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
 }
 
+EAPI void
+elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (wd->do_gesture == !!gesture) return;
+
+   if (wd->gest)
+     {
+        evas_object_del(wd->gest);
+        wd->gest = NULL;
+     }
+
+   if (gesture)
+     {
+        wd->gest = elm_gesture_layer_add(wd->obj);
+        if (!wd->gest) return;
+        elm_gesture_layer_attach(wd->gest, wd->obj);
+        elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START,
+                                 _gzoom_start, wd);
+        elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE,
+                                 _gzoom_move, wd);
+        elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END,
+                                 _gzoom_end, wd);
+        elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT,
+                                 _gzoom_end, wd);
+     }
+
+   wd->do_gesture = !!gesture;
+}
+
+EAPI Eina_Bool
+elm_photocam_gesture_enabled_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+
+   return wd->do_gesture;
+}