2015-06-24 19:12:05 -07:00
|
|
|
#define EFL_GFX_FILTER_BETA
|
2016-06-08 00:09:38 -07:00
|
|
|
#define EFL_GFX_SIZE_HINT_PROTECTED
|
2015-06-24 19:12:05 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2016-03-21 16:31:26 -07:00
|
|
|
#include "../evas/canvas/evas_table.eo.h"
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
static void _edje_part_make_rtl(Edje_Part_Description_Common *desc);
|
2011-02-01 05:26:49 -08:00
|
|
|
static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type);
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc,
|
|
|
|
Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp,
|
|
|
|
Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
|
|
|
|
Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y,
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
Edje_Real_Part *clip_to,
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Real_Part *confine_to, Edje_Real_Part *threshold,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
Evas_Coord mmw, Evas_Coord mmh,
|
|
|
|
FLOAT_T pos);
|
|
|
|
|
|
|
|
#define EINA_COW_CALC_PHYSICS_BEGIN(Calc, Write) \
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(Calc); \
|
|
|
|
EINA_COW_WRITE_BEGIN(_edje_calc_params_physics_cow, Calc->ext->physics, Edje_Calc_Params_Physics, Write)
|
2013-03-12 22:30:21 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define EINA_COW_CALC_PHYSICS_END(Calc, Write) \
|
2016-08-14 06:30:32 -07:00
|
|
|
EINA_COW_WRITE_END(_edje_calc_params_physics_cow, Calc->ext->physics, Write)
|
2013-03-12 22:30:21 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define EINA_COW_CALC_MAP_BEGIN(Calc, Write) \
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(Calc); \
|
|
|
|
EINA_COW_WRITE_BEGIN(_edje_calc_params_map_cow, Calc->ext->map, Edje_Calc_Params_Map, Write)
|
2013-03-12 22:30:21 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define EINA_COW_CALC_MAP_END(Calc, Write) \
|
2016-08-14 06:30:32 -07:00
|
|
|
EINA_COW_WRITE_END(_edje_calc_params_map_cow, Calc->ext->map, Write)
|
2013-03-12 22:30:21 -07:00
|
|
|
|
2015-06-22 02:17:26 -07:00
|
|
|
#ifdef BUILD_EDJE_FP
|
|
|
|
|
|
|
|
#define TYPE_EPSILON FLT_EPSILON
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define TYPE_EPSILON DBL_EPSILON
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define SET_QUATERNION(type) \
|
|
|
|
double norm; \
|
|
|
|
Eina_Quaternion quaternion; \
|
|
|
|
\
|
|
|
|
eina_quaternion_set(&quaternion, pd_##type->type.orientation.data[0], \
|
|
|
|
pd_##type->type.orientation.data[1], \
|
|
|
|
pd_##type->type.orientation.data[2], \
|
|
|
|
pd_##type->type.orientation.data[3]); \
|
|
|
|
\
|
|
|
|
norm = eina_quaternion_norm(&quaternion); \
|
|
|
|
\
|
|
|
|
if ((norm - 0.0) <= TYPE_EPSILON) \
|
|
|
|
ERR("%s %s", \
|
|
|
|
"{0, 0, 0, 0} quaternion gives rotation on non-zero angle", \
|
|
|
|
"around axis without orientation"); \
|
|
|
|
\
|
|
|
|
eina_quaternion_scale(&quaternion, &quaternion, 1/norm); \
|
|
|
|
\
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_node_orientation_set(ep->node, quaternion.x, quaternion.y, \
|
|
|
|
quaternion.z, quaternion.w);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
#define SET_LOOK_AT(type) \
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_node_look_at_set(ep->node, pd_##type->type.position.space, \
|
|
|
|
pd_##type->type.orientation.data[0], \
|
|
|
|
pd_##type->type.orientation.data[1], \
|
|
|
|
pd_##type->type.orientation.data[2], \
|
|
|
|
pd_##type->type.position.space, \
|
|
|
|
pd_##type->type.orientation.data[3], \
|
|
|
|
pd_##type->type.orientation.data[4], \
|
|
|
|
pd_##type->type.orientation.data[5]);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
#define SET_LOOK_TO(type) \
|
|
|
|
Edje_Real_Part *look_to; \
|
|
|
|
Evas_Real x, y ,z; \
|
|
|
|
look_to = ed->table_parts[pd_##type->type.orientation.look_to % ed->table_parts_size]; \
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_node_position_get(look_to->node, pd_##type->type.position.space, &x, &y, &z); \
|
|
|
|
evas_canvas3d_node_look_at_set(ep->node, pd_##type->type.position.space, x, y, z, \
|
|
|
|
pd_##type->type.position.space, \
|
|
|
|
pd_##type->type.orientation.data[3], \
|
|
|
|
pd_##type->type.orientation.data[4], \
|
|
|
|
pd_##type->type.orientation.data[5]);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
#define SET_ANGLE_AXIS(type) \
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_node_orientation_angle_axis_set(ep->node, pd_##type->type.orientation.data[0], \
|
|
|
|
pd_##type->type.orientation.data[1], \
|
|
|
|
pd_##type->type.orientation.data[2], \
|
|
|
|
pd_##type->type.orientation.data[3]);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
void
|
|
|
|
_edje_calc_params_clear(Edje_Calc_Params *p)
|
|
|
|
{
|
|
|
|
// this happens to cover type.common, type.text and type.node
|
|
|
|
if (p->type.common) free(p->type.common);
|
|
|
|
p->type.common = NULL;
|
|
|
|
|
|
|
|
// handle cow stuff in one place
|
|
|
|
if (p->ext)
|
|
|
|
{
|
2016-08-17 22:18:06 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2016-08-14 06:30:32 -07:00
|
|
|
eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&(p->ext->map));
|
|
|
|
p->ext->map = NULL;
|
2016-08-17 22:18:06 -07:00
|
|
|
# ifdef HAVE_EPHYSICS
|
2016-08-14 06:30:32 -07:00
|
|
|
eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&(p->ext->physics));
|
|
|
|
p->ext->physics = NULL;
|
2016-08-17 22:18:06 -07:00
|
|
|
# endif
|
2016-08-14 06:30:32 -07:00
|
|
|
#endif
|
|
|
|
free(p->ext);
|
|
|
|
p->ext = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
void
|
2013-12-01 21:59:43 -08:00
|
|
|
_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2, FLOAT_T v3, FLOAT_T v4)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T fp_pos;
|
|
|
|
FLOAT_T npos;
|
2013-12-01 21:59:43 -08:00
|
|
|
double v[4];
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-02-24 07:37:16 -08:00
|
|
|
pos = CLAMP(pos, ZERO, FROM_INT(1));
|
2004-10-30 05:19:33 -07:00
|
|
|
|
2010-02-24 07:37:16 -08:00
|
|
|
fp_pos = pos;
|
2009-12-09 07:44:54 -08:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
#if 0 // old code - easy to enable for comparing float vs fixed point
|
2015-06-08 11:43:00 -07:00
|
|
|
/* take linear pos along timescale and use interpolation method */
|
2003-06-23 19:33:04 -07:00
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case EDJE_TWEEN_MODE_SINUSOIDAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* npos = (1.0 - cos(pos * PI)) / 2.0; */
|
|
|
|
npos = DIV2(SUB(FROM_INT(1),
|
|
|
|
COS(MUL(fp_pos,
|
|
|
|
PI))));
|
|
|
|
break;
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
case EDJE_TWEEN_MODE_ACCELERATE:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* npos = 1.0 - sin((PI / 2.0) + (pos * PI / 2.0)); */
|
|
|
|
npos = SUB(FROM_INT(1),
|
|
|
|
SIN(ADD(DIV2(PI),
|
|
|
|
MUL(fp_pos,
|
|
|
|
DIV2(PI)))));
|
|
|
|
break;
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
case EDJE_TWEEN_MODE_DECELERATE:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* npos = sin(pos * PI / 2.0); */
|
|
|
|
npos = SIN(MUL(fp_pos,
|
|
|
|
DIV2(PI)));
|
|
|
|
break;
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
case EDJE_TWEEN_MODE_LINEAR:
|
2015-06-08 11:43:00 -07:00
|
|
|
npos = fp_pos;
|
|
|
|
break;
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
npos = fp_pos;
|
|
|
|
break;
|
2011-05-16 06:16:34 -07:00
|
|
|
}
|
|
|
|
#else
|
2011-11-02 21:43:00 -07:00
|
|
|
switch (mode & EDJE_TWEEN_MODE_MASK)
|
2011-05-16 06:16:34 -07:00
|
|
|
{
|
|
|
|
case EDJE_TWEEN_MODE_SINUSOIDAL:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_SINUSOIDAL,
|
2011-05-16 06:16:34 -07:00
|
|
|
0.0, 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_ACCELERATE:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_ACCELERATE,
|
2011-05-16 06:16:34 -07:00
|
|
|
0.0, 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_DECELERATE:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-01-24 06:48:51 -08:00
|
|
|
ECORE_POS_MAP_DECELERATE,
|
2011-05-16 06:16:34 -07:00
|
|
|
0.0, 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_LINEAR:
|
|
|
|
npos = fp_pos;
|
|
|
|
/* npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2015-06-08 11:43:00 -07:00
|
|
|
ECORE_POS_MAP_LINEAR,
|
2011-05-16 06:16:34 -07:00
|
|
|
0.0, 0.0));
|
|
|
|
*/
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_ACCELERATE_FACTOR:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
|
|
|
ECORE_POS_MAP_ACCELERATE_FACTOR,
|
|
|
|
TO_DOUBLE(v1), 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_DECELERATE_FACTOR:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_DECELERATE_FACTOR,
|
2011-05-16 06:16:34 -07:00
|
|
|
TO_DOUBLE(v1), 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_SINUSOIDAL_FACTOR,
|
2011-05-16 06:16:34 -07:00
|
|
|
TO_DOUBLE(v1), 0.0));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_DIVISOR_INTERP:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_DIVISOR_INTERP,
|
2011-05-16 06:16:34 -07:00
|
|
|
TO_DOUBLE(v1), TO_DOUBLE(v2)));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_BOUNCE:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_BOUNCE,
|
2011-05-16 06:16:34 -07:00
|
|
|
TO_DOUBLE(v1), TO_DOUBLE(v2)));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
case EDJE_TWEEN_MODE_SPRING:
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos),
|
2012-08-14 00:59:06 -07:00
|
|
|
ECORE_POS_MAP_SPRING,
|
2011-05-16 06:16:34 -07:00
|
|
|
TO_DOUBLE(v1), TO_DOUBLE(v2)));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2013-12-01 21:59:43 -08:00
|
|
|
case EDJE_TWEEN_MODE_CUBIC_BEZIER:
|
|
|
|
v[0] = TO_DOUBLE(v1);
|
|
|
|
v[1] = TO_DOUBLE(v2);
|
|
|
|
v[2] = TO_DOUBLE(v3);
|
|
|
|
v[3] = TO_DOUBLE(v4);
|
|
|
|
|
|
|
|
npos = FROM_DOUBLE(ecore_animator_pos_map_n(TO_DOUBLE(pos),
|
|
|
|
ECORE_POS_MAP_CUBIC_BEZIER,
|
|
|
|
4, v));
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-05-16 06:16:34 -07:00
|
|
|
default:
|
|
|
|
npos = fp_pos;
|
|
|
|
break;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2012-03-12 08:28:58 -07:00
|
|
|
#endif
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(npos, ep->description_pos)) return;
|
2003-06-23 19:33:04 -07:00
|
|
|
|
|
|
|
ep->description_pos = npos;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-11-20 20:00:55 -08:00
|
|
|
ep->invalidate = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
/**
|
|
|
|
* Returns part description
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* Converts part description to RTL-desc.
|
|
|
|
*
|
|
|
|
* @param desc Pointer to desc buffer.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
static void
|
|
|
|
_edje_part_make_rtl(Edje_Part_Description_Common *desc)
|
|
|
|
{
|
|
|
|
double t;
|
|
|
|
int i;
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!desc)
|
2011-02-01 05:26:49 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* This makes alignment right-oriented */
|
|
|
|
desc->align.x = 1.0 - desc->align.x;
|
|
|
|
|
|
|
|
/* same as above for relative components */
|
|
|
|
t = desc->rel1.relative_x;
|
|
|
|
desc->rel1.relative_x = 1.0 - desc->rel2.relative_x;
|
|
|
|
desc->rel2.relative_x = 1.0 - t;
|
|
|
|
|
|
|
|
/* +1 and +1 are because how edje works with right
|
|
|
|
* side borders - nothing is printed beyond that limit
|
|
|
|
*
|
|
|
|
* rel2 is now to the left of rel1, and Edje assumes
|
|
|
|
* the opposite so we switch corners on x-axis to define
|
|
|
|
* offset from right to left */
|
|
|
|
i = desc->rel1.offset_x;
|
|
|
|
desc->rel1.offset_x = -(desc->rel2.offset_x + 1);
|
|
|
|
desc->rel2.offset_x = -(i + 1);
|
|
|
|
|
|
|
|
i = desc->rel1.id_x;
|
|
|
|
desc->rel1.id_x = desc->rel2.id_x;
|
|
|
|
desc->rel2.id_x = i;
|
|
|
|
}
|
|
|
|
|
2015-12-02 21:56:10 -08:00
|
|
|
static Edje_Part_Description_Common *
|
|
|
|
_edje_get_custom_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *ret;
|
|
|
|
size_t memsize = 0;
|
|
|
|
|
2016-01-04 17:26:57 -08:00
|
|
|
/* RTL flag is not set, return original description */
|
|
|
|
if (!edje_object_mirrored_get(ed->obj))
|
|
|
|
return src;
|
|
|
|
|
2015-12-02 21:56:10 -08:00
|
|
|
if (!(*dst))
|
|
|
|
{
|
|
|
|
ret = _edje_get_description_by_orientation(ed, src, dst, type);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define POPULATE_MEMSIZE_RTL(Short, Type) \
|
|
|
|
case EDJE_PART_TYPE_##Short: \
|
|
|
|
{ \
|
|
|
|
memsize = sizeof(Edje_Part_Description_##Type); \
|
|
|
|
break; \
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
POPULATE_MEMSIZE_RTL(RECTANGLE, Common);
|
|
|
|
POPULATE_MEMSIZE_RTL(SNAPSHOT, Snapshot);
|
|
|
|
POPULATE_MEMSIZE_RTL(SWALLOW, Common);
|
|
|
|
POPULATE_MEMSIZE_RTL(GROUP, Common);
|
|
|
|
POPULATE_MEMSIZE_RTL(SPACER, Common);
|
|
|
|
POPULATE_MEMSIZE_RTL(TEXT, Text);
|
|
|
|
POPULATE_MEMSIZE_RTL(TEXTBLOCK, Text);
|
|
|
|
POPULATE_MEMSIZE_RTL(IMAGE, Image);
|
|
|
|
POPULATE_MEMSIZE_RTL(PROXY, Proxy);
|
|
|
|
POPULATE_MEMSIZE_RTL(BOX, Box);
|
|
|
|
POPULATE_MEMSIZE_RTL(TABLE, Table);
|
|
|
|
POPULATE_MEMSIZE_RTL(EXTERNAL, External);
|
|
|
|
POPULATE_MEMSIZE_RTL(CAMERA, Camera);
|
|
|
|
POPULATE_MEMSIZE_RTL(LIGHT, Light);
|
|
|
|
POPULATE_MEMSIZE_RTL(MESH_NODE, Mesh_Node);
|
2016-08-20 19:30:45 -07:00
|
|
|
POPULATE_MEMSIZE_RTL(VECTOR, Vector);
|
2015-12-02 21:56:10 -08:00
|
|
|
}
|
|
|
|
#undef POPULATE_MEMSIZE_RTL
|
|
|
|
|
|
|
|
ret = *dst;
|
|
|
|
memcpy(ret, src, memsize);
|
|
|
|
_edje_part_make_rtl(ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
/**
|
|
|
|
* Returns part description
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* Returns part description according to object orientation.
|
|
|
|
* When object is in RTL-orientation (RTL flag is set)
|
|
|
|
* this returns the RTL-desc of it.
|
|
|
|
* RTL-desc would be allocated if was not created by a previous call.
|
|
|
|
* The dst pointer is updated in case of an allocation.
|
|
|
|
*
|
|
|
|
* @param ed Edje object.
|
|
|
|
* @param src The Left To Right (LTR), original desc.
|
|
|
|
* @param dst Pointer to Right To Left (RTL) desc-list.
|
|
|
|
* @param type name of dec type. Example: "default".
|
|
|
|
*
|
|
|
|
* @return Edje part description.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
static Edje_Part_Description_Common *
|
|
|
|
_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *desc_rtl = NULL;
|
|
|
|
Edje_Part_Collection_Directory_Entry *ce;
|
|
|
|
size_t memsize = 0;
|
|
|
|
|
|
|
|
/* RTL flag is not set, return original description */
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!edje_object_mirrored_get(ed->obj))
|
|
|
|
return src;
|
|
|
|
|
|
|
|
if (*dst)
|
|
|
|
return *dst; /* Was allocated before and we should use it */
|
|
|
|
|
|
|
|
#define EDIT_ALLOC_POOL_RTL(Short, Type, Name) \
|
|
|
|
case EDJE_PART_TYPE_##Short: \
|
|
|
|
{ \
|
|
|
|
Edje_Part_Description_##Type * Name; \
|
2016-08-20 19:14:28 -07:00
|
|
|
Name = eina_mempool_malloc(ce->mp->mp_rtl.Short, \
|
2015-06-08 11:43:00 -07:00
|
|
|
sizeof (Edje_Part_Description_##Type)); \
|
|
|
|
desc_rtl = &Name->common; \
|
|
|
|
memsize = sizeof(Edje_Part_Description_##Type); \
|
|
|
|
break; \
|
|
|
|
}
|
2011-02-01 05:26:49 -08:00
|
|
|
|
|
|
|
ce = eina_hash_find(ed->file->collection, ed->group);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
2016-08-20 19:14:28 -07:00
|
|
|
desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.RECTANGLE,
|
2015-06-08 11:43:00 -07:00
|
|
|
sizeof (Edje_Part_Description_Common));
|
|
|
|
ce->count.RECTANGLE++;
|
|
|
|
memsize = sizeof(Edje_Part_Description_Common);
|
|
|
|
break;
|
|
|
|
|
2015-08-05 06:58:01 -07:00
|
|
|
case EDJE_PART_TYPE_SNAPSHOT:
|
2016-08-20 19:14:28 -07:00
|
|
|
desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SNAPSHOT,
|
2015-09-15 02:10:51 -07:00
|
|
|
sizeof (Edje_Part_Description_Snapshot));
|
2015-08-05 06:58:01 -07:00
|
|
|
ce->count.SNAPSHOT++;
|
2015-09-15 02:10:51 -07:00
|
|
|
memsize = sizeof(Edje_Part_Description_Snapshot);
|
2015-08-05 06:58:01 -07:00
|
|
|
break;
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
2016-08-20 19:14:28 -07:00
|
|
|
desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SWALLOW,
|
2015-06-08 11:43:00 -07:00
|
|
|
sizeof (Edje_Part_Description_Common));
|
|
|
|
ce->count.SWALLOW++;
|
|
|
|
memsize = sizeof(Edje_Part_Description_Common);
|
|
|
|
break;
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
2016-08-20 19:14:28 -07:00
|
|
|
desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.GROUP,
|
2015-06-08 11:43:00 -07:00
|
|
|
sizeof (Edje_Part_Description_Common));
|
|
|
|
ce->count.GROUP++;
|
|
|
|
memsize = sizeof(Edje_Part_Description_Common);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_SPACER:
|
2016-08-20 19:14:28 -07:00
|
|
|
desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SPACER,
|
2015-06-08 11:43:00 -07:00
|
|
|
sizeof (Edje_Part_Description_Common));
|
|
|
|
ce->count.SPACER++;
|
|
|
|
memsize = sizeof(Edje_Part_Description_Common);
|
|
|
|
break;
|
|
|
|
EDIT_ALLOC_POOL_RTL(TEXT, Text, text);
|
|
|
|
EDIT_ALLOC_POOL_RTL(TEXTBLOCK, Text, text);
|
|
|
|
EDIT_ALLOC_POOL_RTL(IMAGE, Image, image);
|
|
|
|
EDIT_ALLOC_POOL_RTL(PROXY, Proxy, proxy);
|
|
|
|
EDIT_ALLOC_POOL_RTL(BOX, Box, box);
|
|
|
|
EDIT_ALLOC_POOL_RTL(TABLE, Table, table);
|
|
|
|
EDIT_ALLOC_POOL_RTL(EXTERNAL, External, external_params);
|
2015-06-22 02:17:26 -07:00
|
|
|
EDIT_ALLOC_POOL_RTL(CAMERA, Camera, camera);
|
|
|
|
EDIT_ALLOC_POOL_RTL(LIGHT, Light, light);
|
|
|
|
EDIT_ALLOC_POOL_RTL(MESH_NODE, Mesh_Node, mesh_node);
|
2016-06-08 11:26:07 -07:00
|
|
|
EDIT_ALLOC_POOL_RTL(VECTOR, Vector, vector);
|
2011-02-01 05:26:49 -08:00
|
|
|
}
|
|
|
|
|
2012-06-03 19:57:15 -07:00
|
|
|
if (desc_rtl)
|
2015-06-08 11:43:00 -07:00
|
|
|
memcpy(desc_rtl, src, memsize);
|
2011-02-01 05:26:49 -08:00
|
|
|
|
|
|
|
_edje_part_make_rtl(desc_rtl);
|
|
|
|
|
|
|
|
*dst = desc_rtl;
|
|
|
|
return desc_rtl;
|
|
|
|
}
|
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *
|
2013-12-22 16:51:43 -08:00
|
|
|
_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *state_name,
|
|
|
|
double state_val, Eina_Bool approximate)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2004-10-29 08:12:01 -07:00
|
|
|
Edje_Part *ep = rp->part;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *ret = NULL;
|
|
|
|
Edje_Part_Description_Common *d;
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2009-05-06 05:41:23 -07:00
|
|
|
double min_dst = 99999.0;
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2003-06-23 19:33:04 -07:00
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
/* RTL flag is set, return RTL description */
|
2015-12-09 02:25:59 -08:00
|
|
|
if (edje_object_mirrored_get(ed->obj) && !ep->other.desc_rtl)
|
|
|
|
{
|
|
|
|
ep->other.desc_rtl = (Edje_Part_Description_Common **)
|
|
|
|
calloc(ep->other.desc_count,
|
|
|
|
sizeof (Edje_Part_Description_Common *));
|
|
|
|
}
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
if (!strcmp(state_name, "default") && EQ(state_val, ZERO))
|
2011-02-01 05:26:49 -08:00
|
|
|
return _edje_get_description_by_orientation(ed,
|
2015-06-08 11:43:00 -07:00
|
|
|
ep->default_desc, &ep->default_desc_rtl, ep->type);
|
2004-10-29 07:56:27 -07:00
|
|
|
|
2013-12-22 16:51:43 -08:00
|
|
|
if (!strcmp(state_name, "custom"))
|
2011-02-01 05:26:49 -08:00
|
|
|
return rp->custom ?
|
2015-12-02 21:56:10 -08:00
|
|
|
_edje_get_custom_description_by_orientation(ed, rp->custom->description,
|
|
|
|
&rp->custom->description_rtl, ep->type) : NULL;
|
2004-10-29 10:56:12 -07:00
|
|
|
|
2013-12-22 16:51:43 -08:00
|
|
|
if (!strcmp(state_name, "default") && approximate)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ret = _edje_get_description_by_orientation(ed, ep->default_desc,
|
|
|
|
&ep->default_desc_rtl,
|
|
|
|
ep->type);
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2013-12-22 16:51:43 -08:00
|
|
|
min_dst = ABS(ep->default_desc->state.value - state_val);
|
2004-10-29 07:56:27 -07:00
|
|
|
}
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < ep->other.desc_count; ++i)
|
2004-10-29 07:56:27 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
d = ep->other.desc[i];
|
2011-02-01 05:26:49 -08:00
|
|
|
|
2015-12-09 07:59:42 -08:00
|
|
|
if (d->state.name && (d->state.name == state_name ||
|
|
|
|
!strcmp(d->state.name, state_name)))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2014-02-06 19:16:01 -08:00
|
|
|
if (!approximate)
|
2013-12-22 16:51:43 -08:00
|
|
|
{
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(d->state.value, state_val))
|
2014-02-06 19:16:01 -08:00
|
|
|
return _edje_get_description_by_orientation(ed, d,
|
|
|
|
&ep->other.desc_rtl[i], ep->type);
|
|
|
|
else
|
|
|
|
continue;
|
2013-12-22 16:51:43 -08:00
|
|
|
}
|
|
|
|
else
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-12-22 16:51:43 -08:00
|
|
|
double dst;
|
|
|
|
|
|
|
|
dst = ABS(d->state.value - state_val);
|
|
|
|
if (dst < min_dst)
|
|
|
|
{
|
|
|
|
ret = _edje_get_description_by_orientation(ed, d,
|
|
|
|
&ep->other.desc_rtl[i], ep->type);
|
|
|
|
min_dst = dst;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2004-10-29 07:56:27 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-01-06 03:28:38 -08:00
|
|
|
static int
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps,
|
2012-11-11 00:26:25 -08:00
|
|
|
Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid)
|
2012-01-06 03:28:38 -08:00
|
|
|
{
|
2012-11-11 00:26:25 -08:00
|
|
|
Edje_Image_Directory_Set_Entry *entry;
|
|
|
|
Edje_Image_Directory_Set *set = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
int w = 0, h = 0, id;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
if (!st && !imid) return -1;
|
2012-11-11 00:26:25 -08:00
|
|
|
if (st && !st->image.set) return st->image.id;
|
2015-06-08 11:43:00 -07:00
|
|
|
if (imid && !imid->set) return imid->id;
|
|
|
|
|
2012-11-11 00:26:25 -08:00
|
|
|
if (imid) id = imid->id;
|
2015-06-08 11:43:00 -07:00
|
|
|
else id = st->image.id;
|
|
|
|
|
2012-11-11 00:26:25 -08:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
|
|
|
if (eps && *eps)
|
|
|
|
{
|
|
|
|
if ((*eps)->id == id) set = (*eps)->set;
|
|
|
|
if (set)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
if (((*eps)->entry->size.min.w <= w) &&
|
2012-11-11 00:26:25 -08:00
|
|
|
(w <= (*eps)->entry->size.max.w))
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
if (((*eps)->entry->size.min.h <= h) &&
|
2012-11-11 00:26:25 -08:00
|
|
|
(h <= (*eps)->entry->size.max.h))
|
|
|
|
{
|
|
|
|
return (*eps)->entry->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-11-11 00:26:25 -08:00
|
|
|
if (!set) set = ed->file->image_dir->sets + id;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-11-11 00:26:25 -08:00
|
|
|
EINA_LIST_FOREACH(set->entries, l, entry)
|
|
|
|
{
|
|
|
|
if ((entry->size.min.w <= w) && (w <= entry->size.max.w))
|
|
|
|
{
|
|
|
|
if ((entry->size.min.h <= h) && (h <= entry->size.max.h))
|
|
|
|
{
|
|
|
|
if (eps)
|
|
|
|
{
|
|
|
|
if (!*eps) *eps = calloc(1, sizeof(Edje_Real_Part_Set));
|
|
|
|
if (*eps)
|
|
|
|
{
|
|
|
|
(*eps)->entry = entry;
|
|
|
|
(*eps)->set = set;
|
|
|
|
(*eps)->id = id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return entry->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
entry = eina_list_data_get(set->entries);
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (eps)
|
|
|
|
{
|
|
|
|
if (!*eps)
|
|
|
|
*eps = calloc(1, sizeof (Edje_Real_Part_Set));
|
|
|
|
if (*eps)
|
|
|
|
{
|
|
|
|
(*eps)->entry = entry;
|
|
|
|
(*eps)->set = set;
|
|
|
|
(*eps)->id = id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return entry->id;
|
|
|
|
}
|
2014-11-18 00:13:38 -08:00
|
|
|
|
2012-11-11 00:26:25 -08:00
|
|
|
return -1;
|
2012-01-06 03:28:38 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-10-27 23:50:38 -07:00
|
|
|
_edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set, FLOAT_T pos)
|
2012-01-06 03:28:38 -08:00
|
|
|
{
|
|
|
|
int image_id;
|
|
|
|
int image_count, image_num;
|
|
|
|
|
|
|
|
image_id = _edje_image_find(ep->object, ed,
|
2012-08-14 00:59:06 -07:00
|
|
|
&ep->param1.set,
|
2015-06-08 11:43:00 -07:00
|
|
|
(Edje_Part_Description_Image *)ep->param1.description,
|
2012-08-14 00:59:06 -07:00
|
|
|
NULL);
|
2014-10-30 23:15:39 -07:00
|
|
|
if (set) *set = ep->param1.set;
|
2012-01-06 03:28:38 -08:00
|
|
|
if (image_id < 0)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Image_Directory_Entry *ie;
|
2012-01-06 03:28:38 -08:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (!ed->file->image_dir) ie = NULL;
|
|
|
|
else ie = ed->file->image_dir->entries + (-image_id) - 1;
|
|
|
|
if ((ie) &&
|
|
|
|
(ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
|
|
|
|
(ie->entry))
|
|
|
|
{
|
|
|
|
evas_object_image_file_set(ep->object, ie->entry, NULL);
|
|
|
|
}
|
2012-01-06 03:28:38 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
image_count = 2;
|
|
|
|
if (ep->param2)
|
2015-06-08 11:43:00 -07:00
|
|
|
image_count += ((Edje_Part_Description_Image *)ep->param2->description)->image.tweens_count;
|
2012-08-14 00:59:06 -07:00
|
|
|
image_num = TO_INT(MUL(pos, SUB(FROM_INT(image_count),
|
|
|
|
FROM_DOUBLE(0.5))));
|
|
|
|
if (image_num > (image_count - 1))
|
|
|
|
image_num = image_count - 1;
|
|
|
|
if (image_num <= 0)
|
|
|
|
{
|
|
|
|
image_id = _edje_image_find(ep->object, ed,
|
|
|
|
&ep->param1.set,
|
2015-06-08 11:43:00 -07:00
|
|
|
(Edje_Part_Description_Image *)ep->param1.description,
|
2012-08-14 00:59:06 -07:00
|
|
|
NULL);
|
2014-10-30 23:15:39 -07:00
|
|
|
if (set) *set = ep->param1.set;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->param2)
|
|
|
|
{
|
|
|
|
if (image_num == (image_count - 1))
|
|
|
|
{
|
|
|
|
image_id = _edje_image_find(ep->object, ed,
|
|
|
|
&ep->param2->set,
|
|
|
|
(Edje_Part_Description_Image *)ep->param2->description,
|
|
|
|
NULL);
|
|
|
|
if (set) *set = ep->param2->set;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Edje_Part_Image_Id *imid;
|
|
|
|
|
|
|
|
imid = ((Edje_Part_Description_Image *)ep->param2->description)->image.tweens[image_num - 1];
|
|
|
|
image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid);
|
|
|
|
if (set) *set = NULL;
|
|
|
|
}
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
if (image_id < 0)
|
|
|
|
{
|
2016-03-15 11:29:47 -07:00
|
|
|
ERR("Part \"%s\" description, "
|
2012-08-14 00:59:06 -07:00
|
|
|
"\"%s\" %3.3f with image %i index has a missing image id in a set of %i !!!",
|
|
|
|
ep->part->name,
|
|
|
|
ep->param1.description->state.name,
|
|
|
|
ep->param1.description->state.value,
|
|
|
|
image_num,
|
|
|
|
image_count);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-11 00:02:43 -08:00
|
|
|
char buf[1024] = "edje/images/";
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
/* Replace snprint("edje/images/%i") == memcpy + itoa */
|
2012-11-11 00:02:43 -08:00
|
|
|
eina_convert_itoa(image_id, buf + 12); /* No need to check length as 2³² need only 10 characteres. */
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2013-06-24 19:44:38 -07:00
|
|
|
evas_object_image_mmap_set(ep->object, ed->file->f, buf);
|
2012-08-14 00:59:06 -07:00
|
|
|
if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
|
|
|
|
{
|
|
|
|
ERR("Error loading image collection \"%s\" from "
|
|
|
|
"file \"%s\". Missing EET Evas loader module?",
|
|
|
|
buf, ed->file->path);
|
|
|
|
switch (evas_object_image_load_error_get(ep->object))
|
|
|
|
{
|
|
|
|
case EVAS_LOAD_ERROR_GENERIC:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_GENERIC");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EVAS_LOAD_ERROR_DOES_NOT_EXIST:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EVAS_LOAD_ERROR_PERMISSION_DENIED:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EVAS_LOAD_ERROR_CORRUPT_FILE:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT");
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Error type: ???");
|
|
|
|
break;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-01-06 03:28:38 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 23:16:34 -07:00
|
|
|
static void
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_real_part_rel_to_apply(Edje *ed EINA_UNUSED,
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Real_Part_State *state)
|
2011-09-26 23:16:34 -07:00
|
|
|
{
|
|
|
|
if (state->description)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_External *external;
|
2011-09-26 23:16:34 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type != EDJE_RP_TYPE_SWALLOW) ||
|
|
|
|
(!ep->typedata.swallow)) return;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
external = (Edje_Part_Description_External *)state->description;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (state->external_params)
|
2012-09-11 06:14:51 -07:00
|
|
|
_edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object, state->external_params);
|
|
|
|
state->external_params = _edje_external_params_parse(ep->typedata.swallow->swallowed_object, external->external_params);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2011-09-26 23:16:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-29 07:56:27 -07:00
|
|
|
void
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2)
|
2004-10-29 07:56:27 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *epd1;
|
|
|
|
Edje_Part_Description_Common *epd2 = NULL;
|
2015-05-11 03:21:54 -07:00
|
|
|
Edje_Part_Description_Common *last_desc;
|
2015-03-31 20:28:33 -07:00
|
|
|
Eina_Bool change_w, change_h;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Image *epdi;
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2004-10-29 07:56:27 -07:00
|
|
|
if (!d1) d1 = "default";
|
|
|
|
|
2013-12-22 16:51:43 -08:00
|
|
|
epd1 = _edje_part_description_find(ed, ep, d1, v1, EINA_TRUE);
|
2009-08-14 10:19:42 -07:00
|
|
|
if (!epd1)
|
2016-03-10 14:15:13 -08:00
|
|
|
{
|
|
|
|
ERR("Cannot find description \"%s\" in part \"%s\" from group \"%s\". Fallback to default description.",
|
|
|
|
d1, ep->part->name, ed->group);
|
|
|
|
epd1 = _edje_get_description_by_orientation(ed, ep->part->default_desc,
|
|
|
|
&ep->part->default_desc_rtl,
|
|
|
|
ep->type); /* never NULL */
|
|
|
|
}
|
2004-10-29 07:56:27 -07:00
|
|
|
|
2010-04-14 09:34:06 -07:00
|
|
|
if (d2)
|
2013-12-22 16:51:43 -08:00
|
|
|
epd2 = _edje_part_description_find(ed, ep, d2, v2, EINA_TRUE);
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
epdi = (Edje_Part_Description_Image *)epd2;
|
2009-08-17 08:16:23 -07:00
|
|
|
/* There is an animation if both description are different or if description is an image with tweens */
|
2010-08-21 06:52:25 -07:00
|
|
|
if (epd2 && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count)))
|
2009-08-14 10:19:42 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (!ep->param2)
|
|
|
|
{
|
|
|
|
ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp,
|
|
|
|
sizeof(Edje_Real_Part_State));
|
2017-05-08 06:39:21 -07:00
|
|
|
if (ep->param2)
|
|
|
|
memset(ep->param2, 0, sizeof(Edje_Real_Part_State));
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
|
2012-09-11 06:14:51 -07:00
|
|
|
{
|
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
|
|
|
_edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object,
|
|
|
|
ep->param2->external_params);
|
|
|
|
}
|
2017-05-08 06:39:21 -07:00
|
|
|
if (ep->param2)
|
|
|
|
ep->param2->external_params = NULL;
|
2009-08-14 10:19:42 -07:00
|
|
|
}
|
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->param2)
|
|
|
|
{
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
|
|
|
|
{
|
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
|
|
|
_edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object,
|
|
|
|
ep->param2->external_params);
|
|
|
|
}
|
|
|
|
if (ep->param2)
|
|
|
|
{
|
|
|
|
free(ep->param2->set);
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
_edje_calc_params_clear(&(ep->param2->p));
|
2013-03-12 22:30:21 -07:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
eina_mempool_free(_edje_real_part_state_mp, ep->param2);
|
|
|
|
ep->param2 = NULL;
|
|
|
|
}
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2015-05-11 03:21:54 -07:00
|
|
|
last_desc = ep->chosen_description;
|
2009-08-14 10:19:42 -07:00
|
|
|
ep->param1.description = epd1;
|
|
|
|
ep->chosen_description = epd1;
|
2015-05-11 03:21:54 -07:00
|
|
|
if (last_desc)
|
2015-04-01 04:23:38 -07:00
|
|
|
{
|
2015-05-11 03:21:54 -07:00
|
|
|
change_w = ep->chosen_description->fixed.w != last_desc->fixed.w;
|
|
|
|
change_h = ep->chosen_description->fixed.h != last_desc->fixed.h;
|
2015-04-01 04:23:38 -07:00
|
|
|
}
|
2011-09-26 23:16:34 -07:00
|
|
|
_edje_real_part_rel_to_apply(ed, ep, &ep->param1);
|
2009-10-31 11:07:08 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
if (ep->param2)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->param2->description = epd2;
|
2004-10-30 07:19:46 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
_edje_real_part_rel_to_apply(ed, ep, ep->param2);
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->description_pos > FROM_DOUBLE(0.0))
|
|
|
|
ep->chosen_description = epd2;
|
2009-08-14 10:19:42 -07:00
|
|
|
}
|
2004-10-30 07:19:46 -07:00
|
|
|
|
2015-05-11 03:21:54 -07:00
|
|
|
if (last_desc != ep->chosen_description)
|
2015-03-31 20:28:33 -07:00
|
|
|
{
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_EXTERNAL)
|
2015-05-11 03:21:54 -07:00
|
|
|
_edje_external_recalc_apply(ed, ep, NULL, last_desc);
|
|
|
|
else if ((last_desc) && (ep->part->type == EDJE_PART_TYPE_GROUP))
|
2015-03-31 20:28:33 -07:00
|
|
|
{
|
|
|
|
Edje_Size *min, *max, *pmin, *pmax;
|
|
|
|
|
|
|
|
min = &ep->chosen_description->min;
|
|
|
|
max = &ep->chosen_description->max;
|
2015-05-11 03:21:54 -07:00
|
|
|
pmin = &last_desc->min;
|
|
|
|
pmax = &last_desc->max;
|
2015-03-31 20:28:33 -07:00
|
|
|
if (change_w || change_h ||
|
2015-06-08 11:43:00 -07:00
|
|
|
(((pmin->w == pmax->w) && (pmin->h == pmax->h) && (pmin->w > 0) && (pmin->h > 0)) &&
|
|
|
|
(((min->w != max->w) || (min->h != max->h) || (min->w <= 0) || (min->h <= 0)))))
|
2015-03-31 20:28:33 -07:00
|
|
|
{
|
|
|
|
Edje *ted;
|
|
|
|
|
|
|
|
ted = _edje_fetch(ep->typedata.swallow->swallowed_object);
|
|
|
|
ted->recalc_call = ted->dirty = ted->recalc_hints = EINA_TRUE;
|
|
|
|
_edje_recalc(ted);
|
|
|
|
}
|
2016-01-12 02:39:37 -08:00
|
|
|
|
|
|
|
edje_object_mirrored_set(ep->typedata.swallow->swallowed_object,
|
|
|
|
edje_object_mirrored_get(ed->obj));
|
2015-03-31 20:28:33 -07:00
|
|
|
}
|
|
|
|
}
|
2010-04-19 13:37:35 -07:00
|
|
|
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->recalc_hints = EINA_TRUE;
|
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-11-20 20:00:55 -08:00
|
|
|
ep->invalidate = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_recalc(Edje *ed)
|
|
|
|
{
|
2014-03-18 07:00:14 -07:00
|
|
|
if ((ed->freeze > 0) || (_edje_util_freeze_val > 0))
|
2008-09-09 23:39:57 -07:00
|
|
|
{
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->recalc = EINA_TRUE;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
2014-03-18 07:00:14 -07:00
|
|
|
if (_edje_util_freeze_val > 0)
|
2010-02-14 22:40:58 -08:00
|
|
|
{
|
|
|
|
if (!ed->freeze_calc)
|
|
|
|
{
|
2014-03-18 07:00:14 -07:00
|
|
|
_edje_util_freeze_calc_count++;
|
|
|
|
_edje_util_freeze_calc_list = eina_list_append(_edje_util_freeze_calc_list, ed);
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->freeze_calc = EINA_TRUE;
|
2010-02-14 22:40:58 -08:00
|
|
|
}
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
return;
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2012-01-04 21:21:02 -08:00
|
|
|
// XXX: dont need this with current smart calc infra. remove me later
|
|
|
|
// if (ed->postponed) return;
|
2012-01-05 07:26:49 -08:00
|
|
|
// if (!ed->calc_only)
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_smart_changed(ed->obj);
|
2012-01-04 21:21:02 -08:00
|
|
|
// XXX: dont need this with current smart calc infra. remove me later
|
2012-09-04 22:38:01 -07:00
|
|
|
// ed->postponed = EINA_TRUE;
|
2008-11-14 03:06:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_recalc_do(Edje *ed)
|
|
|
|
{
|
2016-07-03 22:59:59 -07:00
|
|
|
unsigned short i;
|
2012-01-04 21:21:02 -08:00
|
|
|
Eina_Bool need_calc;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
2012-01-04 21:21:02 -08:00
|
|
|
// XXX: dont need this with current smart calc infra. remove me later
|
2012-09-04 22:38:01 -07:00
|
|
|
// ed->postponed = EINA_FALSE;
|
2012-01-04 21:21:02 -08:00
|
|
|
need_calc = evas_object_smart_need_recalculate_get(ed->obj);
|
2008-12-14 08:30:29 -08:00
|
|
|
evas_object_smart_need_recalculate_set(ed->obj, 0);
|
2010-02-23 00:37:30 -08:00
|
|
|
if (!ed->dirty) return;
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->dirty = EINA_FALSE;
|
2009-08-10 08:16:51 -07:00
|
|
|
ed->state++;
|
2007-05-26 16:57:21 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *ep;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
ep = ed->table_parts[i];
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
ep->calculated = FLAG_NONE; // FIXME: this is dubious (see below)
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->calculating = FLAG_NONE;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2007-05-26 16:57:21 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *ep;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
ep = ed->table_parts[i];
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
if (ep->calculated != FLAG_XY) // FIXME: this is always true (see for above)
|
2011-11-28 02:20:51 -08:00
|
|
|
_edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY, NULL);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2012-09-04 22:38:01 -07:00
|
|
|
if (!ed->calc_only) ed->recalc = EINA_FALSE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->all_part_change = EINA_FALSE;
|
|
|
|
ed->text_part_change = EINA_FALSE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-01-03 21:17:11 -08:00
|
|
|
if (!ed->calc_only)
|
2012-01-13 18:29:13 -08:00
|
|
|
{
|
|
|
|
if (ed->recalc_call)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(ed->obj, EDJE_OBJECT_EVENT_RECALC, NULL);
|
2012-01-13 18:29:13 -08:00
|
|
|
}
|
2012-01-04 21:21:02 -08:00
|
|
|
else
|
|
|
|
evas_object_smart_need_recalculate_set(ed->obj, need_calc);
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->recalc_call = EINA_FALSE;
|
2012-03-12 08:28:58 -07:00
|
|
|
|
|
|
|
if (ed->update_hints && ed->recalc_hints && !ed->calc_only)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
|
|
|
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->recalc_hints = EINA_FALSE;
|
2012-03-12 08:28:58 -07:00
|
|
|
|
2017-05-31 01:03:26 -07:00
|
|
|
edje_object_size_min_calc(ed->obj, &w, &h);
|
2016-06-08 22:31:37 -07:00
|
|
|
efl_gfx_size_hint_restricted_min_set(ed->obj, w, h);
|
2012-03-12 08:28:58 -07:00
|
|
|
}
|
2012-06-24 06:23:37 -07:00
|
|
|
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!ed->collection) return;
|
2012-06-24 06:23:37 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ed->collection->limits.parts_count; i++)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
unsigned char limit;
|
|
|
|
int part;
|
|
|
|
|
|
|
|
part = ed->collection->limits.parts[i].part;
|
2012-07-11 03:50:30 -07:00
|
|
|
name = ed->collection->parts[part]->name;
|
2012-06-24 06:23:37 -07:00
|
|
|
limit = ed->table_parts[part]->chosen_description->limit;
|
|
|
|
switch (limit)
|
|
|
|
{
|
|
|
|
case 0:
|
2015-06-08 11:43:00 -07:00
|
|
|
ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN;
|
|
|
|
ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN;
|
|
|
|
break;
|
|
|
|
|
2012-06-24 06:23:37 -07:00
|
|
|
case 1:
|
2015-06-08 11:43:00 -07:00
|
|
|
ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN;
|
|
|
|
break;
|
|
|
|
|
2012-06-24 06:23:37 -07:00
|
|
|
case 2:
|
2015-06-08 11:43:00 -07:00
|
|
|
ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN;
|
|
|
|
break;
|
|
|
|
|
2012-06-24 06:23:37 -07:00
|
|
|
case 3:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2012-06-24 06:23:37 -07:00
|
|
|
}
|
|
|
|
|
2012-07-11 03:50:30 -07:00
|
|
|
if ((limit & 1) == 1)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
|
|
|
if (ed->table_parts[part]->w > 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
(ed->collection->limits.parts[i].width != EDJE_PART_LIMIT_OVER))
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_OVER;
|
2012-06-24 06:23:37 -07:00
|
|
|
_edje_emit(ed, "limit,width,over", name);
|
|
|
|
}
|
|
|
|
else if (ed->table_parts[part]->w < 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].width != EDJE_PART_LIMIT_BELOW)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_BELOW;
|
2012-06-24 06:23:37 -07:00
|
|
|
_edje_emit(ed, "limit,width,below", name);
|
|
|
|
}
|
|
|
|
else if (ed->table_parts[part]->w == 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].width != EDJE_PART_LIMIT_ZERO)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_ZERO;
|
2012-06-24 06:23:37 -07:00
|
|
|
_edje_emit(ed, "limit,width,zero", name);
|
|
|
|
}
|
|
|
|
}
|
2012-07-11 03:50:30 -07:00
|
|
|
if ((limit & 2) == 2)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
|
|
|
if (ed->table_parts[part]->h > 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
(ed->collection->limits.parts[i].height != EDJE_PART_LIMIT_OVER))
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_OVER;
|
2012-06-24 06:23:37 -07:00
|
|
|
_edje_emit(ed, "limit,height,over", name);
|
|
|
|
}
|
|
|
|
else if (ed->table_parts[part]->h < 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].height != EDJE_PART_LIMIT_BELOW)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_BELOW;
|
|
|
|
_edje_emit(ed, "limit,height,below", name);
|
2012-06-24 06:23:37 -07:00
|
|
|
}
|
|
|
|
else if (ed->table_parts[part]->h == 0 &&
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].height != EDJE_PART_LIMIT_ZERO)
|
2012-06-24 06:23:37 -07:00
|
|
|
{
|
2012-07-11 03:50:30 -07:00
|
|
|
ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_ZERO;
|
2012-06-24 06:23:37 -07:00
|
|
|
_edje_emit(ed, "limit,height,zero", name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2003-08-15 06:35:25 -07:00
|
|
|
int
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, FLOAT_T *y)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
2009-08-11 05:47:00 -07:00
|
|
|
if (ep->drag)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
2013-07-18 23:39:49 -07:00
|
|
|
Eina_Bool tx = EINA_FALSE;
|
|
|
|
Eina_Bool ty = EINA_FALSE;
|
|
|
|
|
|
|
|
if (ep->drag->threshold)
|
|
|
|
{
|
|
|
|
// Check if we are in the threshold or not and cancel the movement.
|
|
|
|
tx = ep->drag->threshold_x && ep->drag->threshold_started_x;
|
|
|
|
ty = ep->drag->threshold_y && ep->drag->threshold_started_y;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->drag->confine_to)
|
|
|
|
{
|
|
|
|
FLOAT_T dx, dy, dw, dh;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if ((ep->part->dragable.x != 0) &&
|
2015-06-08 11:43:00 -07:00
|
|
|
(ep->part->dragable.y != 0)) ret = 3;
|
|
|
|
else if (ep->part->dragable.x != 0)
|
|
|
|
ret = 1;
|
|
|
|
else if (ep->part->dragable.y != 0)
|
|
|
|
ret = 2;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
dx = FROM_INT(ep->x - ep->drag->confine_to->x);
|
|
|
|
dw = FROM_INT(ep->drag->confine_to->w - ep->w);
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(dw, ZERO)) dx = DIV(dx, dw);
|
2012-08-14 00:59:06 -07:00
|
|
|
else dx = ZERO;
|
|
|
|
|
|
|
|
dy = FROM_INT(ep->y - ep->drag->confine_to->y);
|
|
|
|
dh = FROM_INT(ep->drag->confine_to->h - ep->h);
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(dh, ZERO)) dy = DIV(dy, dh);
|
2012-08-14 00:59:06 -07:00
|
|
|
else dy = ZERO;
|
|
|
|
|
2013-07-18 23:39:49 -07:00
|
|
|
if (x) *x = tx ? ep->drag->x : dx;
|
|
|
|
if (y) *y = ty ? ep->drag->y : dy;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-18 23:39:49 -07:00
|
|
|
if (x) *x = tx ? ep->drag->x : ADD(FROM_INT(ep->drag->tmp.x), ep->drag->x);
|
|
|
|
if (y) *y = ty ? ep->drag->y : ADD(FROM_INT(ep->drag->tmp.y), ep->drag->y);
|
2012-08-14 00:59:06 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2009-12-09 07:44:54 -08:00
|
|
|
if (x) *x = ZERO;
|
|
|
|
if (y) *y = ZERO;
|
2003-08-15 06:35:25 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-09 07:44:54 -08:00
|
|
|
_edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T y)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
2017-07-11 00:25:44 -07:00
|
|
|
Evas_Coord ex = 0, ey = 0;
|
2004-12-11 11:22:55 -08:00
|
|
|
/* check whether this part is dragable at all */
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!ep->drag) return;
|
2017-07-19 23:21:34 -07:00
|
|
|
if (ep->drag->down.count > 0) return;
|
2004-12-11 11:22:55 -08:00
|
|
|
|
|
|
|
/* instead of checking for equality, we really should check that
|
|
|
|
* the difference is greater than foo, but I have no idea what
|
|
|
|
* value we would set foo to, because it would depend on the
|
|
|
|
* size of the dragable...
|
|
|
|
*/
|
2017-07-11 00:25:44 -07:00
|
|
|
evas_object_geometry_get(ep->object, &ex, &ey, NULL, NULL);
|
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(ep->drag->x, x) || ep->drag->tmp.x)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->drag->x = x;
|
|
|
|
ep->drag->tmp.x = 0;
|
|
|
|
ep->drag->need_reset = 0;
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
2004-12-11 11:22:55 -08:00
|
|
|
}
|
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(ep->drag->y, y) || ep->drag->tmp.y)
|
2004-12-11 11:22:55 -08:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->drag->y = y;
|
|
|
|
ep->drag->tmp.y = 0;
|
|
|
|
ep->drag->need_reset = 0;
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2004-10-30 07:28:40 -07:00
|
|
|
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-11-20 20:00:55 -08:00
|
|
|
ep->invalidate = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2004-12-11 11:22:55 -08:00
|
|
|
_edje_recalc(ed); /* won't do anything if dirty flag isn't set */
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
static void
|
2009-08-12 07:13:17 -07:00
|
|
|
_edje_part_recalc_single_rel(Edje *ed,
|
2013-01-03 18:08:14 -08:00
|
|
|
Edje_Real_Part *ep EINA_UNUSED,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Real_Part *rel1_to_x,
|
|
|
|
Edje_Real_Part *rel1_to_y,
|
|
|
|
Edje_Real_Part *rel2_to_x,
|
|
|
|
Edje_Real_Part *rel2_to_y,
|
|
|
|
Edje_Calc_Params *params)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-09-14 08:53:47 -07:00
|
|
|
FLOAT_T x, w;
|
|
|
|
FLOAT_T y, h;
|
2017-04-25 16:25:11 -07:00
|
|
|
FLOAT_T offset, sc;
|
|
|
|
Eina_Bool offset_is_scaled = (desc->offset_is_scaled) && (ep->part->scale);
|
|
|
|
|
|
|
|
if (offset_is_scaled)
|
|
|
|
{
|
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (offset_is_scaled)
|
|
|
|
offset = SCALE(sc, desc->rel1.offset_x);
|
|
|
|
else
|
|
|
|
offset = FROM_INT(desc->rel1.offset_x);
|
2010-04-19 13:37:40 -07:00
|
|
|
|
2010-09-14 08:53:47 -07:00
|
|
|
if (rel1_to_x)
|
2017-04-25 16:25:11 -07:00
|
|
|
x = ADD(ADD(offset, FROM_INT(rel1_to_x->x)),
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel1.relative_x, rel1_to_x->w));
|
2010-09-14 08:53:47 -07:00
|
|
|
else
|
2017-04-25 16:25:11 -07:00
|
|
|
x = ADD(offset,
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel1.relative_x, ed->w));
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = x;
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2017-04-25 16:25:11 -07:00
|
|
|
if (offset_is_scaled)
|
|
|
|
offset = SUB(SCALE(sc, desc->rel2.offset_x + 1), FROM_INT(1));
|
|
|
|
else
|
|
|
|
offset = FROM_INT(desc->rel2.offset_x);
|
|
|
|
|
2010-09-14 08:53:47 -07:00
|
|
|
if (rel2_to_x)
|
2017-04-25 16:25:11 -07:00
|
|
|
w = ADD(SUB(ADD(ADD(offset, FROM_INT(rel2_to_x->x)),
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel2.relative_x, rel2_to_x->w)),
|
|
|
|
x),
|
|
|
|
FROM_INT(1));
|
2010-09-14 08:53:47 -07:00
|
|
|
else
|
2017-04-25 16:25:11 -07:00
|
|
|
w = ADD(SUB(ADD(offset,
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel2.relative_x, ed->w)),
|
|
|
|
x),
|
|
|
|
FROM_INT(1));
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.w = w;
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2017-04-25 16:25:11 -07:00
|
|
|
|
|
|
|
if (offset_is_scaled)
|
|
|
|
offset = SCALE(sc, desc->rel1.offset_y);
|
|
|
|
else
|
|
|
|
offset = FROM_INT(desc->rel1.offset_y);
|
|
|
|
|
2010-09-14 08:53:47 -07:00
|
|
|
if (rel1_to_y)
|
2017-04-25 16:25:11 -07:00
|
|
|
y = ADD(ADD(offset, FROM_INT(rel1_to_y->y)),
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel1.relative_y, rel1_to_y->h));
|
2010-09-14 08:53:47 -07:00
|
|
|
else
|
2017-04-25 16:25:11 -07:00
|
|
|
y = ADD(offset,
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel1.relative_y, ed->h));
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = y;
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2017-04-25 16:25:11 -07:00
|
|
|
if (offset_is_scaled)
|
|
|
|
offset = SUB(SCALE(sc, desc->rel2.offset_y + 1), FROM_INT(1));
|
|
|
|
else
|
|
|
|
offset = FROM_INT(desc->rel2.offset_y);
|
|
|
|
|
2010-09-14 08:53:47 -07:00
|
|
|
if (rel2_to_y)
|
2017-04-25 16:25:11 -07:00
|
|
|
h = ADD(SUB(ADD(ADD(offset, FROM_INT(rel2_to_y->y)),
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel2.relative_y, rel2_to_y->h)),
|
|
|
|
y),
|
|
|
|
FROM_INT(1));
|
2010-09-14 08:53:47 -07:00
|
|
|
else
|
2017-04-25 16:25:11 -07:00
|
|
|
h = ADD(SUB(ADD(offset,
|
2012-08-14 00:59:06 -07:00
|
|
|
SCALE(desc->rel2.relative_y, ed->h)),
|
|
|
|
y),
|
|
|
|
FROM_INT(1));
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.h = h;
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2010-09-15 07:15:23 -07:00
|
|
|
static Edje_Internal_Aspect
|
2012-01-06 03:28:38 -08:00
|
|
|
_edje_part_recalc_single_aspect(Edje *ed,
|
|
|
|
Edje_Real_Part *ep,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int *minw, int *minh,
|
|
|
|
int *maxw, int *maxh,
|
2012-01-06 03:28:38 -08:00
|
|
|
FLOAT_T pos)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2010-09-15 07:15:23 -07:00
|
|
|
Edje_Internal_Aspect apref = EDJE_ASPECT_PREFER_NONE;
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T aspect, amax, amin;
|
|
|
|
FLOAT_T new_w = ZERO, new_h = ZERO, want_x, want_y, want_w, want_h;
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.h <= ZERO) aspect = FROM_INT(999999);
|
|
|
|
else aspect = DIV(params->eval.w, params->eval.h);
|
2009-08-12 07:13:17 -07:00
|
|
|
amax = desc->aspect.max;
|
|
|
|
amin = desc->aspect.min;
|
2012-01-06 03:28:38 -08:00
|
|
|
if (desc->aspect.prefer == EDJE_ASPECT_PREFER_SOURCE &&
|
|
|
|
ep->part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
|
|
|
|
|
|
|
/* We only need pose to find the right image that would be displayed,
|
|
|
|
and the right aspect ratio in that case */
|
2014-10-27 23:50:38 -07:00
|
|
|
_edje_real_part_image_set(ed, ep, NULL, pos);
|
2012-01-06 03:28:38 -08:00
|
|
|
evas_object_image_size_get(ep->object, &w, &h);
|
|
|
|
amin = amax = DIV(FROM_INT(w), FROM_INT(h));
|
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
|
|
|
{
|
|
|
|
if ((ep->typedata.swallow->swallow_params.aspect.w > 0) &&
|
|
|
|
(ep->typedata.swallow->swallow_params.aspect.h > 0))
|
|
|
|
amin = amax =
|
2015-06-08 11:43:00 -07:00
|
|
|
DIV(FROM_INT(ep->typedata.swallow->swallow_params.aspect.w),
|
|
|
|
FROM_INT(ep->typedata.swallow->swallow_params.aspect.h));
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
2013-07-18 00:18:19 -07:00
|
|
|
want_x = params->eval.x;
|
|
|
|
want_w = new_w = params->eval.w;
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
want_y = params->eval.y;
|
|
|
|
want_h = new_h = params->eval.h;
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2009-12-09 07:44:54 -08:00
|
|
|
if ((amin > ZERO) && (amax > ZERO))
|
2004-05-24 00:58:37 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
apref = desc->aspect.prefer;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
if (ep->typedata.swallow->swallow_params.aspect.mode > EDJE_ASPECT_CONTROL_NONE)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
switch (ep->typedata.swallow->swallow_params.aspect.mode)
|
|
|
|
{
|
|
|
|
case EDJE_ASPECT_CONTROL_NEITHER:
|
|
|
|
apref = EDJE_ASPECT_PREFER_NONE;
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_HORIZONTAL:
|
|
|
|
apref = EDJE_ASPECT_PREFER_HORIZONTAL;
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_VERTICAL:
|
|
|
|
apref = EDJE_ASPECT_PREFER_VERTICAL;
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
case EDJE_ASPECT_CONTROL_BOTH:
|
|
|
|
apref = EDJE_ASPECT_PREFER_BOTH;
|
|
|
|
break;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (apref)
|
|
|
|
{
|
|
|
|
case EDJE_ASPECT_PREFER_NONE:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* keep both dimensions in check */
|
|
|
|
/* adjust for min aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect < amin)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_h = DIV(params->eval.w, amin);
|
|
|
|
new_w = MUL(amin, params->eval.h);
|
|
|
|
}
|
|
|
|
/* adjust for max aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect > amax)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_h = DIV(params->eval.w, amax);
|
|
|
|
new_w = MUL(amax, params->eval.h);
|
|
|
|
}
|
2016-12-14 00:59:40 -08:00
|
|
|
if (new_w < params->eval.w)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_w = params->eval.w;
|
|
|
|
new_h = DIV(params->eval.w, amax);
|
|
|
|
}
|
2016-12-14 00:59:40 -08:00
|
|
|
if (new_h < params->eval.h)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_w = MUL(amax, params->eval.h);
|
|
|
|
new_h = params->eval.h;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* prefer vertical size as determiner */
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_ASPECT_PREFER_VERTICAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* keep both dimensions in check */
|
|
|
|
/* adjust for max aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect > amax)
|
2015-06-08 11:43:00 -07:00
|
|
|
new_w = MUL(amax, params->eval.h);
|
|
|
|
/* adjust for min aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect < amin)
|
2015-06-08 11:43:00 -07:00
|
|
|
new_w = MUL(amin, params->eval.h);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* prefer horizontal size as determiner */
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_ASPECT_PREFER_HORIZONTAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* keep both dimensions in check */
|
|
|
|
/* adjust for max aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect > amax)
|
2015-06-08 11:43:00 -07:00
|
|
|
new_h = DIV(params->eval.w, amax);
|
|
|
|
/* adjust for min aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect < amin)
|
2015-06-08 11:43:00 -07:00
|
|
|
new_h = DIV(params->eval.w, amin);
|
|
|
|
break;
|
|
|
|
|
2012-01-06 03:28:38 -08:00
|
|
|
case EDJE_ASPECT_PREFER_SOURCE:
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_ASPECT_PREFER_BOTH:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* keep both dimensions in check */
|
|
|
|
/* adjust for max aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect > amax)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_w = MUL(amax, params->eval.h);
|
|
|
|
new_h = DIV(params->eval.w, amax);
|
|
|
|
}
|
|
|
|
/* adjust for min aspect (width / height) */
|
2016-12-14 00:59:40 -08:00
|
|
|
if (aspect < amin)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
new_w = MUL(amin, params->eval.h);
|
|
|
|
new_h = DIV(params->eval.w, amin);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
2016-12-14 00:59:40 -08:00
|
|
|
if (apref != EDJE_ASPECT_PREFER_NONE)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
|
|
|
if ((*maxw >= 0) && (new_w > FROM_INT(*maxw)))
|
|
|
|
new_w = FROM_INT(*maxw);
|
|
|
|
if (new_w < FROM_INT(*minw))
|
|
|
|
new_w = FROM_INT(*minw);
|
|
|
|
|
|
|
|
if ((FROM_INT(*maxh) >= 0) && (new_h > FROM_INT(*maxh)))
|
|
|
|
new_h = FROM_INT(*maxh);
|
|
|
|
if (new_h < FROM_INT(*minh))
|
|
|
|
new_h = FROM_INT(*minh);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do real adjustment */
|
|
|
|
if (apref == EDJE_ASPECT_PREFER_BOTH)
|
|
|
|
{
|
2016-12-14 00:59:40 -08:00
|
|
|
/* fix h and vary w */
|
|
|
|
if (new_w > params->eval.w)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2016-12-14 00:59:40 -08:00
|
|
|
// params->w = new_w;
|
|
|
|
// EXCEEDS BOUNDS in W
|
|
|
|
new_h = DIV(params->eval.w, amin);
|
|
|
|
new_w = params->eval.w;
|
|
|
|
if (new_h > params->eval.h)
|
|
|
|
{
|
|
|
|
new_h = params->eval.h;
|
|
|
|
new_w = MUL(amin, params->eval.h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* fix w and vary h */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// params->h = new_h;
|
|
|
|
// EXCEEDS BOUNDS in H
|
|
|
|
new_h = params->eval.h;
|
|
|
|
new_w = MUL(amin, params->eval.h);
|
2013-07-18 00:18:19 -07:00
|
|
|
if (new_w > params->eval.w)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
new_h = DIV(params->eval.w, amin);
|
|
|
|
new_w = params->eval.w;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2016-12-14 00:59:40 -08:00
|
|
|
params->eval.w = new_w;
|
|
|
|
params->eval.h = new_h;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2004-05-24 00:58:37 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
if (apref != EDJE_ASPECT_PREFER_BOTH)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if ((amin > 0.0) && (amax > ZERO) && (apref == EDJE_ASPECT_PREFER_NONE))
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.w = new_w;
|
|
|
|
params->eval.h = new_h;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-07-18 00:18:19 -07:00
|
|
|
else if (SUB(params->eval.h, new_h) > SUB(params->eval.w, new_w))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.h < new_h)
|
|
|
|
params->eval.h = new_h;
|
|
|
|
else if (params->eval.h > new_h)
|
|
|
|
params->eval.h = new_h;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (apref == EDJE_ASPECT_PREFER_VERTICAL)
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.w = new_w;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.w < new_w)
|
|
|
|
params->eval.w = new_w;
|
|
|
|
else if (params->eval.w > new_w)
|
|
|
|
params->eval.w = new_w;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (apref == EDJE_ASPECT_PREFER_HORIZONTAL)
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.h = new_h;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2013-08-07 00:00:15 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = ADD(want_x,
|
2015-06-08 11:43:00 -07:00
|
|
|
MUL(SUB(want_w, params->eval.w),
|
|
|
|
desc->align.x));
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = ADD(want_y,
|
|
|
|
MUL(SUB(want_h, params->eval.h),
|
|
|
|
desc->align.y));
|
2010-09-15 07:15:23 -07:00
|
|
|
return apref;
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-07-16 04:37:58 -07:00
|
|
|
_edje_part_recalc_single_step(Edje_Part_Description_Common *desc,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Calc_Params *params)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2010-09-14 08:53:47 -07:00
|
|
|
if (desc->step.x > 0)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
int steps;
|
|
|
|
int new_w;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
steps = TO_INT(params->eval.w) / desc->step.x;
|
2012-08-14 00:59:06 -07:00
|
|
|
new_w = desc->step.x * steps;
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.w > FROM_INT(new_w))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = ADD(params->eval.x, SCALE(desc->align.x, SUB(params->eval.w, FROM_INT(new_w))));
|
|
|
|
params->eval.w = FROM_INT(new_w);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2010-09-14 08:53:47 -07:00
|
|
|
|
|
|
|
if (desc->step.y > 0)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
int steps;
|
|
|
|
int new_h;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
steps = TO_INT(params->eval.h) / desc->step.y;
|
2012-08-14 00:59:06 -07:00
|
|
|
new_h = desc->step.y * steps;
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.h > FROM_INT(new_h))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = ADD(params->eval.y, SCALE(desc->align.y, SUB(params->eval.h, FROM_INT(new_h))));
|
|
|
|
params->eval.h = FROM_INT(new_h);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2004-10-12 20:43:42 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
|
|
|
|
2013-02-15 07:38:49 -08:00
|
|
|
static double
|
|
|
|
_edje_part_recalc_single_textblock_scale_range_adjust(Edje_Part_Description_Text *chosen_desc, double base_scale, double scale)
|
|
|
|
{
|
|
|
|
double size, min, max;
|
|
|
|
|
|
|
|
if (chosen_desc->text.size == 0)
|
2015-06-08 11:43:00 -07:00
|
|
|
return scale;
|
2013-02-15 07:38:49 -08:00
|
|
|
|
|
|
|
min = base_scale * chosen_desc->text.size_range_min;
|
|
|
|
max = chosen_desc->text.size_range_max * base_scale;
|
|
|
|
size = chosen_desc->text.size * scale;
|
|
|
|
|
|
|
|
if ((size > max) && (max > 0))
|
2015-06-08 11:43:00 -07:00
|
|
|
scale = max / (double)chosen_desc->text.size;
|
2013-02-15 07:38:49 -08:00
|
|
|
else if (size < min)
|
2015-06-08 11:43:00 -07:00
|
|
|
scale = min / (double)chosen_desc->text.size;
|
2013-02-15 07:38:49 -08:00
|
|
|
|
|
|
|
return scale;
|
|
|
|
}
|
|
|
|
|
edje: support legacy Textblock calculation logic for 1.18 edje file
Summary:
From EFL 1.19, Edje Textblock calculation logic was fixed according to
Edje documents. But, it broke old edje files which ignored text.min
option for minimum width. Even if the old edje files were wrong,
we need to support them as discussed from T5548.
Also, this patch will change default efl_version to 1.18 from 1.19.
So, without efl_version property, edje file will run on the legacy logic.
Fixes T5548
Test Plan: Turn on/off presentation mode in Enlightenment.
Reviewers: herdsman, cedric, jpeg, zmike, raster
Subscribers: stefan_schmidt
Maniphest Tasks: T5548
Differential Revision: https://phab.enlightenment.org/D4967
Adjusted by @jpeg
2017-07-03 21:53:59 -07:00
|
|
|
/*
|
|
|
|
* Legacy function for min/max calculation of textblock part.
|
|
|
|
* It can't calculate min/max properly in many cases.
|
|
|
|
*
|
|
|
|
* To keep backward compatibility, it will be used for old version of EDJ files.
|
|
|
|
* You can't see proper min/max result accroding to documents with this function.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int *minw, int *minh,
|
|
|
|
int *maxw, int *maxh)
|
|
|
|
{
|
|
|
|
Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
|
|
|
|
|
|
|
|
/* Legacy code for Textblock min/max calculation */
|
|
|
|
if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y))
|
|
|
|
{
|
|
|
|
int mw = 0, mh = 0;
|
|
|
|
|
|
|
|
tw = th = 0;
|
|
|
|
if (!chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
efl_gfx_size_set(ep->object, TO_INT(params->eval.w), TO_INT(params->eval.h));
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_textblock_size_native_get(ep->object, &tw, &th);
|
|
|
|
evas_object_textblock_style_insets_get(ep->object, &ins_l,
|
|
|
|
&ins_r, &ins_t, &ins_b);
|
|
|
|
mw = ins_l + tw + ins_r;
|
|
|
|
mh = ins_t + th + ins_b;
|
|
|
|
if (minw && chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
if (mw > *minw) *minw = mw;
|
|
|
|
}
|
|
|
|
if (minh && chosen_desc->text.min_y)
|
|
|
|
{
|
|
|
|
if (mh > *minh) *minh = mh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y))
|
|
|
|
{
|
|
|
|
int mw = 0, mh = 0;
|
|
|
|
|
|
|
|
tw = th = 0;
|
|
|
|
if (!chosen_desc->text.max_x)
|
|
|
|
{
|
|
|
|
efl_gfx_size_set(ep->object, TO_INT(params->eval.w), TO_INT(params->eval.h));
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_textblock_size_native_get(ep->object, &tw, &th);
|
|
|
|
evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
|
|
|
|
&ins_t, &ins_b);
|
|
|
|
mw = ins_l + tw + ins_r;
|
|
|
|
mh = ins_t + th + ins_b;
|
|
|
|
if (maxw && chosen_desc->text.max_x)
|
|
|
|
{
|
|
|
|
if (mw > *maxw) *maxw = mw;
|
|
|
|
if (minw && (*maxw < *minw)) *maxw = *minw;
|
|
|
|
}
|
|
|
|
if (maxh && chosen_desc->text.max_y)
|
|
|
|
{
|
|
|
|
if (mh > *maxh) *maxh = mh;
|
|
|
|
if (minh && (*maxh < *minh)) *maxh = *minh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int *minw, int *minh,
|
|
|
|
int *maxw, int *maxh)
|
|
|
|
{
|
|
|
|
Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
|
|
|
|
Evas_Coord min_calc_w = 0, min_calc_h = 0;
|
|
|
|
|
|
|
|
/* min_calc_* values need to save calculated minumum size
|
|
|
|
* for maximum size calculation */
|
|
|
|
if (minw) min_calc_w = *minw;
|
|
|
|
if (minh) min_calc_h = *minh;
|
|
|
|
|
|
|
|
if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y))
|
|
|
|
{
|
|
|
|
evas_object_textblock_style_insets_get(ep->object, &ins_l,
|
|
|
|
&ins_r, &ins_t, &ins_b);
|
|
|
|
|
|
|
|
tw = th = 0;
|
|
|
|
if (!chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
/* text.min: 0 1
|
|
|
|
* text.max: X X */
|
|
|
|
int temp_h = TO_INT(params->eval.h);
|
|
|
|
int temp_w = TO_INT(params->eval.w);
|
|
|
|
|
|
|
|
if (min_calc_w > temp_w)
|
|
|
|
temp_w = min_calc_w;
|
|
|
|
if ((!chosen_desc->text.max_x) &&
|
|
|
|
maxw && (*maxw > -1) && (*maxw < temp_w))
|
|
|
|
temp_w = *maxw;
|
|
|
|
|
|
|
|
if (chosen_desc->text.max_y)
|
|
|
|
{
|
|
|
|
/* text.min: 0 1
|
|
|
|
* text.max: X 1 */
|
|
|
|
temp_h = INT_MAX / 10000;
|
|
|
|
}
|
|
|
|
else if (maxh && (*maxh > TO_INT(params->eval.h)))
|
|
|
|
{
|
|
|
|
/* text.min: 0 1
|
|
|
|
* text.max: X 0
|
|
|
|
* And there is a limit for height. */
|
|
|
|
temp_h = *maxh;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If base width for calculation is 0,
|
|
|
|
* don't get meaningless height for multiline */
|
|
|
|
if (temp_w > 0)
|
|
|
|
{
|
|
|
|
efl_gfx_size_set(ep->object, temp_w, temp_h);
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, &th);
|
|
|
|
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: 1 X
|
|
|
|
* text.max: X X */
|
|
|
|
if (chosen_desc->text.min_y && (!chosen_desc->text.max_x) &&
|
|
|
|
maxw && (*maxw > -1))
|
|
|
|
{
|
|
|
|
/* text.min: 1 1
|
|
|
|
* text.max: 0 X */
|
|
|
|
int temp_w, temp_h;
|
|
|
|
|
|
|
|
temp_w = *maxw;
|
|
|
|
temp_h = INT_MAX / 10000;
|
|
|
|
|
|
|
|
if (min_calc_w > temp_w)
|
|
|
|
temp_w = min_calc_w;
|
|
|
|
|
|
|
|
if ((!chosen_desc->text.max_y) && maxh && (*maxh > -1))
|
|
|
|
{
|
|
|
|
/* text.min: 1 1
|
|
|
|
* text.max: 0 0
|
|
|
|
* There is limit for height. */
|
|
|
|
temp_h = *maxh;
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_gfx_size_set(ep->object, temp_w, temp_h);
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
|
|
|
|
/* If base width for calculation is 0,
|
|
|
|
* don't get meaningless height for multiline */
|
|
|
|
if (temp_w <= 0)
|
|
|
|
{
|
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, &th);
|
|
|
|
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: 1 X
|
|
|
|
* text.max: 1 X
|
|
|
|
* Or,
|
|
|
|
* text.min: 1 X
|
|
|
|
* text.max: 0 X without max width.
|
|
|
|
* It is a singleline Textblock. */
|
|
|
|
efl_canvas_text_size_native_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
|
|
|
|
if (!chosen_desc->text.max_x &&
|
|
|
|
(maxw && (*maxw > -1) && (*maxw < tw)))
|
|
|
|
{
|
|
|
|
/* text.min: 1 0
|
|
|
|
* text.max: 0 X */
|
|
|
|
tw = *maxw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tw > min_calc_w) min_calc_w = tw;
|
|
|
|
if (th > min_calc_h) min_calc_h = th;
|
|
|
|
if (chosen_desc->text.min_x && minw) *minw = min_calc_w;
|
|
|
|
if (chosen_desc->text.min_y && minh) *minh = min_calc_h;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y))
|
|
|
|
{
|
|
|
|
evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
|
|
|
|
&ins_t, &ins_b);
|
|
|
|
|
|
|
|
tw = th = 0;
|
|
|
|
if (!chosen_desc->text.max_x)
|
|
|
|
{
|
|
|
|
/* text.min: X X
|
|
|
|
* text.max: 0 1 */
|
|
|
|
int temp_w, temp_h;
|
|
|
|
|
|
|
|
if (chosen_desc->text.min_y)
|
|
|
|
{
|
|
|
|
/* text.min: X 1
|
|
|
|
* text.max: 0 1
|
|
|
|
* Already calculated in text for height. */
|
|
|
|
tw = TO_INT(params->eval.w);
|
|
|
|
if (min_calc_w > tw)
|
|
|
|
tw = min_calc_w;
|
|
|
|
|
|
|
|
th = min_calc_h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: X 0
|
|
|
|
* text.max: 0 1 */
|
|
|
|
temp_w = TO_INT(params->eval.w);
|
|
|
|
temp_h = TO_INT(params->eval.h);
|
|
|
|
|
|
|
|
if (min_calc_w > temp_w)
|
|
|
|
temp_w = min_calc_w;
|
|
|
|
if (maxw && (*maxw > -1) && (*maxw < temp_w))
|
|
|
|
temp_w = *maxw;
|
|
|
|
if (min_calc_h > temp_h)
|
|
|
|
temp_h = min_calc_h;
|
|
|
|
|
|
|
|
/* If base width for calculation is 0,
|
|
|
|
* don't get meaningless height for multiline */
|
|
|
|
if (temp_w > 0)
|
|
|
|
{
|
|
|
|
efl_gfx_size_set(ep->object, temp_w, temp_h);
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, &th);
|
|
|
|
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.max: 1 X */
|
|
|
|
if (chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
/* text.min: 1 X
|
|
|
|
* text.max: 1 X
|
|
|
|
* Singleline. */
|
|
|
|
efl_canvas_text_size_native_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: 0 X
|
|
|
|
* text.max: 1 X */
|
|
|
|
if (chosen_desc->text.max_y)
|
|
|
|
{
|
|
|
|
/* text.min: 0 X
|
|
|
|
* text.max: 1 1 */
|
|
|
|
int temp_w, temp_h;
|
|
|
|
|
|
|
|
temp_w = TO_INT(params->eval.w);
|
|
|
|
temp_h = TO_INT(params->eval.h);
|
|
|
|
|
|
|
|
if (min_calc_w > temp_w)
|
|
|
|
temp_w = min_calc_w;
|
|
|
|
if (min_calc_h > temp_h)
|
|
|
|
temp_h = min_calc_h;
|
|
|
|
|
|
|
|
if (chosen_desc->text.min_y)
|
|
|
|
{
|
|
|
|
/* text.min: 0 1
|
|
|
|
* text.max: 1 1
|
|
|
|
* There is no need to calculate it again. */
|
|
|
|
tw = min_calc_w;
|
|
|
|
th = min_calc_h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: 0 0
|
|
|
|
* text.max: 1 1 */
|
|
|
|
|
|
|
|
efl_gfx_size_set(ep->object, temp_w, temp_h);
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
|
|
|
|
/* If base width for calculation is 0,
|
|
|
|
* don't get meaningless height for multiline */
|
|
|
|
if (temp_w <= 0)
|
|
|
|
{
|
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, &th);
|
|
|
|
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* text.min: 0 X
|
|
|
|
* text.max: 1 0 */
|
|
|
|
int temp_w, temp_h;
|
|
|
|
|
|
|
|
temp_w = TO_INT(params->eval.w);
|
|
|
|
if (min_calc_w > temp_w)
|
|
|
|
temp_w = min_calc_w;
|
|
|
|
|
|
|
|
efl_gfx_size_get(ep->object, NULL, &temp_h);
|
|
|
|
efl_gfx_size_set(ep->object, temp_w, temp_h);
|
|
|
|
efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
|
|
|
|
|
|
|
|
tw += ins_l + ins_r;
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
|
|
|
|
/* If base width for calculation is 0,
|
|
|
|
* don't get meaningless height for multiline */
|
|
|
|
if (temp_w <= 0)
|
|
|
|
{
|
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, &th);
|
|
|
|
|
|
|
|
th += ins_t + ins_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (maxw && chosen_desc->text.max_x)
|
|
|
|
{
|
|
|
|
if (tw > *maxw) *maxw = tw;
|
|
|
|
if (minw && (*maxw < *minw)) *maxw = *minw;
|
|
|
|
}
|
|
|
|
if (maxh && chosen_desc->text.max_y)
|
|
|
|
{
|
|
|
|
if (th > *maxh) *maxh = th;
|
|
|
|
if (minh && (*maxh < *minh)) *maxh = *minh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
2009-12-09 07:44:54 -08:00
|
|
|
_edje_part_recalc_single_textblock(FLOAT_T sc,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje *ed,
|
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int *minw, int *minh,
|
|
|
|
int *maxw, int *maxh)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!ep->typedata.text))
|
|
|
|
return;
|
2017-06-09 17:20:47 -07:00
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
if (chosen_desc)
|
2005-09-12 02:43:49 -07:00
|
|
|
{
|
edje: support legacy Textblock calculation logic for 1.18 edje file
Summary:
From EFL 1.19, Edje Textblock calculation logic was fixed according to
Edje documents. But, it broke old edje files which ignored text.min
option for minimum width. Even if the old edje files were wrong,
we need to support them as discussed from T5548.
Also, this patch will change default efl_version to 1.18 from 1.19.
So, without efl_version property, edje file will run on the legacy logic.
Fixes T5548
Test Plan: Turn on/off presentation mode in Enlightenment.
Reviewers: herdsman, cedric, jpeg, zmike, raster
Subscribers: stefan_schmidt
Maniphest Tasks: T5548
Differential Revision: https://phab.enlightenment.org/D4967
Adjusted by @jpeg
2017-07-03 21:53:59 -07:00
|
|
|
Evas_Coord tw, th;
|
2012-08-14 00:59:06 -07:00
|
|
|
const char *text = "";
|
|
|
|
const char *style = "";
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Style *stl = NULL;
|
2012-08-14 00:59:06 -07:00
|
|
|
const char *tmp;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
if (chosen_desc->text.id_source >= 0)
|
|
|
|
{
|
2014-04-22 10:19:09 -07:00
|
|
|
Edje_Part_Description_Text *et;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.text->source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2014-04-22 10:19:09 -07:00
|
|
|
et = _edje_real_part_text_source_description_get(ep, NULL);
|
|
|
|
tmp = edje_string_get(&et->text.style);
|
2012-08-14 00:59:06 -07:00
|
|
|
if (tmp) style = tmp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.text->source = NULL;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
tmp = edje_string_get(&chosen_desc->text.style);
|
|
|
|
if (tmp) style = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chosen_desc->text.id_text_source >= 0)
|
|
|
|
{
|
2014-04-22 10:19:09 -07:00
|
|
|
Edje_Part_Description_Text *et;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.text->text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2014-04-22 10:19:09 -07:00
|
|
|
et = _edje_real_part_text_text_source_description_get(ep, &rp);
|
|
|
|
text = edje_string_get(&et->text.text);
|
|
|
|
|
|
|
|
if (rp->typedata.text->text) text = rp->typedata.text->text;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.text->text_source = NULL;
|
2012-08-14 00:59:06 -07:00
|
|
|
text = edje_string_get(&chosen_desc->text.text);
|
2012-09-11 06:14:51 -07:00
|
|
|
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
|
|
|
{
|
|
|
|
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
|
|
|
stl = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ep->part->scale)
|
|
|
|
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
|
|
|
|
2012-06-28 03:19:30 -07:00
|
|
|
if ((chosen_desc->text.fit_x) || (chosen_desc->text.fit_y))
|
|
|
|
{
|
2013-02-15 07:38:49 -08:00
|
|
|
double base_s = 1.0;
|
|
|
|
double orig_s;
|
|
|
|
double s = base_s;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2013-02-15 07:38:49 -08:00
|
|
|
if (ep->part->scale) base_s = TO_DOUBLE(sc);
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_scale_set(ep->object, base_s);
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, &tw, &th);
|
2013-02-15 07:38:49 -08:00
|
|
|
|
|
|
|
orig_s = base_s;
|
|
|
|
/* Now make it bigger so calculations will be more accurate
|
|
|
|
* and less influenced by hinting... */
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
orig_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s,
|
|
|
|
orig_s * TO_INT(params->eval.w) / tw);
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_scale_set(ep->object, orig_s);
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, &tw, &th);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2012-06-28 03:19:30 -07:00
|
|
|
if (chosen_desc->text.fit_x)
|
|
|
|
{
|
2013-02-15 07:38:49 -08:00
|
|
|
if (tw > 0)
|
2012-06-28 03:19:30 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s,
|
|
|
|
orig_s * TO_INT(params->eval.w) / tw);
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_scale_set(ep->object, s);
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, NULL);
|
2012-06-28 03:19:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (chosen_desc->text.fit_y)
|
|
|
|
{
|
2013-02-15 07:38:49 -08:00
|
|
|
if (th > 0)
|
2012-06-28 03:19:30 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
double tmp_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s,
|
|
|
|
orig_s * TO_INT(params->eval.h) / th);
|
2013-02-15 07:38:49 -08:00
|
|
|
/* If we already have X fit, restrict Y to be no bigger
|
|
|
|
* than what we got with X. */
|
|
|
|
if (!((chosen_desc->text.fit_x) && (tmp_s > s)))
|
|
|
|
{
|
|
|
|
s = tmp_s;
|
|
|
|
}
|
|
|
|
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_scale_set(ep->object, s);
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, NULL, NULL);
|
2012-06-28 03:19:30 -07:00
|
|
|
}
|
|
|
|
}
|
2013-02-19 03:40:00 -08:00
|
|
|
|
|
|
|
/* Final tuning, try going down 90% at a time, hoping it'll
|
|
|
|
* actually end up being correct. */
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
int i = 5; /* Tries before we give up. */
|
|
|
|
Evas_Coord fw, fh;
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, &fw, &fh);
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
/* If we are still too big, try reducing the size to
|
|
|
|
* 95% each try. */
|
|
|
|
while ((i > 0) &&
|
|
|
|
((chosen_desc->text.fit_x && (fw > TO_INT(params->eval.w))) ||
|
|
|
|
(chosen_desc->text.fit_y && (fh > TO_INT(params->eval.h)))))
|
|
|
|
{
|
|
|
|
double tmp_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, s * 0.95);
|
|
|
|
|
|
|
|
/* Break if we are not making any progress. */
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(tmp_s, s))
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
s = tmp_s;
|
|
|
|
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_scale_set(ep->object, s);
|
2016-05-24 06:11:03 -07:00
|
|
|
efl_canvas_text_size_native_get(ep->object, &fw, &fh);
|
2015-06-08 11:43:00 -07:00
|
|
|
i--;
|
|
|
|
}
|
|
|
|
}
|
2012-06-28 03:19:30 -07:00
|
|
|
}
|
2013-02-15 07:38:49 -08:00
|
|
|
|
2013-02-22 06:13:35 -08:00
|
|
|
if (stl)
|
|
|
|
{
|
|
|
|
if (evas_object_textblock_style_get(ep->object) != stl->style)
|
|
|
|
evas_object_textblock_style_set(ep->object, stl->style);
|
|
|
|
// FIXME: need to account for editing
|
|
|
|
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
// do nothing - should be done elsewhere
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-26 01:07:20 -08:00
|
|
|
evas_object_textblock_text_markup_set(ep->object, text);
|
2013-02-22 06:13:35 -08:00
|
|
|
}
|
2017-06-09 17:20:47 -07:00
|
|
|
|
edje: support legacy Textblock calculation logic for 1.18 edje file
Summary:
From EFL 1.19, Edje Textblock calculation logic was fixed according to
Edje documents. But, it broke old edje files which ignored text.min
option for minimum width. Even if the old edje files were wrong,
we need to support them as discussed from T5548.
Also, this patch will change default efl_version to 1.18 from 1.19.
So, without efl_version property, edje file will run on the legacy logic.
Fixes T5548
Test Plan: Turn on/off presentation mode in Enlightenment.
Reviewers: herdsman, cedric, jpeg, zmike, raster
Subscribers: stefan_schmidt
Maniphest Tasks: T5548
Differential Revision: https://phab.enlightenment.org/D4967
Adjusted by @jpeg
2017-07-03 21:53:59 -07:00
|
|
|
if ((ed->file->efl_version.major >= 1) && (ed->file->efl_version.minor >= 19))
|
|
|
|
{
|
|
|
|
_edje_part_recalc_single_textblock_min_max_calc(ep,
|
|
|
|
chosen_desc,
|
|
|
|
params,
|
|
|
|
minw, minh,
|
|
|
|
maxw, maxh);
|
2017-06-09 17:20:47 -07:00
|
|
|
}
|
edje: support legacy Textblock calculation logic for 1.18 edje file
Summary:
From EFL 1.19, Edje Textblock calculation logic was fixed according to
Edje documents. But, it broke old edje files which ignored text.min
option for minimum width. Even if the old edje files were wrong,
we need to support them as discussed from T5548.
Also, this patch will change default efl_version to 1.18 from 1.19.
So, without efl_version property, edje file will run on the legacy logic.
Fixes T5548
Test Plan: Turn on/off presentation mode in Enlightenment.
Reviewers: herdsman, cedric, jpeg, zmike, raster
Subscribers: stefan_schmidt
Maniphest Tasks: T5548
Differential Revision: https://phab.enlightenment.org/D4967
Adjusted by @jpeg
2017-07-03 21:53:59 -07:00
|
|
|
else
|
2017-06-09 17:20:47 -07:00
|
|
|
{
|
edje: support legacy Textblock calculation logic for 1.18 edje file
Summary:
From EFL 1.19, Edje Textblock calculation logic was fixed according to
Edje documents. But, it broke old edje files which ignored text.min
option for minimum width. Even if the old edje files were wrong,
we need to support them as discussed from T5548.
Also, this patch will change default efl_version to 1.18 from 1.19.
So, without efl_version property, edje file will run on the legacy logic.
Fixes T5548
Test Plan: Turn on/off presentation mode in Enlightenment.
Reviewers: herdsman, cedric, jpeg, zmike, raster
Subscribers: stefan_schmidt
Maniphest Tasks: T5548
Differential Revision: https://phab.enlightenment.org/D4967
Adjusted by @jpeg
2017-07-03 21:53:59 -07:00
|
|
|
_edje_part_recalc_single_textblock_min_max_calc_legacy(ep,
|
|
|
|
chosen_desc,
|
|
|
|
params,
|
|
|
|
minw, minh,
|
|
|
|
maxw, maxh);
|
2013-02-22 06:11:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-16 03:37:44 -07:00
|
|
|
evas_object_textblock_valign_set(ep->object, TO_DOUBLE(chosen_desc->text.align.y));
|
2005-09-12 02:43:49 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
|
|
|
|
2012-08-27 01:59:11 -07:00
|
|
|
static void
|
|
|
|
_edje_textblock_recalc_apply(Edje *ed, Edje_Real_Part *ep,
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Calc_Params *params,
|
|
|
|
Edje_Part_Description_Text *chosen_desc)
|
2012-08-27 01:59:11 -07:00
|
|
|
{
|
|
|
|
/* FIXME: this is just an hack. */
|
|
|
|
FLOAT_T sc;
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
2012-08-27 01:59:11 -07:00
|
|
|
if (chosen_desc->text.fit_x || chosen_desc->text.fit_y)
|
|
|
|
{
|
|
|
|
_edje_part_recalc_single_textblock(sc, ed, ep, chosen_desc, params,
|
2015-06-08 11:43:00 -07:00
|
|
|
NULL, NULL, NULL, NULL);
|
2012-08-27 01:59:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_recalc_single_text(FLOAT_T sc EINA_UNUSED,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje *ed,
|
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Text *desc,
|
|
|
|
Edje_Part_Description_Text *chosen_desc,
|
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int *minw, int *minh,
|
2015-06-17 00:26:30 -07:00
|
|
|
int *maxw, int *maxh)
|
2011-08-20 18:38:17 -07:00
|
|
|
#define RECALC_SINGLE_TEXT_USING_APPLY 1
|
|
|
|
#if RECALC_SINGLE_TEXT_USING_APPLY
|
|
|
|
/*
|
|
|
|
* XXX TODO NOTE:
|
|
|
|
*
|
|
|
|
* Original _edje_part_recalc_single_text() was not working as
|
|
|
|
* expected since it was not doing size fit, range, ellipsis and so
|
|
|
|
* on.
|
|
|
|
*
|
|
|
|
* The purpose of this function compared with
|
|
|
|
* _edje_text_recalc_apply() is to be faster, not calling Evas update
|
|
|
|
* functions. However for text this is quite difficult given that to
|
|
|
|
* fit we need to set the font, size, style, etc. If it was done
|
|
|
|
* correctly, we'd save some calls to move and some color sets,
|
|
|
|
* however those shouldn't matter much in the overall picture.
|
|
|
|
*
|
|
|
|
* I've changed this to force applying the value, it should be more
|
|
|
|
* correct and not so slow. The previous code is kept below for
|
|
|
|
* reference but should be removed before next release!
|
|
|
|
*
|
|
|
|
* -- Gustavo Barbieri at 20-Aug-2011
|
|
|
|
*/
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
int mw, mh, size;
|
2011-08-20 18:38:17 -07:00
|
|
|
char *sfont = NULL;
|
|
|
|
|
|
|
|
_edje_text_class_font_get(ed, desc, &size, &sfont);
|
|
|
|
free(sfont);
|
2016-08-14 06:30:32 -07:00
|
|
|
|
|
|
|
_edje_calc_params_need_type_text(params);
|
|
|
|
params->type.text->size = size; /* XXX TODO used by further calcs, go inside recalc_apply? */
|
2011-08-20 18:38:17 -07:00
|
|
|
|
2015-06-17 00:26:30 -07:00
|
|
|
_edje_text_recalc_apply(ed, ep, params, chosen_desc, EINA_TRUE);
|
2011-08-20 18:38:17 -07:00
|
|
|
|
|
|
|
if ((!chosen_desc) ||
|
|
|
|
((!chosen_desc->text.min_x) && (!chosen_desc->text.min_y) &&
|
|
|
|
(!chosen_desc->text.max_x) && (!chosen_desc->text.max_y)))
|
|
|
|
return;
|
|
|
|
|
2014-05-12 19:22:22 -07:00
|
|
|
// Note: No need to add padding to that, it's already in the geometry
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_size_get(ep->object, &mw, &mh);
|
2011-08-20 18:38:17 -07:00
|
|
|
|
|
|
|
if (chosen_desc->text.max_x)
|
|
|
|
{
|
2016-07-11 18:20:03 -07:00
|
|
|
if ((*maxw < 0) || (mw > *maxw)) *maxw = mw;
|
2011-08-20 18:38:17 -07:00
|
|
|
}
|
|
|
|
if (chosen_desc->text.max_y)
|
|
|
|
{
|
2016-07-11 18:20:03 -07:00
|
|
|
if ((*maxh < 0) || (mh > *maxh)) *maxh = mh;
|
2011-08-20 18:38:17 -07:00
|
|
|
}
|
|
|
|
if (chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
if (mw > *minw) *minw = mw;
|
2016-07-11 18:20:03 -07:00
|
|
|
if ((*maxw > -1) && (*minw > *maxw)) *minw = *maxw;
|
2011-08-20 18:38:17 -07:00
|
|
|
}
|
|
|
|
if (chosen_desc->text.min_y)
|
|
|
|
{
|
|
|
|
if (mh > *minh) *minh = mh;
|
2016-07-11 18:20:03 -07:00
|
|
|
if ((*maxh > -1) && (*minh > *maxh)) *minh = *maxh;
|
2011-08-20 18:38:17 -07:00
|
|
|
}
|
2016-07-11 18:20:03 -07:00
|
|
|
if ((*maxw > -1) && (mw > *maxw)) mw = *maxw;
|
|
|
|
if ((*maxh > -1) && (mh > *maxh)) mh = *maxh;
|
|
|
|
|
|
|
|
evas_object_resize(ep->object, mw, mh);
|
2011-08-20 18:38:17 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2011-08-20 18:38:17 -07:00
|
|
|
#else
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
|
|
|
char *sfont = NULL;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
if (chosen_desc)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
const char *text;
|
|
|
|
const char *font;
|
|
|
|
Evas_Coord tw, th;
|
|
|
|
int inlined_font = 0;
|
2014-04-22 10:19:09 -07:00
|
|
|
Edje_Real_Part *source, *text_source;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
/* Update a object_text part */
|
|
|
|
|
|
|
|
if (chosen_desc->text.id_source >= 0)
|
2014-05-12 19:20:01 -07:00
|
|
|
ep->typedata.text->source = ed->table_parts[chosen_desc->text.id_source % ed->table_parts_size];
|
2012-08-14 00:59:06 -07:00
|
|
|
else
|
2014-05-12 19:20:01 -07:00
|
|
|
source = ep->typedata.text->source = NULL;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
if (chosen_desc->text.id_text_source >= 0)
|
2014-05-12 19:20:01 -07:00
|
|
|
ep->typedata.text->text_source = ed->table_parts[chosen_desc->text.id_text_source % ed->table_parts_size];
|
2012-08-14 00:59:06 -07:00
|
|
|
else
|
2014-05-12 19:20:01 -07:00
|
|
|
text_source = ep->typedata.text->text_source = NULL;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2014-05-12 19:20:01 -07:00
|
|
|
if (ep->typedata.text->text_source)
|
|
|
|
text = edje_string_get(&_edje_real_part_text_text_source_description_get(ep, &text_source)->text.text);
|
2012-08-14 00:59:06 -07:00
|
|
|
else
|
|
|
|
text = edje_string_get(&chosen_desc->text.text);
|
|
|
|
|
2014-05-12 19:20:01 -07:00
|
|
|
if (ep->typedata.text->source)
|
|
|
|
font = _edje_text_class_font_get(ed, _edje_real_part_text_source_description_get(ep, &source), &size, &sfont);
|
2012-08-14 00:59:06 -07:00
|
|
|
else
|
|
|
|
font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
|
|
|
|
|
|
|
|
if (!font) font = "";
|
|
|
|
|
2014-04-22 10:19:09 -07:00
|
|
|
if (text_source)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2014-05-12 19:20:01 -07:00
|
|
|
if (text_source->typedata.text->text) text = text_source->typedata.text->text;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-12 19:20:01 -07:00
|
|
|
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
2014-04-22 10:19:09 -07:00
|
|
|
if (source)
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2014-05-12 19:20:01 -07:00
|
|
|
if (source->typedata.text->font) font = source->typedata.text->font;
|
|
|
|
if (source->typedata.text->size > 0) size = source->typedata.text->size;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-12 19:20:01 -07:00
|
|
|
if (ep->typedata.text->font) font = ep->typedata.text->font;
|
|
|
|
if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
if (!text) text = "";
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2004-08-29 22:39:24 -07:00
|
|
|
/* check if the font is embedded in the .eet */
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ed->file->fonts)
|
|
|
|
{
|
|
|
|
Edje_Font_Directory_Entry *fnt;
|
2007-04-05 08:54:16 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
fnt = eina_hash_find(ed->file->fonts, font);
|
2006-07-02 23:15:05 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (fnt)
|
|
|
|
{
|
2010-10-11 00:24:46 -07:00
|
|
|
char *font2;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len = strlen(font) + sizeof("edje/fonts/") + 1;
|
2010-10-11 00:24:46 -07:00
|
|
|
font2 = alloca(len);
|
|
|
|
sprintf(font2, "edje/fonts/%s", font);
|
|
|
|
font = font2;
|
2012-08-14 00:59:06 -07:00
|
|
|
inlined_font = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ep->part->scale)
|
|
|
|
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
|
|
|
if (inlined_font)
|
2010-10-11 00:24:46 -07:00
|
|
|
{
|
|
|
|
evas_object_text_font_source_set(ep->object, ed->path);
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
else evas_object_text_font_source_set(ep->object, NULL);
|
|
|
|
|
|
|
|
if ((_edje_fontset_append) && (font))
|
|
|
|
{
|
|
|
|
char *font2;
|
|
|
|
|
|
|
|
font2 = malloc(strlen(font) + 1 + strlen(_edje_fontset_append) + 1);
|
|
|
|
if (font2)
|
|
|
|
{
|
|
|
|
strcpy(font2, font);
|
|
|
|
strcat(font2, ",");
|
|
|
|
strcat(font2, _edje_fontset_append);
|
|
|
|
evas_object_text_font_set(ep->object, font2, size);
|
|
|
|
free(font2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_text_font_set(ep->object, font, size);
|
|
|
|
if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y) ||
|
|
|
|
(chosen_desc->text.max_x) || (chosen_desc->text.max_y))
|
|
|
|
{
|
|
|
|
int mw, mh;
|
|
|
|
Evas_Text_Style_Type
|
2015-06-08 11:43:00 -07:00
|
|
|
style = EVAS_TEXT_STYLE_PLAIN,
|
|
|
|
shadow = EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;
|
2012-08-14 00:59:06 -07:00
|
|
|
const Evas_Text_Style_Type styles[] = {
|
2015-06-08 11:43:00 -07:00
|
|
|
EVAS_TEXT_STYLE_PLAIN,
|
|
|
|
EVAS_TEXT_STYLE_PLAIN,
|
|
|
|
EVAS_TEXT_STYLE_OUTLINE,
|
|
|
|
EVAS_TEXT_STYLE_SOFT_OUTLINE,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_SOFT_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_OUTLINE_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_FAR_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_FAR_SOFT_SHADOW,
|
|
|
|
EVAS_TEXT_STYLE_GLOW
|
2012-08-14 00:59:06 -07:00
|
|
|
};
|
|
|
|
const Evas_Text_Style_Type shadows[] = {
|
2015-06-08 11:43:00 -07:00
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT,
|
2011-04-11 05:08:03 -07:00
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT,
|
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT
|
|
|
|
};
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if ((ep->part->effect & EVAS_TEXT_STYLE_MASK_BASIC)
|
2011-04-11 05:08:03 -07:00
|
|
|
< EDJE_TEXT_EFFECT_LAST)
|
2012-08-14 00:59:06 -07:00
|
|
|
style = styles[ep->part->effect];
|
2011-04-11 05:08:03 -07:00
|
|
|
shadow = shadows
|
2015-06-08 11:43:00 -07:00
|
|
|
[(ep->part->effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) >> 4];
|
2011-04-11 05:08:03 -07:00
|
|
|
EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(style, shadow);
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_obj_text_style_set(ep->object, style);
|
|
|
|
evas_obj_text_set(ep->object, text);
|
|
|
|
efl_gfx_size_get(ep->object, &tw, &th);
|
2012-08-14 00:59:06 -07:00
|
|
|
if (chosen_desc->text.max_x)
|
|
|
|
{
|
|
|
|
int l, r;
|
|
|
|
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
|
|
|
mw = tw + l + r;
|
|
|
|
if ((*maxw < 0) || (mw < *maxw)) *maxw = mw;
|
|
|
|
}
|
|
|
|
if (chosen_desc->text.max_y)
|
|
|
|
{
|
|
|
|
int t, b;
|
|
|
|
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
|
|
|
mh = th + t + b;
|
|
|
|
if ((*maxh < 0) || (mh < *maxh)) *maxh = mh;
|
|
|
|
}
|
|
|
|
if (chosen_desc->text.min_x)
|
|
|
|
{
|
|
|
|
int l, r;
|
|
|
|
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
|
|
|
mw = tw + l + r;
|
|
|
|
if (mw > *minw) *minw = mw;
|
|
|
|
}
|
|
|
|
if (chosen_desc->text.min_y)
|
|
|
|
{
|
|
|
|
int t, b;
|
|
|
|
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
|
|
|
mh = th + t + b;
|
|
|
|
if (mh > *minh) *minh = mh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sfont) free(sfont);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2009-02-05 10:15:34 -08:00
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
/* FIXME: Do we really need to call it twice if chosen_desc ? */
|
2009-08-12 10:57:34 -07:00
|
|
|
sfont = NULL;
|
2010-01-15 11:57:17 -08:00
|
|
|
_edje_text_class_font_get(ed, desc, &size, &sfont);
|
2009-08-12 07:13:17 -07:00
|
|
|
free(sfont);
|
|
|
|
params->type.text.size = size;
|
|
|
|
}
|
2011-08-20 18:38:17 -07:00
|
|
|
#endif
|
2009-02-05 10:15:34 -08:00
|
|
|
|
2010-09-14 08:36:16 -07:00
|
|
|
static void
|
2013-07-18 00:18:19 -07:00
|
|
|
_edje_part_recalc_single_min_length(FLOAT_T align, FLOAT_T *start, FLOAT_T *length, int min)
|
2010-09-14 08:36:16 -07:00
|
|
|
{
|
|
|
|
if (min >= 0)
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
if (*length < FROM_INT(min))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
*start = ADD(*start, (SCALE(align, (*length - min))));
|
|
|
|
*length = FROM_INT(min);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2010-09-14 08:36:16 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
2010-07-16 04:37:58 -07:00
|
|
|
_edje_part_recalc_single_min(Edje_Part_Description_Common *desc,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int minw, int minh,
|
|
|
|
Edje_Internal_Aspect aspect)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
FLOAT_T tmp;
|
|
|
|
FLOAT_T w;
|
|
|
|
FLOAT_T h;
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
w = NEQ(params->eval.w, ZERO) ? params->eval.w : FROM_INT(99999);
|
|
|
|
h = NEQ(params->eval.h, ZERO) ? params->eval.h : FROM_INT(99999);
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2010-09-15 07:15:23 -07:00
|
|
|
switch (aspect)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_NONE:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_VERTICAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.w, minh), h);
|
|
|
|
if (tmp >= FROM_INT(minw))
|
|
|
|
{
|
|
|
|
minw = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_HORIZONTAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.h, minw), w);
|
|
|
|
if (tmp >= FROM_INT(minh))
|
|
|
|
{
|
|
|
|
minh = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-01-06 03:28:38 -08:00
|
|
|
case EDJE_ASPECT_PREFER_SOURCE:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_BOTH:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.w, minh), h);
|
|
|
|
if (tmp >= FROM_INT(minw))
|
|
|
|
{
|
|
|
|
minw = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.h, minw), w);
|
|
|
|
if (tmp >= FROM_INT(minh))
|
|
|
|
{
|
|
|
|
minh = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
_edje_part_recalc_single_min_length(desc->align.x, ¶ms->eval.x, ¶ms->eval.w, minw);
|
|
|
|
_edje_part_recalc_single_min_length(desc->align.y, ¶ms->eval.y, ¶ms->eval.h, minh);
|
2010-09-14 08:36:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-18 00:18:19 -07:00
|
|
|
_edje_part_recalc_single_max_length(FLOAT_T align, FLOAT_T *start, FLOAT_T *length, int max)
|
2010-09-14 08:36:16 -07:00
|
|
|
{
|
|
|
|
if (max >= 0)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*length > max)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
*start = ADD(*start, SCALE(align, (*length - max)));
|
2012-08-14 00:59:06 -07:00
|
|
|
*length = max;
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-07-16 04:37:58 -07:00
|
|
|
_edje_part_recalc_single_max(Edje_Part_Description_Common *desc,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int maxw, int maxh,
|
|
|
|
Edje_Internal_Aspect aspect)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
FLOAT_T tmp;
|
|
|
|
FLOAT_T w;
|
|
|
|
FLOAT_T h;
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
w = NEQ(params->eval.w, 0) ? params->eval.w : FROM_INT(99999);
|
|
|
|
h = NEQ(params->eval.h, 0) ? params->eval.h : FROM_INT(99999);
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2010-09-15 07:15:23 -07:00
|
|
|
switch (aspect)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_NONE:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_VERTICAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.w, maxh), h);
|
|
|
|
if (tmp <= FROM_INT(maxw))
|
|
|
|
{
|
|
|
|
maxw = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_HORIZONTAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.h, maxw), w);
|
|
|
|
if (tmp <= FROM_INT(maxh))
|
|
|
|
{
|
|
|
|
maxh = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-01-06 03:28:38 -08:00
|
|
|
case EDJE_ASPECT_PREFER_SOURCE:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2010-09-14 08:36:16 -07:00
|
|
|
case EDJE_ASPECT_PREFER_BOTH:
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.w, maxh), h);
|
|
|
|
if (tmp <= FROM_INT(maxw))
|
|
|
|
{
|
|
|
|
maxw = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
tmp = DIV(SCALE(params->eval.h, maxw), w);
|
|
|
|
if (tmp <= FROM_INT(maxh))
|
|
|
|
{
|
|
|
|
maxh = TO_INT(tmp);
|
|
|
|
break;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2010-09-14 08:36:16 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
_edje_part_recalc_single_max_length(desc->align.x, ¶ms->eval.x, ¶ms->eval.w, maxw);
|
|
|
|
_edje_part_recalc_single_max_length(desc->align.y, ¶ms->eval.y, ¶ms->eval.h, maxh);
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-07-18 23:39:49 -07:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep,
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Real_Part *threshold,
|
2013-07-18 23:39:49 -07:00
|
|
|
Edje_Calc_Params *params)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(params);
|
2013-07-18 23:39:49 -07:00
|
|
|
if (threshold)
|
|
|
|
{
|
|
|
|
if (ep->drag->threshold_started_x &&
|
|
|
|
threshold->x < TO_INT(params->eval.x) &&
|
|
|
|
TO_INT(params->eval.x) + TO_INT(params->eval.w) < threshold->x + threshold->w)
|
|
|
|
{
|
|
|
|
// Cancel movement to previous position due to our presence inside the threshold
|
2016-08-14 06:30:32 -07:00
|
|
|
params->eval.x = FROM_INT(params->ext->req_drag.x);
|
|
|
|
params->eval.w = FROM_INT(params->ext->req_drag.w);
|
2015-06-08 11:43:00 -07:00
|
|
|
ep->drag->threshold_x = EINA_TRUE;
|
2013-07-18 23:39:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
params->ext->req_drag.x = TO_INT(params->eval.x);
|
|
|
|
params->ext->req_drag.w = TO_INT(params->eval.w);
|
2013-07-18 23:39:49 -07:00
|
|
|
ep->drag->threshold_started_x = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (ep->drag->threshold_started_y &&
|
|
|
|
threshold->y < TO_INT(params->eval.y) &&
|
|
|
|
TO_INT(params->eval.y) + TO_INT(params->eval.h) < threshold->y + threshold->h)
|
|
|
|
{
|
|
|
|
// Cancel movement to previous position due to our presence inside the threshold
|
2016-08-14 06:30:32 -07:00
|
|
|
params->eval.y = FROM_INT(params->ext->req_drag.y);
|
|
|
|
params->eval.h = FROM_INT(params->ext->req_drag.h);
|
2015-06-08 11:43:00 -07:00
|
|
|
ep->drag->threshold_y = EINA_TRUE;
|
2013-07-18 23:39:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
params->ext->req_drag.y = TO_INT(params->eval.y);
|
|
|
|
params->ext->req_drag.h = TO_INT(params->eval.h);
|
2013-07-18 23:39:49 -07:00
|
|
|
ep->drag->threshold_started_y = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
params->ext->req_drag.x = TO_INT(params->eval.x);
|
|
|
|
params->ext->req_drag.w = TO_INT(params->eval.w);
|
|
|
|
params->ext->req_drag.y = TO_INT(params->eval.y);
|
|
|
|
params->ext->req_drag.h = TO_INT(params->eval.h);
|
2013-07-18 23:39:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *confine_to,
|
2013-07-18 23:39:49 -07:00
|
|
|
Edje_Real_Part *threshold,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Calc_Params *params,
|
|
|
|
int minw, int minh,
|
|
|
|
int maxw, int maxh)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
|
|
|
/* confine */
|
|
|
|
if (confine_to)
|
2009-08-11 05:47:00 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
int offset;
|
|
|
|
int step;
|
|
|
|
FLOAT_T v;
|
|
|
|
|
|
|
|
/* complex dragable params */
|
|
|
|
v = SCALE(ep->drag->size.x, confine_to->w);
|
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
if ((minw > 0) && (TO_INT(v) < minw)) params->eval.w = FROM_INT(minw);
|
2015-06-08 11:43:00 -07:00
|
|
|
else if ((maxw >= 0) && (TO_INT(v) > maxw))
|
|
|
|
params->eval.w = FROM_INT(maxw);
|
2013-07-18 00:18:19 -07:00
|
|
|
else params->eval.w = v;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
offset = TO_INT(SCALE(ep->drag->x, (confine_to->w - TO_INT(params->eval.w))))
|
2015-06-08 11:43:00 -07:00
|
|
|
+ ep->drag->tmp.x;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->part->dragable.step_x > 0)
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = FROM_INT(confine_to->x +
|
|
|
|
((offset / ep->part->dragable.step_x) * ep->part->dragable.step_x));
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else if (ep->part->dragable.count_x > 0)
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
step = (confine_to->w - TO_INT(params->eval.w)) / ep->part->dragable.count_x;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (step < 1) step = 1;
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = FROM_INT(confine_to->x +
|
|
|
|
((offset / step) * step));
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
v = SCALE(ep->drag->size.y, confine_to->h);
|
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
if ((minh > 0) && (TO_INT(v) < minh)) params->eval.h = FROM_INT(minh);
|
2015-06-08 11:43:00 -07:00
|
|
|
else if ((maxh >= 0) && (TO_INT(v) > maxh))
|
|
|
|
params->eval.h = FROM_INT(maxh);
|
2013-07-18 00:18:19 -07:00
|
|
|
else params->eval.h = v;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2013-07-18 00:18:19 -07:00
|
|
|
offset = TO_INT(SCALE(ep->drag->y, (confine_to->h - TO_INT(params->eval.h))))
|
2015-06-08 11:43:00 -07:00
|
|
|
+ ep->drag->tmp.y;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->part->dragable.step_y > 0)
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = FROM_INT(confine_to->y +
|
|
|
|
((offset / ep->part->dragable.step_y) * ep->part->dragable.step_y));
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
else if (ep->part->dragable.count_y > 0)
|
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
step = (confine_to->h - TO_INT(params->eval.h)) / ep->part->dragable.count_y;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (step < 1) step = 1;
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = FROM_INT(confine_to->y +
|
|
|
|
((offset / step) * step));
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-07-18 23:39:49 -07:00
|
|
|
|
|
|
|
_edje_part_recalc_single_drag_threshold(ep, threshold, params);
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
/* limit to confine */
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.x < FROM_INT(confine_to->x))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = FROM_INT(confine_to->x);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-07-18 00:18:19 -07:00
|
|
|
if ((ADD(params->eval.x, params->eval.w)) > FROM_INT(confine_to->x + confine_to->w))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = SUB(FROM_INT(confine_to->x + confine_to->w), params->eval.w);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-07-18 00:18:19 -07:00
|
|
|
if (params->eval.y < FROM_INT(confine_to->y))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = FROM_INT(confine_to->y);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-07-18 00:18:19 -07:00
|
|
|
if ((ADD(params->eval.y, params->eval.h)) > FROM_INT(confine_to->y + confine_to->h))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.y = SUB(FROM_INT(confine_to->y + confine_to->h), params->eval.h);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2010-09-14 08:53:47 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
/* simple dragable params */
|
2013-07-18 00:18:19 -07:00
|
|
|
params->eval.x = ADD(ADD(params->eval.x, ep->drag->x), FROM_INT(ep->drag->tmp.x));
|
|
|
|
params->eval.y = ADD(ADD(params->eval.y, ep->drag->y), FROM_INT(ep->drag->tmp.y));
|
2013-07-18 23:39:49 -07:00
|
|
|
|
|
|
|
_edje_part_recalc_single_drag_threshold(ep, threshold, params);
|
2010-09-14 08:53:47 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2006-08-20 20:00:01 -07:00
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_fill(Edje_Real_Part *ep,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Part_Description_Spec_Fill *fill,
|
|
|
|
Edje_Calc_Params *params)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2010-09-14 08:53:47 -07:00
|
|
|
int fw;
|
|
|
|
int fh;
|
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
params->smooth = fill->smooth;
|
2006-08-20 20:00:01 -07:00
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
if (fill->type == EDJE_FILL_TYPE_TILE)
|
2010-09-14 08:53:47 -07:00
|
|
|
evas_object_image_size_get(ep->object, &fw, NULL);
|
|
|
|
else
|
2013-07-23 23:46:20 -07:00
|
|
|
fw = params->final.w;
|
2010-07-13 08:47:19 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_common(params);
|
|
|
|
params->type.common->fill.x = fill->pos_abs_x
|
2015-06-08 11:43:00 -07:00
|
|
|
+ TO_INT(SCALE(fill->pos_rel_x, fw));
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.common->fill.w = fill->abs_x
|
2015-06-08 11:43:00 -07:00
|
|
|
+ TO_INT(SCALE(fill->rel_x, fw));
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
if (fill->type == EDJE_FILL_TYPE_TILE)
|
2010-09-14 08:53:47 -07:00
|
|
|
evas_object_image_size_get(ep->object, NULL, &fh);
|
|
|
|
else
|
2013-07-23 23:46:20 -07:00
|
|
|
fh = params->final.h;
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.common->fill.y = fill->pos_abs_y
|
2015-06-08 11:43:00 -07:00
|
|
|
+ TO_INT(SCALE(fill->pos_rel_y, fh));
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.common->fill.h = fill->abs_y
|
2015-06-08 11:43:00 -07:00
|
|
|
+ TO_INT(SCALE(fill->rel_y, fh));
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-12-09 07:44:54 -08:00
|
|
|
_edje_part_recalc_single_min_max(FLOAT_T sc,
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje *ed,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
int *minw, int *minh,
|
|
|
|
int *maxw, int *maxh)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
Edje_Size_Class *size_class = NULL;
|
|
|
|
Evas_Coord mnw, mnh, mxw, mxh;
|
|
|
|
|
|
|
|
if (desc->size_class)
|
|
|
|
size_class = _edje_size_class_find(ed, desc->size_class);
|
|
|
|
|
|
|
|
if (size_class)
|
|
|
|
{
|
|
|
|
mnw = size_class->minw;
|
|
|
|
mnh = size_class->minh;
|
|
|
|
mxw = size_class->maxw;
|
|
|
|
mxh = size_class->maxh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mnw = desc->min.w;
|
|
|
|
mnh = desc->min.h;
|
|
|
|
mxw = desc->max.w;
|
|
|
|
mxh = desc->max.h;
|
|
|
|
}
|
|
|
|
|
|
|
|
*minw = mnw;
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *minw = TO_INT_ROUND(SCALE(sc, *minw));
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
|
|
|
{
|
2015-10-19 11:12:23 -07:00
|
|
|
if (ep->typedata.swallow->swallow_params.min.w > *minw)
|
2012-09-11 06:14:51 -07:00
|
|
|
*minw = ep->typedata.swallow->swallow_params.min.w;
|
|
|
|
}
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2013-04-07 20:24:44 -07:00
|
|
|
if (ed->calc_only)
|
2012-01-13 18:29:13 -08:00
|
|
|
{
|
|
|
|
if (desc->minmul.have)
|
|
|
|
{
|
|
|
|
FLOAT_T mmw = desc->minmul.w;
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(mmw, FROM_INT(1))) *minw = TO_INT(SCALE(mmw, *minw));
|
2012-01-13 18:29:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
2010-09-14 08:53:47 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
/* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
|
|
|
|
if ((ep->typedata.swallow->swallow_params.max.w <= 0) ||
|
|
|
|
(ep->typedata.swallow->swallow_params.max.w == EDJE_INF_MAX_W))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxw = mxw;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxw > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxw < 1) *maxw = 1;
|
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
if (mxw <= 0)
|
2012-09-11 06:14:51 -07:00
|
|
|
*maxw = ep->typedata.swallow->swallow_params.max.w;
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxw = mxw;
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxw > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxw < 1) *maxw = 1;
|
|
|
|
}
|
|
|
|
if (ep->typedata.swallow->swallow_params.max.w < *maxw)
|
|
|
|
*maxw = ep->typedata.swallow->swallow_params.max.w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxw = mxw;
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxw > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxw = TO_INT_ROUND(SCALE(sc, *maxw));
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxw < 1) *maxw = 1;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2013-04-07 20:24:44 -07:00
|
|
|
if ((ed->calc_only) && (desc->minmul.have) &&
|
2016-12-20 15:59:46 -08:00
|
|
|
(NEQ(desc->minmul.w, FROM_INT(1)))) *maxw = *minw;
|
2010-09-14 08:53:47 -07:00
|
|
|
if (*maxw >= 0)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxw < *minw) *maxw = *minw;
|
2010-09-14 08:53:47 -07:00
|
|
|
}
|
|
|
|
|
2015-12-07 19:15:48 -08:00
|
|
|
*minh = mnh;
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *minh = TO_INT_ROUND(SCALE(sc, *minh));
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
|
|
|
{
|
2015-10-19 11:12:23 -07:00
|
|
|
if (ep->typedata.swallow->swallow_params.min.h > *minh)
|
2012-09-11 06:14:51 -07:00
|
|
|
*minh = ep->typedata.swallow->swallow_params.min.h;
|
|
|
|
}
|
2010-09-14 08:53:47 -07:00
|
|
|
|
2013-04-07 20:24:44 -07:00
|
|
|
if (ed->calc_only)
|
2012-01-13 18:29:13 -08:00
|
|
|
{
|
|
|
|
if (desc->minmul.have)
|
|
|
|
{
|
|
|
|
FLOAT_T mmh = desc->minmul.h;
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(mmh, FROM_INT(1))) *minh = TO_INT(SCALE(mmh, *minh));
|
2012-01-13 18:29:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
2010-09-14 08:53:47 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
/* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
|
|
|
|
if ((ep->typedata.swallow->swallow_params.max.h <= 0) ||
|
|
|
|
(ep->typedata.swallow->swallow_params.max.h == EDJE_INF_MAX_H))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxh = mxh;
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxh > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxh < 1) *maxh = 1;
|
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
if (mxh <= 0)
|
2012-09-11 06:14:51 -07:00
|
|
|
*maxh = ep->typedata.swallow->swallow_params.max.h;
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxh = mxh;
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxh > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxh < 1) *maxh = 1;
|
|
|
|
}
|
|
|
|
if (ep->typedata.swallow->swallow_params.max.h < *maxh)
|
|
|
|
*maxh = ep->typedata.swallow->swallow_params.max.h;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-07 19:15:48 -08:00
|
|
|
*maxh = mxh;
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxh > 0)
|
|
|
|
{
|
2016-11-28 21:03:20 -08:00
|
|
|
if (ep->part->scale) *maxh = TO_INT_ROUND(SCALE(sc, *maxh));
|
2012-09-11 06:14:51 -07:00
|
|
|
if (*maxh < 1) *maxh = 1;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2013-04-07 20:24:44 -07:00
|
|
|
if ((ed->calc_only) && (desc->minmul.have) &&
|
2016-12-20 15:59:46 -08:00
|
|
|
(NEQ(desc->minmul.h, FROM_INT(1)))) *maxh = *minh;
|
2010-09-14 08:53:47 -07:00
|
|
|
if (*maxh >= 0)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (*maxh < *minh) *maxh = *minh;
|
2010-09-14 08:53:47 -07:00
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
}
|
2005-03-06 16:22:58 -08:00
|
|
|
|
2011-11-27 15:55:37 -08:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_map(Edje *ed,
|
2013-01-03 18:08:14 -08:00
|
|
|
Edje_Real_Part *ep EINA_UNUSED,
|
2011-11-27 15:55:37 -08:00
|
|
|
Edje_Real_Part *center,
|
|
|
|
Edje_Real_Part *light,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *persp,
|
2011-11-27 15:55:37 -08:00
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Part_Description_Common *chosen_desc,
|
|
|
|
Edje_Calc_Params *params)
|
|
|
|
{
|
|
|
|
params->mapped = chosen_desc->map.on;
|
|
|
|
params->lighted = params->mapped ? !!light : 0;
|
|
|
|
params->persp_on = params->mapped ? !!persp : 0;
|
|
|
|
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!params->mapped) return;
|
2011-11-27 15:55:37 -08:00
|
|
|
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_BEGIN(params, params_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
if (center)
|
|
|
|
{
|
|
|
|
params_write->center.x = ed->x + center->x + (center->w / 2);
|
|
|
|
params_write->center.y = ed->y + center->y + (center->h / 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params_write->center.x = ed->x + params->final.x + (params->final.w / 2);
|
|
|
|
params_write->center.y = ed->y + params->final.y + (params->final.h / 2);
|
|
|
|
}
|
|
|
|
params_write->center.z = 0;
|
|
|
|
|
|
|
|
params_write->rotation.x = desc->map.rot.x;
|
|
|
|
params_write->rotation.y = desc->map.rot.y;
|
|
|
|
params_write->rotation.z = desc->map.rot.z;
|
|
|
|
params_write->zoom.x = desc->map.zoom.x;
|
|
|
|
params_write->zoom.y = desc->map.zoom.y;
|
|
|
|
|
|
|
|
if (light)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Common *light_desc2;
|
|
|
|
FLOAT_T pos, pos2;
|
|
|
|
|
|
|
|
params_write->light.x = ed->x + light->x + (light->w / 2);
|
|
|
|
params_write->light.y = ed->y + light->y + (light->h / 2);
|
|
|
|
|
|
|
|
pos = light->description_pos;
|
|
|
|
pos2 = (pos < ZERO) ? ZERO : ((pos > FROM_INT(1)) ? FROM_INT(1) : pos);
|
|
|
|
|
|
|
|
light_desc2 = light->param2 ? light->param2->description : NULL;
|
|
|
|
|
|
|
|
/* take into account CURRENT state also */
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(pos, ZERO) && light_desc2)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
params_write->light.z = light->param1.description->persp.zplane +
|
|
|
|
TO_INT(SCALE(pos, light_desc2->persp.zplane - light->param1.description->persp.zplane));
|
|
|
|
params_write->light.r = light->param1.description->color.r +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color.r - light->param1.description->color.r));
|
|
|
|
params_write->light.g = light->param1.description->color.g +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color.g - light->param1.description->color.g));
|
|
|
|
params_write->light.b = light->param1.description->color.b +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color.b - light->param1.description->color.b));
|
|
|
|
params_write->light.ar = light->param1.description->color2.r +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color2.r - light->param1.description->color2.r));
|
|
|
|
params_write->light.ag = light->param1.description->color2.g +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color2.g - light->param1.description->color2.g));
|
|
|
|
params_write->light.ab = light->param1.description->color2.b +
|
|
|
|
TO_INT(SCALE(pos2, light_desc2->color2.b - light->param1.description->color2.b));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params_write->light.z = light->param1.description->persp.zplane;
|
|
|
|
params_write->light.r = light->param1.description->color.r;
|
|
|
|
params_write->light.g = light->param1.description->color.g;
|
|
|
|
params_write->light.b = light->param1.description->color.b;
|
|
|
|
params_write->light.ar = light->param1.description->color2.r;
|
|
|
|
params_write->light.ag = light->param1.description->color2.g;
|
|
|
|
params_write->light.ab = light->param1.description->color2.b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (persp)
|
|
|
|
{
|
|
|
|
FLOAT_T pos;
|
|
|
|
|
|
|
|
params_write->persp.x = ed->x + persp->x + (persp->w / 2);
|
|
|
|
params_write->persp.y = ed->y + persp->y + (persp->h / 2);
|
|
|
|
|
|
|
|
pos = persp->description_pos;
|
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(pos, ZERO) && persp->param2)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
params_write->persp.z = persp->param1.description->persp.zplane +
|
|
|
|
TO_INT(SCALE(pos, persp->param2->description->persp.zplane -
|
|
|
|
persp->param1.description->persp.zplane));
|
|
|
|
params_write->persp.focal = persp->param1.description->persp.focal +
|
|
|
|
TO_INT(SCALE(pos, persp->param2->description->persp.focal -
|
|
|
|
persp->param1.description->persp.focal));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params_write->persp.z = persp->param1.description->persp.zplane;
|
|
|
|
params_write->persp.focal = persp->param1.description->persp.focal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
params_write->colors = desc->map.colors;
|
|
|
|
params_write->colors_count = desc->map.colors_count;
|
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_END(params, params_write);
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
|
2015-06-29 01:51:42 -07:00
|
|
|
static int
|
|
|
|
_filter_bsearch_cmp(const void *a, const void *b)
|
|
|
|
{
|
|
|
|
const Edje_Gfx_Filter *filter = b;
|
|
|
|
const char *key = a;
|
|
|
|
|
|
|
|
return strcmp(key, filter->name);
|
|
|
|
}
|
|
|
|
|
2015-06-16 21:49:18 -07:00
|
|
|
static inline const char *
|
2015-06-29 00:47:00 -07:00
|
|
|
_edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter)
|
2015-06-16 21:49:18 -07:00
|
|
|
{
|
2015-06-17 00:26:30 -07:00
|
|
|
if (!filter->code) return NULL;
|
2015-06-16 21:49:18 -07:00
|
|
|
if (EINA_UNLIKELY(!filter->checked_data))
|
|
|
|
{
|
2015-06-29 01:51:42 -07:00
|
|
|
Edje_Gfx_Filter *found;
|
|
|
|
|
2015-06-29 00:47:00 -07:00
|
|
|
filter->checked_data = EINA_TRUE;
|
2015-06-29 01:51:42 -07:00
|
|
|
if (!ed->file->filter_dir)
|
|
|
|
return filter->code;
|
|
|
|
|
|
|
|
found = bsearch(filter->code, &(ed->file->filter_dir->filters[0]),
|
|
|
|
ed->file->filter_dir->filters_count,
|
|
|
|
sizeof(Edje_Gfx_Filter), _filter_bsearch_cmp);
|
|
|
|
if (found)
|
|
|
|
{
|
|
|
|
filter->name = found->name;
|
|
|
|
filter->code = found->script;
|
|
|
|
filter->no_free = EINA_TRUE;
|
|
|
|
return filter->code;
|
|
|
|
}
|
2015-06-16 21:49:18 -07:00
|
|
|
}
|
|
|
|
return filter->code;
|
|
|
|
}
|
|
|
|
|
2016-10-11 05:11:14 -07:00
|
|
|
static void
|
|
|
|
_edje_part_pixel_adjust(Edje *ed,
|
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Calc_Params *params)
|
|
|
|
{
|
|
|
|
/* Adjust rounding to not loose one pixels compared to float
|
|
|
|
information only when rendering to avoid infinite adjustement
|
|
|
|
when doing min restricted calc */
|
|
|
|
if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
|
|
|
|
{
|
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
|
|
|
params->final.w += 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ep->invalidate = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
|
|
|
|
{
|
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
|
|
|
params->final.w -= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ep->invalidate = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
|
|
|
|
{
|
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
|
|
|
params->final.h += 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ep->invalidate = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
|
|
|
|
{
|
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
|
|
|
params->final.h -= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ep->invalidate = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-16 21:49:18 -07:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single_filter(Edje *ed,
|
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Part_Description_Common *chosen_desc,
|
|
|
|
double pos)
|
|
|
|
{
|
2015-10-21 04:01:26 -07:00
|
|
|
Edje_Part_Description_Spec_Filter *filter, *prevfilter;
|
2015-06-16 21:49:18 -07:00
|
|
|
Eina_List *filter_sources = NULL, *prev_sources = NULL;
|
|
|
|
const char *src1, *src2, *part, *code;
|
|
|
|
Evas_Object *obj = ep->object;
|
|
|
|
Eina_List *li1, *li2;
|
|
|
|
|
2015-09-07 01:22:07 -07:00
|
|
|
/* handle TEXT, IMAGE, PROXY, SNAPSHOT part types here */
|
2015-06-16 21:49:18 -07:00
|
|
|
if (ep->part->type == EDJE_PART_TYPE_TEXT)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *chosen_edt = (Edje_Part_Description_Text *) chosen_desc;
|
|
|
|
Edje_Part_Description_Text *edt = (Edje_Part_Description_Text *) desc;
|
2015-08-18 05:05:51 -07:00
|
|
|
filter = &chosen_edt->filter;
|
|
|
|
prev_sources = edt->filter.sources;
|
|
|
|
filter_sources = chosen_edt->filter.sources;
|
2015-10-21 04:01:26 -07:00
|
|
|
prevfilter = &(edt->filter);
|
2015-06-16 21:49:18 -07:00
|
|
|
}
|
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *chosen_edi = (Edje_Part_Description_Image *) chosen_desc;
|
|
|
|
Edje_Part_Description_Image *edi = (Edje_Part_Description_Image *) desc;
|
2015-08-18 05:05:51 -07:00
|
|
|
filter = &chosen_edi->filter;
|
|
|
|
prev_sources = edi->filter.sources;
|
|
|
|
filter_sources = chosen_edi->filter.sources;
|
2015-10-21 04:01:26 -07:00
|
|
|
prevfilter = &(edi->filter);
|
2015-06-16 21:49:18 -07:00
|
|
|
}
|
2015-08-18 05:14:11 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_PROXY)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Proxy *chosen_edp = (Edje_Part_Description_Proxy *) chosen_desc;
|
|
|
|
Edje_Part_Description_Proxy *edp = (Edje_Part_Description_Proxy *) desc;
|
|
|
|
filter = &chosen_edp->filter;
|
|
|
|
prev_sources = edp->filter.sources;
|
|
|
|
filter_sources = chosen_edp->filter.sources;
|
2015-10-21 04:01:26 -07:00
|
|
|
prevfilter = &(edp->filter);
|
2015-08-18 05:14:11 -07:00
|
|
|
}
|
2015-09-07 01:22:07 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Snapshot *chosen_eds = (Edje_Part_Description_Snapshot *) chosen_desc;
|
|
|
|
Edje_Part_Description_Snapshot *eds = (Edje_Part_Description_Snapshot *) desc;
|
|
|
|
filter = &chosen_eds->filter;
|
|
|
|
prev_sources = eds->filter.sources;
|
|
|
|
filter_sources = chosen_eds->filter.sources;
|
2015-10-21 04:01:26 -07:00
|
|
|
prevfilter = &(eds->filter);
|
2015-09-07 01:22:07 -07:00
|
|
|
}
|
2015-06-16 21:49:18 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
CRI("Invalid call to filter recalc");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-21 04:01:26 -07:00
|
|
|
if ((!filter->code) && (!prevfilter->code)) return;
|
|
|
|
|
2015-06-16 21:49:18 -07:00
|
|
|
/* common code below */
|
2015-06-29 00:47:00 -07:00
|
|
|
code = _edje_filter_get(ed, filter);
|
2015-06-16 21:49:18 -07:00
|
|
|
if (!code)
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_program_set(obj, NULL, NULL);
|
2015-06-16 21:49:18 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-06-22 20:21:20 -07:00
|
|
|
if (!filter->sources_set)
|
|
|
|
{
|
|
|
|
filter->sources_set = 1;
|
|
|
|
prev_sources = NULL;
|
|
|
|
}
|
|
|
|
|
2016-02-29 01:41:28 -08:00
|
|
|
/* pass extra data items */
|
|
|
|
if (filter->data)
|
|
|
|
{
|
|
|
|
unsigned int k;
|
|
|
|
for (k = 0; k < filter->data_count; k++)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Spec_Filter_Data *data = &(filter->data[k]);
|
|
|
|
if (data->invalid_cc)
|
2016-03-01 06:47:40 -08:00
|
|
|
continue;
|
2016-02-29 01:41:28 -08:00
|
|
|
if (!data->value)
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_data_set(obj, data->name, NULL, EINA_FALSE);
|
2016-02-29 01:41:28 -08:00
|
|
|
}
|
|
|
|
else if (!strncmp(data->value, "color_class('", sizeof("color_class('") - 1))
|
|
|
|
{
|
|
|
|
/* special handling for color classes even tho they're not that great */
|
|
|
|
char *ccname, *buffer, *r;
|
|
|
|
Edje_Color_Class *cc;
|
|
|
|
|
|
|
|
ccname = strdup(data->value + sizeof("color_class('") - 1);
|
|
|
|
if (ccname)
|
|
|
|
{
|
|
|
|
r = strchr(ccname, '\'');
|
|
|
|
if (r && (r[1] == ')') && (r[2] == '\0'))
|
|
|
|
{
|
|
|
|
*r = '\0';
|
|
|
|
cc = _edje_color_class_find(ed, ccname);
|
|
|
|
if (cc)
|
|
|
|
{
|
|
|
|
static const char fmt[] =
|
2016-03-01 19:01:15 -08:00
|
|
|
"{r=%d,g=%d,b=%d,a=%d,"
|
2016-02-29 01:41:28 -08:00
|
|
|
"r2=%d,g2=%d,b2=%d,a2=%d,"
|
|
|
|
"r3=%d,g3=%d,b3=%d,a3=%d}";
|
|
|
|
int len = sizeof(fmt) + 20;
|
|
|
|
len += strlen(data->name);
|
|
|
|
buffer = alloca(len);
|
2016-03-01 19:01:15 -08:00
|
|
|
snprintf(buffer, len - 1, fmt,
|
2016-02-29 01:41:28 -08:00
|
|
|
(int) cc->r, (int) cc->g, (int) cc->b, (int) cc->a,
|
|
|
|
(int) cc->r2, (int) cc->g2, (int) cc->b2, (int) cc->a2,
|
|
|
|
(int) cc->r3, (int) cc->g3, (int) cc->b3, (int) cc->a3);
|
|
|
|
buffer[len - 1] = 0;
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_data_set(obj, data->name, buffer, EINA_TRUE);
|
2016-02-29 01:41:28 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unknown color class: %s", ccname);
|
|
|
|
data->invalid_cc = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to parse color class: %s", data->value);
|
|
|
|
data->invalid_cc = EINA_TRUE;
|
|
|
|
}
|
|
|
|
free(ccname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_data_set(obj, data->name, data->value, EINA_FALSE);
|
2016-02-29 01:41:28 -08:00
|
|
|
}
|
|
|
|
}
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_program_set(obj, code, filter->name);
|
2016-02-29 01:41:28 -08:00
|
|
|
if (prev_sources != filter_sources)
|
|
|
|
{
|
|
|
|
/* remove sources that are not there anymore
|
2016-03-01 06:47:40 -08:00
|
|
|
* this O(n^2) loop assumes a very small number of sources */
|
2016-02-29 01:41:28 -08:00
|
|
|
EINA_LIST_FOREACH(prev_sources, li1, src1)
|
|
|
|
{
|
|
|
|
Eina_Bool found = 0;
|
|
|
|
EINA_LIST_FOREACH(filter_sources, li2, src2)
|
|
|
|
{
|
|
|
|
if (!strcmp(src1, src2))
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
part = strchr(src1, ':');
|
|
|
|
if (!part)
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_source_set(obj, src1, NULL);
|
2016-02-29 01:41:28 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
char *name = strdup(src1);
|
2016-12-16 15:15:17 -08:00
|
|
|
if (!name) continue ;
|
2016-02-29 01:41:28 -08:00
|
|
|
name[part - src1] = 0;
|
2016-03-01 06:47:40 -08:00
|
|
|
efl_gfx_filter_source_set(obj, name, NULL);
|
2016-02-29 01:41:28 -08:00
|
|
|
free(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* add all sources by part name */
|
|
|
|
EINA_LIST_FOREACH(filter_sources, li1, src1)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
char *name = NULL;
|
|
|
|
if ((part = strchr(src1, ':')) != NULL)
|
|
|
|
{
|
|
|
|
name = strdup(src1);
|
2016-12-16 15:15:17 -08:00
|
|
|
if (!name) continue ;
|
2016-02-29 01:41:28 -08:00
|
|
|
name[part - src1] = 0;
|
|
|
|
part++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
part = src1;
|
|
|
|
rp = _edje_real_part_get(ed, part);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_source_set(obj, name ? name : part, rp ? rp->object : NULL);
|
2016-02-29 01:41:28 -08:00
|
|
|
free(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* pass edje state for transitions */
|
|
|
|
if (ep->param2)
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_state_set(obj, chosen_desc->state.name, chosen_desc->state.value,
|
2016-03-01 06:47:40 -08:00
|
|
|
ep->param2->description->state.name, ep->param2->description->state.value,
|
|
|
|
pos);
|
2016-02-29 01:41:28 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_filter_state_set(obj, chosen_desc->state.name, chosen_desc->state.value,
|
2016-03-01 06:47:40 -08:00
|
|
|
NULL, 0.0, pos);
|
2016-02-29 01:41:28 -08:00
|
|
|
}
|
2015-06-16 21:49:18 -07:00
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
static void
|
|
|
|
_edje_part_recalc_single(Edje *ed,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *ep,
|
|
|
|
Edje_Part_Description_Common *desc,
|
|
|
|
Edje_Part_Description_Common *chosen_desc,
|
2011-11-27 15:55:37 -08:00
|
|
|
Edje_Real_Part *center,
|
|
|
|
Edje_Real_Part *light,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *persp,
|
|
|
|
Edje_Real_Part *rel1_to_x,
|
|
|
|
Edje_Real_Part *rel1_to_y,
|
|
|
|
Edje_Real_Part *rel2_to_x,
|
|
|
|
Edje_Real_Part *rel2_to_y,
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
Edje_Real_Part *clip_to,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *confine_to,
|
2013-07-18 23:39:49 -07:00
|
|
|
Edje_Real_Part *threshold,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Calc_Params *params,
|
2013-06-03 01:17:33 -07:00
|
|
|
Evas_Coord mmw, Evas_Coord mmh,
|
2012-01-06 03:28:38 -08:00
|
|
|
FLOAT_T pos)
|
2009-08-12 07:13:17 -07:00
|
|
|
{
|
|
|
|
Edje_Color_Class *cc = NULL;
|
2010-09-15 07:15:23 -07:00
|
|
|
Edje_Internal_Aspect apref;
|
2009-08-12 07:13:17 -07:00
|
|
|
int minw = 0, minh = 0, maxw = 0, maxh = 0;
|
2016-03-17 11:12:34 -07:00
|
|
|
Eina_Bool fixedw = EINA_FALSE, fixedh = EINA_FALSE;
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T sc;
|
2009-08-12 07:13:17 -07:00
|
|
|
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_part_recalc_single_min_max(sc, ed, ep, desc, &minw, &minh, &maxw, &maxh);
|
2013-06-03 01:17:33 -07:00
|
|
|
if (minw < mmw) minw = mmw;
|
|
|
|
if (minh < mmh) minh = mmh;
|
2012-03-11 03:43:08 -07:00
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
/* relative coords of top left & bottom right */
|
2010-09-14 08:53:47 -07:00
|
|
|
_edje_part_recalc_single_rel(ed, ep, desc, rel1_to_x, rel1_to_y, rel2_to_x, rel2_to_y, params);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2009-12-09 07:44:54 -08:00
|
|
|
/* aspect */
|
2012-01-06 03:28:38 -08:00
|
|
|
apref = _edje_part_recalc_single_aspect(ed, ep, desc, params, &minw, &minh, &maxw, &maxh, pos);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
|
|
|
/* size step */
|
2010-09-14 08:53:47 -07:00
|
|
|
_edje_part_recalc_single_step(desc, params);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2016-03-17 11:12:34 -07:00
|
|
|
/* check whether this part has fixed value or not*/
|
|
|
|
if ((rel1_to_x == rel2_to_x) &&
|
2016-12-20 15:59:46 -08:00
|
|
|
(EQ(desc->rel1.relative_x, desc->rel2.relative_x)) &&
|
2016-03-17 11:12:34 -07:00
|
|
|
(!chosen_desc->fixed.w))
|
|
|
|
{
|
|
|
|
chosen_desc->fixed.w = 1;
|
|
|
|
fixedw = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((rel1_to_y == rel2_to_y) &&
|
2016-12-20 15:59:46 -08:00
|
|
|
(EQ(desc->rel1.relative_y, desc->rel2.relative_y)) &&
|
2016-03-17 11:12:34 -07:00
|
|
|
(!chosen_desc->fixed.h))
|
|
|
|
{
|
|
|
|
chosen_desc->fixed.h = 1;
|
|
|
|
fixedh = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (fixedw || fixedh)
|
2016-06-29 22:32:50 -07:00
|
|
|
{
|
|
|
|
INF("file %s, group %s has a non-fixed part '%s'. You should add "
|
|
|
|
"'fixed: %d %d'. But in order to optimize the edje calc, we "
|
|
|
|
"add it automatically.", ed->path, ed->group, ep->part->name,
|
|
|
|
fixedw, fixedh);
|
|
|
|
}
|
2016-03-17 11:12:34 -07:00
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
/* colors */
|
|
|
|
if (ep->part->type != EDJE_PART_TYPE_SPACER)
|
|
|
|
{
|
|
|
|
if ((desc->color_class) && (*desc->color_class))
|
2016-02-04 22:55:46 -08:00
|
|
|
cc = _edje_color_class_recursive_find(ed, desc->color_class);
|
2014-05-14 20:26:44 -07:00
|
|
|
|
|
|
|
if (cc)
|
|
|
|
{
|
|
|
|
params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
|
|
|
|
params->color.g = (((int)cc->g + 1) * desc->color.g) >> 8;
|
|
|
|
params->color.b = (((int)cc->b + 1) * desc->color.b) >> 8;
|
|
|
|
params->color.a = (((int)cc->a + 1) * desc->color.a) >> 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params->color.r = desc->color.r;
|
|
|
|
params->color.g = desc->color.g;
|
|
|
|
params->color.b = desc->color.b;
|
|
|
|
params->color.a = desc->color.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* visible */
|
|
|
|
params->visible = desc->visible;
|
|
|
|
|
2016-08-09 04:11:07 -07:00
|
|
|
/* no_render override */
|
|
|
|
if (EDJE_DESC_NO_RENDER_IS_SET(desc))
|
|
|
|
{
|
|
|
|
params->no_render = EDJE_DESC_NO_RENDER_VALUE(desc);
|
|
|
|
params->no_render_apply = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params->no_render = ep->part->no_render;
|
|
|
|
params->no_render_apply = 0;
|
|
|
|
}
|
|
|
|
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
/* clip override */
|
2016-08-14 06:30:32 -07:00
|
|
|
if (clip_to)
|
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(params);
|
|
|
|
params->ext->clip_to = clip_to;
|
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
/* set parameters, some are required for recalc_single_text[block] */
|
|
|
|
switch (ep->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part_Set *set;
|
|
|
|
Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)desc;
|
2014-05-14 20:26:44 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_real_part_image_set(ed, ep, &set, pos);
|
2014-10-18 04:56:30 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* border */
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_common(params);
|
|
|
|
params->type.common->spec.image.l = img_desc->image.border.l;
|
|
|
|
params->type.common->spec.image.r = img_desc->image.border.r;
|
2014-05-14 20:26:44 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.common->spec.image.t = img_desc->image.border.t;
|
|
|
|
params->type.common->spec.image.b = img_desc->image.border.b;
|
2014-05-14 20:26:44 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.common->spec.image.border_scale_by = img_desc->image.border.scale_by;
|
2014-05-14 20:26:44 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (set && set->set)
|
|
|
|
{
|
2014-05-14 20:26:44 -07:00
|
|
|
#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
|
2016-08-14 06:30:32 -07:00
|
|
|
SET_BORDER_DEFINED(params->type.common->spec.image.l, set->entry->border.l);
|
|
|
|
SET_BORDER_DEFINED(params->type.common->spec.image.r, set->entry->border.r);
|
|
|
|
SET_BORDER_DEFINED(params->type.common->spec.image.t, set->entry->border.t);
|
|
|
|
SET_BORDER_DEFINED(params->type.common->spec.image.b, set->entry->border.b);
|
2014-05-14 20:26:44 -07:00
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
params->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
|
|
|
|
set->entry->border.scale_by : params->type.common->spec.image.border_scale_by;
|
2014-05-14 20:26:44 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text *)desc;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_text(params);
|
2015-06-08 11:43:00 -07:00
|
|
|
/* text.align */
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.text->align.x = text_desc->text.align.x;
|
|
|
|
params->type.text->align.y = text_desc->text.align.y;
|
|
|
|
params->type.text->ellipsis = text_desc->text.ellipsis;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
/* text colors */
|
|
|
|
if (cc)
|
2014-05-14 20:26:44 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.text->color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8;
|
|
|
|
params->type.text->color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8;
|
|
|
|
params->type.text->color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8;
|
|
|
|
params->type.text->color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8;
|
|
|
|
params->type.text->color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8;
|
|
|
|
params->type.text->color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8;
|
|
|
|
params->type.text->color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8;
|
|
|
|
params->type.text->color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8;
|
2014-05-14 20:26:44 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
else
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
params->type.text->color2.r = text_desc->common.color2.r;
|
|
|
|
params->type.text->color2.g = text_desc->common.color2.g;
|
|
|
|
params->type.text->color2.b = text_desc->common.color2.b;
|
|
|
|
params->type.text->color2.a = text_desc->common.color2.a;
|
|
|
|
params->type.text->color3.r = text_desc->text.color3.r;
|
|
|
|
params->type.text->color3.g = text_desc->text.color3.g;
|
|
|
|
params->type.text->color3.b = text_desc->text.color3.b;
|
|
|
|
params->type.text->color3.a = text_desc->text.color3.a;
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2015-09-07 01:22:07 -07:00
|
|
|
case EDJE_PART_TYPE_SNAPSHOT:
|
2016-06-08 11:26:07 -07:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2016-02-17 14:48:33 -08:00
|
|
|
case EDJE_PART_TYPE_LIGHT:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Light *light_desc = (Edje_Part_Description_Light *)desc;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(params);
|
|
|
|
params->type.node->data[0] = light_desc->light.orientation.data[0];
|
|
|
|
params->type.node->point.x = light_desc->light.position.point.x;
|
|
|
|
params->type.node->point.y = light_desc->light.position.point.y;
|
|
|
|
params->type.node->point.z = light_desc->light.position.point.z;
|
2016-02-17 14:48:33 -08:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_CAMERA:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Camera *camera_desc = (Edje_Part_Description_Camera *)desc;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(params);
|
|
|
|
params->type.node->data[0] = camera_desc->camera.orientation.data[0];
|
|
|
|
params->type.node->point.x = camera_desc->camera.position.point.x;
|
|
|
|
params->type.node->point.y = camera_desc->camera.position.point.y;
|
|
|
|
params->type.node->point.z = camera_desc->camera.position.point.z;
|
2016-02-17 14:48:33 -08:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case EDJE_PART_TYPE_MESH_NODE:
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Mesh_Node *mesh_desc = (Edje_Part_Description_Mesh_Node *)desc;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(params);
|
|
|
|
params->type.node->frame = mesh_desc->mesh_node.mesh.frame;
|
|
|
|
params->type.node->data[0] = mesh_desc->mesh_node.orientation.data[0];
|
|
|
|
params->type.node->point.x = mesh_desc->mesh_node.position.point.x;
|
|
|
|
params->type.node->point.y = mesh_desc->mesh_node.position.point.y;
|
|
|
|
params->type.node->point.z = mesh_desc->mesh_node.position.point.z;
|
|
|
|
params->type.node->scale_3d.x = mesh_desc->mesh_node.scale_3d.x;
|
|
|
|
params->type.node->scale_3d.y = mesh_desc->mesh_node.scale_3d.y;
|
|
|
|
params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z;
|
2016-02-17 14:48:33 -08:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
|
|
|
|
break;
|
|
|
|
|
2014-05-14 20:26:44 -07:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2014-05-14 20:26:44 -07:00
|
|
|
}
|
|
|
|
|
2009-08-12 07:13:17 -07:00
|
|
|
/* if we have text that wants to make the min size the text size... */
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
2009-08-12 07:13:17 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_TEXT)
|
2015-06-16 21:49:18 -07:00
|
|
|
{
|
2015-06-17 00:26:30 -07:00
|
|
|
_edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
2015-06-16 21:49:18 -07:00
|
|
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2011-06-04 08:58:02 -07:00
|
|
|
if ((ep->part->type == EDJE_PART_TYPE_TABLE) &&
|
2012-08-14 00:59:06 -07:00
|
|
|
(((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) ||
|
2011-06-04 08:58:02 -07:00
|
|
|
(((Edje_Part_Description_Table *)chosen_desc)->table.min.v))))
|
|
|
|
{
|
|
|
|
Evas_Coord lminw = 0, lminh = 0;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
|
|
|
efl_canvas_group_calculate(ep->object);
|
2016-06-08 22:31:37 -07:00
|
|
|
efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh);
|
2011-06-04 08:58:02 -07:00
|
|
|
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h)
|
|
|
|
{
|
|
|
|
if (lminw > minw) minw = lminw;
|
|
|
|
}
|
|
|
|
if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)
|
|
|
|
{
|
|
|
|
if (lminh > minh) minh = lminh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((ep->part->type == EDJE_PART_TYPE_BOX) &&
|
2012-08-14 00:59:06 -07:00
|
|
|
((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) ||
|
|
|
|
(((Edje_Part_Description_Box *)chosen_desc)->box.min.v)))
|
2011-06-04 08:58:02 -07:00
|
|
|
{
|
|
|
|
Evas_Coord lminw = 0, lminh = 0;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(ep->object, 1);
|
|
|
|
efl_canvas_group_calculate(ep->object);
|
2016-06-08 22:31:37 -07:00
|
|
|
efl_gfx_size_hint_restricted_min_get(ep->object, &lminw, &lminh);
|
2011-06-04 08:58:02 -07:00
|
|
|
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h)
|
|
|
|
{
|
|
|
|
if (lminw > minw) minw = lminw;
|
|
|
|
}
|
|
|
|
if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)
|
|
|
|
{
|
|
|
|
if (lminh > minh) minh = lminh;
|
|
|
|
}
|
|
|
|
}
|
2015-08-18 05:35:55 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
2012-01-26 10:24:00 -08:00
|
|
|
{
|
2015-08-18 05:35:55 -07:00
|
|
|
if (chosen_desc->min.limit || chosen_desc->max.limit)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2012-01-26 10:24:00 -08:00
|
|
|
|
2015-08-18 05:35:55 -07:00
|
|
|
/* We only need pos to find the right image that would be displayed */
|
|
|
|
/* Yes, if someone set aspect preference to SOURCE and also max,min
|
2012-01-26 10:24:00 -08:00
|
|
|
to SOURCE, it will be under efficient, but who cares at the
|
|
|
|
moment. */
|
2015-08-18 05:35:55 -07:00
|
|
|
_edje_real_part_image_set(ed, ep, NULL, pos);
|
|
|
|
evas_object_image_size_get(ep->object, &w, &h);
|
2012-01-26 10:24:00 -08:00
|
|
|
|
2015-08-18 05:35:55 -07:00
|
|
|
if (chosen_desc->min.limit)
|
|
|
|
{
|
|
|
|
if (w > minw) minw = w;
|
|
|
|
if (h > minh) minh = h;
|
|
|
|
}
|
|
|
|
if (chosen_desc->max.limit)
|
|
|
|
{
|
|
|
|
if ((maxw <= 0) || (w < maxw)) maxw = w;
|
|
|
|
if ((maxh <= 0) || (h < maxh)) maxh = h;
|
|
|
|
}
|
2012-01-26 10:24:00 -08:00
|
|
|
}
|
2015-06-16 21:49:18 -07:00
|
|
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
2012-01-26 10:24:00 -08:00
|
|
|
}
|
2015-08-18 05:14:11 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_PROXY)
|
|
|
|
{
|
|
|
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
|
|
|
}
|
2015-09-07 01:22:07 -07:00
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_SNAPSHOT)
|
|
|
|
{
|
|
|
|
_edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
|
|
|
|
}
|
2009-08-12 07:13:17 -07:00
|
|
|
|
|
|
|
/* remember what our size is BEFORE we go limit it */
|
2013-07-18 00:18:19 -07:00
|
|
|
params->req.x = TO_INT(params->eval.x);
|
|
|
|
params->req.y = TO_INT(params->eval.y);
|
|
|
|
params->req.w = TO_INT(params->eval.w);
|
|
|
|
params->req.h = TO_INT(params->eval.h);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
|
|
|
/* adjust for min size */
|
2010-09-15 07:15:23 -07:00
|
|
|
_edje_part_recalc_single_min(desc, params, minw, minh, apref);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
|
|
|
/* adjust for max size */
|
2010-09-15 07:15:23 -07:00
|
|
|
_edje_part_recalc_single_max(desc, params, maxw, maxh, apref);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
|
|
|
/* take care of dragable part */
|
|
|
|
if (ep->drag)
|
2013-07-18 23:39:49 -07:00
|
|
|
_edje_part_recalc_single_drag(ep, confine_to, threshold, params, minw, minh, maxw, maxh);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2013-07-23 23:46:20 -07:00
|
|
|
/* Update final size after last change to its position */
|
|
|
|
params->final.x = TO_INT(params->eval.x);
|
|
|
|
params->final.y = TO_INT(params->eval.y);
|
|
|
|
params->final.w = TO_INT(params->eval.w);
|
|
|
|
params->final.h = TO_INT(params->eval.h);
|
|
|
|
|
2016-10-11 05:11:14 -07:00
|
|
|
_edje_part_pixel_adjust(ed, ep, params);
|
2009-08-12 07:13:17 -07:00
|
|
|
/* fill */
|
2010-07-13 08:47:19 -07:00
|
|
|
if (ep->part->type == EDJE_PART_TYPE_IMAGE)
|
2011-03-11 09:46:29 -08:00
|
|
|
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params);
|
|
|
|
else if (ep->part->type == EDJE_PART_TYPE_PROXY)
|
|
|
|
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Proxy *)desc)->proxy.fill, params);
|
2009-08-12 07:13:17 -07:00
|
|
|
|
2012-12-03 08:36:32 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2013-03-12 22:30:21 -07:00
|
|
|
if (ep->part->physics_body || ep->body)
|
|
|
|
{
|
|
|
|
EINA_COW_CALC_PHYSICS_BEGIN(params, params_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
params_write->mass = desc->physics.mass;
|
|
|
|
params_write->restitution = desc->physics.restitution;
|
|
|
|
params_write->friction = desc->physics.friction;
|
|
|
|
params_write->damping.linear = desc->physics.damping.linear;
|
|
|
|
params_write->damping.angular = desc->physics.damping.angular;
|
|
|
|
params_write->sleep.linear = desc->physics.sleep.linear;
|
|
|
|
params_write->sleep.angular = desc->physics.sleep.angular;
|
|
|
|
params_write->material = desc->physics.material;
|
|
|
|
params_write->density = desc->physics.density;
|
|
|
|
params_write->hardness = desc->physics.hardness;
|
|
|
|
params_write->ignore_part_pos = desc->physics.ignore_part_pos;
|
|
|
|
params_write->light_on = desc->physics.light_on;
|
|
|
|
params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x;
|
|
|
|
params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y;
|
|
|
|
params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z;
|
|
|
|
params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x;
|
|
|
|
params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y;
|
|
|
|
params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z;
|
|
|
|
params_write->backcull = desc->physics.backcull;
|
|
|
|
params_write->z = desc->physics.z;
|
|
|
|
params_write->depth = desc->physics.depth;
|
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_PHYSICS_END(params, params_write);
|
|
|
|
}
|
2012-12-03 08:36:32 -08:00
|
|
|
#endif
|
2011-11-27 15:55:37 -08:00
|
|
|
_edje_part_recalc_single_map(ed, ep, center, light, persp, desc, chosen_desc, params);
|
2008-02-21 10:35:27 -08:00
|
|
|
}
|
|
|
|
|
2008-12-17 18:43:20 -08:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_table_recalc_apply(Edje *ed EINA_UNUSED,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Real_Part *ep,
|
2013-01-03 18:08:14 -08:00
|
|
|
Edje_Calc_Params *p3 EINA_UNUSED,
|
2012-08-14 00:59:06 -07:00
|
|
|
Edje_Part_Description_Table *chosen_desc)
|
2008-12-17 18:43:20 -08:00
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_obj_table_homogeneous_set(ep->object, chosen_desc->table.homogeneous);
|
|
|
|
evas_obj_table_align_set(ep->object, TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y));
|
|
|
|
evas_obj_table_padding_set(ep->object, chosen_desc->table.padding.x, chosen_desc->table.padding.y);
|
2009-04-26 19:36:56 -07:00
|
|
|
if (evas_object_smart_need_recalculate_get(ep->object))
|
|
|
|
{
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(ep->object, 0);
|
|
|
|
efl_canvas_group_calculate(ep->object);
|
2009-04-26 19:36:56 -07:00
|
|
|
}
|
2008-12-17 18:43:20 -08:00
|
|
|
}
|
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
static void
|
|
|
|
_edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Proxy *chosen_desc, FLOAT_T pos)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *pp;
|
2011-08-20 00:27:52 -07:00
|
|
|
int part_id = -1;
|
2011-03-11 09:46:29 -08:00
|
|
|
|
2013-05-09 03:27:50 -07:00
|
|
|
if (ep->param2 && (pos >= FROM_DOUBLE(0.5)))
|
2015-06-08 11:43:00 -07:00
|
|
|
part_id = ((Edje_Part_Description_Proxy *)ep->param2->description)->proxy.id;
|
2011-08-20 00:27:52 -07:00
|
|
|
else
|
2012-08-14 00:59:06 -07:00
|
|
|
part_id = chosen_desc->proxy.id;
|
2011-08-20 00:27:52 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
if ((p3->type.common->fill.w == 0) || (p3->type.common->fill.h == 0) ||
|
2011-08-20 00:27:52 -07:00
|
|
|
(part_id < 0))
|
2011-03-11 09:46:29 -08:00
|
|
|
{
|
|
|
|
evas_object_image_source_set(ep->object, NULL);
|
2011-08-20 06:03:01 -07:00
|
|
|
return;
|
2011-03-11 09:46:29 -08:00
|
|
|
}
|
|
|
|
pp = ed->table_parts[part_id % ed->table_parts_size];
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2012-09-04 04:27:43 -07:00
|
|
|
if (pp->nested_smart) /* using nested_smart for nested parts */
|
2011-03-11 09:46:29 -08:00
|
|
|
{
|
2012-09-04 04:27:43 -07:00
|
|
|
evas_object_image_source_set(ep->object, pp->nested_smart);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (pp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2015-09-07 01:22:07 -07:00
|
|
|
case EDJE_PART_TYPE_SNAPSHOT:
|
2016-06-08 11:26:07 -07:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_image_source_set(ep->object, pp->object);
|
|
|
|
break;
|
|
|
|
|
2012-09-04 04:27:43 -07:00
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */
|
|
|
|
break;
|
|
|
|
|
2012-09-04 04:27:43 -07:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((pp->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(pp->typedata.swallow))
|
|
|
|
{
|
|
|
|
evas_object_image_source_set(ep->object, pp->typedata.swallow->swallowed_object);
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-09-04 04:27:43 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* FIXME: detect that at compile time and prevent it */
|
|
|
|
break;
|
2012-09-04 04:27:43 -07:00
|
|
|
}
|
2011-03-11 09:46:29 -08:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
efl_gfx_fill_set(ep->object, (Eina_Rect) p3->type.common->fill);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_image_smooth_scale_set(ep->object, p3->smooth);
|
2016-03-14 03:38:44 -07:00
|
|
|
evas_object_image_source_visible_set(ep->object, chosen_desc->proxy.source_visible);
|
2016-03-23 18:34:52 -07:00
|
|
|
evas_object_image_source_clip_set(ep->object, chosen_desc->proxy.source_clip);
|
2011-03-11 09:46:29 -08:00
|
|
|
}
|
|
|
|
|
2008-02-21 10:35:27 -08:00
|
|
|
static void
|
2010-07-29 05:02:36 -07:00
|
|
|
_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Image *chosen_desc, FLOAT_T pos)
|
2008-02-21 10:35:27 -08:00
|
|
|
{
|
2010-02-20 22:53:44 -08:00
|
|
|
FLOAT_T sc;
|
2014-10-27 23:50:38 -07:00
|
|
|
Edje_Real_Part_Set *set;
|
2008-02-21 10:35:27 -08:00
|
|
|
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(ed->scale, ed->file->base_scale);
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, ed->file->base_scale);
|
2014-10-27 23:50:38 -07:00
|
|
|
|
|
|
|
_edje_real_part_image_set(ed, ep, &set, pos);
|
2014-11-10 04:00:02 -08:00
|
|
|
|
|
|
|
/* border */
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_common(p3);
|
|
|
|
p3->type.common->spec.image.l = chosen_desc->image.border.l;
|
|
|
|
p3->type.common->spec.image.r = chosen_desc->image.border.r;
|
2014-11-10 04:00:02 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.common->spec.image.t = chosen_desc->image.border.t;
|
|
|
|
p3->type.common->spec.image.b = chosen_desc->image.border.b;
|
2014-11-10 04:00:02 -08:00
|
|
|
|
2017-01-25 05:30:13 -08:00
|
|
|
// XXX: do NOT do this. you can use border scale by to animate transitions
|
|
|
|
// p3->type.common->spec.image.border_scale_by = chosen_desc->image.border.scale_by;
|
2014-11-10 04:00:02 -08:00
|
|
|
|
2014-10-27 23:50:38 -07:00
|
|
|
if (set && set->set)
|
|
|
|
{
|
|
|
|
#define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result;
|
2016-08-14 06:30:32 -07:00
|
|
|
SET_BORDER_DEFINED(p3->type.common->spec.image.l, set->entry->border.l);
|
|
|
|
SET_BORDER_DEFINED(p3->type.common->spec.image.r, set->entry->border.r);
|
|
|
|
SET_BORDER_DEFINED(p3->type.common->spec.image.t, set->entry->border.t);
|
|
|
|
SET_BORDER_DEFINED(p3->type.common->spec.image.b, set->entry->border.b);
|
2014-10-27 23:50:38 -07:00
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->type.common->spec.image.border_scale_by = NEQ(set->entry->border.scale_by, ZERO) ?
|
|
|
|
set->entry->border.scale_by : p3->type.common->spec.image.border_scale_by;
|
2014-10-27 23:50:38 -07:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
efl_gfx_fill_set(ep->object, (Eina_Rect) p3->type.common->fill);
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_image_smooth_scale_set(ep->object, p3->smooth);
|
2010-07-16 07:13:38 -07:00
|
|
|
if (chosen_desc->image.border.scale)
|
2011-10-09 22:53:02 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
if (p3->type.common->spec.image.border_scale_by > FROM_DOUBLE(0.0))
|
2011-10-09 22:53:02 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
FLOAT_T sc2 = MUL(sc, p3->type.common->spec.image.border_scale_by);
|
2011-10-09 22:53:02 -07:00
|
|
|
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc2));
|
|
|
|
}
|
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc));
|
2011-10-09 22:53:02 -07:00
|
|
|
}
|
2010-02-23 21:47:23 -08:00
|
|
|
else
|
2011-10-10 00:58:14 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
if (p3->type.common->spec.image.border_scale_by > FROM_DOUBLE(0.0))
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_image_border_scale_set
|
2016-08-14 06:30:32 -07:00
|
|
|
(ep->object, TO_DOUBLE(p3->type.common->spec.image.border_scale_by));
|
2011-10-10 00:58:14 -07:00
|
|
|
else
|
2012-08-14 00:59:06 -07:00
|
|
|
evas_object_image_border_scale_set(ep->object, 1.0);
|
2011-10-10 00:58:14 -07:00
|
|
|
}
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_object_image_border_set(ep->object, p3->type.common->spec.image.l, p3->type.common->spec.image.r,
|
|
|
|
p3->type.common->spec.image.t, p3->type.common->spec.image.b);
|
2010-07-16 07:13:38 -07:00
|
|
|
if (chosen_desc->image.border.no_fill == 0)
|
2009-02-12 05:39:15 -08:00
|
|
|
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_DEFAULT);
|
2010-07-16 07:13:38 -07:00
|
|
|
else if (chosen_desc->image.border.no_fill == 1)
|
2009-02-12 05:39:15 -08:00
|
|
|
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_NONE);
|
2010-07-16 07:13:38 -07:00
|
|
|
else if (chosen_desc->image.border.no_fill == 2)
|
2009-02-12 05:39:15 -08:00
|
|
|
evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_SOLID);
|
2008-02-21 10:35:27 -08:00
|
|
|
}
|
|
|
|
|
2016-06-08 11:26:07 -07:00
|
|
|
static void
|
|
|
|
_edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_UNUSED, Edje_Part_Description_Vector *chosen_desc, FLOAT_T pos)
|
|
|
|
{
|
|
|
|
int w, h;
|
2016-08-03 17:34:50 -07:00
|
|
|
int new_svg = -1;
|
2016-06-08 21:49:56 -07:00
|
|
|
Efl_VG *root_vg;
|
|
|
|
Eina_Matrix3 matrix;
|
|
|
|
Edje_Vector_Data *start, *end;
|
2016-06-08 11:26:07 -07:00
|
|
|
|
|
|
|
evas_object_geometry_get(ep->object, NULL, NULL, &w, &h);
|
|
|
|
|
|
|
|
if( (w == 0) || (h == 0)) return;
|
|
|
|
|
|
|
|
root_vg = evas_object_vg_root_node_get(ep->object);
|
|
|
|
|
|
|
|
if (ep->param2)
|
|
|
|
{
|
|
|
|
Edje_Part_Description_Vector *next_state = (Edje_Part_Description_Vector *)ep->param2->description;
|
|
|
|
if (chosen_desc->vg.id != next_state->vg.id)
|
|
|
|
{
|
|
|
|
new_svg = next_state->vg.id;
|
|
|
|
}
|
|
|
|
}
|
2016-08-03 17:34:50 -07:00
|
|
|
if (new_svg >= 0) // animation with svg id change
|
2016-06-08 11:26:07 -07:00
|
|
|
{
|
2016-06-08 21:49:56 -07:00
|
|
|
start = _edje_ref_vector_data(ed, chosen_desc->vg.id);
|
|
|
|
end = _edje_ref_vector_data(ed, new_svg);
|
|
|
|
|
|
|
|
// for start vector
|
2016-07-25 22:31:44 -07:00
|
|
|
_apply_transformation(start->vg, w, h, start);
|
2016-06-08 21:49:56 -07:00
|
|
|
|
|
|
|
// for end vector
|
2016-07-25 22:31:44 -07:00
|
|
|
_apply_transformation(end->vg, w, h, end);
|
2016-06-08 21:49:56 -07:00
|
|
|
|
2016-06-08 11:26:07 -07:00
|
|
|
// do the interpolation
|
2016-06-08 21:49:56 -07:00
|
|
|
if (!evas_vg_node_interpolate(ep->typedata.vector->cur.vg, start->vg, end->vg, pos))
|
2016-06-08 11:26:07 -07:00
|
|
|
{
|
2016-06-08 21:49:56 -07:00
|
|
|
ERR(" Can't interpolate check the svg file \n");
|
2016-06-08 11:26:07 -07:00
|
|
|
}
|
2016-06-08 21:49:56 -07:00
|
|
|
// performance hack
|
|
|
|
// instead of duplicating the tree and applying the transformation
|
|
|
|
// i just updated the transformation matrix and reset it back to null.
|
|
|
|
// assumption is that the root vg will never have a transformation
|
|
|
|
eina_matrix3_identity(&matrix);
|
|
|
|
evas_vg_node_transformation_set(start->vg, &matrix);
|
|
|
|
evas_vg_node_transformation_set(end->vg, &matrix);
|
2016-06-08 11:26:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ep->typedata.vector->cur.svg_id == chosen_desc->vg.id) // no svg file change
|
|
|
|
{
|
2016-07-25 22:31:44 -07:00
|
|
|
_apply_transformation(ep->typedata.vector->cur.vg, w, h, &ep->typedata.vector->cur);
|
2016-06-08 11:26:07 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-08 21:49:56 -07:00
|
|
|
if (ep->typedata.vector->cur.vg)
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_del(ep->typedata.vector->cur.vg);
|
2016-06-08 21:49:56 -07:00
|
|
|
|
|
|
|
_edje_dupe_vector_data(ed, chosen_desc->vg.id, w, h, &ep->typedata.vector->cur);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_parent_set(ep->typedata.vector->cur.vg, root_vg);
|
2016-06-08 11:26:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-27 15:55:37 -08:00
|
|
|
static Edje_Real_Part *
|
|
|
|
_edje_real_part_state_get(Edje *ed, Edje_Real_Part *ep, int flags, int id, int *state)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *result = NULL;
|
|
|
|
|
|
|
|
if (id >= 0 && id != ep->part->id)
|
|
|
|
{
|
|
|
|
result = ed->table_parts[id % ed->table_parts_size];
|
|
|
|
if (result)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
if (!result->calculated) _edje_part_recalc(ed, result, flags, NULL);
|
2011-11-27 15:55:37 -08:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
if (state) *state = result->state;
|
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)state;
|
2011-11-27 15:55:37 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2008-02-21 10:35:27 -08:00
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_physics_world_geometry_check(EPhysics_World *world)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h, d;
|
2016-08-01 03:04:42 -07:00
|
|
|
if (!EPH_LOAD()) return EINA_FALSE;
|
|
|
|
EPH_CALL(ephysics_world_render_geometry_get)(world, NULL, NULL, NULL, &w, &h, &d);
|
2015-06-08 11:43:00 -07:00
|
|
|
return w && h && d;
|
2012-12-05 11:29:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-07 20:24:44 -07:00
|
|
|
_edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *pf,
|
2015-06-08 11:43:00 -07:00
|
|
|
Eina_Bool pos_update)
|
2012-12-05 11:29:33 -08:00
|
|
|
{
|
2016-08-01 03:04:42 -07:00
|
|
|
if (!EPH_LOAD()) return;
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(pf);
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_linear_movement_enable_set)
|
|
|
|
(ep->body,
|
2016-08-14 06:30:32 -07:00
|
|
|
pf->ext->physics->mov_freedom.lin.x,
|
|
|
|
pf->ext->physics->mov_freedom.lin.y,
|
|
|
|
pf->ext->physics->mov_freedom.lin.z);
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_angular_movement_enable_set)
|
|
|
|
(ep->body,
|
2016-08-14 06:30:32 -07:00
|
|
|
pf->ext->physics->mov_freedom.ang.x,
|
|
|
|
pf->ext->physics->mov_freedom.ang.y,
|
|
|
|
pf->ext->physics->mov_freedom.ang.z);
|
2012-12-11 10:52:35 -08:00
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
/* Boundaries geometry and mass shouldn't be changed */
|
|
|
|
if (ep->part->physics_body < EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP)
|
|
|
|
{
|
2012-12-11 10:52:35 -08:00
|
|
|
Evas_Coord x, y, z, w, h, d;
|
|
|
|
|
2012-12-05 11:29:54 -08:00
|
|
|
if (pos_update)
|
|
|
|
{
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_move)
|
|
|
|
(ep->body,
|
|
|
|
ed->x + pf->final.x,
|
|
|
|
ed->y + pf->final.y,
|
2016-08-14 06:30:32 -07:00
|
|
|
pf->ext->physics->z);
|
2013-07-18 00:18:19 -07:00
|
|
|
ep->x = pf->final.x;
|
|
|
|
ep->y = pf->final.y;
|
|
|
|
ep->w = pf->final.w;
|
|
|
|
ep->h = pf->final.h;
|
2012-12-05 11:29:54 -08:00
|
|
|
}
|
2012-12-10 03:47:22 -08:00
|
|
|
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_geometry_get)(ep->body, &x, &y, &z, &w, &h, &d);
|
2016-08-14 06:30:32 -07:00
|
|
|
if ((d) && (d != pf->ext->physics->depth))
|
|
|
|
EPH_CALL(ephysics_body_resize)(ep->body, w, h, pf->ext->physics->depth);
|
|
|
|
if (z != pf->ext->physics->z)
|
|
|
|
EPH_CALL(ephysics_body_move)(ep->body, x, y, pf->ext->physics->z);
|
2012-12-11 10:52:35 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
EPH_CALL(ephysics_body_material_set)(ep->body, pf->ext->physics->material);
|
|
|
|
if (!pf->ext->physics->material)
|
2012-12-10 03:47:22 -08:00
|
|
|
{
|
2016-12-20 15:59:46 -08:00
|
|
|
if (NEQ(pf->ext->physics->density, ZERO))
|
2016-08-14 06:30:32 -07:00
|
|
|
EPH_CALL(ephysics_body_density_set)(ep->body, pf->ext->physics->density);
|
2012-12-10 03:47:22 -08:00
|
|
|
else
|
2016-08-14 06:30:32 -07:00
|
|
|
EPH_CALL(ephysics_body_mass_set)(ep->body, pf->ext->physics->mass);
|
2012-12-10 03:47:22 -08:00
|
|
|
}
|
2012-12-10 06:19:03 -08:00
|
|
|
|
|
|
|
if ((ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_BOX) ||
|
2012-12-11 13:30:38 -08:00
|
|
|
(ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_SPHERE) ||
|
|
|
|
(ep->part->physics_body == EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER) ||
|
2012-12-10 06:19:03 -08:00
|
|
|
(ep->part->physics_body == EDJE_PART_PHYSICS_BODY_CLOTH))
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_soft_body_hardness_set)
|
2016-08-14 06:30:32 -07:00
|
|
|
(ep->body, pf->ext->physics->hardness * 100);
|
2012-12-10 03:47:22 -08:00
|
|
|
}
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
if (!pf->ext->physics->material)
|
2012-12-10 03:47:22 -08:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
EPH_CALL(ephysics_body_restitution_set)(ep->body, pf->ext->physics->restitution);
|
|
|
|
EPH_CALL(ephysics_body_friction_set)(ep->body, pf->ext->physics->friction);
|
2012-12-05 11:29:33 -08:00
|
|
|
}
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
EPH_CALL(ephysics_body_damping_set)(ep->body, pf->ext->physics->damping.linear,
|
|
|
|
pf->ext->physics->damping.angular);
|
|
|
|
EPH_CALL(ephysics_body_sleeping_threshold_set)(ep->body, pf->ext->physics->sleep.linear,
|
|
|
|
pf->ext->physics->sleep.angular);
|
|
|
|
EPH_CALL(ephysics_body_light_set)(ep->body, pf->ext->physics->light_on);
|
|
|
|
EPH_CALL(ephysics_body_back_face_culling_set)(ep->body, pf->ext->physics->backcull);
|
2012-12-05 11:29:33 -08:00
|
|
|
}
|
|
|
|
|
2012-12-05 11:30:00 -08:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_physics_body_update_cb(void *data, EPhysics_Body *body, void *event_info EINA_UNUSED)
|
2012-12-05 11:30:00 -08:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = data;
|
2016-08-01 03:04:42 -07:00
|
|
|
Edje *ed;
|
2013-04-06 10:18:48 -07:00
|
|
|
|
2016-08-01 03:04:42 -07:00
|
|
|
if (!EPH_LOAD()) return;
|
|
|
|
ed = EPH_CALL(ephysics_body_data_get(body));
|
|
|
|
EPH_CALL(ephysics_body_geometry_get)(body, &(rp->x), &(rp->y), NULL,
|
|
|
|
&(rp->w), &(rp->h), NULL);
|
|
|
|
EPH_CALL(ephysics_body_evas_object_update)(body);
|
2013-04-07 20:24:44 -07:00
|
|
|
ed->dirty = EINA_TRUE;
|
2012-12-05 11:30:00 -08:00
|
|
|
}
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
static void
|
2013-04-07 20:24:44 -07:00
|
|
|
_edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
|
2012-12-05 11:29:33 -08:00
|
|
|
{
|
|
|
|
Eina_Bool resize = EINA_TRUE;
|
2012-12-11 06:09:03 -08:00
|
|
|
Edje_Physics_Face *pface;
|
|
|
|
Eina_List *l;
|
2012-12-05 11:29:33 -08:00
|
|
|
|
2016-08-01 03:04:42 -07:00
|
|
|
if (!EPH_LOAD()) return;
|
2012-12-05 11:29:33 -08:00
|
|
|
switch (rp->part->physics_body)
|
|
|
|
{
|
|
|
|
case EDJE_PART_PHYSICS_BODY_RIGID_BOX:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_box_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-11 13:30:38 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_RIGID_SPHERE:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_sphere_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-11 13:30:38 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_cylinder_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_SOFT_BOX:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_soft_box_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-11 13:30:38 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_SOFT_SPHERE:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_soft_sphere_add)(world, 0);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-11 13:30:38 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_soft_cylinder_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_CLOTH:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_cloth_add)(world, 0, 0);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_top_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_bottom_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_RIGHT:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_right_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_LEFT:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_left_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_FRONT:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_front_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
case EDJE_PART_PHYSICS_BODY_BOUNDARY_BACK:
|
2016-08-01 03:04:42 -07:00
|
|
|
rp->body = EPH_CALL(ephysics_body_back_boundary_add)(world);
|
2015-06-08 11:43:00 -07:00
|
|
|
resize = EINA_FALSE;
|
|
|
|
break;
|
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
ERR("Invalid body: %i", rp->part->physics_body);
|
|
|
|
return;
|
2012-12-05 11:29:33 -08:00
|
|
|
}
|
|
|
|
|
2012-12-11 06:09:03 -08:00
|
|
|
EINA_LIST_FOREACH(rp->part->default_desc->physics.faces, l, pface)
|
|
|
|
{
|
|
|
|
Evas_Object *edje_obj;
|
|
|
|
Evas *evas;
|
|
|
|
|
|
|
|
if (!pface->source) continue;
|
|
|
|
|
|
|
|
evas = evas_object_evas_get(rp->object);
|
|
|
|
edje_obj = edje_object_add(evas);
|
|
|
|
if (!edje_obj) continue;
|
|
|
|
|
2013-04-07 20:24:44 -07:00
|
|
|
edje_object_file_set(edje_obj, ed->path, pface->source);
|
2012-12-11 06:09:03 -08:00
|
|
|
evas_object_resize(edje_obj, 1, 1);
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_face_evas_object_set)(rp->body, pface->type,
|
|
|
|
edje_obj, EINA_FALSE);
|
2012-12-11 06:09:03 -08:00
|
|
|
rp->body_faces = eina_list_append(rp->body_faces, edje_obj);
|
|
|
|
}
|
|
|
|
|
2016-08-01 03:04:42 -07:00
|
|
|
EPH_CALL(ephysics_body_evas_object_set)(rp->body, rp->object, resize);
|
|
|
|
EPH_CALL(ephysics_body_event_callback_add)(rp->body, EPHYSICS_CALLBACK_BODY_UPDATE,
|
|
|
|
_edje_physics_body_update_cb, rp);
|
|
|
|
EPH_CALL(ephysics_body_data_set)(rp->body, ed);
|
2012-12-05 11:29:33 -08:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2012-12-05 11:29:33 -08:00
|
|
|
#endif
|
|
|
|
|
2016-12-20 15:59:46 -08:00
|
|
|
#define FINTP(_x1, _x2, _p) \
|
|
|
|
((((int)_x1) == ((int)_x2)) \
|
|
|
|
? FROM_INT((_x1)) \
|
|
|
|
: ADD(FROM_INT(_x1), \
|
2015-06-08 11:43:00 -07:00
|
|
|
SCALE((_p), (_x2) - (_x1))))
|
2013-06-06 02:18:36 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define FFP(_x1, _x2, _p) \
|
2016-12-20 15:59:46 -08:00
|
|
|
(EQ((_x1), (_x2)) \
|
2015-06-08 11:43:00 -07:00
|
|
|
? (_x1) \
|
|
|
|
: ADD(_x1, MUL(_p, SUB(_x2, _x1))));
|
2013-06-06 02:18:36 -07:00
|
|
|
|
|
|
|
#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p))
|
|
|
|
|
2013-10-14 23:00:13 -07:00
|
|
|
static void
|
|
|
|
_map_colors_free(Edje_Calc_Params *pf)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
if (pf->ext)
|
|
|
|
{
|
|
|
|
Edje_Map_Color **colors = pf->ext->map->colors;
|
|
|
|
int i;
|
2013-10-14 23:00:13 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
for (i = 0; i < (int)pf->ext->map->colors_count; i++) free(colors[i]);
|
|
|
|
free(colors);
|
|
|
|
}
|
2013-10-14 23:00:13 -07:00
|
|
|
}
|
|
|
|
|
2013-06-06 02:18:36 -07:00
|
|
|
static Eina_Bool
|
2013-10-14 23:00:13 -07:00
|
|
|
_map_colors_interp(Edje_Calc_Params *p1, Edje_Calc_Params *p2,
|
|
|
|
Edje_Calc_Params_Map *pmap, FLOAT_T pos)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2016-06-13 05:31:48 -07:00
|
|
|
Edje_Map_Color *col = NULL, *col2 = NULL, *col3;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
unsigned char col1_r = 255, col1_g = 255, col1_b = 255, col1_a = 255;
|
|
|
|
unsigned char col2_r = 255, col2_g = 255, col2_b = 255, col2_a = 255;
|
2013-06-06 02:18:36 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(p1);
|
|
|
|
_edje_calc_params_need_ext(p2);
|
|
|
|
|
|
|
|
if ((p1->ext->map->colors_count > 0) || (p2->ext->map->colors_count > 0))
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
pmap->colors_count = (p1->ext->map->colors_count > p2->ext->map->colors_count ? p1->ext->map->colors_count : p2->ext->map->colors_count);
|
2013-07-18 04:08:56 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
pmap->colors = (Edje_Map_Color **)malloc(sizeof(Edje_Map_Color *) * (int)pmap->colors_count);
|
2013-07-18 04:08:56 -07:00
|
|
|
|
2016-06-13 05:31:48 -07:00
|
|
|
/* create all Map Color structs at first
|
|
|
|
to make sure we won't get SIGSEV later on cleanup. */
|
|
|
|
for (i = 0; i < (int)pmap->colors_count; i++)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2013-07-18 04:08:56 -07:00
|
|
|
col3 = malloc(sizeof(Edje_Map_Color));
|
2016-06-13 05:31:48 -07:00
|
|
|
col3->idx = i; /* we don't care about index position anyway */
|
2013-07-18 04:08:56 -07:00
|
|
|
|
2016-06-13 05:31:48 -07:00
|
|
|
/* find color with idx from first */
|
2016-08-14 06:30:32 -07:00
|
|
|
for (j = 0; j < (int)p1->ext->map->colors_count; j++)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
col = p1->ext->map->colors[j];
|
2016-06-13 05:31:48 -07:00
|
|
|
if (col3->idx == col->idx)
|
|
|
|
{
|
|
|
|
col1_r = col->r;
|
|
|
|
col1_g = col->g;
|
|
|
|
col1_b = col->b;
|
|
|
|
col1_a = col->a;
|
|
|
|
break;
|
|
|
|
}
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
2016-06-13 05:31:48 -07:00
|
|
|
/* find color from idx from second */
|
2016-08-14 06:30:32 -07:00
|
|
|
for (j = 0; j < (int)p2->ext->map->colors_count; j++)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
col2 = p2->ext->map->colors[j];
|
2016-06-13 05:31:48 -07:00
|
|
|
if (col3->idx == col2->idx)
|
|
|
|
{
|
|
|
|
col2_r = col2->r;
|
|
|
|
col2_g = col2->g;
|
|
|
|
col2_b = col2->b;
|
|
|
|
col2_a = col2->a;
|
|
|
|
break;
|
|
|
|
}
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
2016-06-13 05:31:48 -07:00
|
|
|
|
|
|
|
/* interpolate!
|
|
|
|
if color didn't existed, then there are default 255 values */
|
|
|
|
col3->r = INTP(col1_r, col2_r, pos);
|
|
|
|
col3->g = INTP(col1_g, col2_g, pos);
|
|
|
|
col3->b = INTP(col1_b, col2_b, pos);
|
|
|
|
col3->a = INTP(col1_a, col2_a, pos);
|
|
|
|
|
|
|
|
pmap->colors[i] = col3;
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
2016-06-13 05:31:48 -07:00
|
|
|
|
2013-06-06 02:18:36 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf,
|
2013-06-06 02:36:40 -07:00
|
|
|
Edje_Part_Description_Common *chosen_desc,
|
2013-10-14 23:00:13 -07:00
|
|
|
Edje_Real_Part *ep, Evas_Object *mo)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
Edje_Map_Color *color, **colors;
|
|
|
|
int colors_cnt, i;
|
2013-07-18 04:08:56 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
if (!pf->ext) return;
|
|
|
|
|
|
|
|
colors = pf->ext->map->colors;
|
|
|
|
colors_cnt = pf->ext->map->colors_count;
|
2013-06-06 02:18:36 -07:00
|
|
|
|
2013-06-06 02:36:40 -07:00
|
|
|
evas_map_util_points_populate_from_object(map, ep->object);
|
|
|
|
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
|
|
|
|
((ep->part->type == EDJE_PART_TYPE_SWALLOW) &&
|
2016-08-15 06:44:41 -07:00
|
|
|
(efl_isa(mo, EFL_CANVAS_IMAGE_INTERNAL_CLASS) &&
|
2013-06-06 02:36:40 -07:00
|
|
|
(!evas_object_image_source_get(mo))))
|
2015-06-08 11:43:00 -07:00
|
|
|
)
|
2013-06-06 02:36:40 -07:00
|
|
|
{
|
|
|
|
int iw = 1, ih = 1;
|
|
|
|
|
|
|
|
evas_object_image_size_get(mo, &iw, &ih);
|
|
|
|
evas_map_point_image_uv_set(map, 0, 0.0, 0.0);
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_map_point_image_uv_set(map, 1, iw, 0.0);
|
|
|
|
evas_map_point_image_uv_set(map, 2, iw, ih);
|
|
|
|
evas_map_point_image_uv_set(map, 3, 0.0, ih);
|
2013-06-06 02:36:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//map color
|
2013-07-18 04:08:56 -07:00
|
|
|
if (colors_cnt == 0)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
|
|
|
evas_map_point_color_set(map, 0, 255, 255, 255, 255);
|
|
|
|
evas_map_point_color_set(map, 1, 255, 255, 255, 255);
|
|
|
|
evas_map_point_color_set(map, 2, 255, 255, 255, 255);
|
|
|
|
evas_map_point_color_set(map, 3, 255, 255, 255, 255);
|
|
|
|
}
|
2013-06-06 02:36:40 -07:00
|
|
|
else
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2013-10-14 23:00:13 -07:00
|
|
|
for (i = 0; i < colors_cnt; i++)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2013-10-14 23:00:13 -07:00
|
|
|
color = colors[i];
|
|
|
|
evas_map_point_color_set(map, color->idx, color->r, color->g,
|
|
|
|
color->b, color->a);
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
|
|
|
}
|
2013-06-06 02:36:40 -07:00
|
|
|
|
2015-03-02 03:19:49 -08:00
|
|
|
//zoom
|
|
|
|
evas_map_util_zoom(map,
|
2016-08-14 06:30:32 -07:00
|
|
|
pf->ext->map->zoom.x, pf->ext->map->zoom.y,
|
|
|
|
pf->ext->map->center.x, pf->ext->map->center.y);
|
2015-03-02 03:19:49 -08:00
|
|
|
|
2013-06-06 02:36:40 -07:00
|
|
|
//rotate
|
|
|
|
evas_map_util_3d_rotate(map,
|
2016-08-14 06:30:32 -07:00
|
|
|
TO_DOUBLE(pf->ext->map->rotation.x),
|
|
|
|
TO_DOUBLE(pf->ext->map->rotation.y),
|
|
|
|
TO_DOUBLE(pf->ext->map->rotation.z),
|
|
|
|
pf->ext->map->center.x, pf->ext->map->center.y,
|
|
|
|
pf->ext->map->center.z);
|
2013-06-06 02:36:40 -07:00
|
|
|
|
|
|
|
// calculate light color & position etc. if there is one
|
|
|
|
if (pf->lighted)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_map_util_3d_lighting(map, pf->ext->map->light.x, pf->ext->map->light.y,
|
|
|
|
pf->ext->map->light.z, pf->ext->map->light.r,
|
|
|
|
pf->ext->map->light.g, pf->ext->map->light.b,
|
|
|
|
pf->ext->map->light.ar, pf->ext->map->light.ag,
|
|
|
|
pf->ext->map->light.ab);
|
2013-06-06 02:36:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// calculate perspective point
|
|
|
|
if (chosen_desc->map.persp_on)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2013-06-06 02:36:40 -07:00
|
|
|
evas_map_util_3d_perspective(map,
|
2016-08-14 06:30:32 -07:00
|
|
|
pf->ext->map->persp.x, pf->ext->map->persp.y,
|
|
|
|
pf->ext->map->persp.z, pf->ext->map->persp.focal);
|
2013-06-06 02:36:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// handle backface culling (object is facing away from view
|
|
|
|
if (chosen_desc->map.backcull)
|
|
|
|
{
|
|
|
|
if (pf->visible)
|
2013-06-06 02:18:36 -07:00
|
|
|
{
|
2013-06-06 02:36:40 -07:00
|
|
|
if (evas_map_util_clockwise_get(map))
|
|
|
|
evas_object_show(mo);
|
|
|
|
else evas_object_hide(mo);
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
|
|
|
}
|
2013-06-06 02:36:40 -07:00
|
|
|
|
|
|
|
// handle smooth
|
|
|
|
if (chosen_desc->map.smooth) evas_map_smooth_set(map, EINA_TRUE);
|
|
|
|
else evas_map_smooth_set(map, EINA_FALSE);
|
|
|
|
// handle alpha
|
|
|
|
if (chosen_desc->map.alpha) evas_map_alpha_set(map, EINA_TRUE);
|
|
|
|
else evas_map_alpha_set(map, EINA_FALSE);
|
2013-06-06 02:18:36 -07:00
|
|
|
}
|
|
|
|
|
2013-04-07 18:39:04 -07:00
|
|
|
#define Rel1X 0
|
|
|
|
#define Rel1Y 1
|
2013-06-06 02:18:36 -07:00
|
|
|
#define Rel2X 2
|
|
|
|
#define Rel2Y 3
|
2016-01-13 02:59:31 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_circular_dependency_find(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part *cep, Eina_List **clist)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = NULL;
|
|
|
|
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep == ep) return EINA_TRUE;
|
|
|
|
if (!cep) cep = ep;
|
2015-12-30 20:49:56 -08:00
|
|
|
|
2016-04-14 05:55:14 -07:00
|
|
|
if ((cep->calculating & FLAG_X))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description->rel1.id_x >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param1.description->rel1.id_x];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description->rel2.id_x >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param1.description->rel2.id_x];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2->description->rel1.id_x >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param2->description->rel1.id_x];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2->description->rel2.id_x >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param2->description->rel2.id_x];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if ((cep->calculating & FLAG_Y))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description->rel1.id_y >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param1.description->rel1.id_y];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param1.description->rel2.id_y >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param1.description->rel2.id_y];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2->description->rel1.id_y >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param2->description->rel1.id_y];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 05:55:14 -07:00
|
|
|
if (cep->param2->description->rel2.id_y >= 0)
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
rp = ed->table_parts[cep->param2->description->rel2.id_y];
|
2016-01-13 02:59:31 -08:00
|
|
|
if (_circular_dependency_find(ed, ep, rp, clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
|
|
|
*clist = eina_list_prepend(*clist, rp->part->name);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
static void
|
|
|
|
_edje_part_calc_params_memcpy(Edje_Calc_Params *p, Edje_Calc_Params *s, Edje_Part_Type t)
|
|
|
|
{
|
2016-08-17 22:18:06 -07:00
|
|
|
_edje_calc_params_clear(p);
|
2016-08-14 06:30:32 -07:00
|
|
|
memcpy(p, s, sizeof(Edje_Calc_Params));
|
2016-08-17 22:18:06 -07:00
|
|
|
if (s->ext)
|
|
|
|
{
|
|
|
|
p->ext = NULL;
|
|
|
|
_edje_calc_params_need_ext(p);
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
eina_cow_memcpy(_edje_calc_params_map_cow,
|
|
|
|
(const Eina_Cow_Data **)&(p->ext->map),
|
|
|
|
s->ext->map);
|
|
|
|
# ifdef HAVE_EPHYSICS
|
|
|
|
eina_cow_memcpy(_edje_calc_params_physics_cow,
|
|
|
|
(const Eina_Cow_Data **)&(p->ext->physics),
|
|
|
|
s->ext->physics);
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
}
|
2016-08-14 06:30:32 -07:00
|
|
|
switch (t)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
|
|
|
{
|
|
|
|
Edje_Calc_Params_Type_Common *d = malloc(sizeof(*d));
|
|
|
|
if (d)
|
|
|
|
{
|
|
|
|
memcpy(d, s->type.common, sizeof(*d));
|
|
|
|
p->type.common = d;
|
|
|
|
}
|
|
|
|
else p->type.common = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
|
|
|
{
|
|
|
|
Edje_Calc_Params_Type_Text *d = malloc(sizeof(*d));
|
|
|
|
if (d)
|
|
|
|
{
|
|
|
|
memcpy(d, s->type.text, sizeof(*d));
|
|
|
|
p->type.text = d;
|
|
|
|
}
|
|
|
|
else p->type.text = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_LIGHT:
|
|
|
|
case EDJE_PART_TYPE_CAMERA:
|
|
|
|
case EDJE_PART_TYPE_MESH_NODE:
|
|
|
|
{
|
|
|
|
Edje_Calc_Params_Type_Node *d = malloc(sizeof(*d));
|
|
|
|
if (d)
|
|
|
|
{
|
|
|
|
memcpy(d, s->type.node, sizeof(*d));
|
|
|
|
p->type.node = d;
|
|
|
|
}
|
|
|
|
else p->type.node = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-28 02:20:51 -08:00
|
|
|
void
|
|
|
|
_edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2011-08-14 14:55:31 -07:00
|
|
|
Eina_Bool proxy_invalidate = EINA_FALSE;
|
2009-08-10 08:16:51 -07:00
|
|
|
int state1 = -1;
|
|
|
|
int state2 = -1;
|
|
|
|
int statec = -1;
|
2013-07-18 23:39:49 -07:00
|
|
|
int statet = -1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#else
|
|
|
|
Edje_Calc_Params lp1, lp2;
|
|
|
|
#endif
|
2011-11-27 15:55:37 -08:00
|
|
|
int statec1 = -1;
|
|
|
|
int statec2 = -1;
|
|
|
|
int statel1 = -1;
|
|
|
|
int statel2 = -1;
|
|
|
|
int statep1 = -1;
|
|
|
|
int statep2 = -1;
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
int statecl = -1;
|
2011-11-27 15:55:37 -08:00
|
|
|
Edje_Real_Part *center[2] = { NULL, NULL };
|
|
|
|
Edje_Real_Part *light[2] = { NULL, NULL };
|
|
|
|
Edje_Real_Part *persp[2] = { NULL, NULL };
|
2013-04-07 18:39:04 -07:00
|
|
|
Edje_Real_Part *rp1[4] = { NULL, NULL, NULL, NULL };
|
|
|
|
Edje_Real_Part *rp2[4] = { NULL, NULL, NULL, NULL };
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
Edje_Real_Part *clip1 = NULL, *clip2 = NULL;
|
2009-08-10 08:16:51 -07:00
|
|
|
Edje_Calc_Params *p1, *pf;
|
2010-07-29 05:02:36 -07:00
|
|
|
Edje_Part_Description_Common *chosen_desc;
|
2009-08-11 05:47:00 -07:00
|
|
|
Edje_Real_Part *confine_to = NULL;
|
2013-07-18 23:39:49 -07:00
|
|
|
Edje_Real_Part *threshold = NULL;
|
2011-05-16 06:16:34 -07:00
|
|
|
FLOAT_T pos = ZERO, pos2;
|
2016-08-22 05:44:43 -07:00
|
|
|
Edje_Calc_Params lp3 = { {0} };
|
2013-06-03 01:17:33 -07:00
|
|
|
Evas_Coord mmw = 0, mmh = 0;
|
2013-06-06 02:18:36 -07:00
|
|
|
Eina_Bool map_colors_free = EINA_FALSE;
|
2004-02-04 03:10:10 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
#else
|
|
|
|
lp1.type.common = NULL;
|
|
|
|
lp1.ext = NULL;
|
|
|
|
|
|
|
|
lp2.type.common = NULL;
|
|
|
|
lp2.ext = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
lp3.type.common = NULL;
|
|
|
|
lp3.ext = NULL;
|
|
|
|
|
2010-07-13 08:47:19 -07:00
|
|
|
/* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_GRADIENT)
|
2010-07-29 05:02:36 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ERR("GRADIENT spotted during recalc ! That should never happen ! Send your edje file to devel ml.");
|
|
|
|
return;
|
2010-07-29 05:02:36 -07:00
|
|
|
}
|
2010-07-13 08:47:19 -07:00
|
|
|
|
2017-02-21 00:49:44 -08:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN(flags != FLAG_NONE);
|
|
|
|
if (!state)
|
2003-10-17 20:34:54 -07:00
|
|
|
{
|
2017-02-21 00:49:44 -08:00
|
|
|
if ((ep->calculated & FLAG_XY) == FLAG_XY) return;
|
|
|
|
if ((ep->calculated & flags) == flags) return;
|
2003-10-17 20:34:54 -07:00
|
|
|
}
|
2017-02-21 00:49:44 -08:00
|
|
|
|
2004-10-12 20:43:42 -07:00
|
|
|
if (ep->calculating & flags)
|
|
|
|
{
|
|
|
|
#if 1
|
2012-08-14 00:59:06 -07:00
|
|
|
const char *axes = "NONE", *faxes = "NONE";
|
|
|
|
|
|
|
|
if ((ep->calculating & FLAG_X) &&
|
|
|
|
(ep->calculating & FLAG_Y))
|
|
|
|
axes = "XY";
|
|
|
|
else if ((ep->calculating & FLAG_X))
|
|
|
|
axes = "X";
|
|
|
|
else if ((ep->calculating & FLAG_Y))
|
|
|
|
axes = "Y";
|
|
|
|
|
|
|
|
if ((flags & FLAG_X) &&
|
|
|
|
(flags & FLAG_Y))
|
|
|
|
faxes = "XY";
|
|
|
|
else if ((flags & FLAG_X))
|
|
|
|
faxes = "X";
|
|
|
|
else if ((flags & FLAG_Y))
|
|
|
|
faxes = "Y";
|
|
|
|
ERR("Circular dependency when calculating part \"%s\". "
|
|
|
|
"Already calculating %s [%02x] axes. "
|
|
|
|
"Need to calculate %s [%02x] axes",
|
|
|
|
ep->part->name,
|
|
|
|
axes, ep->calculating,
|
|
|
|
faxes, flags);
|
2015-12-30 20:49:56 -08:00
|
|
|
|
|
|
|
Eina_List *clist = NULL;
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
char *part_name;
|
|
|
|
char depends_path[PATH_MAX] = "";
|
2016-07-21 09:29:35 -07:00
|
|
|
|
|
|
|
if (_circular_dependency_find(ed, ep, NULL, &clist))
|
2015-12-30 20:49:56 -08:00
|
|
|
{
|
2016-07-21 09:29:35 -07:00
|
|
|
strncat(depends_path, ep->part->name,
|
2015-12-30 20:49:56 -08:00
|
|
|
sizeof(depends_path) - strlen(depends_path) - 1);
|
2016-07-21 09:29:35 -07:00
|
|
|
EINA_LIST_FOREACH(clist, l, part_name)
|
|
|
|
{
|
|
|
|
strncat(depends_path, " -> ",
|
|
|
|
sizeof(depends_path) - strlen(depends_path) - 1);
|
|
|
|
strncat(depends_path, part_name,
|
|
|
|
sizeof(depends_path) - strlen(depends_path) - 1);
|
|
|
|
}
|
|
|
|
ERR("Circular dependency in the group '%s' : %s",
|
|
|
|
ed->group, depends_path);
|
|
|
|
eina_list_free(clist);
|
2015-12-30 20:49:56 -08:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
return;
|
2004-10-12 20:43:42 -07:00
|
|
|
}
|
2012-03-11 03:43:08 -07:00
|
|
|
|
2013-08-07 00:00:15 -07:00
|
|
|
if (ep->part->type == EDJE_PART_TYPE_GROUP &&
|
2012-09-11 06:14:51 -07:00
|
|
|
((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
2015-06-08 11:43:00 -07:00
|
|
|
(ep->typedata.swallow)) &&
|
2012-09-11 06:14:51 -07:00
|
|
|
ep->typedata.swallow->swallowed_object)
|
2012-03-12 08:28:58 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
edje_object_scale_set(ep->typedata.swallow->swallowed_object, TO_DOUBLE(ed->scale));
|
2012-03-12 08:28:58 -07:00
|
|
|
|
|
|
|
if (ep->description_pos > FROM_DOUBLE(0.5) && ep->param2)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
edje_object_update_hints_set(ep->typedata.swallow->swallowed_object, ep->param2->description->min.limit);
|
2012-03-12 08:28:58 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
edje_object_update_hints_set(ep->typedata.swallow->swallowed_object, ep->param1.description->min.limit);
|
2012-03-12 08:28:58 -07:00
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
if (edje_object_update_hints_get(ep->typedata.swallow->swallowed_object))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2012-08-06 02:22:42 -07:00
|
|
|
Edje *ted;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
ted = _edje_fetch(ep->typedata.swallow->swallowed_object);
|
2012-08-06 02:22:42 -07:00
|
|
|
_edje_recalc_do(ted);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2012-03-12 08:28:58 -07:00
|
|
|
}
|
2013-06-03 01:17:33 -07:00
|
|
|
if (ep->part->type == EDJE_PART_TYPE_GROUP &&
|
|
|
|
((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
2015-06-08 11:43:00 -07:00
|
|
|
(ep->typedata.swallow)) &&
|
2013-06-03 01:17:33 -07:00
|
|
|
ep->typedata.swallow->swallowed_object)
|
|
|
|
{
|
2015-03-31 16:07:46 -07:00
|
|
|
Edje_Size *min = NULL, *max = NULL;
|
|
|
|
|
|
|
|
if (ep->chosen_description)
|
|
|
|
{
|
|
|
|
min = &ep->chosen_description->min;
|
|
|
|
max = &ep->chosen_description->max;
|
|
|
|
}
|
2015-03-31 20:27:01 -07:00
|
|
|
if (min && max && (min->w == max->w) && (min->h == max->h) && (min->w > 0) && (min->h > 0))
|
2015-03-31 16:07:46 -07:00
|
|
|
mmw = min->w, mmh = min->h;
|
|
|
|
else
|
|
|
|
edje_object_size_min_calc(ep->typedata.swallow->swallowed_object,
|
|
|
|
&mmw, &mmh);
|
2013-06-03 01:17:33 -07:00
|
|
|
}
|
2012-03-11 03:43:08 -07:00
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2011-11-28 02:20:51 -08:00
|
|
|
if (ep->state == ed->state && !state)
|
2013-06-20 04:28:18 -07:00
|
|
|
return;
|
2009-08-14 10:19:42 -07:00
|
|
|
#endif
|
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->param1.description)
|
2014-02-18 19:18:42 -08:00
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->param1.description->rel1.id_x >= 0)
|
|
|
|
rp1[Rel1X] = ed->table_parts[ep->param1.description->rel1.id_x];
|
|
|
|
if (ep->param1.description->rel2.id_x >= 0)
|
|
|
|
rp1[Rel2X] = ed->table_parts[ep->param1.description->rel2.id_x];
|
|
|
|
if (ep->param1.description->rel1.id_y >= 0)
|
|
|
|
rp1[Rel1Y] = ed->table_parts[ep->param1.description->rel1.id_y];
|
|
|
|
if (ep->param1.description->rel2.id_y >= 0)
|
|
|
|
rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y];
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
if (ep->param1.description->clip_to_id >= 0)
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
{
|
|
|
|
clip1 = ed->table_parts[ep->param1.description->clip_to_id % ed->table_parts_size];
|
|
|
|
ed->has_state_clip = EINA_TRUE;
|
|
|
|
}
|
2014-02-18 19:18:42 -08:00
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
if (ep->param2)
|
|
|
|
{
|
|
|
|
if (ep->param2->description->rel1.id_x >= 0)
|
|
|
|
rp2[Rel1X] = ed->table_parts[ep->param2->description->rel1.id_x];
|
|
|
|
if (ep->param2->description->rel2.id_x >= 0)
|
|
|
|
rp2[Rel2X] = ed->table_parts[ep->param2->description->rel2.id_x];
|
|
|
|
if (ep->param2->description->rel1.id_y >= 0)
|
|
|
|
rp2[Rel1Y] = ed->table_parts[ep->param2->description->rel1.id_y];
|
|
|
|
if (ep->param2->description->rel2.id_y >= 0)
|
|
|
|
rp2[Rel2Y] = ed->table_parts[ep->param2->description->rel2.id_y];
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
if (ep->param2->description->clip_to_id >= 0)
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
{
|
|
|
|
clip2 = ed->table_parts[ep->param2->description->clip_to_id % ed->table_parts_size];
|
|
|
|
ed->has_state_clip = EINA_TRUE;
|
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
}
|
|
|
|
|
2004-10-12 20:43:42 -07:00
|
|
|
if (flags & FLAG_X)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->calculating |= flags & FLAG_X;
|
2015-06-08 11:43:00 -07:00
|
|
|
if (rp1[Rel1X])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp1[Rel1X], FLAG_X, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
state1 = rp1[Rel1X]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp1[Rel2X])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp1[Rel2X], FLAG_X, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state1 < rp1[Rel2X]->state)
|
|
|
|
state1 = rp1[Rel2X]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
if (ep->param2)
|
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp2[Rel1X])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp2[Rel1X], FLAG_X, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
state2 = rp2[Rel1X]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp2[Rel2X])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp2[Rel2X], FLAG_X, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state2 < rp2[Rel2X]->state)
|
|
|
|
state2 = rp2[Rel2X]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2004-10-12 20:43:42 -07:00
|
|
|
}
|
|
|
|
if (flags & FLAG_Y)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->calculating |= flags & FLAG_Y;
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp1[Rel1Y])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp1[Rel1Y], FLAG_Y, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state1 < rp1[Rel1Y]->state)
|
|
|
|
state1 = rp1[Rel1Y]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp1[Rel2Y])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp1[Rel2Y], FLAG_Y, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state1 < rp1[Rel2Y]->state)
|
|
|
|
state1 = rp1[Rel2Y]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
if (ep->param2)
|
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp2[Rel1Y])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp2[Rel1Y], FLAG_Y, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state2 < rp2[Rel1Y]->state)
|
|
|
|
state2 = rp2[Rel1Y]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2013-04-07 18:39:04 -07:00
|
|
|
if (rp2[Rel2Y])
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
2013-04-07 18:39:04 -07:00
|
|
|
_edje_part_recalc(ed, rp2[Rel2Y], FLAG_Y, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-04-07 18:39:04 -07:00
|
|
|
if (state2 < rp2[Rel2Y]->state)
|
|
|
|
state2 = rp2[Rel2Y]->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
}
|
2009-08-10 08:16:51 -07:00
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
if (clip1)
|
|
|
|
{
|
|
|
|
_edje_part_recalc(ed, clip1, flags, NULL);
|
|
|
|
statecl = clip1->state;
|
|
|
|
}
|
|
|
|
if (clip2)
|
|
|
|
{
|
|
|
|
_edje_part_recalc(ed, clip2, flags, NULL);
|
|
|
|
if (statecl < clip2->state)
|
|
|
|
statecl = clip2->state;
|
|
|
|
}
|
2013-07-18 23:39:49 -07:00
|
|
|
if (ep->drag)
|
2009-08-10 08:16:51 -07:00
|
|
|
{
|
2013-07-18 23:39:49 -07:00
|
|
|
if (ep->drag->confine_to)
|
|
|
|
{
|
|
|
|
confine_to = ep->drag->confine_to;
|
|
|
|
_edje_part_recalc(ed, confine_to, flags, NULL);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-07-18 23:39:49 -07:00
|
|
|
statec = confine_to->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2013-07-18 23:39:49 -07:00
|
|
|
}
|
|
|
|
if (ep->drag->threshold)
|
|
|
|
{
|
|
|
|
threshold = ep->drag->threshold;
|
|
|
|
// We shall not recalculate the threshold position as
|
|
|
|
// we use it's previous position to assert the threshold
|
|
|
|
// the one before moving take action.
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
statet = threshold->state;
|
|
|
|
#endif
|
|
|
|
}
|
2004-10-12 20:43:42 -07:00
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
// if (ep->text.source) _edje_part_recalc(ed, ep->text.source, flags);
|
|
|
|
// if (ep->text.text_source) _edje_part_recalc(ed, ep->text.text_source, flags);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
/* actually calculate now */
|
2004-10-12 20:43:42 -07:00
|
|
|
chosen_desc = ep->chosen_description;
|
2004-02-04 03:10:10 -08:00
|
|
|
if (!chosen_desc)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->calculating = FLAG_NONE;
|
|
|
|
ep->calculated |= flags;
|
|
|
|
return;
|
2004-02-04 03:10:10 -08:00
|
|
|
}
|
2009-08-10 08:16:51 -07:00
|
|
|
|
2012-05-16 03:37:44 -07:00
|
|
|
pos = ep->description_pos;
|
|
|
|
|
2015-03-31 16:10:02 -07:00
|
|
|
if ((ep->part->type == EDJE_PART_TYPE_PROXY) && chosen_desc->visible)
|
2011-08-14 14:55:31 -07:00
|
|
|
{
|
2011-08-20 06:03:01 -07:00
|
|
|
int part_id = -1;
|
2011-08-14 14:55:31 -07:00
|
|
|
|
2013-05-09 03:27:50 -07:00
|
|
|
if (ep->param2 && (pos >= FROM_DOUBLE(0.5)))
|
2015-06-08 11:43:00 -07:00
|
|
|
part_id = ((Edje_Part_Description_Proxy *)ep->param2->description)->proxy.id;
|
2011-08-14 14:55:31 -07:00
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
part_id = ((Edje_Part_Description_Proxy *)chosen_desc)->proxy.id;
|
2011-11-27 15:55:37 -08:00
|
|
|
|
2011-11-30 02:57:30 -08:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2013-01-07 13:34:20 -08:00
|
|
|
Edje_Real_Part *pp;
|
|
|
|
pp = _edje_real_part_state_get(ed, ep, flags, part_id, NULL);
|
2011-11-27 15:55:37 -08:00
|
|
|
if (pp && pp->invalidate) proxy_invalidate = EINA_TRUE;
|
2013-01-07 13:34:20 -08:00
|
|
|
#else
|
|
|
|
_edje_real_part_state_get(ed, ep, flags, part_id, NULL);
|
2011-11-30 02:57:30 -08:00
|
|
|
#endif
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Recalc if needed the map center && light source */
|
|
|
|
if (ep->param1.description->map.on)
|
|
|
|
{
|
|
|
|
center[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.rot.id_center, &statec1);
|
|
|
|
light[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_light, &statel1);
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (chosen_desc->map.persp_on)
|
|
|
|
{
|
2011-11-27 15:55:37 -08:00
|
|
|
persp[0] = _edje_real_part_state_get(ed, ep, flags, ep->param1.description->map.id_persp, &statep1);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ep->param2 && ep->param2->description->map.on)
|
|
|
|
{
|
|
|
|
center[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.rot.id_center, &statec2);
|
|
|
|
light[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_light, &statel2);
|
|
|
|
|
|
|
|
if (chosen_desc->map.persp_on)
|
2011-08-20 06:03:01 -07:00
|
|
|
{
|
2011-11-27 15:55:37 -08:00
|
|
|
persp[1] = _edje_real_part_state_get(ed, ep, flags, ep->param2->description->map.id_persp, &statep2);
|
2011-08-20 06:03:01 -07:00
|
|
|
}
|
2011-08-14 14:55:31 -07:00
|
|
|
}
|
|
|
|
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifndef EDJE_CALC_CACHE
|
|
|
|
p1 = &lp1;
|
|
|
|
#else
|
2009-08-14 10:19:42 -07:00
|
|
|
p1 = &ep->param1.p;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
if (ep->param1.description)
|
2009-08-10 08:16:51 -07:00
|
|
|
{
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ed->all_part_change ||
|
|
|
|
ep->invalidate ||
|
2013-11-20 20:12:34 -08:00
|
|
|
(state1 >= ep->param1.state) ||
|
|
|
|
(statec >= ep->param1.state) ||
|
|
|
|
(statet >= ep->param1.state) ||
|
|
|
|
(statec1 >= ep->param1.state) ||
|
|
|
|
(statel1 >= ep->param1.state) ||
|
|
|
|
(statep1 >= ep->param1.state) ||
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
(statecl >= ep->param1.state) ||
|
2011-08-14 14:55:31 -07:00
|
|
|
proxy_invalidate ||
|
2011-11-28 02:20:51 -08:00
|
|
|
state ||
|
2013-11-21 21:02:40 -08:00
|
|
|
ed->need_map_update ||
|
2013-11-20 20:12:34 -08:00
|
|
|
((ep->part->type == EDJE_PART_TYPE_TEXT ||
|
|
|
|
ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
|
|
|
ed->text_part_change))
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
_edje_part_recalc_single(ed, ep, ep->param1.description,
|
|
|
|
chosen_desc, center[0], light[0],
|
|
|
|
persp[0], rp1[Rel1X], rp1[Rel1Y],
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
rp1[Rel2X], rp1[Rel2Y], clip1, confine_to,
|
2015-06-08 11:43:00 -07:00
|
|
|
threshold, p1, mmw, mmh,
|
|
|
|
pos);
|
2017-04-25 16:25:11 -07:00
|
|
|
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2015-06-08 11:43:00 -07:00
|
|
|
if (flags == FLAG_XY) ep->param1.state = ed->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2009-08-10 08:16:51 -07:00
|
|
|
}
|
2011-11-02 21:43:00 -07:00
|
|
|
if (ep->param2)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
int beginning_pos, part_type;
|
|
|
|
Edje_Calc_Params *p2, *p3;
|
2009-08-10 08:16:51 -07:00
|
|
|
|
2011-11-02 21:43:00 -07:00
|
|
|
if (ep->current)
|
|
|
|
{
|
2016-08-17 22:18:06 -07:00
|
|
|
_edje_calc_params_clear(p1);
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_part_calc_params_memcpy(p1, ep->current, ep->part->type);
|
|
|
|
}
|
2009-08-14 10:19:42 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3 = &lp3;
|
2009-08-14 10:19:42 -07:00
|
|
|
#ifndef EDJE_CALC_CACHE
|
2012-08-14 00:59:06 -07:00
|
|
|
p2 = &lp2;
|
2009-08-10 08:16:51 -07:00
|
|
|
#else
|
2012-08-14 00:59:06 -07:00
|
|
|
p2 = &ep->param2->p;
|
2009-08-10 08:16:51 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ed->all_part_change ||
|
|
|
|
ep->invalidate ||
|
2013-11-20 20:12:34 -08:00
|
|
|
(state2 >= ep->param2->state) ||
|
|
|
|
(statec >= ep->param2->state) ||
|
|
|
|
(statet >= ep->param2->state) ||
|
|
|
|
(statec2 >= ep->param2->state) ||
|
|
|
|
(statel2 >= ep->param2->state) ||
|
|
|
|
(statep2 >= ep->param2->state) ||
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
(statecl >= ep->param2->state) ||
|
2011-08-14 14:55:31 -07:00
|
|
|
proxy_invalidate ||
|
2011-11-28 02:20:51 -08:00
|
|
|
state ||
|
2013-11-21 21:02:40 -08:00
|
|
|
ed->need_map_update ||
|
2013-11-20 20:12:34 -08:00
|
|
|
((ep->part->type == EDJE_PART_TYPE_TEXT ||
|
|
|
|
ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
|
|
|
ed->text_part_change))
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
_edje_part_recalc_single(ed, ep, ep->param2->description,
|
|
|
|
chosen_desc, center[1], light[1],
|
|
|
|
persp[1], rp2[Rel1X], rp2[Rel1Y],
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
rp2[Rel2X], rp2[Rel2Y], clip2, confine_to,
|
2015-06-08 11:43:00 -07:00
|
|
|
threshold, p2, mmw, mmh,
|
|
|
|
pos);
|
2017-04-25 16:25:11 -07:00
|
|
|
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2015-06-08 11:43:00 -07:00
|
|
|
if (flags == FLAG_XY) ep->param2->state = ed->state;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
pos2 = pos;
|
|
|
|
if (pos2 < ZERO) pos2 = ZERO;
|
2015-06-08 11:43:00 -07:00
|
|
|
else if (pos2 > FROM_INT(1))
|
|
|
|
pos2 = FROM_INT(1);
|
2012-08-14 00:59:06 -07:00
|
|
|
beginning_pos = (pos < FROM_DOUBLE(0.5));
|
|
|
|
part_type = ep->part->type;
|
|
|
|
|
|
|
|
/* visible is special */
|
|
|
|
if ((p1->visible) && (!p2->visible))
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->visible = NEQ(pos, FROM_INT(1));
|
2012-08-14 00:59:06 -07:00
|
|
|
else if ((!p1->visible) && (p2->visible))
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->visible = NEQ(pos, ZERO);
|
2012-08-14 00:59:06 -07:00
|
|
|
else
|
|
|
|
p3->visible = p1->visible;
|
|
|
|
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
/* clip_to will behave a bit like visible */
|
2016-12-20 15:59:46 -08:00
|
|
|
if (EQ(pos, ZERO))
|
2016-08-14 06:30:32 -07:00
|
|
|
{
|
|
|
|
if ((p1->ext) && (p1->ext->clip_to))
|
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->clip_to = p1->ext->clip_to;
|
|
|
|
}
|
|
|
|
}
|
2016-12-20 15:59:46 -08:00
|
|
|
else if (EQ(pos, FROM_INT(1)))
|
2016-08-14 06:30:32 -07:00
|
|
|
{
|
|
|
|
if ((p2->ext) && (p2->ext->clip_to))
|
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->clip_to = p2->ext->clip_to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((!p1->ext) || (!p1->ext->clip_to))
|
|
|
|
{
|
|
|
|
if ((p2->ext) && (p2->ext->clip_to))
|
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->clip_to = p2->ext->clip_to;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p3->ext) p3->ext->clip_to = NULL;
|
|
|
|
}
|
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
else
|
2016-08-14 06:30:32 -07:00
|
|
|
{
|
|
|
|
if ((p1->ext) && (p1->ext->clip_to))
|
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->clip_to = p1->ext->clip_to;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p3->ext) p3->ext->clip_to = NULL;
|
|
|
|
}
|
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
|
2016-08-09 04:11:07 -07:00
|
|
|
/* and no_render as well */
|
|
|
|
if ((p1->no_render) && (!p2->no_render))
|
|
|
|
{
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->no_render = EQ(pos, FROM_INT(1));
|
2016-08-09 04:11:07 -07:00
|
|
|
p3->no_render_apply = 1;
|
|
|
|
}
|
|
|
|
else if ((!p1->no_render) && (p2->no_render))
|
|
|
|
{
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->no_render = EQ(pos, ZERO);
|
2016-08-09 04:11:07 -07:00
|
|
|
p3->no_render_apply = 1;
|
|
|
|
}
|
|
|
|
else if (p1->no_render != ep->part->no_render)
|
|
|
|
{
|
|
|
|
p3->no_render = p1->no_render;
|
|
|
|
p3->no_render_apply = 1;
|
|
|
|
}
|
|
|
|
else p3->no_render = ep->part->no_render;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
p3->smooth = (beginning_pos) ? p1->smooth : p2->smooth;
|
|
|
|
|
|
|
|
/* FIXME: do x and y separately base on flag */
|
2013-07-18 00:18:19 -07:00
|
|
|
p3->final.x = INTP(p1->final.x, p2->final.x, pos);
|
|
|
|
p3->final.y = INTP(p1->final.y, p2->final.y, pos);
|
|
|
|
p3->final.w = INTP(p1->final.w, p2->final.w, pos);
|
|
|
|
p3->final.h = INTP(p1->final.h, p2->final.h, pos);
|
|
|
|
|
|
|
|
p3->eval.x = FFP(p1->eval.x, p2->eval.x, pos);
|
|
|
|
p3->eval.y = FFP(p1->eval.y, p2->eval.y, pos);
|
|
|
|
p3->eval.w = FFP(p1->eval.w, p2->eval.w, pos);
|
|
|
|
p3->eval.h = FFP(p1->eval.h, p2->eval.h, pos);
|
2012-08-14 00:59:06 -07:00
|
|
|
|
|
|
|
p3->req.x = INTP(p1->req.x, p2->req.x, pos);
|
|
|
|
p3->req.y = INTP(p1->req.y, p2->req.y, pos);
|
|
|
|
p3->req.w = INTP(p1->req.w, p2->req.w, pos);
|
|
|
|
p3->req.h = INTP(p1->req.h, p2->req.h, pos);
|
|
|
|
|
2016-10-11 05:11:14 -07:00
|
|
|
_edje_part_pixel_adjust(ed, ep, p3);
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (ep->part->dragable.x)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->req_drag.x = INTP(p1->ext->req_drag.x, p2->ext->req_drag.x, pos);
|
|
|
|
p3->ext->req_drag.w = INTP(p1->ext->req_drag.w, p2->ext->req_drag.w, pos);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
if (ep->part->dragable.y)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(p3);
|
|
|
|
p3->ext->req_drag.y = INTP(p1->ext->req_drag.y, p2->ext->req_drag.y, pos);
|
|
|
|
p3->ext->req_drag.h = INTP(p1->ext->req_drag.h, p2->ext->req_drag.h, pos);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
p3->color.r = INTP(p1->color.r, p2->color.r, pos2);
|
|
|
|
p3->color.g = INTP(p1->color.g, p2->color.g, pos2);
|
|
|
|
p3->color.b = INTP(p1->color.b, p2->color.b, pos2);
|
|
|
|
p3->color.a = INTP(p1->color.a, p2->color.a, pos2);
|
|
|
|
|
2012-12-03 08:36:32 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2013-03-12 22:30:21 -07:00
|
|
|
if (ep->part->physics_body || ep->body)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(p1);
|
|
|
|
_edje_calc_params_need_ext(p2);
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_PHYSICS_BEGIN(p3, p3_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2016-12-20 15:59:46 -08:00
|
|
|
p3_write->mass = FFP(p1->ext->physics->mass,
|
|
|
|
p2->ext->physics->mass,
|
|
|
|
pos);
|
|
|
|
p3_write->restitution = FFP(p1->ext->physics->restitution,
|
|
|
|
p2->ext->physics->restitution,
|
|
|
|
pos);
|
|
|
|
p3_write->friction = FFP(p1->ext->physics->friction,
|
|
|
|
p2->ext->physics->friction,
|
|
|
|
pos);
|
|
|
|
p3_write->density = FFP(p1->ext->physics->density,
|
|
|
|
p2->ext->physics->density,
|
|
|
|
pos);
|
|
|
|
p3_write->hardness = FFP(p1->ext->physics->hardness,
|
|
|
|
p2->ext->physics->hardness,
|
|
|
|
pos);
|
|
|
|
|
|
|
|
p3_write->damping.linear = FFP(p1->ext->physics->damping.linear,
|
|
|
|
p2->ext->physics->damping.linear,
|
|
|
|
pos);
|
|
|
|
p3_write->damping.angular = FFP(p1->ext->physics->damping.angular,
|
|
|
|
p2->ext->physics->damping.angular,
|
|
|
|
pos);
|
|
|
|
|
|
|
|
p3_write->sleep.linear = FFP(p1->ext->physics->sleep.linear,
|
|
|
|
p2->ext->physics->sleep.linear,
|
|
|
|
pos);
|
|
|
|
p3_write->sleep.angular = FFP(p1->ext->physics->sleep.angular,
|
|
|
|
p2->ext->physics->sleep.angular,
|
|
|
|
pos);
|
2016-08-14 06:30:32 -07:00
|
|
|
|
|
|
|
p3_write->z = INTP(p1->ext->physics->z, p2->ext->physics->z, pos);
|
|
|
|
p3_write->depth = INTP(p1->ext->physics->depth, p2->ext->physics->depth, pos);
|
|
|
|
|
|
|
|
if ((p1->ext->physics->ignore_part_pos) && (p2->ext->physics->ignore_part_pos))
|
2015-06-08 11:43:00 -07:00
|
|
|
p3_write->ignore_part_pos = 1;
|
|
|
|
else
|
|
|
|
p3_write->ignore_part_pos = 0;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
if ((p1->ext->physics->material) && (p2->ext->physics->material))
|
|
|
|
p3_write->material = p1->ext->physics->material;
|
2015-06-08 11:43:00 -07:00
|
|
|
else
|
|
|
|
p3_write->material = EPHYSICS_BODY_MATERIAL_CUSTOM;
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3_write->light_on = p1->ext->physics->light_on || p2->ext->physics->light_on;
|
|
|
|
p3_write->backcull = p1->ext->physics->backcull || p2->ext->physics->backcull;
|
|
|
|
|
|
|
|
p3_write->mov_freedom.lin.x = p1->ext->physics->mov_freedom.lin.x ||
|
|
|
|
p2->ext->physics->mov_freedom.lin.x;
|
|
|
|
p3_write->mov_freedom.lin.y = p1->ext->physics->mov_freedom.lin.y ||
|
|
|
|
p2->ext->physics->mov_freedom.lin.y;
|
|
|
|
p3_write->mov_freedom.lin.z = p1->ext->physics->mov_freedom.lin.z ||
|
|
|
|
p2->ext->physics->mov_freedom.lin.z;
|
|
|
|
p3_write->mov_freedom.ang.x = p1->ext->physics->mov_freedom.ang.x ||
|
|
|
|
p2->ext->physics->mov_freedom.ang.x;
|
|
|
|
p3_write->mov_freedom.ang.y = p1->ext->physics->mov_freedom.ang.y ||
|
|
|
|
p2->ext->physics->mov_freedom.ang.y;
|
|
|
|
p3_write->mov_freedom.ang.z = p1->ext->physics->mov_freedom.ang.z ||
|
|
|
|
p2->ext->physics->mov_freedom.ang.z;
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_PHYSICS_END(p3, p3_write);
|
|
|
|
}
|
2012-12-03 08:36:32 -08:00
|
|
|
#endif
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
switch (part_type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_common(p3);
|
|
|
|
p3->type.common->spec.image.l = INTP(p1->type.common->spec.image.l, p2->type.common->spec.image.l, pos);
|
|
|
|
p3->type.common->spec.image.r = INTP(p1->type.common->spec.image.r, p2->type.common->spec.image.r, pos);
|
|
|
|
p3->type.common->spec.image.t = INTP(p1->type.common->spec.image.t, p2->type.common->spec.image.t, pos);
|
|
|
|
p3->type.common->spec.image.b = INTP(p1->type.common->spec.image.b, p2->type.common->spec.image.b, pos);
|
|
|
|
p3->type.common->spec.image.border_scale_by = FFP(p1->type.common->spec.image.border_scale_by, p2->type.common->spec.image.border_scale_by, pos);
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2017-06-05 11:58:40 -07:00
|
|
|
/* No break as proxy and image share code and object. */
|
2011-03-11 09:46:29 -08:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_common(p3);
|
|
|
|
p3->type.common->fill.x = INTP(p1->type.common->fill.x, p2->type.common->fill.x, pos);
|
|
|
|
p3->type.common->fill.y = INTP(p1->type.common->fill.y, p2->type.common->fill.y, pos);
|
|
|
|
p3->type.common->fill.w = INTP(p1->type.common->fill.w, p2->type.common->fill.w, pos);
|
|
|
|
p3->type.common->fill.h = INTP(p1->type.common->fill.h, p2->type.common->fill.h, pos);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_TEXT:
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_text(p3);
|
|
|
|
p3->type.text->size = INTP(p1->type.text->size, p2->type.text->size, pos);
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2012-08-14 00:59:06 -07:00
|
|
|
|
2017-06-05 11:58:40 -07:00
|
|
|
/* no break as we share code with the TEXTBLOCK type here. */
|
2015-06-08 11:43:00 -07:00
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_text(p3);
|
|
|
|
p3->type.text->color2.r = INTP(p1->type.text->color2.r, p2->type.text->color2.r, pos2);
|
|
|
|
p3->type.text->color2.g = INTP(p1->type.text->color2.g, p2->type.text->color2.g, pos2);
|
|
|
|
p3->type.text->color2.b = INTP(p1->type.text->color2.b, p2->type.text->color2.b, pos2);
|
|
|
|
p3->type.text->color2.a = INTP(p1->type.text->color2.a, p2->type.text->color2.a, pos2);
|
|
|
|
|
|
|
|
p3->type.text->color3.r = INTP(p1->type.text->color3.r, p2->type.text->color3.r, pos2);
|
|
|
|
p3->type.text->color3.g = INTP(p1->type.text->color3.g, p2->type.text->color3.g, pos2);
|
|
|
|
p3->type.text->color3.b = INTP(p1->type.text->color3.b, p2->type.text->color3.b, pos2);
|
|
|
|
p3->type.text->color3.a = INTP(p1->type.text->color3.a, p2->type.text->color3.a, pos2);
|
|
|
|
|
|
|
|
p3->type.text->align.x = FFP(p1->type.text->align.x, p2->type.text->align.x, pos);
|
|
|
|
p3->type.text->align.y = FFP(p1->type.text->align.y, p2->type.text->align.y, pos);
|
|
|
|
p3->type.text->ellipsis = TO_DOUBLE(FINTP(p1->type.text->ellipsis, p2->type.text->ellipsis, pos2));
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2016-02-17 14:48:33 -08:00
|
|
|
case EDJE_PART_TYPE_MESH_NODE:
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(p3);
|
|
|
|
p3->type.node->frame = INTP(p1->type.node->frame, p2->type.node->frame, pos);
|
|
|
|
p3->type.node->data[0] = INTP(p1->type.node->data[0], p2->type.node->data[0], pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->point.x = FFP(p1->type.node->point.x, p2->type.node->point.x, pos);
|
|
|
|
p3->type.node->point.y = FFP(p1->type.node->point.y, p2->type.node->point.y, pos);
|
|
|
|
p3->type.node->point.z = FFP(p1->type.node->point.z, p2->type.node->point.z, pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->scale_3d.x = FFP(p1->type.node->scale_3d.x, p2->type.node->scale_3d.x, pos);
|
|
|
|
p3->type.node->scale_3d.y = FFP(p1->type.node->scale_3d.y, p2->type.node->scale_3d.y, pos);
|
|
|
|
p3->type.node->scale_3d.z = FFP(p1->type.node->scale_3d.z, p2->type.node->scale_3d.z, pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_CAMERA:
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->data[0] = FFP(p1->type.node->data[0], p2->type.node->data[0], pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->point.x = FFP(p1->type.node->point.x, p2->type.node->point.x, pos);
|
|
|
|
p3->type.node->point.y = FFP(p1->type.node->point.y, p2->type.node->point.y, pos);
|
|
|
|
p3->type.node->point.z = FFP(p1->type.node->point.z, p2->type.node->point.z, pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_LIGHT:
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->data[0] = FFP(p1->type.node->data[0], p2->type.node->data[0], pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
p3->type.node->point.x = FFP(p1->type.node->point.x, p2->type.node->point.x, pos);
|
|
|
|
p3->type.node->point.y = FFP(p1->type.node->point.y, p2->type.node->point.y, pos);
|
|
|
|
p3->type.node->point.z = FFP(p1->type.node->point.z, p2->type.node->point.z, pos);
|
2016-02-17 14:48:33 -08:00
|
|
|
break;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2011-11-01 21:15:01 -07:00
|
|
|
|
2014-08-21 07:10:54 -07:00
|
|
|
/* mapped is a special case like visible */
|
|
|
|
if ((p1->mapped) && (!p2->mapped))
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->mapped = NEQ(pos, FROM_INT(1));
|
2014-08-21 07:10:54 -07:00
|
|
|
else if ((!p1->mapped) && (p2->mapped))
|
2016-12-20 15:59:46 -08:00
|
|
|
p3->mapped = NEQ(pos, ZERO);
|
2014-08-21 07:10:54 -07:00
|
|
|
else
|
|
|
|
p3->mapped = p1->mapped;
|
|
|
|
|
2011-11-27 15:55:37 -08:00
|
|
|
p3->persp_on = p3->mapped ? p1->persp_on | p2->persp_on : 0;
|
|
|
|
p3->lighted = p3->mapped ? p1->lighted | p2->lighted : 0;
|
2014-08-21 07:10:54 -07:00
|
|
|
if (p3->mapped)
|
2011-11-27 15:55:37 -08:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_ext(p1);
|
|
|
|
_edje_calc_params_need_ext(p2);
|
|
|
|
_edje_calc_params_need_ext(p3);
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_BEGIN(p3, p3_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
p3_write->center.x = INTP(p1->ext->map->center.x, p2->ext->map->center.x, pos);
|
|
|
|
p3_write->center.y = INTP(p1->ext->map->center.y, p2->ext->map->center.y, pos);
|
|
|
|
p3_write->center.z = INTP(p1->ext->map->center.z, p2->ext->map->center.z, pos);
|
|
|
|
p3_write->rotation.x = FFP(p1->ext->map->rotation.x, p2->ext->map->rotation.x, pos);
|
|
|
|
p3_write->rotation.y = FFP(p1->ext->map->rotation.y, p2->ext->map->rotation.y, pos);
|
|
|
|
p3_write->rotation.z = FFP(p1->ext->map->rotation.z, p2->ext->map->rotation.z, pos);
|
|
|
|
p3_write->zoom.x = FFP(p1->ext->map->zoom.x, p2->ext->map->zoom.x, pos);
|
|
|
|
p3_write->zoom.y = FFP(p1->ext->map->zoom.y, p2->ext->map->zoom.y, pos);
|
2015-06-08 11:43:00 -07:00
|
|
|
|
|
|
|
#define MIX(P1, P2, P3, pos, info) \
|
2016-08-14 06:30:32 -07:00
|
|
|
P3->info = P1->ext->map->info + TO_INT(SCALE(pos, P2->ext->map->info - P1->ext->map->info));
|
2015-06-08 11:43:00 -07:00
|
|
|
map_colors_free = _map_colors_interp(p1, p2, p3_write, pos);
|
|
|
|
|
|
|
|
if (p1->lighted && p2->lighted)
|
|
|
|
{
|
|
|
|
MIX(p1, p2, p3_write, pos, light.x);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.y);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.z);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.r);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.g);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.b);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.ar);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.ag);
|
|
|
|
MIX(p1, p2, p3_write, pos, light.ab);
|
|
|
|
}
|
|
|
|
else if (p1->lighted)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
memcpy(&p3_write->light, &p1->ext->map->light, sizeof (p1->ext->map->light));
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
else if (p2->lighted)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
memcpy(&p3_write->light, &p2->ext->map->light, sizeof (p2->ext->map->light));
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p1->persp_on && p2->persp_on)
|
|
|
|
{
|
|
|
|
MIX(p1, p2, p3_write, pos, persp.x);
|
|
|
|
MIX(p1, p2, p3_write, pos, persp.y);
|
|
|
|
MIX(p1, p2, p3_write, pos, persp.z);
|
|
|
|
MIX(p1, p2, p3_write, pos, persp.focal);
|
|
|
|
}
|
|
|
|
else if (p1->persp_on)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
memcpy(&p3_write->persp, &p1->ext->map->persp, sizeof (p1->ext->map->persp));
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
else if (p2->persp_on)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
memcpy(&p3_write->persp, &p2->ext->map->persp, sizeof (p2->ext->map->persp));
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_END(p3, p3_write);
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
|
2013-03-13 00:26:36 -07:00
|
|
|
#ifndef EDJE_CALC_CACHE
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_clear(&lp2);
|
2013-03-13 00:26:36 -07:00
|
|
|
#endif
|
2012-08-14 00:59:06 -07:00
|
|
|
pf = p3;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
else
|
2004-04-27 01:16:13 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
pf = p1;
|
2004-04-27 01:16:13 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2011-11-27 15:55:37 -08:00
|
|
|
if (!pf->persp_on && chosen_desc->map.persp_on)
|
|
|
|
{
|
|
|
|
if (ed->persp)
|
|
|
|
{
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_BEGIN(pf, pf_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
pf_write->persp.x = ed->persp->px;
|
|
|
|
pf_write->persp.y = ed->persp->py;
|
|
|
|
pf_write->persp.z = ed->persp->z0;
|
|
|
|
pf_write->persp.focal = ed->persp->foc;
|
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_END(pf, pf_write);
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Edje_Perspective *ps;
|
|
|
|
|
|
|
|
// fixme: a tad inefficient as this is a has lookup
|
|
|
|
ps = edje_object_perspective_get(ed->obj);
|
|
|
|
if (!ps)
|
|
|
|
ps = edje_evas_global_perspective_get(evas_object_evas_get(ed->obj));
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_BEGIN(pf, pf_write)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
if (ps)
|
|
|
|
{
|
|
|
|
pf_write->persp.x = ps->px;
|
|
|
|
pf_write->persp.y = ps->py;
|
|
|
|
pf_write->persp.z = ps->z0;
|
|
|
|
pf_write->persp.focal = ps->foc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pf_write->persp.x = ed->x + (ed->w / 2);
|
|
|
|
pf_write->persp.y = ed->y + (ed->h / 2);
|
|
|
|
pf_write->persp.z = 0;
|
|
|
|
pf_write->persp.focal = 1000;
|
|
|
|
}
|
|
|
|
}
|
2013-03-12 22:30:21 -07:00
|
|
|
EINA_COW_CALC_MAP_END(pf, pf_write);
|
2011-11-27 15:55:37 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-28 02:20:51 -08:00
|
|
|
if (state)
|
|
|
|
{
|
2016-08-17 22:18:06 -07:00
|
|
|
_edje_calc_params_clear(state);
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_part_calc_params_memcpy(state, pf, ep->part->type);
|
2011-11-28 02:20:51 -08:00
|
|
|
}
|
|
|
|
|
2008-02-27 08:03:23 -08:00
|
|
|
ep->req = pf->req;
|
2003-06-23 19:33:04 -07:00
|
|
|
|
2009-08-11 05:47:00 -07:00
|
|
|
if (ep->drag && ep->drag->need_reset)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
FLOAT_T dx, dy;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
dx = ZERO;
|
|
|
|
dy = ZERO;
|
|
|
|
_edje_part_dragable_calc(ed, ep, &dx, &dy);
|
2009-08-11 05:47:00 -07:00
|
|
|
ep->drag->x = dx;
|
2017-07-11 00:25:44 -07:00
|
|
|
ep->drag->val.x = dx;
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->drag->y = dy;
|
2017-07-11 00:25:44 -07:00
|
|
|
ep->drag->val.y = dy;
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->drag->tmp.x = 0;
|
|
|
|
ep->drag->tmp.y = 0;
|
|
|
|
ep->drag->need_reset = 0;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
if (!ed->calc_only)
|
|
|
|
{
|
2010-02-16 08:20:15 -08:00
|
|
|
Evas_Object *mo;
|
2010-04-19 13:37:40 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
/* Common move, resize and color_set for all part. */
|
|
|
|
switch (ep->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
|
|
|
Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)chosen_desc;
|
|
|
|
|
|
|
|
evas_object_image_scale_hint_set(ep->object,
|
|
|
|
img_desc->image.scale_hint);
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-06-08 11:43:00 -07:00
|
|
|
/* No break here as we share the rest of the code for all types. Intended fall-through*/
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_BOX:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_TABLE:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2015-09-15 02:10:51 -07:00
|
|
|
case EDJE_PART_TYPE_SNAPSHOT:
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2016-06-08 11:26:07 -07:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
2015-06-08 11:43:00 -07:00
|
|
|
evas_object_color_set(ep->object,
|
|
|
|
(pf->color.r * pf->color.a) / 255,
|
|
|
|
(pf->color.g * pf->color.a) / 255,
|
|
|
|
(pf->color.b * pf->color.a) / 255,
|
|
|
|
pf->color.a);
|
2012-12-10 04:24:15 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
/* body attributes should be updated for invisible objects */
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!ep->part->physics_body)
|
|
|
|
{
|
|
|
|
if (!pf->visible)
|
|
|
|
{
|
|
|
|
evas_object_hide(ep->object);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
evas_object_show(ep->object);
|
2016-08-09 04:11:07 -07:00
|
|
|
if (pf->no_render_apply)
|
|
|
|
efl_canvas_object_no_render_set(ep->object, pf->no_render);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
else if (!pf->visible)
|
|
|
|
{
|
|
|
|
Evas_Object *face_obj;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ep->body_faces, l, face_obj)
|
|
|
|
evas_object_hide(face_obj);
|
|
|
|
evas_object_hide(ep->object);
|
|
|
|
}
|
2012-12-05 11:29:33 -08:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!pf->visible)
|
|
|
|
{
|
|
|
|
evas_object_hide(ep->object);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
evas_object_show(ep->object);
|
2016-08-09 04:11:07 -07:00
|
|
|
if (pf->no_render_apply)
|
|
|
|
efl_canvas_object_no_render_set(ep->object, pf->no_render);
|
2012-12-10 04:24:15 -08:00
|
|
|
#endif
|
2017-06-05 11:58:40 -07:00
|
|
|
EINA_FALLTHROUGH;
|
2016-08-09 04:11:07 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
/* move and resize are needed for all previous object => no break here. */
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* visibility and color have no meaning on SWALLOW and GROUP part. */
|
2012-11-28 14:38:47 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_size_set(ep->object, pf->final.w, pf->final.h);
|
2015-06-08 11:43:00 -07:00
|
|
|
if ((ep->part->physics_body) && (!ep->body))
|
|
|
|
{
|
|
|
|
if (_edje_physics_world_geometry_check(ed->world))
|
|
|
|
{
|
|
|
|
_edje_physics_body_add(ed, ep, ed->world);
|
|
|
|
_edje_physics_body_props_update(ed, ep, pf, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ep->body)
|
|
|
|
{
|
|
|
|
if (((ep->prev_description) &&
|
|
|
|
(chosen_desc != ep->prev_description)) ||
|
|
|
|
(pf != p1))
|
2016-08-14 06:30:32 -07:00
|
|
|
{
|
|
|
|
_edje_calc_params_need_ext(pf);
|
|
|
|
_edje_physics_body_props_update(ed, ep, pf, !pf->ext->physics->ignore_part_pos);
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
else
|
2017-09-14 20:14:32 -07:00
|
|
|
efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y));
|
2012-12-11 10:52:35 -08:00
|
|
|
#else
|
2017-09-14 20:14:32 -07:00
|
|
|
efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y));
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_size_set(ep->object, pf->final.w, pf->final.h);
|
2012-12-11 10:52:35 -08:00
|
|
|
#endif
|
2012-12-10 03:31:27 -08:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
if (ep->nested_smart) /* Move, Resize all nested parts */
|
|
|
|
{ /* Not really needed but will improve the bounding box evaluation done by Evas */
|
2017-09-14 20:14:32 -07:00
|
|
|
efl_gfx_position_set(ep->nested_smart, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y));
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_size_set(ep->nested_smart, pf->final.w, pf->final.h);
|
2015-06-08 11:43:00 -07:00
|
|
|
}
|
|
|
|
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_real_part_configure(ed, ep);
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
|
|
|
|
/* handle clip overrides */
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
if (ed->has_state_clip)
|
|
|
|
{
|
|
|
|
if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object))
|
|
|
|
evas_object_clip_set(ep->object, pf->ext->clip_to->object);
|
|
|
|
else if (ep->part->clip_to_id >= 0)
|
|
|
|
evas_object_clip_set(ep->object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
|
|
|
|
else
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_object_clip_set(ep->object, ed->base.clipper);
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_TEXT:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* This is correctly handle in _edje_text_recalc_apply at the moment. */
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* FIXME: definitivly remove this code when we switch to new format. */
|
|
|
|
abort();
|
|
|
|
break;
|
|
|
|
|
2012-06-12 20:21:31 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* We really should do nothing on SPACER part */
|
|
|
|
break;
|
2015-06-22 02:17:26 -07:00
|
|
|
case EDJE_PART_TYPE_CAMERA:
|
|
|
|
{
|
2016-05-17 05:21:39 -07:00
|
|
|
Evas_Object *viewport;
|
2015-06-22 02:17:26 -07:00
|
|
|
Evas_Canvas3D_Camera *camera = NULL;
|
|
|
|
Edje_Part_Description_Camera *pd_camera;
|
|
|
|
|
2016-05-17 05:21:39 -07:00
|
|
|
efl_gfx_size_set(ep->object, pf->req.w, pf->req.h);
|
|
|
|
|
2015-06-22 02:17:26 -07:00
|
|
|
pd_camera = (Edje_Part_Description_Camera*) ep->chosen_description;
|
2016-05-17 05:21:39 -07:00
|
|
|
|
2017-09-14 20:14:32 -07:00
|
|
|
efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)),
|
2016-05-17 05:21:39 -07:00
|
|
|
efl_gfx_size_set(ep->object, pf->final.w, pf->final.h);
|
|
|
|
|
|
|
|
viewport = evas_object_image_source_get(ep->object);
|
|
|
|
|
|
|
|
efl_gfx_size_set(viewport, pf->req.w, pf->req.h);
|
|
|
|
|
|
|
|
evas_object_image_source_visible_set(ep->object, EINA_FALSE);
|
|
|
|
evas_object_image_source_events_set(ep->object, EINA_TRUE);
|
|
|
|
evas_object_show(ep->object);
|
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
camera = evas_canvas3d_node_camera_get(ep->node);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_camera_projection_perspective_set(camera, pd_camera->camera.camera.fovy, pd_camera->camera.camera.aspect, pd_camera->camera.camera.frustum_near, pd_camera->camera.camera.frustum_far);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(pf);
|
|
|
|
evas_canvas3d_node_position_set(ep->node, pf->type.node->point.x, pf->type.node->point.y, pf->type.node->point.z);
|
2015-06-22 02:17:26 -07:00
|
|
|
switch (pd_camera->camera.orientation.type)
|
|
|
|
{
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE:
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_QUATERNION:
|
|
|
|
{
|
|
|
|
SET_QUATERNION(camera)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_AT:
|
|
|
|
SET_LOOK_AT(camera)
|
|
|
|
break;
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_TO:
|
|
|
|
{
|
|
|
|
SET_LOOK_TO(camera)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_ANGLE_AXIS:
|
|
|
|
SET_ANGLE_AXIS(camera)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_LIGHT:
|
|
|
|
{
|
2015-06-29 06:13:58 -07:00
|
|
|
Evas_Canvas3D_Light *light_node = NULL;
|
2015-06-22 02:17:26 -07:00
|
|
|
Edje_Part_Description_Light *pd_light;
|
|
|
|
|
|
|
|
pd_light = (Edje_Part_Description_Light*) ep->chosen_description;
|
2016-03-01 10:02:49 -08:00
|
|
|
light_node = evas_canvas3d_node_light_get(ep->node);
|
|
|
|
|
|
|
|
evas_canvas3d_light_ambient_set(light_node, (float) pd_light->light.properties.ambient.r / 255, (float) pd_light->light.properties.ambient.g / 255, (float) pd_light->light.properties.ambient.b / 255, (float) pd_light->light.properties.ambient.a / 255);
|
|
|
|
evas_canvas3d_light_diffuse_set(light_node, (float) pd_light->light.properties.diffuse.r / 255, (float) pd_light->light.properties.diffuse.g / 255, (float) pd_light->light.properties.diffuse.b / 255, (float) pd_light->light.properties.diffuse.a / 255);
|
|
|
|
evas_canvas3d_light_specular_set(light_node, (float) pd_light->light.properties.specular.r / 255, (float) pd_light->light.properties.specular.g / 255, (float) pd_light->light.properties.specular.b / 255, (float) pd_light->light.properties.specular.a / 255);
|
|
|
|
evas_canvas3d_light_directional_set(light_node, EINA_TRUE);
|
|
|
|
evas_canvas3d_light_projection_perspective_set(light_node, pd_light->light.light.fovy, pd_light->light.light.aspect, pd_light->light.light.frustum_near, pd_light->light.light.frustum_far);
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(pf);
|
|
|
|
evas_canvas3d_node_position_set(ep->node, pf->type.node->point.x, pf->type.node->point.y, pf->type.node->point.z);
|
2015-06-22 02:17:26 -07:00
|
|
|
switch (pd_light->light.orientation.type)
|
|
|
|
{
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE:
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_QUATERNION:
|
|
|
|
{
|
|
|
|
SET_QUATERNION(light);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_AT:
|
|
|
|
SET_LOOK_AT(light)
|
|
|
|
break;
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_TO:
|
|
|
|
{
|
|
|
|
SET_LOOK_TO(light)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_ANGLE_AXIS:
|
|
|
|
SET_ANGLE_AXIS(light)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EDJE_PART_TYPE_MESH_NODE:
|
|
|
|
{
|
|
|
|
Evas_Canvas3D_Material *material = NULL;
|
|
|
|
Evas_Canvas3D_Texture *texture = NULL;
|
|
|
|
Evas_Canvas3D_Mesh *mesh = NULL;
|
|
|
|
const char *proxy;
|
|
|
|
Edje_Part_Description_Mesh_Node *pd_mesh_node;
|
|
|
|
const Eina_List *meshes;
|
|
|
|
const Eina_List *list;
|
2016-02-17 14:48:33 -08:00
|
|
|
Eina_Bool frame_exist;
|
2015-06-22 02:17:26 -07:00
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
meshes = evas_canvas3d_node_mesh_list_get(ep->node);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(meshes, list, mesh)
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
material = evas_canvas3d_mesh_frame_material_get(mesh, 0);
|
|
|
|
texture = evas_canvas3d_material_texture_get(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
pd_mesh_node = (Edje_Part_Description_Mesh_Node*) ep->chosen_description;
|
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE);
|
|
|
|
evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE);
|
|
|
|
evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE);
|
|
|
|
evas_canvas3d_material_enable_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, pd_mesh_node->mesh_node.properties.normal);
|
|
|
|
evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, (float) pd_mesh_node->mesh_node.properties.ambient.r / 255, (float) pd_mesh_node->mesh_node.properties.ambient.g / 255, (float) pd_mesh_node->mesh_node.properties.ambient.b / 255, (float) pd_mesh_node->mesh_node.properties.ambient.a / 255);
|
|
|
|
evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, (float) pd_mesh_node->mesh_node.properties.diffuse.r / 255, (float) pd_mesh_node->mesh_node.properties.diffuse.g / 255, (float) pd_mesh_node->mesh_node.properties.diffuse.b / 255, (float) pd_mesh_node->mesh_node.properties.diffuse.a / 255);
|
|
|
|
evas_canvas3d_material_color_set(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, (float) pd_mesh_node->mesh_node.properties.specular.r / 255, (float) pd_mesh_node->mesh_node.properties.specular.g / 255, (float) pd_mesh_node->mesh_node.properties.specular.b / 255, (float) pd_mesh_node->mesh_node.properties.specular.a / 255);
|
|
|
|
evas_canvas3d_material_shininess_set(material, pd_mesh_node->mesh_node.properties.shininess);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
switch(pd_mesh_node->mesh_node.mesh.primitive)
|
|
|
|
{
|
|
|
|
case EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE:
|
|
|
|
case EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE:
|
|
|
|
{
|
|
|
|
Eo *primitive = NULL;
|
2017-09-05 23:14:07 -07:00
|
|
|
primitive = efl_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, ed->base.evas);
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_primitive_form_set(primitive, pd_mesh_node->mesh_node.mesh.primitive);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(pf);
|
|
|
|
frame_exist = evas_canvas3d_mesh_frame_exist(mesh, pf->type.node->frame);
|
2016-02-17 14:48:33 -08:00
|
|
|
if (!frame_exist)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_canvas3d_mesh_frame_material_set(mesh, pf->type.node->frame, material);
|
2016-02-17 14:48:33 -08:00
|
|
|
}
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_mesh_from_primitive_set(mesh, 0, primitive);
|
2015-06-22 02:17:26 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pd_mesh_node->mesh_node.texture.need_texture && pd_mesh_node->mesh_node.texture.textured)
|
|
|
|
{
|
|
|
|
proxy = NULL;
|
|
|
|
|
2016-03-01 10:02:49 -08:00
|
|
|
texture = evas_canvas3d_material_texture_get(material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE);
|
2015-06-22 02:17:26 -07:00
|
|
|
|
|
|
|
//proxy = _edje_image_name_find(ed, pd_mesh_node->mesh_node.texture.id);
|
|
|
|
/*FIXME Conflict with function _edje_image_name_find (two places in edje_utils and edje_edit.c,
|
|
|
|
temporary desicion need to clarify up to commit to phab*/
|
|
|
|
proxy = ed->file->image_dir->entries[pd_mesh_node->mesh_node.texture.id].entry;
|
|
|
|
if (proxy)
|
|
|
|
{
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_texture_file_set(texture, eina_stringshare_add(proxy), NULL);
|
|
|
|
evas_canvas3d_texture_filter_set(texture, pd_mesh_node->mesh_node.texture.filter1, pd_mesh_node->mesh_node.texture.filter2);
|
|
|
|
evas_canvas3d_texture_wrap_set(texture, pd_mesh_node->mesh_node.texture.wrap1, pd_mesh_node->mesh_node.texture.wrap2);
|
2015-06-22 02:17:26 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_need_type_node(pf);
|
|
|
|
frame_exist = evas_canvas3d_mesh_frame_exist(mesh, pf->type.node->frame);
|
2016-02-17 14:48:33 -08:00
|
|
|
if (!frame_exist)
|
2016-03-03 04:23:04 -08:00
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_canvas3d_mesh_frame_add(mesh, pf->type.node->frame);
|
|
|
|
evas_canvas3d_mesh_frame_material_set(mesh, pf->type.node->frame, material);
|
2016-03-03 04:23:04 -08:00
|
|
|
}
|
2016-04-14 04:28:20 -07:00
|
|
|
evas_canvas3d_mesh_shader_mode_set(mesh, pd_mesh_node->mesh_node.properties.shade);
|
2016-03-01 10:02:49 -08:00
|
|
|
evas_canvas3d_mesh_vertex_assembly_set(mesh, pd_mesh_node->mesh_node.mesh.assembly);
|
2016-08-14 06:30:32 -07:00
|
|
|
evas_canvas3d_node_mesh_frame_set(ep->node, mesh, pf->type.node->frame);
|
|
|
|
evas_canvas3d_node_scale_set(ep->node, pf->type.node->scale_3d.x, pf->type.node->scale_3d.y, pf->type.node->scale_3d.z);
|
|
|
|
evas_canvas3d_node_position_set(ep->node, pf->type.node->point.x, pf->type.node->point.y, pf->type.node->point.z);
|
2015-06-22 02:17:26 -07:00
|
|
|
switch (pd_mesh_node->mesh_node.orientation.type)
|
|
|
|
{
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_NONE:
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_QUATERNION:
|
|
|
|
{
|
|
|
|
SET_QUATERNION(mesh_node)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_AT:
|
|
|
|
SET_LOOK_AT(mesh_node)
|
|
|
|
break;
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_LOOK_TO:
|
|
|
|
{
|
|
|
|
SET_LOOK_TO(mesh_node)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EVAS_CANVAS3D_NODE_ORIENTATION_TYPE_ANGLE_AXIS:
|
|
|
|
SET_ANGLE_AXIS(mesh_node)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Some object need special recalc. */
|
|
|
|
switch (ep->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_TEXT:
|
2015-06-17 00:26:30 -07:00
|
|
|
_edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc, EINA_FALSE);
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
|
|
|
|
2011-03-11 09:46:29 -08:00
|
|
|
case EDJE_PART_TYPE_PROXY:
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy *)chosen_desc, pos);
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_IMAGE:
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_image_recalc_apply(ed, ep, pf, (Edje_Part_Description_Image *)chosen_desc, pos);
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_BOX:
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_box_recalc_apply(ed, ep, pf, (Edje_Part_Description_Box *)chosen_desc);
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_TABLE:
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table *)chosen_desc);
|
|
|
|
break;
|
|
|
|
|
2012-08-27 01:59:11 -07:00
|
|
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
2015-06-08 11:43:00 -07:00
|
|
|
_edje_textblock_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text *)chosen_desc);
|
|
|
|
break;
|
|
|
|
|
2016-06-08 11:26:07 -07:00
|
|
|
case EDJE_PART_TYPE_VECTOR:
|
|
|
|
_edje_svg_recalc_apply(ed, ep, pf, (Edje_Part_Description_Vector *)chosen_desc, pos);
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
case EDJE_PART_TYPE_RECTANGLE:
|
|
|
|
case EDJE_PART_TYPE_SWALLOW:
|
2016-01-12 02:34:22 -08:00
|
|
|
case EDJE_PART_TYPE_GROUP:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* Nothing special to do for this type of object. */
|
|
|
|
break;
|
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
case EDJE_PART_TYPE_GRADIENT:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* FIXME: definitivly remove this code when we switch to new format. */
|
|
|
|
abort();
|
|
|
|
break;
|
|
|
|
|
2012-06-12 20:21:31 -07:00
|
|
|
case EDJE_PART_TYPE_SPACER:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* We really should do nothing on SPACER part */
|
|
|
|
break;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if (((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow)) &&
|
|
|
|
(ep->typedata.swallow->swallowed_object))
|
2012-08-14 00:59:06 -07:00
|
|
|
{
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
if (ed->has_state_clip)
|
|
|
|
{
|
|
|
|
if ((pf->ext) && (pf->ext->clip_to) && (pf->ext->clip_to->object))
|
|
|
|
evas_object_clip_set(ep->typedata.swallow->swallowed_object, pf->ext->clip_to->object);
|
|
|
|
else if (ep->part->clip_to_id >= 0)
|
|
|
|
evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->table_parts[ep->part->clip_to_id % ed->table_parts_size]->object);
|
|
|
|
else
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_object_clip_set(ep->typedata.swallow->swallowed_object, ed->base.clipper);
|
edje: Add workaround for misuses of clip_set
An unfortunately very common misuse of clip is as follows:
- Layout A is created (edje object / elm_layout)
- Object B is swallowed inside A
- Clipper C is set to clip B
This is a invalid usage, as layout A takes control over the clip
property of B (just like it does for geometry, visibility, color...).
Since 75ec3a7338c9c2406d4 edje_recalc resets the clip at every calc
loop, as it can change between states.
In the past, edje_recalc did not reset the clip so anyone could
(wrongly) swallow an object and then change its clip from C to modify
its color, mask it, blend it, etc... Even though this was not proper
use of the API, this is not very clearly documented, and since it
worked, it has been (ab)used a lot already.
The result now is that a clipper set from C will become visible
as an opaque white rectangle covering the entire UI. Booh.
This patch is a workaround that should have no impact on well
written applications. As a bonus this avoids an extra call to
clip_set() from edje.
@fix
2017-04-10 00:01:28 -07:00
|
|
|
}
|
Edje: Add clip as a property of a part description
Since masking, for performance and themeing reasons, it becomes
interesting to be able to switch clippers on the fly. In particular,
switching from an IMAGE mask to a standard RECT clipper can save a
lot of power when masking is not required.
This new flag "description.clip_to" will behave a bit like a mix of
rel.to and visible:
- It points to a part by name, just like part.clip_to. This will
override the clipper set by the part, or override the default clipper.
- Like "visible", it can not be interpolated between two values, so
it will switch only at the end of a transition.
- By default there is no clip override, which means Edje will fallback
to the part's clipper, if any, or the base (group's) clipper.
NOTE:
- Since a clipper that does not clip anything becomes a standard object,
it is visible and rendered. This will in 99.999% cases not be the
intended behaviour. Currently we can simply use a transparent RECT
in order to always have something clipped by the clipper, but this is
a hack and this will trigger rendering of masks in their surfaces even
when they are not actually used.
Ideally, there should be a flag indicating to Edje & Evas that an object
should be considered a clipper in all situations, and never be rendered
on screen.
TODO:
- Support Edje Edit
- Add Embryo & Lua functions
- Add support in edje_convert
- Add Edje/Evas flag to mark objects as "no_render"
@feature
2015-04-28 02:56:02 -07:00
|
|
|
|
2012-08-14 00:59:06 -07:00
|
|
|
if (pf->visible)
|
|
|
|
{
|
2014-05-26 09:23:29 -07:00
|
|
|
Eina_Bool vis = EINA_TRUE;
|
|
|
|
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
vis = evas_object_visible_get(ed->obj);
|
2017-09-14 20:14:32 -07:00
|
|
|
efl_gfx_position_set(ep->typedata.swallow->swallowed_object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y));
|
2016-03-01 10:02:49 -08:00
|
|
|
efl_gfx_size_set(ep->typedata.swallow->swallowed_object, pf->final.w, pf->final.h);
|
|
|
|
efl_gfx_visible_set(ep->typedata.swallow->swallowed_object, vis);
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
else evas_object_hide(ep->typedata.swallow->swallowed_object);
|
|
|
|
mo = ep->typedata.swallow->swallowed_object;
|
2012-08-14 00:59:06 -07:00
|
|
|
}
|
2010-02-16 08:20:15 -08:00
|
|
|
else mo = ep->object;
|
2016-07-08 05:16:16 -07:00
|
|
|
if (ep->part->type != EDJE_PART_TYPE_SPACER)
|
2010-02-16 08:20:15 -08:00
|
|
|
{
|
2014-12-23 21:51:03 -08:00
|
|
|
Evas_Object *map_obj;
|
|
|
|
|
|
|
|
/* Apply map to smart obj holding nested parts */
|
|
|
|
if (ep->nested_smart) map_obj = ep->nested_smart;
|
|
|
|
else map_obj = mo;
|
2016-07-08 05:16:16 -07:00
|
|
|
|
|
|
|
if (chosen_desc->map.on)
|
2015-06-08 11:43:00 -07:00
|
|
|
{
|
2016-07-08 05:16:16 -07:00
|
|
|
static Evas_Map *map = NULL;
|
|
|
|
|
|
|
|
ed->have_mapped_part = EINA_TRUE;
|
|
|
|
// create map and populate with part geometry
|
|
|
|
if (!map) map = evas_map_new(4);
|
|
|
|
|
|
|
|
_edje_map_prop_set(map, pf, chosen_desc, ep, mo);
|
|
|
|
|
|
|
|
if (map_obj)
|
2015-10-21 04:01:26 -07:00
|
|
|
{
|
2016-07-08 05:16:16 -07:00
|
|
|
evas_object_map_set(map_obj, map);
|
|
|
|
evas_object_map_enable_set(map_obj, EINA_TRUE);
|
2015-10-21 04:01:26 -07:00
|
|
|
}
|
2016-07-08 05:16:16 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Disable map only if map were enabled.
|
|
|
|
if (map_obj && evas_object_map_enable_get(map_obj))
|
2012-12-05 11:30:00 -08:00
|
|
|
{
|
2015-10-21 04:01:26 -07:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2016-07-08 05:16:16 -07:00
|
|
|
if (!ep->nested_smart && !ep->body)
|
2015-10-21 04:01:26 -07:00
|
|
|
{
|
2012-12-05 11:30:00 -08:00
|
|
|
#endif
|
2016-07-08 05:16:16 -07:00
|
|
|
evas_object_map_enable_set(mo, EINA_FALSE);
|
|
|
|
evas_object_map_set(mo, NULL);
|
2016-07-08 14:16:39 -07:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2015-10-21 04:01:26 -07:00
|
|
|
}
|
2016-07-08 14:16:39 -07:00
|
|
|
#endif
|
2015-10-21 04:01:26 -07:00
|
|
|
}
|
2012-09-04 04:27:43 -07:00
|
|
|
}
|
2010-02-16 08:20:15 -08:00
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-10-14 23:00:13 -07:00
|
|
|
if (map_colors_free) _map_colors_free(pf);
|
|
|
|
|
2012-12-05 11:30:00 -08:00
|
|
|
ep->prev_description = chosen_desc;
|
2017-03-13 22:06:24 -07:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2012-12-05 11:30:00 -08:00
|
|
|
if (!ep->body)
|
|
|
|
{
|
|
|
|
#endif
|
2015-10-20 02:07:21 -07:00
|
|
|
ep->x = pf->final.x;
|
|
|
|
ep->y = pf->final.y;
|
|
|
|
ep->w = pf->final.w;
|
|
|
|
ep->h = pf->final.h;
|
2012-12-05 11:29:33 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2015-10-20 02:07:21 -07:00
|
|
|
}
|
2012-12-05 11:29:33 -08:00
|
|
|
#endif
|
|
|
|
|
2012-12-05 11:30:00 -08:00
|
|
|
ep->calculated |= flags;
|
|
|
|
ep->calculating = FLAG_NONE;
|
2012-12-05 11:29:33 -08:00
|
|
|
|
2013-03-13 00:26:36 -07:00
|
|
|
if (pf == &lp3)
|
|
|
|
{
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_clear(&lp3);
|
2013-03-13 00:26:36 -07:00
|
|
|
}
|
|
|
|
|
2009-08-14 10:19:42 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
if (ep->calculated == FLAG_XY)
|
|
|
|
{
|
2012-08-14 00:59:06 -07:00
|
|
|
ep->state = ed->state;
|
2013-11-20 20:00:55 -08:00
|
|
|
ep->invalidate = EINA_FALSE;
|
2009-08-14 10:19:42 -07:00
|
|
|
}
|
2013-03-13 00:26:36 -07:00
|
|
|
#else
|
2016-08-14 06:30:32 -07:00
|
|
|
_edje_calc_params_clear(&lp1);
|
2013-03-13 01:38:57 -07:00
|
|
|
#endif
|
2016-08-14 06:30:32 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|