diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 9f357d9ef0..558b221c9a 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -150,10 +150,6 @@ my_bt_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) eina_list_free(grps); } - - if (file && eina_str_has_extension(file, ".gif") - && efl_playable_get(ph)) - efl_player_autoplay_set(ph, EINA_TRUE); } static void @@ -835,6 +831,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE { printf("animation is available for this image.\n"); efl_player_autoplay_set(zoomable, EINA_TRUE); + efl_player_playback_loop_set(zoomable, EINA_TRUE); } rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win, diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index c1e0eb80f2..9cc59b0dd0 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -137,7 +137,16 @@ _efl_ui_image_animate_cb(void *data) sd->cur_frame++; if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) - sd->cur_frame = sd->cur_frame % sd->frame_count; + { + if (sd->playback_loop) + sd->cur_frame = sd->cur_frame % sd->frame_count; + else + { + sd->anim_timer = NULL; + sd->cur_frame = 0; + return EINA_FALSE; + } + } evas_object_image_animated_frame_set(sd->img, sd->cur_frame); @@ -593,6 +602,7 @@ _efl_ui_image_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Data *priv) { evas_object_event_callback_add (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj); + priv->playback_loop = EINA_TRUE; } else { @@ -1753,6 +1763,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an { edje_object_animation_set(sd->img, anim); sd->anim = anim; + efl_player_playback_loop_set(sd->img, sd->playback_loop); return EINA_TRUE; } sd->img = elm_image_object_get(obj); @@ -1820,6 +1831,19 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd) return _efl_ui_image_animated_get_internal(obj, sd); } +EOLIAN static void +_efl_ui_image_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Bool playback_loop) +{ + playback_loop = !!playback_loop; + sd->playback_loop = playback_loop; +} + +EOLIAN static Eina_Bool +_efl_ui_image_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) +{ + return sd->playback_loop; +} + EOLIAN static void _efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay) { diff --git a/src/lib/elementary/efl_ui_image.eo b/src/lib/elementary/efl_ui_image.eo index 392251e4de..9ebb14982c 100644 --- a/src/lib/elementary/efl_ui_image.eo +++ b/src/lib/elementary/efl_ui_image.eo @@ -104,7 +104,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui. Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } Efl.Player.autoplay { set; get; } - @empty Efl.Player.playback_loop { set; get; } + Efl.Player.playback_loop { set; get; } Efl.Layout.Signal.signal_emit; Efl.Layout.Signal.message_send; Efl.Layout.Signal.signal_callback_add; diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 64f6ce210f..6b7370350c 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -1835,7 +1835,10 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable efl_ui_scroll_manager_pan_set(priv->smanager, priv->pan_obj); if (elm_widget_is_legacy(obj)) - edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj); + { + edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj); + priv->playback_loop = EINA_TRUE; + } else edje_object_part_swallow(edje, "efl.content", priv->pan_obj); @@ -3012,7 +3015,16 @@ _efl_ui_image_zoomable_animate_cb(void *data) sd->cur_frame++; if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) - sd->cur_frame = sd->cur_frame % sd->frame_count; + { + if (sd->playback_loop) + sd->cur_frame = sd->cur_frame % sd->frame_count; + else + { + sd->anim_timer = NULL; + sd->cur_frame = 0; + return EINA_FALSE; + } + } evas_object_image_animated_frame_set(sd->img, sd->cur_frame); sd->frame_duration = evas_object_image_animated_frame_duration_get @@ -3034,6 +3046,7 @@ _efl_ui_image_zoomable_animated_set_internal(Eo *obj EINA_UNUSED, Efl_Ui_Image_Z { sd->anim = anim; edje_object_animation_set(sd->edje, anim); + efl_player_playback_loop_set(sd->edje, sd->playback_loop); return EINA_TRUE; } @@ -3103,6 +3116,19 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab return _efl_ui_image_zoomable_animated_get_internal(obj, sd); } +EOLIAN static void +_efl_ui_image_zoomable_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playback_loop) +{ + playback_loop = !!playback_loop; + sd->playback_loop = playback_loop; +} + +EOLIAN static Eina_Bool +_efl_ui_image_zoomable_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd) +{ + return sd->playback_loop; +} + EOLIAN static void _efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay) { diff --git a/src/lib/elementary/efl_ui_image_zoomable.eo b/src/lib/elementary/efl_ui_image_zoomable.eo index 0cbd8424d9..20424a568d 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.eo +++ b/src/lib/elementary/efl_ui_image_zoomable.eo @@ -53,7 +53,7 @@ class Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom Efl.Player.playback_progress { get; set; } Efl.Player.playback_speed { get; set; } Efl.Player.autoplay { set; get; } - @empty Efl.Player.playback_loop { set; get; } + Efl.Player.playback_loop { set; get; } Efl.Ui.Zoom.zoom_animation { set; get; } Efl.Ui.Zoom.zoom_level { set; get; } Efl.Ui.Zoom.zoom_mode { set; get; } diff --git a/src/lib/elementary/efl_ui_image_zoomable_private.h b/src/lib/elementary/efl_ui_image_zoomable_private.h index c5435a27db..296c98d481 100644 --- a/src/lib/elementary/efl_ui_image_zoomable_private.h +++ b/src/lib/elementary/efl_ui_image_zoomable_private.h @@ -143,6 +143,7 @@ struct _Efl_Ui_Image_Zoomable_Data Eina_Bool orientation_changed : 1; Eina_Bool anim : 1; Eina_Bool autoplay : 1; + Eina_Bool playback_loop : 1; Eina_Bool freeze_want : 1; Eina_Bool show_item: 1; }; diff --git a/src/lib/elementary/efl_ui_widget_image.h b/src/lib/elementary/efl_ui_widget_image.h index 00716b18f1..e3d7264509 100644 --- a/src/lib/elementary/efl_ui_widget_image.h +++ b/src/lib/elementary/efl_ui_widget_image.h @@ -98,6 +98,7 @@ struct _Efl_Ui_Image_Data Eina_Bool edje : 1; Eina_Bool anim : 1; Eina_Bool autoplay : 1; + Eina_Bool playback_loop : 1; Eina_Bool paused : 1; Eina_Bool async_enable : 1; Eina_Bool scale_up : 1;