efl_ui_animation_view: introduce a new widget for controlling vector animation. 42/212442/4
authorHermet Park <hermetpark@gmail.com>
Wed, 21 Aug 2019 08:39:43 +0000 (17:39 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 22 Aug 2019 05:48:43 +0000 (05:48 +0000)
Summary:
This is a new convenient ui control that designed to load vector resources
-svg, json-, and control animations if it supports.

Please turn on evas-loaders-json in meson options,
if you'd like to use Lottie Animation.

Co-authored-by: JunsuChoi <jsuya.choi@samsung.com>
@feature

Reviewers: #committers, jsuya, zmike, bu5hm4n

Reviewed By: #committers, bu5hm4n

Subscribers: zmike, bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9451

Change-Id: I5afaf9e5718a9b311013e272c99170d50132e82f

src/lib/elementary/Efl_Ui.h
src/lib/elementary/Elementary.h
src/lib/elementary/efl_ui_animation_view.c
src/lib/elementary/efl_ui_animation_view.eo
src/lib/elementary/efl_ui_animation_view_eo.legacy.c
src/lib/elementary/efl_ui_animation_view_legacy.h
src/lib/elementary/efl_ui_animation_view_private.h
src/lib/elementary/meson.build
src/tests/elementary/spec/efl_test_gfx_view.c [new file with mode: 0644]
src/tests/elementary/spec/efl_ui_spec_suite.h
src/tests/elementary/spec/meson.build

index c33792b..9393c37 100644 (file)
@@ -209,6 +209,7 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
 # include <efl_ui_text_async.eo.h>
 # endif
 
+# include <efl_ui_animation_view.h>
 # include <efl_ui_clock.h>
 # include <efl_ui_image_factory.eo.h>
 # include <efl_ui_video.h>
index 72af897..71df164 100644 (file)
@@ -361,9 +361,7 @@ typedef Eo Efl_Ui_Focus_Manager;
 # include <efl_ui_dnd.eo.h>
 # include <efl_ui_dnd_container.eo.h>
 # include <efl_ui_relative_layout.eo.h>
-
 # include <efl_ui_animation_view.eo.h>
-
 # include <efl_ui_tab_bar.eo.h>
 # include <efl_ui_tab_page.eo.h>
 # include <efl_ui_tab_page_part_tab.eo.h>
index ab8b8ff..5f883c3 100644 (file)
@@ -39,13 +39,13 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
 };
 
 static void
-_sizing_eval(void *data)
+_sizing_eval(Eo *obj, void *data)
 {
    Efl_Ui_Animation_View_Data *pd = data;
-   if (!efl_file_loaded_get(pd->obj)) return;
+   if (!efl_file_loaded_get(obj)) return;
 
    double hw,hh;
-   efl_gfx_hint_weight_get(pd->obj, &hw, &hh);
+   efl_gfx_hint_weight_get(obj, &hw, &hh);
 
    Eina_Size2D size = efl_canvas_vg_object_default_size_get(pd->vg);
 
@@ -53,24 +53,24 @@ _sizing_eval(void *data)
    if (hw == 0) min.w = size.w;
    if (hh == 0) min.h = size.h;
 
-   efl_gfx_hint_size_min_set(pd->obj, min);
+   efl_gfx_hint_size_min_set(obj, min);
 }
 
 static void
-_size_hint_event_cb(void *data, const Efl_Event *event EINA_UNUSED)
+_size_hint_event_cb(void *data, const Efl_Event *event)
 {
-   _sizing_eval(data);
+   _sizing_eval(event->object, data);
 }
 
 static void
-_transit_go_facade(Efl_Ui_Animation_View_Data *pd)
+_transit_go_facade(Eo* obj, Efl_Ui_Animation_View_Data *pd)
 {
    pd->repeat_times = 0;
    if (pd->play_back)
      pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK;
    else
      pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
-   evas_object_smart_callback_call(pd->obj, SIG_PLAY_START, NULL);
+   evas_object_smart_callback_call(obj, SIG_PLAY_START, NULL);
    if (pd->transit) elm_transit_go(pd->transit);
 }
 
@@ -99,7 +99,7 @@ _visible_check(Eo *obj)
 }
 
 static void
