summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-10 12:11:03 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-20 15:57:51 +0100
commit831d445cc01decc3dddf0e62d3878821ee932ba7 (patch)
treeabce9c328418ac96015b57ae95e1e8b7f467684f
parentdf561eb725b7c20c43e56893c9825b7ae990f9a1 (diff)
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
-rw-r--r--src/bin/elementary/test_photocam.c5
-rw-r--r--src/lib/elementary/efl_ui_image.c26
-rw-r--r--src/lib/elementary/efl_ui_image.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c30
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.eo2
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable_private.h1
-rw-r--r--src/lib/elementary/efl_ui_widget_image.h1
7 files changed, 58 insertions, 9 deletions
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)
150 150
151 eina_list_free(grps); 151 eina_list_free(grps);
152 } 152 }
153
154 if (file && eina_str_has_extension(file, ".gif")
155 && efl_playable_get(ph))
156 efl_player_autoplay_set(ph, EINA_TRUE);
157} 153}
158 154
159static void 155static void
@@ -835,6 +831,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
835 { 831 {
836 printf("animation is available for this image.\n"); 832 printf("animation is available for this image.\n");
837 efl_player_autoplay_set(zoomable, EINA_TRUE); 833 efl_player_autoplay_set(zoomable, EINA_TRUE);
834 efl_player_playback_loop_set(zoomable, EINA_TRUE);
838 } 835 }
839 836
840 rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, win, 837 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)
137 137
138 sd->cur_frame++; 138 sd->cur_frame++;
139 if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) 139 if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count))
140 sd->cur_frame = sd->cur_frame % sd->frame_count; 140 {
141 if (sd->playback_loop)
142 sd->cur_frame = sd->cur_frame % sd->frame_count;
143 else
144 {
145 sd->anim_timer = NULL;
146 sd->cur_frame = 0;
147 return EINA_FALSE;
148 }
149 }
141 150
142 evas_object_image_animated_frame_set(sd->img, sd->cur_frame); 151 evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
143 152
@@ -593,6 +602,7 @@ _efl_ui_image_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Data *priv)
593 { 602 {
594 evas_object_event_callback_add 603 evas_object_event_callback_add
595 (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj); 604 (priv->hit_rect, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up, obj);
605 priv->playback_loop = EINA_TRUE;
596 } 606 }
597 else 607 else
598 { 608 {
@@ -1753,6 +1763,7 @@ _efl_ui_image_animated_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool an
1753 { 1763 {
1754 edje_object_animation_set(sd->img, anim); 1764 edje_object_animation_set(sd->img, anim);
1755 sd->anim = anim; 1765 sd->anim = anim;
1766 efl_player_playback_loop_set(sd->img, sd->playback_loop);
1756 return EINA_TRUE; 1767 return EINA_TRUE;
1757 } 1768 }
1758 sd->img = elm_image_object_get(obj); 1769 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)
1821} 1832}
1822 1833
1823EOLIAN static void 1834EOLIAN static void
1835_efl_ui_image_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Bool playback_loop)
1836{
1837 playback_loop = !!playback_loop;
1838 sd->playback_loop = playback_loop;
1839}
1840
1841EOLIAN static Eina_Bool
1842_efl_ui_image_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
1843{
1844 return sd->playback_loop;
1845}
1846
1847EOLIAN static void
1824_efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay) 1848_efl_ui_image_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool autoplay)
1825{ 1849{
1826 autoplay = !!autoplay; 1850 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.
104 Efl.Player.playback_progress { get; set; } 104 Efl.Player.playback_progress { get; set; }
105 Efl.Player.playback_speed { get; set; } 105 Efl.Player.playback_speed { get; set; }
106 Efl.Player.autoplay { set; get; } 106 Efl.Player.autoplay { set; get; }
107 @empty Efl.Player.playback_loop { set; get; } 107 Efl.Player.playback_loop { set; get; }
108 Efl.Layout.Signal.signal_emit; 108 Efl.Layout.Signal.signal_emit;
109 Efl.Layout.Signal.message_send; 109 Efl.Layout.Signal.message_send;
110 Efl.Layout.Signal.signal_callback_add; 110 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
1835 1835
1836 efl_ui_scroll_manager_pan_set(priv->smanager, priv->pan_obj); 1836 efl_ui_scroll_manager_pan_set(priv->smanager, priv->pan_obj);
1837 if (elm_widget_is_legacy(obj)) 1837 if (elm_widget_is_legacy(obj))
1838 edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj); 1838 {
1839 edje_object_part_swallow(edje, "elm.swallow.content", priv->pan_obj);
1840 priv->playback_loop = EINA_TRUE;
1841 }
1839 else 1842 else
1840 edje_object_part_swallow(edje, "efl.content", priv->pan_obj); 1843 edje_object_part_swallow(edje, "efl.content", priv->pan_obj);
1841 1844
@@ -3012,7 +3015,16 @@ _efl_ui_image_zoomable_animate_cb(void *data)
3012 3015
3013 sd->cur_frame++; 3016 sd->cur_frame++;
3014 if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count)) 3017 if ((sd->frame_count > 0) && (sd->cur_frame > sd->frame_count))
3015 sd->cur_frame = sd->cur_frame % sd->frame_count; 3018 {
3019 if (sd->playback_loop)
3020 sd->cur_frame = sd->cur_frame % sd->frame_count;
3021 else
3022 {
3023 sd->anim_timer = NULL;
3024 sd->cur_frame = 0;
3025 return EINA_FALSE;
3026 }
3027 }
3016 3028
3017 evas_object_image_animated_frame_set(sd->img, sd->cur_frame); 3029 evas_object_image_animated_frame_set(sd->img, sd->cur_frame);
3018 sd->frame_duration = evas_object_image_animated_frame_duration_get 3030 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
3034 { 3046 {
3035 sd->anim = anim; 3047 sd->anim = anim;
3036 edje_object_animation_set(sd->edje, anim); 3048 edje_object_animation_set(sd->edje, anim);
3049 efl_player_playback_loop_set(sd->edje, sd->playback_loop);
3037 return EINA_TRUE; 3050 return EINA_TRUE;
3038 } 3051 }
3039 3052
@@ -3104,6 +3117,19 @@ _efl_ui_image_zoomable_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Zoomab
3104} 3117}
3105 3118
3106EOLIAN static void 3119EOLIAN static void
3120_efl_ui_image_zoomable_efl_player_playback_loop_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool playback_loop)
3121{
3122 playback_loop = !!playback_loop;
3123 sd->playback_loop = playback_loop;
3124}
3125
3126EOLIAN static Eina_Bool
3127_efl_ui_image_zoomable_efl_player_playback_loop_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
3128{
3129 return sd->playback_loop;
3130}
3131
3132EOLIAN static void
3107_efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay) 3133_efl_ui_image_zoomable_efl_player_autoplay_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Bool autoplay)
3108{ 3134{
3109 autoplay = !!autoplay; 3135 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
53 Efl.Player.playback_progress { get; set; } 53 Efl.Player.playback_progress { get; set; }
54 Efl.Player.playback_speed { get; set; } 54 Efl.Player.playback_speed { get; set; }
55 Efl.Player.autoplay { set; get; } 55 Efl.Player.autoplay { set; get; }
56 @empty Efl.Player.playback_loop { set; get; } 56 Efl.Player.playback_loop { set; get; }
57 Efl.Ui.Zoom.zoom_animation { set; get; } 57 Efl.Ui.Zoom.zoom_animation { set; get; }
58 Efl.Ui.Zoom.zoom_level { set; get; } 58 Efl.Ui.Zoom.zoom_level { set; get; }
59 Efl.Ui.Zoom.zoom_mode { set; get; } 59 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
143 Eina_Bool orientation_changed : 1; 143 Eina_Bool orientation_changed : 1;
144 Eina_Bool anim : 1; 144 Eina_Bool anim : 1;
145 Eina_Bool autoplay : 1; 145 Eina_Bool autoplay : 1;
146 Eina_Bool playback_loop : 1;
146 Eina_Bool freeze_want : 1; 147 Eina_Bool freeze_want : 1;
147 Eina_Bool show_item: 1; 148 Eina_Bool show_item: 1;
148}; 149};
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
98 Eina_Bool edje : 1; 98 Eina_Bool edje : 1;
99 Eina_Bool anim : 1; 99 Eina_Bool anim : 1;
100 Eina_Bool autoplay : 1; 100 Eina_Bool autoplay : 1;
101 Eina_Bool playback_loop : 1;
101 Eina_Bool paused : 1; 102 Eina_Bool paused : 1;
102 Eina_Bool async_enable : 1; 103 Eina_Bool async_enable : 1;
103 Eina_Bool scale_up : 1; 104 Eina_Bool scale_up : 1;