timeline: Rename the reverse property to auto-reverse
Other frameworks expose the same functionality as "auto-reverse", probably to match the cassette tape player. It actually makes sense for Clutter to follow suit.
This commit is contained in:
parent
397e0ddb16
commit
c444447cd3
@ -73,7 +73,7 @@ struct _ClutterTimelinePrivate
|
|||||||
* a tick from the master clock
|
* a tick from the master clock
|
||||||
*/
|
*/
|
||||||
guint waiting_first_tick : 1;
|
guint waiting_first_tick : 1;
|
||||||
guint reverse : 1;
|
guint auto_reverse : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -90,7 +90,7 @@ enum
|
|||||||
PROP_DELAY,
|
PROP_DELAY,
|
||||||
PROP_DURATION,
|
PROP_DURATION,
|
||||||
PROP_DIRECTION,
|
PROP_DIRECTION,
|
||||||
PROP_REVERSE,
|
PROP_AUTO_REVERSE,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
@ -163,8 +163,8 @@ clutter_timeline_set_property (GObject *object,
|
|||||||
clutter_timeline_set_direction (timeline, g_value_get_enum (value));
|
clutter_timeline_set_direction (timeline, g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_REVERSE:
|
case PROP_AUTO_REVERSE:
|
||||||
clutter_timeline_set_reverse (timeline, g_value_get_boolean (value));
|
clutter_timeline_set_auto_reverse (timeline, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -200,8 +200,8 @@ clutter_timeline_get_property (GObject *object,
|
|||||||
g_value_set_enum (value, priv->direction);
|
g_value_set_enum (value, priv->direction);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_REVERSE:
|
case PROP_AUTO_REVERSE:
|
||||||
g_value_set_boolean (value, priv->reverse);
|
g_value_set_boolean (value, priv->auto_reverse);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -314,17 +314,17 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
|
|||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterTimeline:reverse:
|
* ClutterTimeline:auto-reverse:
|
||||||
*
|
*
|
||||||
* Whether the direction of a looping timeline should be reversed
|
* If the direction of the timeline should be automatically reversed
|
||||||
* when emitting the #ClutterTimeline::completed signal.
|
* when reaching the end.
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
obj_props[PROP_REVERSE] =
|
obj_props[PROP_AUTO_REVERSE] =
|
||||||
g_param_spec_boolean ("reverse",
|
g_param_spec_boolean ("auto-reverse",
|
||||||
P_("Reverse"),
|
P_("Auto Reverse"),
|
||||||
P_("Whether the direction should be reversed when looping"),
|
P_("Whether the direction should be reversed when reaching the end"),
|
||||||
FALSE,
|
FALSE,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
@ -683,11 +683,9 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
|
|||||||
|
|
||||||
g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
|
g_signal_emit (timeline, timeline_signals[COMPLETED], 0);
|
||||||
|
|
||||||
/* reverse the direction of the timeline if :loop and
|
if (priv->auto_reverse)
|
||||||
* :reverse are set to TRUE
|
|
||||||
*/
|
|
||||||
if (priv->reverse)
|
|
||||||
{
|
{
|
||||||
|
/* :auto-reverse changes the direction of the timeline */
|
||||||
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
|
||||||
priv->direction = CLUTTER_TIMELINE_BACKWARD;
|
priv->direction = CLUTTER_TIMELINE_BACKWARD;
|
||||||
else
|
else
|
||||||
@ -1538,7 +1536,7 @@ clutter_timeline_has_marker (ClutterTimeline *timeline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_timeline_set_reverse:
|
* clutter_timeline_set_auto_reverse:
|
||||||
* @timeline: a #ClutterTimeline
|
* @timeline: a #ClutterTimeline
|
||||||
* @reverse: %TRUE if the @timeline should reverse the direction
|
* @reverse: %TRUE if the @timeline should reverse the direction
|
||||||
*
|
*
|
||||||
@ -1576,14 +1574,14 @@ clutter_timeline_has_marker (ClutterTimeline *timeline,
|
|||||||
* |[
|
* |[
|
||||||
* timeline = clutter_timeline_new (1000);
|
* timeline = clutter_timeline_new (1000);
|
||||||
* clutter_timeline_set_loop (timeline);
|
* clutter_timeline_set_loop (timeline);
|
||||||
* clutter_timeline_set_reverse (timeline);
|
* clutter_timeline_set_auto_reverse (timeline);
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_timeline_set_reverse (ClutterTimeline *timeline,
|
clutter_timeline_set_auto_reverse (ClutterTimeline *timeline,
|
||||||
gboolean reverse)
|
gboolean reverse)
|
||||||
{
|
{
|
||||||
ClutterTimelinePrivate *priv;
|
ClutterTimelinePrivate *priv;
|
||||||
|
|
||||||
@ -1593,29 +1591,30 @@ clutter_timeline_set_reverse (ClutterTimeline *timeline,
|
|||||||
|
|
||||||
priv = timeline->priv;
|
priv = timeline->priv;
|
||||||
|
|
||||||
if (priv->reverse != reverse)
|
if (priv->auto_reverse != reverse)
|
||||||
{
|
{
|
||||||
priv->reverse = reverse;
|
priv->auto_reverse = reverse;
|
||||||
|
|
||||||
_clutter_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_REVERSE]);
|
_clutter_notify_by_pspec (G_OBJECT (timeline),
|
||||||
|
obj_props[PROP_AUTO_REVERSE]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_timeline_get_reverse:
|
* clutter_timeline_get_auto_reverse:
|
||||||
* @timeline: a #ClutterTimeline
|
* @timeline: a #ClutterTimeline
|
||||||
*
|
*
|
||||||
* Retrieves the value set by clutter_timeline_set_reverse().
|
* Retrieves the value set by clutter_timeline_set_auto_reverse().
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the timeline should reverse when looping, and
|
* Return value: %TRUE if the timeline should automatically reverse, and
|
||||||
* %FALSE otherwise
|
* %FALSE otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
clutter_timeline_get_reverse (ClutterTimeline *timeline)
|
clutter_timeline_get_auto_reverse (ClutterTimeline *timeline)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
|
||||||
|
|
||||||
return timeline->priv->reverse;
|
return timeline->priv->auto_reverse;
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,9 @@ void clutter_timeline_stop (ClutterTimeline *timeli
|
|||||||
void clutter_timeline_set_loop (ClutterTimeline *timeline,
|
void clutter_timeline_set_loop (ClutterTimeline *timeline,
|
||||||
gboolean loop);
|
gboolean loop);
|
||||||
gboolean clutter_timeline_get_loop (ClutterTimeline *timeline);
|
gboolean clutter_timeline_get_loop (ClutterTimeline *timeline);
|
||||||
void clutter_timeline_set_reverse (ClutterTimeline *timeline,
|
void clutter_timeline_set_auto_reverse (ClutterTimeline *timeline,
|
||||||
gboolean reverse);
|
gboolean reverse);
|
||||||
gboolean clutter_timeline_get_reverse (ClutterTimeline *timeline);
|
gboolean clutter_timeline_get_auto_reverse (ClutterTimeline *timeline);
|
||||||
void clutter_timeline_rewind (ClutterTimeline *timeline);
|
void clutter_timeline_rewind (ClutterTimeline *timeline);
|
||||||
void clutter_timeline_skip (ClutterTimeline *timeline,
|
void clutter_timeline_skip (ClutterTimeline *timeline,
|
||||||
guint msecs);
|
guint msecs);
|
||||||
|
@ -2660,12 +2660,12 @@ timeline_completed_cb (ClutterTimeline *timeline,
|
|||||||
completes, the timeline sets itself to run forward again, etc.</para>
|
completes, the timeline sets itself to run forward again, etc.</para>
|
||||||
|
|
||||||
<para>To make a timeline reverse its direction each time it
|
<para>To make a timeline reverse its direction each time it
|
||||||
completes, use the <function>clutter_timeline_set_reverse()</function>
|
completes, use the <function>clutter_timeline_set_auto_reverse()</function>
|
||||||
function:</para>
|
function:</para>
|
||||||
|
|
||||||
<informalexample>
|
<informalexample>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
clutter_timeline_set_reverse (timeline, TRUE);
|
clutter_timeline_set_auto_reverse (timeline, TRUE);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ main (int argc,
|
|||||||
|
|
||||||
state->timeline = clutter_timeline_new (1000);
|
state->timeline = clutter_timeline_new (1000);
|
||||||
clutter_timeline_set_loop (state->timeline, TRUE);
|
clutter_timeline_set_loop (state->timeline, TRUE);
|
||||||
clutter_timeline_set_reverse (state->timeline, TRUE);
|
clutter_timeline_set_auto_reverse (state->timeline, TRUE);
|
||||||
|
|
||||||
g_signal_connect (stage,
|
g_signal_connect (stage,
|
||||||
"key-press-event",
|
"key-press-event",
|
||||||
|
@ -660,8 +660,8 @@ clutter_timeline_get_delay
|
|||||||
ClutterTimelineDirection
|
ClutterTimelineDirection
|
||||||
clutter_timeline_set_direction
|
clutter_timeline_set_direction
|
||||||
clutter_timeline_get_direction
|
clutter_timeline_get_direction
|
||||||
clutter_timeline_set_reverse
|
clutter_timeline_set_auto_reverse
|
||||||
clutter_timeline_get_reverse
|
clutter_timeline_get_auto_reverse
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
clutter_timeline_start
|
clutter_timeline_start
|
||||||
|
@ -106,7 +106,7 @@ reverse_timeline (ClutterTimeline *timeline)
|
|||||||
|
|
||||||
ClutterTimeline *timeline = clutter_animation_get_timeline (animation);
|
ClutterTimeline *timeline = clutter_animation_get_timeline (animation);
|
||||||
clutter_timeline_set_loop (timeline, TRUE);
|
clutter_timeline_set_loop (timeline, TRUE);
|
||||||
clutter_timeline_set_reverse (timeline, TRUE);
|
clutter_timeline_set_auto_reverse (timeline, TRUE);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ test_behave_main (int argc, char *argv[])
|
|||||||
/* Make a timeline */
|
/* Make a timeline */
|
||||||
timeline = clutter_timeline_new (4000);
|
timeline = clutter_timeline_new (4000);
|
||||||
clutter_timeline_set_loop (timeline, TRUE);
|
clutter_timeline_set_loop (timeline, TRUE);
|
||||||
clutter_timeline_set_reverse (timeline, TRUE);
|
clutter_timeline_set_auto_reverse (timeline, TRUE);
|
||||||
|
|
||||||
/* Set an alpha func to power behaviour - ramp is constant rise */
|
/* Set an alpha func to power behaviour - ramp is constant rise */
|
||||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||||
|
@ -755,7 +755,7 @@ test_layout_main (int argc, char *argv[])
|
|||||||
|
|
||||||
main_timeline = clutter_timeline_new (2000);
|
main_timeline = clutter_timeline_new (2000);
|
||||||
clutter_timeline_set_loop (main_timeline, TRUE);
|
clutter_timeline_set_loop (main_timeline, TRUE);
|
||||||
clutter_timeline_set_reverse (main_timeline, TRUE);
|
clutter_timeline_set_auto_reverse (main_timeline, TRUE);
|
||||||
g_signal_connect (main_timeline, "new-frame",
|
g_signal_connect (main_timeline, "new-frame",
|
||||||
G_CALLBACK (relayout_on_frame),
|
G_CALLBACK (relayout_on_frame),
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -221,6 +221,7 @@ test_threads_main (int argc, char *argv[])
|
|||||||
|
|
||||||
timeline = clutter_timeline_new (3000);
|
timeline = clutter_timeline_new (3000);
|
||||||
clutter_timeline_set_loop (timeline, TRUE);
|
clutter_timeline_set_loop (timeline, TRUE);
|
||||||
|
clutter_timeline_set_auto_reverse (timeline, TRUE);
|
||||||
|
|
||||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||||
r_behaviour = clutter_behaviour_rotate_new (alpha,
|
r_behaviour = clutter_behaviour_rotate_new (alpha,
|
||||||
|
Loading…
Reference in New Issue
Block a user