1 #include <Elementary.h>
5 * @defgroup Photocam Photocam
7 * This is a widget specifically for displaying high-resolution digital
8 * camera photos giving speedy feedback (fast load), low memory footprint
9 * and zooming and panning as well as fitting logic. It is entirely focused
10 * on jpeg images, and takes advantage of properties of the jpeg format (via
11 * evas loader features in the jpeg loader).
13 * Signals that you can add callbacks for are:
15 * clicked - This is called when a user has clicked the photo without dragging
18 * press - This is called when a user has pressed down on the photo.
20 * longpressed - This is called when a user has pressed down on the photo for
21 * a long time without dragging around.
23 * clicked,double - This is called when a user has double-clicked the photo.
25 * load - Photo load begins.
27 * loaded - This is called when the image file load is complete for the first
28 * view (low resolution blurry version).
30 * load,details - Photo detailed data load begins.
32 * loaded,details - This is called when the image file load is complete for the
33 * detailed image data (full resolution needed).
35 * zoom,start - Zoom animation started.
37 * zoom,stop - Zoom animation stopped.
39 * zoom,change - Zoom changed when using an auto zoom mode.
41 * scroll - the content has been scrolled (moved)
43 * scroll,anim,start - scrolling animation has started
45 * scroll,anim,stop - scrolling animation has stopped
47 * scroll,drag,start - dragging the contents around has started
49 * scroll,drag,stop - dragging the contents around has stopped
53 * TODO (maybe - optional future stuff):
55 * 1. wrap photo in theme edje so u can have styling around photo (like white
58 * 3. rotation flags in exif handling (nasty! should have rot in evas)
61 typedef struct _Widget_Data Widget_Data;
62 typedef struct _Pan Pan;
63 typedef struct _Grid Grid;
64 typedef struct _Grid_Item Grid_Item;
80 int tsize; // size of tile (tsize x tsize pixels)
81 int zoom; // zoom level tiles want for optimal display (1, 2, 4, 8)
82 int iw, ih; // size of image in pixels
83 int w, h; // size of grid image in pixels (represented by grid)
84 int gw, gh; // size of grid in tiles
85 Grid_Item *grid; // the grid (gw * gh items)
86 Eina_Bool dead : 1; // old grid. will die as soon as anim is over
93 Evas_Object *pan_smart;
95 Evas_Coord pan_x, pan_y, minw, minh;
98 Elm_Photocam_Zoom_Mode mode;
102 Ecore_Timer *scr_timer;
103 Ecore_Timer *long_timer;
104 Ecore_Animator *zoom_animator;
105 double t_start, t_end;
119 Evas_Coord x, y ,w ,h;
122 Evas_Object *img; // low res version of image (scale down == 8)
126 Eina_Bool main_load_pending : 1;
127 Eina_Bool resized : 1;
128 Eina_Bool longpressed : 1;
129 Eina_Bool on_hold : 1;
130 Eina_Bool paused : 1;
135 Evas_Object_Smart_Clipped_Data __clipped_data;
139 static const char *widtype = NULL;
140 static void _del_hook(Evas_Object *obj);
141 static void _theme_hook(Evas_Object *obj);
142 static void _on_focus_hook(void *data, Evas_Object *obj);
143 //static void _show_region_hook(void *data, Evas_Object *obj);
144 static void _sizing_eval(Evas_Object *obj);
145 static void _calc_job(void *data);
146 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
147 Evas_Callback_Type type, void *event_info);
148 static void grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh);
149 static void grid_clear(Evas_Object *obj, Grid *g);
150 static Grid *grid_create(Evas_Object *obj);
151 static void grid_load(Evas_Object *obj, Grid *g);
154 nearest_pow2(int num)
156 unsigned int n = num - 1;
166 img_place(Evas_Object *obj, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
168 Widget_Data *wd = elm_widget_data_get(obj);
169 Evas_Coord ax, ay, gw, gh;
175 if (ow > gw) ax = (ow - gw) / 2;
176 if (oh > gh) ay = (oh - gh) / 2;
177 evas_object_move(wd->img, ox + 0 - px + ax, oy + 0 - py + ay);
178 evas_object_resize(wd->img, gw, gh);
182 wd->show.show = EINA_FALSE;
183 elm_smart_scroller_child_region_show(wd->scr, wd->show.x, wd->show.y, wd->show.w, wd->show.h);
188 grid_place(Evas_Object *obj, Grid *g, Evas_Coord px, Evas_Coord py, Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
190 Widget_Data *wd = elm_widget_data_get(obj);
191 Evas_Coord ax, ay, gw, gh, tx, ty;
198 if (ow > gw) ax = (ow - gw) / 2;
199 if (oh > gh) ay = (oh - gh) / 2;
200 for (y = 0; y < g->gh; y++)
202 for (x = 0; x < g->gw; x++)
204 int tn, xx, yy, ww, hh;
206 tn = (y * g->gw) + x;
207 xx = g->grid[tn].out.x;
208 yy = g->grid[tn].out.y;
209 ww = g->grid[tn].out.w;
210 hh = g->grid[tn].out.h;
211 if ((gw != g->w) && (g->w > 0))
214 xx = (gw * xx) / g->w;
215 ww = ((gw * (tx + ww)) / g->w) - xx;
217 if ((gh != g->h) && (g->h > 0))
220 yy = (gh * yy) / g->h;
221 hh = ((gh * (ty + hh)) / g->h) - yy;
223 evas_object_move(g->grid[tn].img,
226 evas_object_resize(g->grid[tn].img, ww, hh);
232 grid_clear(Evas_Object *obj, Grid *g)
234 Widget_Data *wd = elm_widget_data_get(obj);
237 if (!g->grid) return;
238 for (y = 0; y < g->gh; y++)
240 for (x = 0; x < g->gw; x++)
244 tn = (y * g->gw) + x;
245 evas_object_del(g->grid[tn].img);
246 if (g->grid[tn].want)
249 if (!wd->preload_num)
251 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
252 "elm,state,busy,stop", "elm");
253 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
265 _tile_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
267 Grid_Item *git = data;
272 evas_object_show(git->img);
274 git->wd->preload_num--;
275 if (!git->wd->preload_num)
277 edje_object_signal_emit(elm_smart_scroller_edje_object_get(git->wd->scr),
278 "elm,state,busy,stop", "elm");
279 evas_object_smart_callback_call(git->wd->obj, "loaded,detail", NULL);
285 grid_zoom_calc(double zoom)
289 return nearest_pow2(z);
293 grid_create(Evas_Object *obj)
295 Widget_Data *wd = elm_widget_data_get(obj);
299 if (!wd) return NULL;
300 g = calloc(1, sizeof(Grid));
302 g->zoom = grid_zoom_calc(wd->zoom);
303 g->tsize = wd->tsize;
304 g->iw = wd->size.imw;
305 g->ih = wd->size.imh;
307 g->w = g->iw / g->zoom;
308 g->h = g->ih / g->zoom;
309 if (g->zoom >= 8) return NULL;
310 g->gw = (g->w + g->tsize - 1) / g->tsize;
311 g->gh = (g->h + g->tsize - 1) / g->tsize;
312 g->grid = calloc(1, sizeof(Grid_Item) * g->gw * g->gh);
319 for (y = 0; y < g->gh; y++)
321 for (x = 0; x < g->gw; x++)
325 tn = (y * g->gw) + x;
326 g->grid[tn].src.x = x * g->tsize;
327 if (x == (g->gw - 1))
328 g->grid[tn].src.w = g->w - ((g->gw - 1) * g->tsize);
330 g->grid[tn].src.w = g->tsize;
331 g->grid[tn].src.y = y * g->tsize;
332 if (y == (g->gh - 1))
333 g->grid[tn].src.h = g->h - ((g->gh - 1) * g->tsize);
335 g->grid[tn].src.h = g->tsize;
337 g->grid[tn].out.x = g->grid[tn].src.x;
338 g->grid[tn].out.y = g->grid[tn].src.y;
339 g->grid[tn].out.w = g->grid[tn].src.w;
340 g->grid[tn].out.h = g->grid[tn].src.h;
344 evas_object_image_add(evas_object_evas_get(obj));
345 evas_object_image_scale_hint_set
346 (g->grid[tn].img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
347 evas_object_pass_events_set(g->grid[tn].img, EINA_TRUE);
348 evas_object_smart_member_add(g->grid[tn].img,
350 elm_widget_sub_object_add(obj, g->grid[tn].img);
351 evas_object_image_filled_set(g->grid[tn].img, 1);
352 evas_object_event_callback_add(g->grid[tn].img,
353 EVAS_CALLBACK_IMAGE_PRELOADED,
362 grid_load(Evas_Object *obj, Grid *g)
364 Widget_Data *wd = elm_widget_data_get(obj);
366 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh, gw, gh, tx, ty;
368 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
369 evas_output_viewport_get(evas_object_evas_get(wd->obj), &cvx, &cvy, &cvw, &cvh);
372 for (y = 0; y < g->gh; y++)
374 for (x = 0; x < g->gw; x++)
376 int tn, xx, yy, ww, hh;
377 Eina_Bool visible = EINA_FALSE;
379 tn = (y * g->gw) + x;
380 xx = g->grid[tn].out.x;
381 yy = g->grid[tn].out.y;
382 ww = g->grid[tn].out.w;
383 hh = g->grid[tn].out.h;
384 if ((gw != g->w) && (g->w > 0))
387 xx = (gw * xx) / g->w;
388 ww = ((gw * (tx + ww)) / g->w) - xx;
390 if ((gh != g->h) && (g->h > 0))
393 yy = (gh * yy) / g->h;
394 hh = ((gh * (ty + hh)) / g->h) - yy;
396 if (ELM_RECTS_INTERSECT(xx - wd->pan_x + ox,
401 if ((visible) && (!g->grid[tn].have) && (!g->grid[tn].want))
403 g->grid[tn].want = 1;
404 evas_object_hide(g->grid[tn].img);
405 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
406 evas_object_image_load_scale_down_set(g->grid[tn].img, g->zoom);
407 evas_object_image_load_region_set(g->grid[tn].img,
412 evas_object_image_file_set(g->grid[tn].img, wd->file, NULL);
413 evas_object_image_preload(g->grid[tn].img, 0);
415 if (wd->preload_num == 1)
417 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
418 "elm,state,busy,start", "elm");
419 evas_object_smart_callback_call(obj, "load,detail", NULL);
422 else if ((g->grid[tn].want) && (!visible))
425 if (!wd->preload_num)
427 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
428 "elm,state,busy,stop", "elm");
429 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
431 g->grid[tn].want = 0;
432 evas_object_hide(g->grid[tn].img);
433 evas_object_image_preload(g->grid[tn].img, 1);
434 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
436 else if ((g->grid[tn].have) && (!visible))
438 g->grid[tn].have = 0;
439 evas_object_hide(g->grid[tn].img);
440 evas_object_image_preload(g->grid[tn].img, 1);
441 evas_object_image_file_set(g->grid[tn].img, NULL, NULL);
448 grid_clearall(Evas_Object *obj)
450 Widget_Data *wd = elm_widget_data_get(obj);
453 EINA_LIST_FREE(wd->grids, g)
461 _smooth_update(Evas_Object *obj)
463 Widget_Data *wd = elm_widget_data_get(obj);
468 EINA_LIST_FOREACH(wd->grids, l, g)
470 for (y = 0; y < g->gh; y++)
472 for (x = 0; x < g->gw; x++)
476 tn = (y * g->gw) + x;
477 evas_object_image_smooth_scale_set(g->grid[tn].img, (!wd->nosmooth));
481 evas_object_image_smooth_scale_set(wd->img, (!wd->nosmooth));
489 for (y = 0; y < g->gh; y++)
491 for (x = 0; x < g->gw; x++)
495 tn = (y * g->gw) + x;
496 evas_object_raise(g->grid[tn].img);
502 _scr_timeout(void *data)
504 Widget_Data *wd = elm_widget_data_get(data);
505 if (!wd) return ECORE_CALLBACK_CANCEL;
507 if (!wd->nosmooth) _smooth_update(data);
508 wd->scr_timer = NULL;
509 return ECORE_CALLBACK_CANCEL;
513 _scr(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
515 Widget_Data *wd = elm_widget_data_get(data);
520 if (wd->nosmooth == 1) _smooth_update(data);
522 if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
523 wd->scr_timer = ecore_timer_add(0.5, _scr_timeout, data);
527 _main_preloaded(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
529 Evas_Object *obj = data;
530 Widget_Data *wd = elm_widget_data_get(obj);
533 evas_object_show(wd->img);
534 wd->main_load_pending = 0;
535 g = grid_create(obj);
538 wd->grids = eina_list_prepend(wd->grids, g);
539 grid_load(wd->obj, g);
541 if (wd->calc_job) ecore_job_del(wd->calc_job);
542 wd->calc_job = ecore_job_add(_calc_job, wd);
543 evas_object_smart_callback_call(data, "loaded", NULL);
545 if (!wd->preload_num)
547 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
548 "elm,state,busy,stop", "elm");
549 evas_object_smart_callback_call(obj, "loaded,detail", NULL);
554 zoom_do(Evas_Object *obj, double t)
556 Widget_Data *wd = elm_widget_data_get(obj);
557 Evas_Coord xx, yy, ow, oh;
558 if (!wd) return ECORE_CALLBACK_CANCEL;
559 wd->size.w = (wd->size.ow * (1.0 - t)) + (wd->size.nw * t);
560 wd->size.h = (wd->size.oh * (1.0 - t)) + (wd->size.nh * t);
561 elm_smart_scroller_child_viewport_size_get(wd->scr, &ow, &oh);
562 xx = (wd->size.spos.x * wd->size.w) - (ow / 2);
563 yy = (wd->size.spos.y * wd->size.h) - (oh / 2);
565 else if (xx > (wd->size.w - ow)) xx = wd->size.w - ow;
567 else if (yy > (wd->size.h - oh)) yy = wd->size.h - oh;
569 wd->show.show = EINA_TRUE;
575 if (wd->calc_job) ecore_job_del(wd->calc_job);
576 wd->calc_job = ecore_job_add(_calc_job, wd);
579 Eina_List *l, *l_next;
582 EINA_LIST_FOREACH_SAFE(wd->grids, l, l_next, g)
586 wd->grids = eina_list_remove_list(wd->grids, l);
591 return ECORE_CALLBACK_CANCEL;
593 return ECORE_CALLBACK_RENEW;
598 _zoom_anim(void *data)
600 Evas_Object *obj = data;
601 Widget_Data *wd = elm_widget_data_get(obj);
604 if (!wd) return ECORE_CALLBACK_CANCEL;
605 t = ecore_loop_time_get();
608 else if (wd->t_end > wd->t_start)
609 t = (t - wd->t_start) / (wd->t_end - wd->t_start);
614 go = zoom_do(obj, t);
618 if (!wd->nosmooth) _smooth_update(data);
619 wd->zoom_animator = NULL;
620 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
626 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
628 Widget_Data *wd = elm_widget_data_get(data);
629 // Evas_Event_Mouse_Move *ev = event_info;
634 _long_press(void *data)
636 Widget_Data *wd = elm_widget_data_get(data);
637 if (!wd) return ECORE_CALLBACK_CANCEL;
638 wd->long_timer = NULL;
639 wd->longpressed = EINA_TRUE;
640 evas_object_smart_callback_call(data, "longpressed", NULL);
641 return ECORE_CALLBACK_CANCEL;
645 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
647 Widget_Data *wd = elm_widget_data_get(data);
648 Evas_Event_Mouse_Down *ev = event_info;
650 if (ev->button != 1) return;
651 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
652 else wd->on_hold = EINA_FALSE;
653 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
654 evas_object_smart_callback_call(data, "clicked,double", NULL);
656 evas_object_smart_callback_call(data, "press", NULL);
657 wd->longpressed = EINA_FALSE;
658 if (wd->long_timer) ecore_timer_del(wd->long_timer);
659 wd->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
663 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
665 Widget_Data *wd = elm_widget_data_get(data);
666 Evas_Event_Mouse_Up *ev = event_info;
668 if (ev->button != 1) return;
669 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
670 else wd->on_hold = EINA_FALSE;
673 ecore_timer_del(wd->long_timer);
674 wd->long_timer = NULL;
677 evas_object_smart_callback_call(data, "clicked", NULL);
678 wd->on_hold = EINA_FALSE;
681 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_NULL;
684 _del_hook(Evas_Object *obj)
686 Widget_Data *wd = elm_widget_data_get(obj);
689 EINA_LIST_FREE(wd->grids, g)
691 if (g->grid) free(g->grid);
694 evas_object_del(wd->pan_smart);
695 wd->pan_smart = NULL;
696 if (wd->file) eina_stringshare_del(wd->file);
697 if (wd->calc_job) ecore_job_del(wd->calc_job);
698 if (wd->scr_timer) ecore_timer_del(wd->scr_timer);
699 if (wd->zoom_animator) ecore_animator_del(wd->zoom_animator);
700 if (wd->long_timer) ecore_timer_del(wd->long_timer);
705 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
707 Widget_Data *wd = elm_widget_data_get(obj);
709 if (elm_widget_focus_get(obj))
711 edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
712 evas_object_focus_set(wd->obj, EINA_TRUE);
716 edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
717 evas_object_focus_set(wd->obj, EINA_FALSE);
722 _theme_hook(Evas_Object *obj)
724 Widget_Data *wd = elm_widget_data_get(obj);
726 elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", elm_widget_style_get(obj));
727 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
733 _show_region_hook(void *data, Evas_Object *obj)
735 Widget_Data *wd = elm_widget_data_get(data);
736 Evas_Coord x, y, w, h;
738 elm_widget_show_region_get(obj, &x, &y, &w, &h);
739 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
744 _sizing_eval(Evas_Object *obj)
746 Widget_Data *wd = elm_widget_data_get(obj);
747 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
749 // evas_object_size_hint_min_get(wd->scr, &minw, &minh);
750 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
753 // if (wd->mode != ELM_LIST_LIMIT) minw = -1;
754 evas_object_size_hint_min_set(obj, minw, minh);
755 evas_object_size_hint_max_set(obj, maxw, maxh);
759 _calc_job(void *data)
761 Widget_Data *wd = data;
762 Evas_Coord minw, minh;
769 if (wd->mode != ELM_PHOTOCAM_ZOOM_MODE_MANUAL)
771 double tz = wd->zoom;
773 elm_photocam_zoom_set(wd->obj, tz);
776 if ((minw != wd->minw) || (minh != wd->minh))
780 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
781 _sizing_eval(wd->obj);
784 evas_object_smart_changed(wd->pan_smart);
788 _pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
790 Pan *sd = evas_object_smart_data_get(obj);
792 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
795 evas_object_smart_changed(obj);
799 _pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
801 Pan *sd = evas_object_smart_data_get(obj);
803 if (x) *x = sd->wd->pan_x;
804 if (y) *y = sd->wd->pan_y;
808 _pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
810 Pan *sd = evas_object_smart_data_get(obj);
813 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
814 ow = sd->wd->minw - ow;
816 oh = sd->wd->minh - oh;
823 _pan_min_get(Evas_Object *obj __UNUSED__, Evas_Coord *x, Evas_Coord *y)
830 _pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
832 Pan *sd = evas_object_smart_data_get(obj);
834 if (w) *w = sd->wd->minw;
835 if (h) *h = sd->wd->minh;
839 _pan_add(Evas_Object *obj)
842 Evas_Object_Smart_Clipped_Data *cd;
844 cd = evas_object_smart_data_get(obj);
846 sd = calloc(1, sizeof(Pan));
848 sd->__clipped_data = *cd;
850 evas_object_smart_data_set(obj, sd);
854 _pan_del(Evas_Object *obj)
856 Pan *sd = evas_object_smart_data_get(obj);
862 _pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
864 Pan *sd = evas_object_smart_data_get(obj);
867 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
868 if ((ow == w) && (oh == h)) return;
870 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
871 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
875 _pan_calculate(Evas_Object *obj)
877 Pan *sd = evas_object_smart_data_get(obj);
878 Evas_Coord ox, oy, ow, oh;
882 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
883 img_place(sd->wd->obj, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
884 EINA_LIST_FOREACH(sd->wd->grids, l, g)
886 grid_load(sd->wd->obj, g);
887 grid_place(sd->wd->obj, g, sd->wd->pan_x, sd->wd->pan_y, ox, oy, ow, oh);
892 _pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
894 Pan *sd = evas_object_smart_data_get(obj);
896 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
897 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
901 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
903 Widget_Data *wd = elm_widget_data_get(obj);
905 elm_smart_scroller_hold_set(wd->scr, 1);
909 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
911 Widget_Data *wd = elm_widget_data_get(obj);
913 elm_smart_scroller_hold_set(wd->scr, 0);
917 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
919 Widget_Data *wd = elm_widget_data_get(obj);
921 elm_smart_scroller_freeze_set(wd->scr, 1);
925 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
927 Widget_Data *wd = elm_widget_data_get(obj);
929 elm_smart_scroller_freeze_set(wd->scr, 0);
933 _scr_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
935 evas_object_smart_callback_call(data, "scroll,anim,start", NULL);
939 _scr_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
941 evas_object_smart_callback_call(data, "scroll,anim,stop", NULL);
945 _scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
947 evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
951 _scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
953 evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
957 _scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
959 evas_object_smart_callback_call(data, "scroll", NULL);
963 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
964 Evas_Callback_Type type, void *event_info)
967 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
968 Evas_Event_Key_Down *ev = event_info;
969 Widget_Data *wd = elm_widget_data_get(obj);
970 if (!wd) return EINA_FALSE;
971 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
975 Evas_Coord step_x = 0;
976 Evas_Coord step_y = 0;
979 Evas_Coord page_x = 0;
980 Evas_Coord page_y = 0;
982 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
983 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
984 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
985 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
987 if ((!strcmp(ev->keyname, "Left")) ||
988 (!strcmp(ev->keyname, "KP_Left")))
992 else if ((!strcmp(ev->keyname, "Right")) ||
993 (!strcmp(ev->keyname, "KP_Right")))
997 else if ((!strcmp(ev->keyname, "Up")) ||
998 (!strcmp(ev->keyname, "KP_Up")))
1002 else if ((!strcmp(ev->keyname, "Down")) ||
1003 (!strcmp(ev->keyname, "KP_Down")))
1007 else if ((!strcmp(ev->keyname, "Prior")) ||
1008 (!strcmp(ev->keyname, "KP_Prior")))
1011 y -= -(page_y * v_h) / 100;
1015 else if ((!strcmp(ev->keyname, "Next")) ||
1016 (!strcmp(ev->keyname, "KP_Next")))
1019 y += -(page_y * v_h) / 100;
1023 else if ((!strcmp(ev->keyname, "KP_Add")))
1025 zoom = elm_photocam_zoom_get(obj);
1027 elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
1028 elm_photocam_zoom_set(obj, zoom);
1031 else if ((!strcmp(ev->keyname, "KP_Subtract")))
1033 zoom = elm_photocam_zoom_get(obj);
1035 elm_photocam_zoom_mode_set(obj, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
1036 elm_photocam_zoom_set(obj, zoom);
1039 else return EINA_FALSE;
1041 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1042 elm_smart_scroller_child_pos_set(wd->scr, x, y);
1048 * Add a new Photocam object
1050 * @param parent The parent object
1051 * @return The new object or NULL if it cannot be created
1056 elm_photocam_add(Evas_Object *parent)
1061 Evas_Coord minw, minh;
1062 static Evas_Smart *smart = NULL;
1063 Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
1065 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1067 ELM_SET_WIDTYPE(widtype, "photocam");
1068 elm_widget_type_set(obj, "photocam");
1069 elm_widget_sub_object_add(parent, obj);
1070 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1071 elm_widget_data_set(obj, wd);
1072 elm_widget_del_hook_set(obj, _del_hook);
1073 elm_widget_theme_hook_set(obj, _theme_hook);
1074 elm_widget_can_focus_set(obj, EINA_TRUE);
1075 elm_widget_event_hook_set(obj, _event_hook);
1077 wd->scr = elm_smart_scroller_add(e);
1078 elm_smart_scroller_widget_set(wd->scr, obj);
1079 elm_smart_scroller_object_theme_set(obj, wd->scr, "photocam", "base", "default");
1080 evas_object_smart_callback_add(wd->scr, "scroll", _scr, obj);
1081 evas_object_smart_callback_add(wd->scr, "drag", _scr, obj);
1082 elm_widget_resize_object_set(obj, wd->scr);
1084 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
1085 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
1086 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
1087 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
1088 evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
1090 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce);
1094 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
1095 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
1096 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
1097 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
1101 static Evas_Smart_Class sc;
1103 evas_object_smart_clipped_smart_set(&_pan_sc);
1105 sc.name = "elm_photocam_pan";
1106 sc.version = EVAS_SMART_CLASS_VERSION;
1109 sc.resize = _pan_resize;
1110 sc.move = _pan_move;
1111 sc.calculate = _pan_calculate;
1112 smart = evas_smart_class_new(&sc);
1116 wd->pan_smart = evas_object_smart_add(e, smart);
1117 wd->pan = evas_object_smart_data_get(wd->pan_smart);
1121 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
1122 _pan_set, _pan_get, _pan_max_get,
1123 _pan_min_get, _pan_child_size_get);
1126 wd->mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL;
1130 wd->img = evas_object_image_add(e);
1131 evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_DYNAMIC);
1132 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_DOWN,
1134 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,
1136 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_MOVE,
1138 evas_object_image_scale_hint_set(wd->img, EVAS_IMAGE_SCALE_HINT_STATIC);
1139 evas_object_smart_member_add(wd->img, wd->pan_smart);
1140 elm_widget_sub_object_add(obj, wd->img);
1141 evas_object_image_filled_set(wd->img, 1);
1142 evas_object_event_callback_add(wd->img, EVAS_CALLBACK_IMAGE_PRELOADED,
1143 _main_preloaded, obj);
1145 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
1147 evas_object_size_hint_min_set(obj, minw, minh);
1154 * Set the photo file to be shown
1156 * This sets (and shows) the specified file (with a relative or absolute path)
1157 * and will return a load error (same error that
1158 * evas_object_image_load_error_get() will return). The image will change and
1159 * adjust its size at this point and begin a background load process for this
1160 * photo that at some time in the future will be displayed at the full quality
1163 * @param obj The photocam object
1164 * @param file The photo file
1165 * @return The return error (see EVAS_LOAD_ERROR_NONE, EVAS_LOAD_ERROR_GENERIC etc.)
1169 EAPI Evas_Load_Error
1170 elm_photocam_file_set(Evas_Object *obj, const char *file)
1172 ELM_CHECK_WIDTYPE(obj, widtype) EVAS_LOAD_ERROR_NONE;
1173 Widget_Data *wd = elm_widget_data_get(obj);
1175 if (!wd) return EVAS_LOAD_ERROR_GENERIC;
1176 if (!eina_stringshare_replace(&wd->file, file)) return EVAS_LOAD_ERROR_NONE;
1179 evas_object_hide(wd->img);
1180 evas_object_image_smooth_scale_set(wd->img, (wd->nosmooth == 0));
1181 evas_object_image_file_set(wd->img, NULL, NULL);
1182 evas_object_image_load_scale_down_set(wd->img, 0);
1183 evas_object_image_file_set(wd->img, wd->file, NULL);
1184 evas_object_image_size_get(wd->img, &w, &h);
1187 wd->size.w = wd->size.imw / wd->zoom;
1188 wd->size.h = wd->size.imh / wd->zoom;
1189 if (wd->zoom_animator)
1192 if (wd->nosmooth == 0) _smooth_update(obj);
1193 ecore_animator_del(wd->zoom_animator);
1194 wd->zoom_animator = NULL;
1196 evas_object_image_file_set(wd->img, NULL, NULL);
1197 evas_object_image_load_scale_down_set(wd->img, 8);
1198 evas_object_image_file_set(wd->img, wd->file, NULL);
1199 evas_object_image_preload(wd->img, 0);
1200 wd->main_load_pending = 1;
1201 if (wd->calc_job) ecore_job_del(wd->calc_job);
1202 wd->calc_job = ecore_job_add(_calc_job, wd);
1203 evas_object_smart_callback_call(obj, "load", NULL);
1205 if (wd->preload_num == 1)
1207 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
1208 "elm,state,busy,start", "elm");
1209 evas_object_smart_callback_call(obj, "load,detail", NULL);
1212 double tz = wd->zoom;
1214 elm_photocam_zoom_set(wd->obj, tz);
1216 return evas_object_image_load_error_get(wd->img);
1220 * Returns the path of the current image file
1222 * @param obj The photocam object
1223 * @return Returns the path
1228 elm_photocam_file_get(const Evas_Object *obj)
1230 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1231 Widget_Data *wd = elm_widget_data_get(obj);
1232 if (!wd) return NULL;
1237 * Set the zoom level of the photo
1239 * This sets the zoom level. 1 will be 1:1 pixel for pixel. 2 will be 2:1
1240 * (that is 2x2 photo pixels will display as 1 on-screen pixel). 4:1 will be
1241 * 4x4 photo pixels as 1 screen pixel, and so on. The @p zoom parameter must
1242 * be greater than 0. It is usggested to stick to powers of 2. (1, 2, 4, 8,
1245 * @param obj The photocam object
1246 * @param zoom The zoom level to set
1251 elm_photocam_zoom_set(Evas_Object *obj, double zoom)
1253 ELM_CHECK_WIDTYPE(obj, widtype);
1254 Widget_Data *wd = elm_widget_data_get(obj);
1256 Grid *g, *g_zoom = NULL;
1257 Evas_Coord pw, ph, rx, ry, rw, rh;
1259 int zoom_changed = 0, started = 0;
1262 if (zoom <= (1.0 / 256.0)) zoom = (1.0 / 256.0);
1263 if (zoom == wd->zoom) return;
1265 wd->size.ow = wd->size.w;
1266 wd->size.oh = wd->size.h;
1267 elm_smart_scroller_child_pos_get(wd->scr, &rx, &ry);
1268 elm_smart_scroller_child_viewport_size_get(wd->scr, &rw, &rh);
1269 if ((rw <= 0) || (rh <= 0)) return;
1271 if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_MANUAL)
1273 wd->size.nw = (double)wd->size.imw / wd->zoom;
1274 wd->size.nh = (double)wd->size.imh / wd->zoom;
1276 else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT)
1278 if ((wd->size.imw < 1) || (wd->size.imh < 1))
1285 ph = (wd->size.imh * rw) / wd->size.imw;
1288 pw = (wd->size.imw * rh) / wd->size.imh;
1295 if (wd->size.imw > wd->size.imh)
1296 z = wd->size.imw / pw;
1298 z = wd->size.imh / ph;
1300 else if (z >= 4) z = 4;
1301 else if (z >= 2) z = 2;
1303 if (z != wd->zoom) zoom_changed = 1;
1309 else if (wd->mode == ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL)
1311 if ((wd->size.imw < 1) || (wd->size.imh < 1))
1318 ph = (wd->size.imh * rw) / wd->size.imw;
1321 pw = (wd->size.imw * rh) / wd->size.imh;
1328 if (wd->size.imw > wd->size.imh)
1329 z = wd->size.imw / pw;
1331 z = wd->size.imh / ph;
1333 else if (z >= 4) z = 4;
1334 else if (z >= 2) z = 2;
1336 if (z != wd->zoom) zoom_changed = 1;
1342 if (wd->main_load_pending)
1344 wd->size.w = wd->size.nw;
1345 wd->size.h = wd->size.nh;
1348 EINA_LIST_FOREACH(wd->grids, l, g)
1350 if (g->zoom == grid_zoom_calc(wd->zoom))
1352 wd->grids = eina_list_remove(wd->grids, g);
1353 wd->grids = eina_list_prepend(wd->grids, g);
1358 g = grid_create(obj);
1361 if (eina_list_count(wd->grids) > 1)
1363 g_zoom = eina_list_last(wd->grids)->data;
1364 wd->grids = eina_list_remove(wd->grids, g_zoom);
1365 grid_clear(obj, g_zoom);
1367 EINA_LIST_FOREACH(wd->grids, l, g_zoom)
1372 wd->grids = eina_list_prepend(wd->grids, g);
1376 EINA_LIST_FREE(wd->grids, g)
1383 wd->t_start = ecore_loop_time_get();
1384 wd->t_end = wd->t_start + _elm_config->zoom_friction;
1385 if ((wd->size.w > 0) && (wd->size.h > 0))
1387 wd->size.spos.x = (double)(rx + (rw / 2)) / (double)wd->size.w;
1388 wd->size.spos.y = (double)(ry + (rh / 2)) / (double)wd->size.h;
1392 wd->size.spos.x = 0.5;
1393 wd->size.spos.y = 0.5;
1395 if (rw > wd->size.w) wd->size.spos.x = 0.5;
1396 if (rh > wd->size.h) wd->size.spos.y = 0.5;
1397 if (wd->size.spos.x > 1.0) wd->size.spos.x = 1.0;
1398 if (wd->size.spos.y > 1.0) wd->size.spos.y = 1.0;
1405 if (!wd->zoom_animator)
1407 wd->zoom_animator = ecore_animator_add(_zoom_anim, obj);
1409 if (wd->nosmooth == 1) _smooth_update(obj);
1413 an = wd->zoom_animator;
1416 if (!_zoom_anim(obj))
1418 ecore_animator_del(an);
1422 if (wd->calc_job) ecore_job_del(wd->calc_job);
1423 wd->calc_job = ecore_job_add(_calc_job, wd);
1427 evas_object_smart_callback_call(obj, "zoom,start", NULL);
1429 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1432 evas_object_smart_callback_call(obj, "zoom,change", NULL);
1436 * Get the zoom level of the photo
1438 * This returns the current zoom level of the photocam object. Note that if
1439 * you set the fill mode to other than ELM_PHOTOCAM_ZOOM_MODE_MANUAL
1440 * (which is the default), the zoom level may be changed at any time by the
1441 * photocam object itself to account for photo size and photocam viewpoer size
1443 * @param obj The photocam object
1444 * @return The current zoom level
1449 elm_photocam_zoom_get(const Evas_Object *obj)
1451 ELM_CHECK_WIDTYPE(obj, widtype) 1.0;
1452 Widget_Data *wd = elm_widget_data_get(obj);
1453 if (!wd) return 1.0;
1460 * This sets the zoom mode to manual or one of several automatic levels.
1461 * Manual (ELM_PHOTOCAM_ZOOM_MODE_MANUAL) means that zoom is set manually by
1462 * elm_photocam_zoom_set() and will stay at that level until changed by code
1463 * or until zoom mode is changed. This is the default mode.
1464 * The Automatic modes will allow the photocam object to automatically
1465 * adjust zoom mode based on properties. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT) will
1466 * adjust zoom so the photo fits EXACTLY inside the scroll frame with no pixels
1467 * outside this area. ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL will be similar but
1468 * ensure no pixels within the frame are left unfilled.
1470 * @param obj The photocam object
1471 * @param mode The desired mode
1476 elm_photocam_zoom_mode_set(Evas_Object *obj, Elm_Photocam_Zoom_Mode mode)
1478 ELM_CHECK_WIDTYPE(obj, widtype);
1479 Widget_Data *wd = elm_widget_data_get(obj);
1481 if (wd->mode == mode) return;
1484 double tz = wd->zoom;
1486 elm_photocam_zoom_set(wd->obj, tz);
1493 * This gets the current zoom mode of the photocam object
1495 * @param obj The photocam object
1496 * @return The current zoom mode
1500 EAPI Elm_Photocam_Zoom_Mode
1501 elm_photocam_zoom_mode_get(const Evas_Object *obj)
1503 ELM_CHECK_WIDTYPE(obj, widtype) ELM_PHOTOCAM_ZOOM_MODE_LAST;
1504 Widget_Data *wd = elm_widget_data_get(obj);
1505 if (!wd) return ELM_PHOTOCAM_ZOOM_MODE_LAST;
1510 * Get the current image pixel width and height
1512 * This gets the current photo pixel width and height (for the original).
1513 * The size will be returned in the integers @p w and @p h that are pointed
1516 * @param obj The photocam object
1517 * @param w A pointer to the width return
1518 * @param h A pointer to the height return
1523 elm_photocam_image_size_get(const Evas_Object *obj, int *w, int *h)
1525 ELM_CHECK_WIDTYPE(obj, widtype);
1526 Widget_Data *wd = elm_widget_data_get(obj);
1528 if (w) *w = wd->size.imw;
1529 if (h) *h = wd->size.imh;
1533 * Get the current area of the image that is currently shown
1535 * This gets the region
1539 elm_photocam_region_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
1541 ELM_CHECK_WIDTYPE(obj, widtype);
1542 Widget_Data *wd = elm_widget_data_get(obj);
1543 Evas_Coord sx, sy, sw, sh;
1545 elm_smart_scroller_child_pos_get(wd->scr, &sx, &sy);
1546 elm_smart_scroller_child_viewport_size_get(wd->scr, &sw, &sh);
1551 *x = (wd->size.imw * sx) / wd->size.w;
1552 if (*x > wd->size.imw) *x = wd->size.imw;
1553 else if (*x < 0) *x = 0;
1557 *w = (wd->size.imw * sw) / wd->size.w;
1558 if (*w > wd->size.imw) *w = wd->size.imw;
1559 else if (*w < 0) *w = 0;
1572 *y = (wd->size.imh * sy) / wd->size.h;
1573 if (*y > wd->size.imh) *y = wd->size.imh;
1574 else if (*y < 0) *y = 0;
1578 *h = (wd->size.imh * sh) / wd->size.h;
1579 if (*h > wd->size.imh) *h = wd->size.imh;
1580 else if (*h < 0) *h = 0;
1591 * Set the viewed portion of the image
1593 * This sets the region of the image to be viewed
1595 * @param obj The photocam object
1596 * @param x X-coordinate of region in image original pixels
1597 * @param y Y-coordinate of region in image original pixels
1598 * @param w Width of region in image original pixels
1599 * @param h Height of region in image original pixels
1604 elm_photocam_image_region_show(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1606 ELM_CHECK_WIDTYPE(obj, widtype);
1607 Widget_Data *wd = elm_widget_data_get(obj);
1610 if ((wd->size.imw < 1) || (wd->size.imh < 1)) return;
1611 rx = (x * wd->size.w) / wd->size.imw;
1612 ry = (y * wd->size.h) / wd->size.imh;
1613 rw = (w * wd->size.w) / wd->size.imw;
1614 rh = (w * wd->size.h) / wd->size.imh;
1617 if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
1618 if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
1619 if (wd->zoom_animator)
1622 ecore_animator_del(wd->zoom_animator);
1623 wd->zoom_animator = NULL;
1625 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1627 elm_smart_scroller_child_region_show(wd->scr, rx, ry, rw, rh);
1631 * Bring in the viewed portion of the image
1633 * This brings in the region of the image over time
1635 * @param obj The photocam object
1636 * @param x X-coordinate of region in image original pixels
1637 * @param y Y-coordinate of region in image original pixels
1638 * @param w Width of region in image original pixels
1639 * @param h Height of region in image original pixels
1644 elm_photocam_image_region_bring_in(Evas_Object *obj, int x, int y, int w, int h __UNUSED__)
1646 ELM_CHECK_WIDTYPE(obj, widtype);
1647 Widget_Data *wd = elm_widget_data_get(obj);
1650 if ((wd->size.imw < 1) || (wd->size.imh < 1)) return;
1651 rx = (x * wd->size.w) / wd->size.imw;
1652 ry = (y * wd->size.h) / wd->size.imh;
1653 rw = (w * wd->size.w) / wd->size.imw;
1654 rh = (w * wd->size.h) / wd->size.imh;
1657 if ((rx + rw) > wd->size.w) rx = wd->size.w - rw;
1658 if ((ry + rh) > wd->size.h) ry = wd->size.h - rh;
1659 if (wd->zoom_animator)
1662 if (!wd->nosmooth) _smooth_update(obj);
1663 ecore_animator_del(wd->zoom_animator);
1664 wd->zoom_animator = NULL;
1666 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1668 elm_smart_scroller_region_bring_in(wd->scr, rx, ry, rw, rh);
1672 * Set the paused state for photocam
1674 * This sets the paused state to on (1) or off (0) for photocam. The default
1675 * is on. This will stop zooming using animation ch change zoom levels and
1676 * change instantly. This will stop any existing animations that are running.
1678 * @param obj The photocam object
1679 * @param paused The pause state to set
1684 elm_photocam_paused_set(Evas_Object *obj, Eina_Bool paused)
1686 ELM_CHECK_WIDTYPE(obj, widtype);
1687 Widget_Data *wd = elm_widget_data_get(obj);
1689 if (wd->paused == !!paused) return;
1690 wd->paused = paused;
1693 if (wd->zoom_animator)
1695 ecore_animator_del(wd->zoom_animator);
1696 wd->zoom_animator = NULL;
1698 evas_object_smart_callback_call(obj, "zoom,stop", NULL);
1704 * Get the paused state for photocam
1706 * This gets the current paused state for the photocam object.
1708 * @param obj The photocam object
1709 * @return The current paused state
1714 elm_photocam_paused_get(const Evas_Object *obj)
1716 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1717 Widget_Data *wd = elm_widget_data_get(obj);
1718 if (!wd) return EINA_FALSE;
1723 * Get the internal low-res image used for photocam
1725 * This gets the internal image object inside photocam. Do not modify it. It
1726 * is for inspection only, and hooking callbacks to. Nothing else. It may be
1727 * deleted at any time as well.
1729 * @param obj The photocam object
1730 * @return The internal image object handle, or NULL if none exists
1735 elm_photocam_internal_image_get(const Evas_Object *obj)
1737 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1738 Widget_Data *wd = elm_widget_data_get(obj);
1739 if (!wd) return NULL;
1744 * Set the photocam scrolling bouncing.
1746 * @param obj The photocam object
1747 * @param h_bounce bouncing for horizontal
1748 * @param v_bounce bouncing for vertical
1752 elm_photocam_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
1754 ELM_CHECK_WIDTYPE(obj, widtype);
1755 Widget_Data *wd = elm_widget_data_get(obj);
1757 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
1762 * Get the photocam scrolling bouncing.
1764 * @param obj The photocam object
1765 * @param h_bounce bouncing for horizontal
1766 * @param v_bounce bouncing for vertical
1770 elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
1772 ELM_CHECK_WIDTYPE(obj, widtype);
1773 Widget_Data *wd = elm_widget_data_get(obj);
1775 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);