}
static Eina_Bool
-_zoom_anim_cb(void *data)
+_zoom_anim_cb(void *data,
+ Eo *o EINA_UNUSED,
+ const Eo_Event_Description *desc EINA_UNUSED,
+ void *event_info EINA_UNUSED)
{
double t;
- Eina_Bool go;
Evas_Object *obj = data;
ELM_PHOTOCAM_DATA_GET(obj, sd);
t = 1.0;
t = 1.0 - t;
t = 1.0 - (t * t);
- go = _zoom_do(obj, t);
- if (!go)
+ if (!_zoom_do(obj, t))
{
sd->no_smooth--;
if (!sd->no_smooth) _smooth_update(data);
- sd->zoom_animator = NULL;
+ eo_do(obj,
+ eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj));
eo_do(obj, eo_event_callback_call(EVAS_ZOOMABLE_INTERFACE_EVENT_ZOOM_STOP, NULL));
}
- return go;
+ return EO_CALLBACK_CONTINUE;
}
static Eina_Bool
return EINA_TRUE;
}
-Eina_Bool
-_bounce_eval(void *data)
+static Eina_Bool
+_bounce_eval(void *data,
+ Eo *o EINA_UNUSED,
+ const Eo_Event_Description *desc EINA_UNUSED,
+ void *event_info EINA_UNUSED)
{
Evas_Object *obj = data;
ELM_PHOTOCAM_DATA_GET(obj, sd);
if ((sd->g_layer_zoom.imx == sd->g_layer_zoom.bounce.x_end) &&
(sd->g_layer_zoom.imy == sd->g_layer_zoom.bounce.y_end))
- {
- sd->g_layer_zoom.imx = 0;
- sd->g_layer_zoom.imy = 0;
- sd->zoom_g_layer = EINA_FALSE;
- sd->g_layer_zoom.bounce.animator = NULL;
-
- eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
-
- return ECORE_CALLBACK_CANCEL;
- }
+ goto on_end;
t = ecore_loop_time_get();
tt = (t - sd->g_layer_zoom.bounce.t_start) /
if (t > sd->g_layer_zoom.bounce.t_end)
{
- sd->g_layer_zoom.imx = 0;
- sd->g_layer_zoom.imy = 0;
- sd->zoom_g_layer = EINA_FALSE;
-
- eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
-
_zoom_do(obj, 1.0);
- sd->g_layer_zoom.bounce.animator = NULL;
- return ECORE_CALLBACK_CANCEL;
+ goto on_end;
}
if (sd->g_layer_zoom.imx != sd->g_layer_zoom.bounce.x_end)
_zoom_do(obj, 1.0 - (1.0 - tt));
- return ECORE_CALLBACK_RENEW;
+ return EO_CALLBACK_CONTINUE;
+
+ on_end:
+ sd->g_layer_zoom.imx = 0;
+ sd->g_layer_zoom.imy = 0;
+ sd->zoom_g_layer = EINA_FALSE;
+
+ eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
+
+ eo_do(obj,
+ eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _bounce_eval, obj));
+ return EO_CALLBACK_CONTINUE;
+}
+
+static void
+_elm_photocam_bounce_reset(Eo *obj, Elm_Photocam_Data *sd EINA_UNUSED)
+{
+ Eina_Bool r;
+
+ eo_do(obj,
+ r = eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _bounce_eval, obj));
+ if (r) _zoom_do(obj, 1.0);
+}
+
+static void
+_elm_photocam_zoom_reset(Eo *obj, Elm_Photocam_Data *sd)
+{
+ Eina_Bool r;
+
+ eo_do(obj,
+ r = eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj));
+ if (r)
+ {
+ sd->no_smooth--;
+ if (!sd->no_smooth) _smooth_update(obj);
+ _zoom_do(obj, 1.0);
+ eo_do(obj, eo_event_callback_call(EVAS_ZOOMABLE_INTERFACE_EVENT_ZOOM_STOP, NULL));
+ }
}
static void
Evas_Coord rw = 0, rh = 0;
int x, y, w, h;
- ELM_SAFE_FREE(sd->g_layer_zoom.bounce.animator, ecore_animator_del);
+ _elm_photocam_bounce_reset(obj, sd);
sd->zoom_g_layer = EINA_TRUE;
eo_do(obj, elm_interface_scrollable_freeze_set(EINA_TRUE));
sd->g_layer_zoom.bounce.t_end = t +
_elm_config->page_scroll_friction;
- sd->g_layer_zoom.bounce.animator =
- ecore_animator_add(_bounce_eval, obj);
+ eo_do(obj,
+ eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _bounce_eval, obj));
}
else
{
ecore_job_del(sd->calc_job);
ecore_timer_del(sd->scr_timer);
ecore_timer_del(sd->long_timer);
- ecore_animator_del(sd->zoom_animator);
- ecore_animator_del(sd->g_layer_zoom.bounce.animator);
+ eo_do(obj,
+ eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj),
+ eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _bounce_eval, obj));
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
}
unsigned int i;
_grid_clear_all(obj);
- ELM_SAFE_FREE(sd->g_layer_zoom.bounce.animator, ecore_animator_del);
- if (sd->zoom_animator)
- {
- sd->no_smooth--;
- if (sd->no_smooth == 0) _smooth_update(obj);
- ecore_animator_del(sd->zoom_animator);
- sd->zoom_animator = NULL;
- }
+ _elm_photocam_zoom_reset(obj, sd);
+ _elm_photocam_bounce_reset(obj, sd);
+ sd->no_smooth--;
+ if (sd->no_smooth == 0) _smooth_update(obj);
+
ecore_job_del(sd->calc_job);
evas_object_hide(sd->img);
if (sd->f) eina_file_close(sd->f);
{
double z;
Eina_List *l;
- Ecore_Animator *an;
Elm_Phocam_Grid *g, *g_zoom = NULL;
Evas_Coord pw, ph, rx, ry, rw, rh;
int zoom_changed = 0, started = 0;
+ Eina_Bool an = EINA_FALSE;
if (zoom <= (1.0 / 256.0)) zoom = (1.0 / 256.0);
if (zoom == sd->zoom) return;
}
else
{
- if (!sd->zoom_animator)
+ eo_do(obj,
+ an = eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj),
+ eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _zoom_anim_cb, obj));
+ if (!an)
{
- sd->zoom_animator = ecore_animator_add(_zoom_anim_cb, obj);
sd->no_smooth++;
if (sd->no_smooth == 1) _smooth_update(obj);
started = 1;
}
}
- an = sd->zoom_animator;
if (an)
{
- if (!_zoom_anim_cb(obj))
+ // FIXME: If one day we do support partial animator in photocam, this would require change
+ if (!_zoom_anim_cb(obj, evas_object_evas_get(obj), NULL, NULL))
{
- ecore_animator_del(an);
- an = NULL;
+ _elm_photocam_bounce_reset(obj, sd);
+ an = 0;
}
}
if (rh < 1) rh = 1;
if ((rx + rw) > sd->size.w) rx = sd->size.w - rw;
if ((ry + rh) > sd->size.h) ry = sd->size.h - rh;
- if (sd->g_layer_zoom.bounce.animator)
- {
- ecore_animator_del(sd->g_layer_zoom.bounce.animator);
- sd->g_layer_zoom.bounce.animator = NULL;
- _zoom_do(obj, 1.0);
- }
- if (sd->zoom_animator)
- {
- sd->no_smooth--;
- ecore_animator_del(sd->zoom_animator);
- sd->zoom_animator = NULL;
- _zoom_do(obj, 1.0);
- eo_do(obj, eo_event_callback_call(EVAS_ZOOMABLE_INTERFACE_EVENT_ZOOM_STOP, NULL));
- }
+
+ _elm_photocam_bounce_reset(obj, sd);
+ _elm_photocam_zoom_reset(obj, sd);
+
eo_do(obj, elm_interface_scrollable_content_region_show(rx, ry, rw, rh));
}
if (rh < 1) rh = 1;
if ((rx + rw) > sd->size.w) rx = sd->size.w - rw;
if ((ry + rh) > sd->size.h) ry = sd->size.h - rh;
- if (sd->g_layer_zoom.bounce.animator)
- {
- ecore_animator_del(sd->g_layer_zoom.bounce.animator);
- sd->g_layer_zoom.bounce.animator = NULL;
- _zoom_do(obj, 1.0);
- }
- if (sd->zoom_animator)
- {
- sd->no_smooth--;
- if (!sd->no_smooth) _smooth_update(obj);
- ecore_animator_del(sd->zoom_animator);
- sd->zoom_animator = NULL;
- _zoom_do(obj, 1.0);
- eo_do(obj, eo_event_callback_call(EVAS_ZOOMABLE_INTERFACE_EVENT_ZOOM_STOP, NULL));
- }
+
+ _elm_photocam_bounce_reset(obj, sd);
+ _elm_photocam_zoom_reset(obj, sd);
+
eo_do_super(obj, MY_CLASS, elm_interface_scrollable_region_bring_in(rx, ry, rw, rh));
}
sd->paused = paused;
if (!sd->paused) return;
- if (sd->g_layer_zoom.bounce.animator)
- {
- ecore_animator_del(sd->g_layer_zoom.bounce.animator);
- sd->g_layer_zoom.bounce.animator = NULL;
- _zoom_do(obj, 1.0);
- }
- if (sd->zoom_animator)
- {
- ecore_animator_del(sd->zoom_animator);
- sd->zoom_animator = NULL;
- _zoom_do(obj, 1.0);
- eo_do(obj, eo_event_callback_call(EVAS_ZOOMABLE_INTERFACE_EVENT_ZOOM_STOP, NULL));
- }
+ _elm_photocam_bounce_reset(obj, sd);
+ _elm_photocam_zoom_reset(obj, sd);
}
EOLIAN static Eina_Bool