-_auto_play(Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
+_auto_play(Eo *obj, Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
 {
    if (!pd->auto_play || !pd->transit) return;
 
@@ -114,7 +114,7 @@ _auto_play(Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
              else
                pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
              pd->auto_play_pause = EINA_FALSE;
-             evas_object_smart_callback_call(pd->obj, SIG_PLAY_RESUME, NULL);
+             evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL);
           }
      }
    //Pause Animation
@@ -126,7 +126,7 @@ _auto_play(Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
              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);
+             evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
           }
      }
 }
@@ -134,11 +134,13 @@ _auto_play(Efl_Ui_Animation_View_Data *pd, Eina_Bool vis)
 static void
 _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
 {
-   Efl_Ui_Animation_View_Data *pd = (Efl_Ui_Animation_View_Data *) effect;
+   Eo *obj = (Eo *) effect;
+   EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd);
+   if (!pd) return;
 
    if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY && pd->progress == 1) ||
        (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK && pd->progress == 0))
-     evas_object_smart_callback_call(pd->obj, SIG_PLAY_DONE, NULL);
+     evas_object_smart_callback_call(obj, SIG_PLAY_DONE, NULL);
 
    if (pd->transit != transit) return;
 
@@ -149,7 +151,7 @@ _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
 
    if (prev_state != EFL_UI_ANIMATION_VIEW_STATE_STOP)
      {
-        evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL);
+        evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL);
         pd->progress = 0;
      }
 }
@@ -157,11 +159,12 @@ _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
 static void
 _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
 {
-   Efl_Ui_Animation_View_Data *pd = (Efl_Ui_Animation_View_Data *) effect;
+   Eo *obj = (Eo *) effect;
+   EFL_UI_ANIMATION_VIEW_DATA_GET(obj, pd);
 
-   if (!pd->vg)
+   if (!pd || !pd->vg)
      {
-        ERR("Vector Object is removed in wrong way!, Efl_Ui_Animation_View = %p", pd->obj);
+        ERR("Vector Object is removed in wrong way!, Efl_Ui_Animation_View = %p", obj);
         elm_transit_del(transit);
         return;
      }
@@ -186,7 +189,7 @@ _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
         int repeat_times = elm_transit_current_repeat_times_get(pd->transit);
         if (pd->repeat_times != repeat_times)
           {
-             evas_object_smart_callback_call(pd->obj, SIG_PLAY_REPEAT, NULL);
+             evas_object_smart_callback_call(obj, SIG_PLAY_REPEAT, NULL);
              pd->repeat_times = repeat_times;
           }
      }
@@ -194,7 +197,7 @@ _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
    //transit_cb is always called with a progress value 0 ~ 1.
    //SIG_PLAY_UPDATE callback is called only when there is a real change.
    if (update_frame != current_frame)
-     evas_object_smart_callback_call(pd->obj, SIG_PLAY_UPDATE, NULL);
+     evas_object_smart_callback_call(obj, SIG_PLAY_UPDATE, NULL);
 }
 
 EOLIAN static void
