edje: implement edje.player interface functions
fixes T5560
This commit is contained in:
parent
f2082c0412
commit
0e7a316a7a
|
@ -2156,6 +2156,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);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -1121,3 +1121,31 @@ edje_object_calc_force(Edje_Object *obj)
|
|||
{
|
||||
efl_canvas_layout_calc_force(obj);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ import edje_types;
|
|||
|
||||
class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
|
||||
Efl.Observer, Efl.Ui.Base, Efl.Canvas.Layout_Calc,
|
||||
Efl.Canvas.Layout_Signal, Efl.Canvas.Layout_Group)
|
||||
Efl.Canvas.Layout_Signal, Efl.Canvas.Layout_Group,
|
||||
Efl.Player)
|
||||
{
|
||||
[[Edje object class]]
|
||||
legacy_prefix: edje_object;
|
||||
|
@ -20,7 +21,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 {
|
||||
|
@ -33,30 +34,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.
|
||||
|
@ -87,23 +64,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 {
|
||||
|
@ -832,6 +792,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.]]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
_edje_object_signal_callback_add(Edje *ed, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
||||
{
|
||||
|
@ -297,54 +284,6 @@ _edje_object_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Edje *ed,
|
|||
_edje_emit(ed, emission, source);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
|
|
|
@ -554,6 +554,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 \
|
||||
|
|
Loading…
Reference in New Issue