cssvalue: Pass property ID to transition function

This is to allow animating arrays properly. I'm not really thrilled
about this solution (we leak propertys into the values again...), but
it's the best I can come up with - I prefer it to having N different
array types...
This commit is contained in:
Benjamin Otte 2012-08-30 15:51:29 +02:00
parent fd7668bfb5
commit e3fc081c5d
22 changed files with 40 additions and 17 deletions

View File

@ -95,6 +95,7 @@ gtk_css_value_array_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_array_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -84,6 +84,7 @@ gtk_css_value_bg_size_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_bg_size_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GtkCssValue *x, *y;
@ -99,7 +100,7 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
if (start->x)
{
x = _gtk_css_value_transition (start->x, end->x, progress);
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
if (x == NULL)
return NULL;
}
@ -108,7 +109,7 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
if (start->y)
{
y = _gtk_css_value_transition (start->y, end->y, progress);
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
if (y == NULL)
{
_gtk_css_value_unref (x);

View File

@ -95,6 +95,7 @@ gtk_css_value_border_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_border_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -68,15 +68,16 @@ gtk_css_value_corner_equal (const GtkCssValue *corner1,
static GtkCssValue *
gtk_css_value_corner_transition (GtkCssValue *start,
GtkCssValue *end,
double progress)
GtkCssValue *end,
guint property_id,
double progress)
{
GtkCssValue *x, *y;
x = _gtk_css_value_transition (start->x, end->x, progress);
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
if (x == NULL)
return NULL;
y = _gtk_css_value_transition (start->y, end->y, progress);
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
if (y == NULL)
{
_gtk_css_value_unref (x);

View File

@ -84,6 +84,7 @@ gtk_css_value_ease_equal (const GtkCssValue *ease1,
static GtkCssValue *
gtk_css_value_ease_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -53,6 +53,7 @@ gtk_css_value_engine_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_engine_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -54,6 +54,7 @@ gtk_css_value_enum_equal (const GtkCssValue *enum1,
static GtkCssValue *
gtk_css_value_enum_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -67,6 +67,7 @@ gtk_css_value_image_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_image_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GtkCssImage *fade;

View File

@ -65,6 +65,7 @@ gtk_css_value_inherit_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_inherit_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -54,6 +54,7 @@ gtk_css_value_initial_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_initial_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -142,6 +142,7 @@ gtk_css_value_number_equal (const GtkCssValue *number1,
static GtkCssValue *
gtk_css_value_number_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
/* FIXME: This needs to be supported at least for percentages,

View File

@ -69,14 +69,15 @@ gtk_css_value_position_equal (const GtkCssValue *position1,
static GtkCssValue *
gtk_css_value_position_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GtkCssValue *x, *y;
x = _gtk_css_value_transition (start->x, end->x, progress);
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
if (x == NULL)
return NULL;
y = _gtk_css_value_transition (start->y, end->y, progress);
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
if (y == NULL)
{
_gtk_css_value_unref (x);

View File

@ -53,6 +53,7 @@ gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
static GtkCssValue *
gtk_css_value_repeat_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -53,6 +53,7 @@ gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
static GtkCssValue *
gtk_css_value_rgba_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GdkRGBA transition;

View File

@ -93,6 +93,7 @@ gtk_css_value_shadows_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_shadows_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
GtkCssValue *result;
@ -109,14 +110,14 @@ gtk_css_value_shadows_transition (GtkCssValue *start,
for (i = 0; i < MIN (start->len, end->len); i++)
{
result->values[i] = _gtk_css_value_transition (start->values[i], end->values[i], progress);
result->values[i] = _gtk_css_value_transition (start->values[i], end->values[i], property_id, progress);
}
if (start->len > end->len)
{
for (; i < result->len; i++)
{
GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (start->values[i]);
result->values[i] = _gtk_css_value_transition (start->values[i], fill, progress);
result->values[i] = _gtk_css_value_transition (start->values[i], fill, property_id, progress);
_gtk_css_value_unref (fill);
}
}
@ -125,7 +126,7 @@ gtk_css_value_shadows_transition (GtkCssValue *start,
for (; i < result->len; i++)
{
GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (end->values[i]);
result->values[i] = _gtk_css_value_transition (fill, end->values[i], progress);
result->values[i] = _gtk_css_value_transition (fill, end->values[i], property_id, progress);
_gtk_css_value_unref (fill);
}
}

View File

@ -106,17 +106,18 @@ gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
static GtkCssValue *
gtk_css_value_shadow_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
if (start->inset != end->inset)
return NULL;
return gtk_css_shadow_value_new (_gtk_css_value_transition (start->hoffset, end->hoffset, progress),
_gtk_css_value_transition (start->voffset, end->voffset, progress),
_gtk_css_value_transition (start->radius, end->radius, progress),
_gtk_css_value_transition (start->spread, end->spread, progress),
return gtk_css_shadow_value_new (_gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress),
_gtk_css_value_transition (start->voffset, end->voffset, property_id, progress),
_gtk_css_value_transition (start->radius, end->radius, property_id, progress),
_gtk_css_value_transition (start->spread, end->spread, property_id, progress),
start->inset,
_gtk_css_value_transition (start->color, end->color, progress));
_gtk_css_value_transition (start->color, end->color, property_id, progress));
}
static void

View File

@ -51,6 +51,7 @@ gtk_css_value_string_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_string_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -46,6 +46,7 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation,
value = _gtk_css_value_transition (transition->start,
transition->end,
transition->property,
progress);
if (value == NULL)
value = _gtk_css_value_ref (transition->end);

View File

@ -55,6 +55,7 @@ gtk_css_value_typed_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_typed_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;

View File

@ -125,6 +125,7 @@ _gtk_css_value_equal0 (const GtkCssValue *value1,
GtkCssValue *
_gtk_css_value_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
g_return_val_if_fail (start != NULL, FALSE);
@ -133,7 +134,7 @@ _gtk_css_value_transition (GtkCssValue *start,
if (start->class != end->class)
return NULL;
return start->class->transition (start, end, progress);
return start->class->transition (start, end, property_id, progress);
}
char *

View File

@ -50,6 +50,7 @@ struct _GtkCssValueClass {
const GtkCssValue *value2);
GtkCssValue * (* transition) (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress);
void (* print) (const GtkCssValue *value,
GString *string);
@ -74,6 +75,7 @@ gboolean _gtk_css_value_equal0 (const GtkCssValue
const GtkCssValue *value2);
GtkCssValue *_gtk_css_value_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress);
char * _gtk_css_value_to_string (const GtkCssValue *value);

View File

@ -238,6 +238,7 @@ gtk_css_value_symbolic_equal (const GtkCssValue *value1,
static GtkCssValue *
gtk_css_value_symbolic_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
return NULL;