summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-07-28 11:48:34 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-08-04 16:14:26 +0900
commitc0691f75733483e065f72eccd0bbc5b639060573 (patch)
treee5068c18ba5712aa9854c02e652acacafe038aa0
parent634f7d0dbb191dfa6805e1bd1c909e37d6a12a3b (diff)
downloadefl-devs/ami/edje_player.tar.gz
edje: implement edje.player interface functionsdevs/ami/edje_player
fixes T5560
-rw-r--r--src/lib/edje/Edje_Legacy.h74
-rw-r--r--src/lib/edje/edje_legacy.c28
-rw-r--r--src/lib/edje/edje_object.eo48
-rw-r--r--src/lib/edje/edje_program.c61
-rw-r--r--src/lib/edje/edje_smart.c66
5 files changed, 173 insertions, 104 deletions
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index c37c9068e7..9fda3ea73d 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -1950,6 +1950,80 @@ EAPI char *edje_object_part_text_unescaped_get(const Edje_Object *obj, const cha
EAPI void edje_object_part_text_insert(Edje_Object *obj, const char *part, const char *text);
/**
+ * @brief Whether this object is playing or not.
+ *
+ * This property indicates whether the object is running or not. If stopped (or
+ * paused), all transitions are disabled and programs stop running, until
+ * resumed.
+ *
+ * If play is disabled, the object will remain the same, and its parts will not
+ * change state. Note that play can be disabled during a transition between
+ * states, effectively freezing the object in flight. When paused, no events
+ * will be processed or sent.
+ *
+ * Setting to @c true resumes playing from the current state.
+ *
+ * Start or stop playing programs in this object.
+ *
+ * @param[in] play The play state, @c true by default.
+ *
+ * @ingroup Edje_Object
+ */
+EAPI void edje_object_play_set(Evas_Object *obj, Eina_Bool play);
+
+/**
+ * @brief Whether this object is playing or not.
+ *
+ * This property indicates whether the object is running or not. If stopped (or
+ * paused), all transitions are disabled and programs stop running, until
+ * resumed.
+ *
+ * If play is disabled, the object will remain the same, and its parts will not
+ * change state. Note that play can be disabled during a transition between
+ * states, effectively freezing the object in flight. When paused, no events
+ * will be processed or sent.
+ *
+ * Setting to @c true resumes playing from the current state.
+ *
+ * Get the current state of play, @c true by default.
+ *
+ * @return The play state, @c true by default.
+ *
+ * @ingroup Edje_Object
+ */
+EAPI Eina_Bool edje_object_play_get(const Evas_Object *obj);
+
+/**
+ * @brief Transition duration factor.
+ *
+ * This defines a multiplier for the duration of transitions as they are
+ * defined in EDC. By default this factor is 1.0, which means animations play
+ * at the same speed as described in EDC.
+ *
+ * Sets transition duration factor.
+ *
+ * @param[in] scale The transition duration factor.
+ *
+ * @ingroup Edje_Object
+ */
+EAPI void edje_object_transition_duration_factor_set(Evas_Object *obj, double scale);
+
+/**
+ * @brief Transition duration factor.
+ *
+ * This defines a multiplier for the duration of transitions as they are
+ * defined in EDC. By default this factor is 1.0, which means animations play
+ * at the same speed as described in EDC.
+ *
+ * Gets transition duration factor.
+ *
+ * @return The transition duration factor.
+ *
+ * @ingroup Edje_Object
+ */
+EAPI double edje_object_transition_duration_factor_get(const Evas_Object *obj);
+
+/**
* @}
*/
#include "edje_object.eo.legacy.h"
diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index 256f468fe9..3ba2146aec 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -1009,3 +1009,31 @@ edje_object_part_text_insert(Eo *obj, const char *part, const char *text)
if (ed->text_change.func)
ed->text_change.func(ed->text_change.data, obj, part);
}
+
+EAPI void
+edje_object_play_set(Evas_Object *obj, Eina_Bool play)
+{
+ efl_player_play_set(obj, play);
+}
+
+EAPI Eina_Bool
+edje_object_play_get(const Evas_Object *obj)
+{
+ return efl_player_play_get(obj);
+}
+
+EAPI void
+edje_object_transition_duration_factor_set(Evas_Object *obj, double scale)
+{
+ if (scale <= 0.0) return;
+ efl_player_play_speed_set(obj, 1.0/scale);
+}
+
+EAPI double
+edje_object_transition_duration_factor_get(const Evas_Object *obj)
+{
+ double speed = efl_player_play_speed_get(obj);
+
+ if (speed <= 0.0) speed = 1.0;
+ return 1.0/speed;
+}
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 42314c3555..e4dd2d37ac 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -3,7 +3,7 @@ import edje_types;
// FIXME: This EO doc needs a direct link to the "edcref" doc
class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
- Efl.Observer, Efl.Ui.Base)
+ Efl.Observer, Efl.Ui.Base, Efl.Player)
{
[[Edje object class]]
legacy_prefix: edje_object;
@@ -19,7 +19,7 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
If animations are disabled, transitions between states (as
defined in EDC) are then instantaneous. This is conceptually similar
- to setting the @.transition_duration_factor to an infinitely high
+ to setting the @Efl.Player.play_speed to an infinitely high
value.
]]
get {
@@ -32,30 +32,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
on: bool; [[The animation state, $true by default.]]
}
}
- @property play {
- [[Whether this object is playing or not.
-
- This property indicates whether the object is running or not. If
- stopped (or paused), all transitions are disabled and programs
- stop running, until resumed.
-
- If play is disabled, the object will remain the same, and its parts
- will not change state. Note that play can be disabled during a
- transition between states, effectively freezing the object in
- flight. When paused, no events will be processed or sent.
-
- Setting to $true resumes playing from the current state.
- ]]
- get {
- [[Get the current state of play, $true by default.]]
- }
- set {
- [[Start or stop playing programs in this object.]]
- }
- values {
- play: bool; [[The play state, $true by default.]]
- }
- }
@property perspective {
set {
[[Sets the given perspective object on this Edje object.
@@ -86,23 +62,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
}
}
}
- @property transition_duration_factor {
- [[Transition duration factor.
-
- This defines a multiplier for the duration of transitions as they
- are defined in EDC. By default this factor is 1.0, which means
- animations play at the same speed as described in EDC.
- ]]
- set {
- [[Sets transition duration factor.]]
- }
- get {
- [[Gets transition duration factor.]]
- }
- values {
- scale: double(1.0); [[The transition duration factor.]]
- }
- }
// TODO: Legacy only. EO may rely on futures.
preload {
@@ -1188,6 +1147,9 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
Efl.Container.content_remove;
Efl.Part.part;
Efl.Observer.update;
+ Efl.Player.playable { get; }
+ Efl.Player.play { get; set; }
+ Efl.Player.play_speed { get; set; }
}
events {
recalc; [[Edje re-calculated the object.]]
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 28b9300ccf..ed95d3d7af 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -213,19 +213,6 @@ edje_transition_duration_factor_set(double scale)
_edje_transition_duration_scale = FROM_DOUBLE(scale);
}
-EOLIAN void
-_edje_object_transition_duration_factor_set(Eo *obj EINA_UNUSED,
- Edje *pd, double scale)
-{
- pd->duration_scale = scale;
-}
-
-EOLIAN double
-_edje_object_transition_duration_factor_get(Eo *obj EINA_UNUSED, Edje *pd)
-{
- return pd->duration_scale;
-}
-
void
edje_object_propagate_callback_add(Evas_Object *obj, void (*func)(void *data, Evas_Object *o, const char *emission, const char *source), void *data)
{
@@ -326,54 +313,6 @@ _edje_object_signal_emit(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, co
/* FIXDOC: Verify/Expand */
EOLIAN void
-_edje_object_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play)
-{
- double t;
- Eina_List *l;
- Edje_Running_Program *runp;
- unsigned short i;
-
- if (!ed) return;
- if (ed->delete_me) return;
- if (play)
- {
- if (!ed->paused) return;
- ed->paused = EINA_FALSE;
- t = ecore_time_get() - ed->paused_at;
- EINA_LIST_FOREACH(ed->actions, l, runp)
- runp->start_time += t;
- }
- else
- {
- if (ed->paused) return;
- ed->paused = EINA_TRUE;
- ed->paused_at = ecore_time_get();
- }
-
- for (i = 0; i < ed->table_parts_size; i++)
- {
- Edje_Real_Part *rp;
- rp = ed->table_parts[i];
- if ((rp->part->type == EDJE_PART_TYPE_GROUP) &&
- ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
- (rp->typedata.swallow)) &&
- (rp->typedata.swallow->swallowed_object))
- edje_object_play_set(rp->typedata.swallow->swallowed_object, play);
- }
-}
-
-EOLIAN Eina_Bool
-_edje_object_play_get(Eo *obj EINA_UNUSED, Edje *ed)
-{
- if (!ed) return EINA_FALSE;
- if (ed->delete_me) return EINA_FALSE;
- if (ed->paused) return EINA_FALSE;
-
- return EINA_TRUE;
-}
-
-/* FIXDOC: Verify/Expand */
-EOLIAN void
_edje_object_animation_set(Eo *obj, Edje *ed, Eina_Bool on)
{
Eina_List *l;
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 8c6800fded..9f0967c3d4 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -544,6 +544,72 @@ _edje_object_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object *obs,
}
}
+EOLIAN Eina_Bool
+_edje_object_efl_player_playable_get(Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED)
+{
+ return EINA_TRUE;
+}
+
+EOLIAN void
+_edje_object_efl_player_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play)
+{
+ double t;
+ Eina_List *l;
+ Edje_Running_Program *runp;
+ unsigned short i;
+
+ if (!ed) return;
+ if (ed->delete_me) return;
+ if (play)
+ {
+ if (!ed->paused) return;
+ ed->paused = EINA_FALSE;
+ t = ecore_time_get() - ed->paused_at;
+ EINA_LIST_FOREACH(ed->actions, l, runp)
+ runp->start_time += t;
+ }
+ else
+ {
+ if (ed->paused) return;
+ ed->paused = EINA_TRUE;
+ ed->paused_at = ecore_time_get();
+ }
+
+ for (i = 0; i < ed->table_parts_size; i++)
+ {
+ Edje_Real_Part *rp;
+ rp = ed->table_parts[i];
+ if ((rp->part->type == EDJE_PART_TYPE_GROUP) &&
+ ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
+ (rp->typedata.swallow)) &&
+ (rp->typedata.swallow->swallowed_object))
+ edje_object_play_set(rp->typedata.swallow->swallowed_object, play);
+ }
+}
+
+EOLIAN Eina_Bool
+_edje_object_efl_player_play_get(Eo *obj EINA_UNUSED, Edje *ed)
+{
+ if (!ed) return EINA_FALSE;
+ if (ed->delete_me) return EINA_FALSE;
+ if (ed->paused) return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
+EOLIAN void
+_edje_object_efl_player_play_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed)
+{
+ if (speed <= 0.0) speed = 1.0;
+ pd->duration_scale = 1.0/speed;
+}
+
+EOLIAN double
+_edje_object_efl_player_play_speed_get(Eo *obj EINA_UNUSED, Edje *pd)
+{
+ return 1.0/pd->duration_scale;
+}
+
/* Internal EO APIs and hidden overrides */
#define EDJE_OBJECT_EXTRA_OPS \