From 6e701b686dc4e60287870bb25255c69c5c494c51 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 30 Jul 2019 19:45:57 +0900 Subject: [PATCH] efl_ui_animation_view: sync with upstream code. Change-Id: I511c3665be37da7ad14e2b892e16ca59a90dd2a7 --- src/lib/elementary/efl_ui_animation_view.c | 47 +++++++++++++++++------------ src/lib/elementary/efl_ui_animation_view.eo | 1 + 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c index 6d9e606..ab8b8ff 100644 --- a/src/lib/elementary/efl_ui_animation_view.c +++ b/src/lib/elementary/efl_ui_animation_view.c @@ -42,7 +42,7 @@ static void _sizing_eval(void *data) { Efl_Ui_Animation_View_Data *pd = data; - if (!pd->file) return; + if (!efl_file_loaded_get(pd->obj)) return; double hw,hh; efl_gfx_hint_weight_get(pd->obj, &hw, &hh); @@ -291,29 +291,36 @@ _ready_play(Efl_Ui_Animation_View_Data *pd) return EINA_FALSE; } +EOLIAN static void +_efl_ui_animation_view_efl_file_unload(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) +{ + pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY; + pd->frame_cnt = 0; + pd->frame_duration = 0; + if (pd->transit) elm_transit_del(pd->transit); +} + EOLIAN static Eina_Error _efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd) { - const char *file = efl_file_get(obj); - const char *key = efl_file_key_get(obj); + Eina_Error err; + const char *file; + const char *key; - if (!evas_object_vg_file_set(pd->vg, file, key)) return ENOENT; + if (efl_file_loaded_get(obj)) return 0; + + err = efl_file_load(efl_super(obj, MY_CLASS)); + if (err) return err; + + file = efl_file_get(obj); + key = efl_file_key_get(obj); + efl_file_simple_load(pd->vg, file, key); - pd->file = file; pd->progress = 0; _sizing_eval(pd); - if (!pd->file) - { - pd->state = EFL_UI_ANIMATION_VIEW_STATE_NOT_READY; - pd->frame_cnt = 0; - pd->frame_duration = 0; - if (pd->transit) elm_transit_del(pd->transit); - return ENOENT; - } - - if (!_ready_play(pd)) return 0; + if (!_ready_play(pd)) return 1; if (pd->auto_play) { @@ -321,7 +328,7 @@ _efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd) if (!_visible_check(obj)) { - elm_transit_paused_set(pd->transit, 0); + elm_transit_paused_set(pd->transit, EINA_TRUE); pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE; pd->auto_play_pause = EINA_TRUE; evas_object_smart_callback_call(pd->obj, SIG_PLAY_PAUSE, NULL); @@ -404,7 +411,7 @@ _efl_ui_animation_view_auto_play_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation } EOLIAN static Eina_Bool -_efl_ui_animation_view_play(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) +_efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd) { if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY) return EINA_FALSE; @@ -414,7 +421,7 @@ _efl_ui_animation_view_play(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) pd->play_back = EINA_FALSE; pd->auto_play_pause = EINA_FALSE; - if (!pd->file) return EINA_FALSE; + if (!efl_file_loaded_get(obj)) return EINA_FALSE; if (!pd->transit && !_ready_play(pd)) return EINA_FALSE; if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) @@ -484,7 +491,7 @@ _efl_ui_animation_view_resume(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *p } EOLIAN static Eina_Bool -_efl_ui_animation_view_play_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) +_efl_ui_animation_view_play_back(Eo *obj, Efl_Ui_Animation_View_Data *pd) { if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK) return EINA_FALSE; @@ -494,7 +501,7 @@ _efl_ui_animation_view_play_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data pd->play_back = EINA_TRUE; pd->auto_play_pause = EINA_FALSE; - if (!pd->file) return EINA_FALSE; + if (!efl_file_loaded_get(obj)) return EINA_FALSE; if (!pd->transit && !_ready_play(pd)) return EINA_FALSE; if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo index f4f1776..47dc29d 100644 --- a/src/lib/elementary/efl_ui_animation_view.eo +++ b/src/lib/elementary/efl_ui_animation_view.eo @@ -298,6 +298,7 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.Object.constructor; Efl.Object.destructor; Efl.File.load; + Efl.File.unload; Efl.Gfx.Entity.visible { set; } Efl.Gfx.Entity.position { set; } Efl.Gfx.Entity.size { set; } -- 2.7.4