@@ -238,9 +241,9 @@ _efl_ui_animation_view_efl_object_destructor(Eo *obj,
 
 EOLIAN static Eo *
 _efl_ui_animation_view_efl_object_constructor(Eo *obj,
-                                           Efl_Ui_Animation_View_Data *pd)
+                                           Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
 {
-   pd->obj = obj = efl_constructor(efl_super(obj, MY_CLASS));
+   obj = efl_constructor(efl_super(obj, MY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
 
@@ -261,7 +264,7 @@ _update_frame_duration(Efl_Ui_Animation_View_Data *pd)
 }
 
 static Eina_Bool
-_ready_play(Efl_Ui_Animation_View_Data *pd)
+_ready_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
    pd->auto_play_pause = EINA_FALSE;
    pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
@@ -277,7 +280,7 @@ _ready_play(Efl_Ui_Animation_View_Data *pd)
         Elm_Transit *transit = elm_transit_add();
         elm_transit_object_add(transit, pd->vg);
         if (pd->auto_repeat) elm_transit_repeat_times_set(transit, -1);
-        elm_transit_effect_add(transit, _transit_cb, pd, _transit_del_cb);
+        elm_transit_effect_add(transit, _transit_cb, obj, _transit_del_cb);
         elm_transit_progress_value_set(transit, pd->progress);
         elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
         pd->transit = transit;
@@ -304,6 +307,7 @@ EOLIAN static Eina_Error
 _efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
    Eina_Error err;
+   Eina_Bool ret;
    const char *file;
    const char *key;
 
@@ -314,24 +318,29 @@ _efl_ui_animation_view_efl_file_load(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 
    file = efl_file_get(obj);
    key = efl_file_key_get(obj);
-   efl_file_simple_load(pd->vg, file, key);
+   ret = efl_file_simple_load(pd->vg, file, key);
+   if (!ret)
+     {
+        efl_file_unload(obj);
+        return eina_error_get();
+     }
 
    pd->progress = 0;
 
-   _sizing_eval(pd);
+   _sizing_eval(obj, pd);
 
-   if (!_ready_play(pd)) return 1;
+   if (!_ready_play(obj, pd)) return 1;
 
    if (pd->auto_play)
      {
-        _transit_go_facade(pd);
+        _transit_go_facade(obj, pd);
 
         if (!_visible_check(obj))
           {
              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);
+             evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
           }
      }
    return 0;
@@ -347,7 +356,7 @@ _efl_ui_animation_view_efl_gfx_entity_position_set(Eo *obj,
 
    efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
 
-   _auto_play(pd, _visible_check(obj));
+   _auto_play(obj, pd, _visible_check(obj));
 }
 
 EOLIAN static void
@@ -360,22 +369,44 @@ _efl_ui_animation_view_efl_gfx_entity_size_set(Eo *obj,
 
    efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
 
-   _sizing_eval(pd);
+   _sizing_eval(obj, pd);
 
-   _auto_play(pd, _visible_check(obj));
+   _auto_play(obj, pd, _visible_check(obj));
 }
 
 EOLIAN static void
 _efl_ui_animation_view_efl_gfx_entity_visible_set(Eo *obj,
-                                               Efl_Ui_Animation_View_Data *pd,
-                                               Eina_Bool vis)
+                                                  Efl_Ui_Animation_View_Data *pd,
+                                                  Eina_Bool vis)
 {
   if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
      return;
 
    efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis);
 
-   _auto_play(pd, _visible_check(obj));
+   _auto_play(obj, pd, _visible_check(obj));
+}
+
+EOLIAN static void
+_efl_ui_animation_view_efl_gfx_view_view_size_set(Eo *obj EINA_UNUSED,
+                                                  Efl_Ui_Animation_View_Data *pd,
+                                                  Eina_Size2D size)
+{
+   Eina_Rect viewbox;
+   viewbox.x = viewbox.y =0;
+   viewbox.w = size.w;
+   viewbox.h = size.h;
+
+   efl_canvas_vg_object_viewbox_set(pd->vg, viewbox);
+}
+
+EOLIAN Eina_Size2D
+_efl_ui_animation_view_efl_gfx_view_view_size_get(const Eo *obj EINA_UNUSED,
+                                                  Efl_Ui_Animation_View_Data *pd)
+{
+   Eina_Rect viewbox = efl_canvas_vg_object_viewbox_get(pd->vg);
+
+   return EINA_SIZE2D(viewbox.w, viewbox.h);
 }
 
 EOLIAN static void
@@ -422,10 +453,10 @@ _efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
    pd->auto_play_pause = EINA_FALSE;
 
    if (!efl_file_loaded_get(obj)) return EINA_FALSE;
-   if (!pd->transit && !_ready_play(pd)) return EINA_FALSE;
+   if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE;
 
    if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
-     _transit_go_facade(pd);
+     _transit_go_facade(obj, pd);
    else if (rewind)
      elm_transit_progress_value_set(pd->transit, pd->progress);
 
@@ -433,7 +464,7 @@ _efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 }
 
 EOLIAN static Eina_Bool
