diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2020-02-10 12:11:03 -0500 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-03-20 15:57:51 +0100 |
commit | 831d445cc01decc3dddf0e62d3878821ee932ba7 (patch) | |
tree | abce9c328418ac96015b57ae95e1e8b7f467684f /src/lib | |
parent | df561eb725b7c20c43e56893c9825b7ae990f9a1 (diff) | |
download | efl-831d445cc01decc3dddf0e62d3878821ee932ba7.tar.gz |
efl_ui/image: implement efl.player::playback_loop property
this enables the existing looping functionality only when playback_loop
is set (which is always set for legacy widgets)
fix T8589
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11308
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/elementary/efl_ui_image.c | 26 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image_zoomable.c | 30 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image_zoomable.eo | 2 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_image_zoomable_private.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_widget_image.h | 1 |
6 files changed, 57 insertions, 5 deletions
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); @@ -1821,6 +1832,19 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *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) { autoplay = !!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; } @@ -3104,6 +3117,19 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab } 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) { autoplay = !!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; |