-_efl_ui_animation_view_stop(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
+_efl_ui_animation_view_stop(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
    if (!pd->transit) return EINA_FALSE;
 
@@ -444,14 +475,14 @@ _efl_ui_animation_view_stop(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
    evas_object_vg_animated_frame_set(pd->vg, 0);
    pd->progress = 0;
    pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
-   evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL);
+   evas_object_smart_callback_call(obj, SIG_PLAY_STOP, NULL);
    elm_transit_del(pd->transit);
 
    return EINA_TRUE;
 }
 
 EOLIAN static Eina_Bool
-_efl_ui_animation_view_pause(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
+_efl_ui_animation_view_pause(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
    if (!pd->transit) return EINA_FALSE;
 
@@ -461,7 +492,7 @@ _efl_ui_animation_view_pause(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd
         elm_transit_paused_set(pd->transit, EINA_TRUE);
         pd->state = EFL_UI_ANIMATION_VIEW_STATE_PAUSE;
         pd->auto_play_pause = EINA_FALSE;
-        evas_object_smart_callback_call(pd->obj, SIG_PLAY_PAUSE, NULL);
+        evas_object_smart_callback_call(obj, SIG_PLAY_PAUSE, NULL);
         return EINA_TRUE;
      }
 
@@ -469,7 +500,7 @@ _efl_ui_animation_view_pause(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd
 }
 
 EOLIAN static Eina_Bool
-_efl_ui_animation_view_resume(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
+_efl_ui_animation_view_resume(Eo *obj, Efl_Ui_Animation_View_Data *pd)
 {
    if (!pd->transit) return EINA_FALSE;
 
@@ -482,7 +513,7 @@ _efl_ui_animation_view_resume(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *p
           pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
         pd->auto_play_pause = EINA_FALSE;
 
-        evas_object_smart_callback_call(pd->obj, SIG_PLAY_RESUME, NULL);
+        evas_object_smart_callback_call(obj, SIG_PLAY_RESUME, NULL);
 
         return EINA_TRUE;
      }
@@ -502,12 +533,12 @@ _efl_ui_animation_view_play_back(Eo *obj, Efl_Ui_Animation_View_Data *pd)
    pd->auto_play_pause = EINA_FALSE;
 
    if (!efl_file_loaded_get(obj)) return EINA_FALSE;
-   if (!pd->transit && !_ready_play(pd)) return EINA_FALSE;
+   if (!pd->transit && !_ready_play(obj, pd)) return EINA_FALSE;
 
    if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
      {
         if (pd->progress == 0) pd->progress = 1.0;
-        _transit_go_facade(pd);
+        _transit_go_facade(obj, pd);
      }
    else if (rewind)
      elm_transit_progress_value_set(pd->transit, 1 - pd->progress);
@@ -580,8 +611,8 @@ _efl_ui_animation_view_duration_time_get(const Eo *obj EINA_UNUSED, Efl_Ui_Anima
 }
 
 EOLIAN static Eina_Size2D
-_efl_ui_animation_view_default_size_get(const Eo *obj EINA_UNUSED,
-                                     Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
+_efl_ui_animation_view_default_view_size_get(const Eo *obj EINA_UNUSED,
+                                             Efl_Ui_Animation_View_Data *pd EINA_UNUSED)
 {
    return efl_canvas_vg_object_default_size_get(pd->vg);
 }
@@ -601,7 +632,7 @@ _efl_ui_animation_view_is_playing_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_Vie
 EOLIAN static int
 _efl_ui_animation_view_frame_count_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
 {
-   return evas_object_vg_animated_frame_count_get(pd->vg);
+   return efl_gfx_frame_controller_frame_count_get(pd->vg);
 }
 
 EOLIAN static void
@@ -707,7 +738,6 @@ elm_animation_view_keyframe_get(const Eo *obj)
    return efl_ui_animation_view_progress_get(obj);
 }
 
-
 /* Internal EO APIs and hidden overrides */
 
 #define EFL_UI_ANIMATION_VIEW_EXTRA_OPS \
index 99c6c2d..67321e7 100644 (file)
@@ -1,11 +1,11 @@
 
 enum Efl.Ui.Animation_View_State
 {
-   not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file. @since 1.23]]
-   play, [[Animation is on playing. see @Efl.Ui.Animation_View.play @since 1.23]]
-   play_back, [[Animation is on playing back (rewinding). see @Efl.Ui.Animation_View.play_back @since 1.23]]
-   pause, [[Animation has been paused. To continue animation, call @Efl.Ui.Animation_View.resume. see @Efl.Ui.Animation_View.pause @since 1.23]]
-   stop [[Animation view successfully loaded a file then readied for playing. Otherwise after finished animation or stopped forcely by request. see @Efl.Ui.Animation_View.stop @since 1.23]]
+   not_ready, [[Animation is not ready to play. (Probably, it didn't file set yet or failed to read file.]]
+   play, [[Animation is on playing. see @Efl.Ui.Animation_View.play]]
+   play_back, [[Animation is on playing back (rewinding). see @Efl.Ui.Animation_View.play_back]]
+   pause, [[Animation has been paused. To continue animation, call @Efl.Ui.Animation_View.resume. see @Efl.Ui.Animation_View.pause]]
+   stop [[Animation view successfully loaded a file then readied for playing. Otherwise after finished animation or stopped forcely by request. see @Efl.Ui.Animation_View.stop]]
 }
 
 class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.File
@@ -20,8 +20,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
      animation infomation. Currently approved vector data file format is svg, json and eet.
      Only json(known for Lottie file as well) and eet could contains animation infomation,
      currently Animation_View is supporting.
-
-     @since 1.23
    ]]
    event_prefix: efl_ui_animation_view;
    methods {
@@ -38,8 +36,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
 
            Warning: This auto play will be only affected to the next animation source.
            So must be called before setting animation file.
-
-           @since 1.23
          ]]
          set {
          }
@@ -56,8 +52,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
            end. This auto repeat mode is valid to both play and play_back cases.
 
            $true Enable auto play mode, disable otherwise.
-
-           @since 1.23
          ]]
          set {
          }
@@ -77,8 +71,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
            $true when it's successful. $false otherwise.
 
            Warning: speed must be greater than zero.
-
-           @since 1.23
          ]]
          set {
             return: bool;
@@ -94,8 +86,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
 
            This API returns total duration time of current animation in the seconds.
            If current animation source isn't animatable, it returns zero.
-
-           @since 1.23
          ]]
          get {
          }
@@ -110,8 +100,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
            you can change current position by using this API.
 
            Warning: The range of progress is 0 ~ 1.
-
-           @since 1.23
          ]]
          set {
          }
@@ -125,8 +113,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
          [[Number of current frame.
 
            Ranges from 0 to @.frame_count - 1.
-
-           @since 1.23
          ]]
          set {
          }
@@ -144,9 +130,8 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
 
            Warning: Play request will be ignored if animation source is not set yet or
            animation is paused state or it's already on playing.
-
-           @since 1.23
          ]]
+
          return: bool; [[$true when it's successful. $false otherwise.]]
       }
       play_back {
@@ -157,9 +142,8 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
 
            Warning: Play back request will be ignored if animation source is not set yet or
            animation is paused state or it's already on playing back.
-
-           @since 1.23
          ]]
+
          return: bool; [[$true when it's successful. $false otherwise.]]
       }
       pause {
@@ -168,18 +152,16 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
            Once animation is paused, animation view must get resume to play continue again.
 
            Warning: Animation must be on playing or playing back status.
-
-           @since 1.23
          ]]
+
          return: bool; [[$true when it's successful. $false otherwise.]]
       }
       resume {
          [[Resume paused animation to continue animation.
 
            Warning: This resume must be called on animation paused status.
-
-           @since 1.23
          ]]
+
          return: bool; [[$true when it's successful. $false otherwise.]]
       }
       stop {
@@ -188,15 +170,12 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
            Stop animation instatly regardless of it's status and reset to
            show first frame of animation. Even though current animation is paused,
            the animation status will be stopped.
-
-           @since 1.23
          ]]
+
          return: bool; [[$true when it's successful. $false otherwise.]]
       }
-      @property default_size {
+      @property default_view_size {
          [[The default view size that specified from vector resource.
-
-           @since 1.23
          ]]
          get {
          }
@@ -207,8 +186,6 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
       @property state {
          [[Current animation view state.
            see @Efl.Ui.Animation_View_State
-
-           @since 1.23
          ]]
          get{
          }
@@ -219,77 +196,65 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
       is_playing_back {
          [[Returns the status whether current animation is on playing forward or backward.
            warning: If animation view is not on playing, it will return $false.
-
-           @since 1.23
          ]]
          return: bool; [[$true, if animation on playing back, $false otherwise.]]
       }
       @property frame_count {
          [[The index of end frame of the animation view, if it's animated.
            note : frame number starts with 0.
-
-           @since 1.23
          ]]
          get {
          }
          values {
-            frame_count: int; [[ The number of frames. 0, if it's not animated.]]
+            frame_count: int; [[The number of frames. 0, if it's not animated.]]
          }
       }
       @property min_progress {
          [[The start progress of the play.
            Default value is 0.
-
-           @since 1.23
          ]]
          set {
          }
          get {
          }
          values {
-            min_progress: double; [[ The minimum progress. Value must be 0 ~ 1. ]]
+            min_progress: double; [[The minimum progress. Value must be 0 ~ 1.]]
          }
       }
       @property max_progress {
          [[The last progress of the play.
            Default value is 1.
-
-           since 1.23
          ]]
          set {
          }
          get {
          }
          values {
-            max_progress: double; [[ The maximum progress. Value must be 0 ~ 1. ]]
+            max_progress: double; [[The maximum progress. Value must be 0 ~ 1.]]
          }
       }
       @property min_frame {
          [[The start frame of the play.
            Default value is 0.
-
-           @since 1.23
          ]]
          set {
          }
          get {
          }
          values {
-            min_frame: int; [[ The minimum frame for play. Value must be 0 ~ @.max_frame ]]
+            min_frame: int; [[The minimum frame for play. Value must be 0 ~ @.max_frame]]
          }
       }
       @property max_frame {
          [[The last frame of the play.
            Default value is @.frame_count - 1
-
-           @since 1.23
          ]]
          set {
          }
          get {
          }
          values {
-            max_frame: int; [[ The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1) ]]
+            max_frame: int; [[The maximum frame for play. Value must be @.min_frame ~ (@.frame_count - 1)]]
          }
       }
 
@@ -302,5 +267,15 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
       Efl.Gfx.Entity.visible { set; }
       Efl.Gfx.Entity.position { set; }
       Efl.Gfx.Entity.size { set; }
+      Efl.Gfx.View.view_size { set; get; }
+   }
+   events {
+      play,start: void; [[Called when animation is just started]]
+      play,repeat: void; [[Called when animation is just repeated]]
+      play,done: void; [[Called when animation is just finished]]
+      play,pause: void; [[Called when animation is just paused]]
+      play,resume: void; [[Called when animation is just resumed]]
+      play,stop: void; [[Called when animation is just stopped]]
+      play,update: void; [[Called when animation is just updated]]
    }
 }
index af3add7..87ed323 100644 (file)
@@ -98,7 +98,7 @@ elm_animation_view_stop(Efl_Ui_Animation_View *obj)
 EAPI Eina_Size2D
 elm_animation_view_default_size_get(const Efl_Ui_Animation_View *obj)
 {
-   return efl_ui_animation_view_default_size_get(obj);
+   return efl_ui_animation_view_default_view_size_get(obj);
 }
 
 EAPI Eina_Bool
index 117b6b5..bbea010 100644 (file)
@@ -53,4 +53,3 @@ EAPI Elm_Animation_View_State elm_animation_view_state_get(Elm_Animation_View *o
 //Will be removed soon. See: elm_animation_view_progress_set(), elm_animation_view_progress_get()
 EINA_DEPRECATED EAPI void elm_animation_view_keyframe_set(Elm_Animation_View *obj, double keyframe);
 EINA_DEPRECATED EAPI double elm_animation_view_keyframe_get(const Elm_Animation_View *obj);
-
index 2dec04d..0de9b2a 100644 (file)
@@ -8,7 +8,6 @@ typedef struct _Efl_Ui_Animation_View_Data Efl_Ui_Animation_View_Data;
 
 struct _Efl_Ui_Animation_View_Data
 {
-   Eo* obj;                           //Efl_Ui_Animation_View Object
    Eo* vg;                            //Evas_Object_Vg
    Efl_Ui_Animation_View_State state;
    Elm_Transit *transit;
@@ -28,7 +27,7 @@ struct _Efl_Ui_Animation_View_Data
 };
 
 #define EFL_UI_ANIMATION_VIEW_DATA_GET(o, sd) \
-  Efl_Ui_Animation_View_Data * sd = efl_data_scope_get(o, EFL_UI_ANIMATION_VIEW_CLASS)
+  Efl_Ui_Animation_View_Data * sd = efl_data_scope_safe_get(o, EFL_UI_ANIMATION_VIEW_CLASS)
 
 #define EFL_UI_ANIMATION_VIEW_DATA_GET_OR_RETURN(o, ptr)   \
   EFL_UI_ANIMATION_VIEW_DATA_GET(o, ptr);                  \
index f7de6e7..11bec4e 100644 (file)
@@ -43,6 +43,7 @@ endforeach
 
 pub_eo_files = [
   'efl_ui_widget.eo',
+  'efl_ui_animation_view.eo',
   'efl_ui_bg.eo',
   'efl_ui_button.eo',
   'efl_ui_calendar.eo',
@@ -311,6 +312,7 @@ elementary_headers_unstable = [
   'efl_ui_widget_flip.h',
   'elm_widget_flipselector.h',
   'efl_ui_widget_frame.h',
+  'efl_ui_animation_view_private.h',
   'elm_widget_gengrid.h',
   'elm_widget_genlist.h',
   'elm_widget_glview.h',
@@ -439,6 +441,8 @@ elementary_pub_headers = [
   'elc_naviframe_common.h',
   'elc_popup.h',
   'elc_popup_legacy.h',
+  'efl_ui_animation_view.h',
+  'efl_ui_animation_view_legacy.h',
   'elm_access.h',
   'elm_actionslider.h',
   'elm_actionslider_legacy.h',
@@ -628,6 +632,7 @@ elementary_pub_headers = [
   'elm_win_legacy.h',
   'elm_helper.h',
   'elm_part_helper.h',
+  'efl_ui_animation_view_eo.legacy.h',
   'efl_ui_bg_eo.legacy.h',
   'efl_ui_bg_legacy_eo.legacy.h',
   'efl_ui_button_eo.legacy.h',
@@ -798,6 +803,7 @@ elementary_src = [
   'elc_popup.c',
   'elc_scrolled_entry.c',
   'elm_access.c',
+  'efl_ui_animation_view.c',
   'elm_actionslider.c',
   'elm_atspi_app_object.c',
   'elm_atspi_bridge.c',
diff --git a/src/tests/elementary/spec/efl_test_gfx_view.c b/src/tests/elementary/spec/efl_test_gfx_view.c
new file mode 100644 (file)
index 0000000..fc41113
--- /dev/null
@@ -0,0 +1,39 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Efl_Ui.h>
+#include "efl_ui_spec_suite.h"
+#include "suite_helpers.h"
+
+/* spec-meta-start
+      {"test-interface":"Efl.Gfx.View",
+       "test-widgets": ["Efl.Ui.Animation_View"]}
+   spec-meta-end */
+
+EFL_START_TEST(view_size)
+{
+#define TUPLE_CHECK(W, H) \
+  do { \
+   Eina_Size2D sz; \
+   efl_gfx_view_size_set(widget, EINA_SIZE2D(W, H)); \
+   sz = efl_gfx_view_size_get(widget); \
+   ck_assert(W == sz.w); \
+   ck_assert(H == sz.h); \
+  } while(0);
+
+  TUPLE_CHECK(100, 100);
+  TUPLE_CHECK(100, 200);
+  TUPLE_CHECK(200, 100);
+  TUPLE_CHECK(800, 700);
+  TUPLE_CHECK(10, 50);
+
+#undef TUPLE_CHECK
+}
+EFL_END_TEST
+
+void
+efl_gfx_view_behavior_test(TCase *tc)
+{
+   tcase_add_test(tc, view_size);
+}
index a4bceea..0d86596 100644 (file)
@@ -14,6 +14,7 @@ void efl_pack_behavior_test(TCase *tc);
 void efl_pack_linear_behavior_test(TCase *tc);
 void efl_content_behavior_test(TCase *tc);
 void efl_gfx_arrangement_behavior_test(TCase *tc);
+void efl_gfx_view_behavior_test(TCase *tc);
 void efl_ui_clickable_behavior_test(TCase *tc);
 void efl_ui_format_behavior_test(TCase *tc);
 void efl_ui_range_display_behavior_test(TCase *tc);
index 0da3494..33be7aa 100644 (file)
@@ -11,6 +11,7 @@ efl_ui_suite_behavior_test_files = files([
   'efl_test_single_selectable.c',
   'efl_test_multi_selectable.c',
   'efl_test_selectable.c',
+  'efl_test_gfx_view.c',
 ])
 
 efl_ui_suite_behavior_src = files([