forked from enlightenment/efl
* edje: Starting refactor of edje_recalc_single.
SVN revision: 41706
This commit is contained in:
parent
caf64d8849
commit
3fe43bff2c
|
@ -270,104 +270,16 @@ _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_part_recalc_single(Edje *ed,
|
_edje_part_recalc_single_rel(Edje *ed,
|
||||||
Edje_Real_Part *ep,
|
Edje_Real_Part *ep,
|
||||||
Edje_Part_Description *desc,
|
Edje_Part_Description *desc,
|
||||||
Edje_Part_Description *chosen_desc,
|
|
||||||
Edje_Real_Part *rel1_to_x,
|
Edje_Real_Part *rel1_to_x,
|
||||||
Edje_Real_Part *rel1_to_y,
|
Edje_Real_Part *rel1_to_y,
|
||||||
Edje_Real_Part *rel2_to_x,
|
Edje_Real_Part *rel2_to_x,
|
||||||
Edje_Real_Part *rel2_to_y,
|
Edje_Real_Part *rel2_to_y,
|
||||||
Edje_Real_Part *confine_to,
|
|
||||||
Edje_Calc_Params *params,
|
Edje_Calc_Params *params,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
int minw = 0, minh = 0, maxw = 0, maxh = 0;
|
|
||||||
double sc;
|
|
||||||
|
|
||||||
flags = FLAG_XY;
|
|
||||||
|
|
||||||
sc = ed->scale;
|
|
||||||
if (sc == 0.0) sc = _edje_scale;
|
|
||||||
// if (flags & FLAG_X)
|
|
||||||
{
|
|
||||||
minw = desc->min.w;
|
|
||||||
if (ep->part->scale) minw = (int)(((double)minw) * sc);
|
|
||||||
if (ep->swallow_params.min.w > desc->min.w)
|
|
||||||
minw = ep->swallow_params.min.w;
|
|
||||||
|
|
||||||
/* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
|
|
||||||
if ((ep->swallow_params.max.w <= 0) ||
|
|
||||||
(ep->swallow_params.max.w == EDJE_INF_MAX_W))
|
|
||||||
{
|
|
||||||
maxw = desc->max.w;
|
|
||||||
if (maxw > 0)
|
|
||||||
{
|
|
||||||
if (ep->part->scale) maxw = (int)(((double)maxw) * sc);
|
|
||||||
if (maxw < 1) maxw = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (desc->max.w <= 0)
|
|
||||||
maxw = ep->swallow_params.max.w;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxw = desc->max.w;
|
|
||||||
if (maxw > 0)
|
|
||||||
{
|
|
||||||
if (ep->part->scale) maxw = (int)(((double)maxw) * sc);
|
|
||||||
if (maxw < 1) maxw = 1;
|
|
||||||
}
|
|
||||||
if (ep->swallow_params.max.w < maxw)
|
|
||||||
maxw = ep->swallow_params.max.w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (maxw >= 0)
|
|
||||||
{
|
|
||||||
if (maxw < minw) maxw = minw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if (flags & FLAG_Y)
|
|
||||||
{
|
|
||||||
minh = desc->min.h;
|
|
||||||
if (ep->part->scale) minh = (int)(((double)minh) * sc);
|
|
||||||
if (ep->swallow_params.min.h > desc->min.h)
|
|
||||||
minh = ep->swallow_params.min.h;
|
|
||||||
|
|
||||||
/* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
|
|
||||||
if ((ep->swallow_params.max.h <= 0) ||
|
|
||||||
(ep->swallow_params.max.h == EDJE_INF_MAX_H))
|
|
||||||
{
|
|
||||||
maxh = desc->max.h;
|
|
||||||
if (maxh > 0)
|
|
||||||
{
|
|
||||||
if (ep->part->scale) maxh = (int)(((double)maxh) * sc);
|
|
||||||
if (maxh < 1) maxh = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (desc->max.h <= 0)
|
|
||||||
maxh = ep->swallow_params.max.h;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxh = desc->max.h;
|
|
||||||
if (maxh > 0)
|
|
||||||
{
|
|
||||||
if (ep->part->scale) maxh = (int)(((double)maxh) * sc);
|
|
||||||
if (maxh < 1) maxh = 1;
|
|
||||||
}
|
|
||||||
if (ep->swallow_params.max.h < maxh)
|
|
||||||
maxh = ep->swallow_params.max.h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (maxh >= 0)
|
|
||||||
{
|
|
||||||
if (maxh < minh) maxh = minh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* relative coords of top left & bottom right */
|
|
||||||
if (flags & FLAG_X)
|
if (flags & FLAG_X)
|
||||||
{
|
{
|
||||||
if (rel1_to_x)
|
if (rel1_to_x)
|
||||||
|
@ -402,10 +314,15 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
(desc->rel2.relative_y * ed->h) -
|
(desc->rel2.relative_y * ed->h) -
|
||||||
params->y + 1;
|
params->y + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* aspect */
|
static void
|
||||||
if (((flags | ep->calculated) & FLAG_XY) == FLAG_XY)
|
_edje_part_recalc_single_aspect(Edje_Real_Part *ep,
|
||||||
{
|
Edje_Part_Description *desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int *minw, int *minh,
|
||||||
|
int *maxw, int *maxh)
|
||||||
|
{
|
||||||
int apref = -10;
|
int apref = -10;
|
||||||
double aspect, amax, amin;
|
double aspect, amax, amin;
|
||||||
double new_w = 0, new_h = 0, want_x, want_y, want_w, want_h;
|
double new_w = 0, new_h = 0, want_x, want_y, want_w, want_h;
|
||||||
|
@ -516,11 +433,11 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
|
|
||||||
if (!((amin > 0.0) && (amax > 0.0) && (apref == EDJE_ASPECT_PREFER_NONE)))
|
if (!((amin > 0.0) && (amax > 0.0) && (apref == EDJE_ASPECT_PREFER_NONE)))
|
||||||
{
|
{
|
||||||
if ((maxw >= 0) && (new_w > maxw)) new_w = maxw;
|
if ((*maxw >= 0) && (new_w > *maxw)) new_w = *maxw;
|
||||||
if (new_w < minw) new_w = minw;
|
if (new_w < *minw) new_w = *minw;
|
||||||
|
|
||||||
if ((maxh >= 0) && (new_h > maxh)) new_h = maxh;
|
if ((*maxh >= 0) && (new_h > *maxh)) new_h = *maxh;
|
||||||
if (new_h < minh) new_h = minh;
|
if (new_h < *minh) new_h = *minh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do real adjustment */
|
/* do real adjustment */
|
||||||
|
@ -588,9 +505,13 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
}
|
}
|
||||||
params->x = want_x + ((want_w - params->w) * desc->align.x);
|
params->x = want_x + ((want_w - params->w) * desc->align.x);
|
||||||
params->y = want_y + ((want_h - params->h) * desc->align.y);
|
params->y = want_y + ((want_h - params->h) * desc->align.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* size step */
|
static void
|
||||||
|
_edje_part_recalc_single_step(Edje_Part_Description *desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
if (flags & FLAG_X)
|
if (flags & FLAG_X)
|
||||||
{
|
{
|
||||||
if (desc->step.x > 0)
|
if (desc->step.x > 0)
|
||||||
|
@ -602,8 +523,7 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
new_w = desc->step.x * steps;
|
new_w = desc->step.x * steps;
|
||||||
if (params->w > new_w)
|
if (params->w > new_w)
|
||||||
{
|
{
|
||||||
params->x = params->x +
|
params->x += ((params->w - new_w) * desc->align.x);
|
||||||
((params->w - new_w) * desc->align.x);
|
|
||||||
params->w = new_w;
|
params->w = new_w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,14 +539,23 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
new_h = desc->step.y * steps;
|
new_h = desc->step.y * steps;
|
||||||
if (params->h > new_h)
|
if (params->h > new_h)
|
||||||
{
|
{
|
||||||
params->y = params->y +
|
params->y += ((params->h - new_h) * desc->align.y);
|
||||||
((params->h - new_h) * desc->align.y);
|
|
||||||
params->h = new_h;
|
params->h = new_h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if we have text that wants to make the min size the text size... */
|
}
|
||||||
if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK))
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_textblock(double sc,
|
||||||
|
Edje *ed,
|
||||||
|
Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description *chosen_desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int *minw, int *minh,
|
||||||
|
int *maxw, int *maxh)
|
||||||
|
{
|
||||||
|
if (chosen_desc)
|
||||||
{
|
{
|
||||||
Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
|
Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
|
||||||
const char *text = "";
|
const char *text = "";
|
||||||
|
@ -705,11 +634,11 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
mh = ins_t + th + ins_b;
|
mh = ins_t + th + ins_b;
|
||||||
// if (chosen_desc->text.min_x)
|
// if (chosen_desc->text.min_x)
|
||||||
{
|
{
|
||||||
if (mw > minw) minw = mw;
|
if (mw > *minw) *minw = mw;
|
||||||
}
|
}
|
||||||
// if (chosen_desc->text.min_y)
|
// if (chosen_desc->text.min_y)
|
||||||
{
|
{
|
||||||
if (mh > minh) minh = mh;
|
if (mh > *minh) *minh = mh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -730,19 +659,34 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
mh = ins_t + th + ins_b;
|
mh = ins_t + th + ins_b;
|
||||||
if (chosen_desc->text.max_x)
|
if (chosen_desc->text.max_x)
|
||||||
{
|
{
|
||||||
if (mw > maxw) maxw = mw;
|
if (mw > *maxw) *maxw = mw;
|
||||||
}
|
}
|
||||||
if (chosen_desc->text.max_y)
|
if (chosen_desc->text.max_y)
|
||||||
{
|
{
|
||||||
if (mh > maxw) maxh = mh;
|
if (mh > *maxw) *maxh = mh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((chosen_desc) && (ep->part->type == EDJE_PART_TYPE_TEXT))
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_text(double sc,
|
||||||
|
Edje *ed,
|
||||||
|
Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description *desc,
|
||||||
|
Edje_Part_Description *chosen_desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int *minw, int *minh,
|
||||||
|
int *maxw, int *maxh)
|
||||||
|
{
|
||||||
|
const char *font;
|
||||||
|
char *sfont = NULL;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
if (chosen_desc)
|
||||||
{
|
{
|
||||||
const char *text;
|
const char *text;
|
||||||
const char *font;
|
const char *font;
|
||||||
char *sfont = NULL;
|
|
||||||
int size;
|
int size;
|
||||||
Evas_Coord tw, th;
|
Evas_Coord tw, th;
|
||||||
int inlined_font = 0;
|
int inlined_font = 0;
|
||||||
|
@ -858,57 +802,52 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
int l, r;
|
int l, r;
|
||||||
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
||||||
mw = tw + l + r;
|
mw = tw + l + r;
|
||||||
if ((maxw < 0) || (mw < maxw)) maxw = mw;
|
if ((*maxw < 0) || (mw < *maxw)) *maxw = mw;
|
||||||
}
|
}
|
||||||
if (chosen_desc->text.max_y)
|
if (chosen_desc->text.max_y)
|
||||||
{
|
{
|
||||||
int t, b;
|
int t, b;
|
||||||
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
||||||
mh = th + t + b;
|
mh = th + t + b;
|
||||||
if ((maxh < 0) || (mh < maxh)) maxh = mh;
|
if ((*maxh < 0) || (mh < *maxh)) *maxh = mh;
|
||||||
}
|
}
|
||||||
if (chosen_desc->text.min_x)
|
if (chosen_desc->text.min_x)
|
||||||
{
|
{
|
||||||
int l, r;
|
int l, r;
|
||||||
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
evas_object_text_style_pad_get(ep->object, &l, &r, NULL, NULL);
|
||||||
mw = tw + l + r;
|
mw = tw + l + r;
|
||||||
if (mw > minw) minw = mw;
|
if (mw > *minw) *minw = mw;
|
||||||
}
|
}
|
||||||
if (chosen_desc->text.min_y)
|
if (chosen_desc->text.min_y)
|
||||||
{
|
{
|
||||||
int t, b;
|
int t, b;
|
||||||
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
evas_object_text_style_pad_get(ep->object, NULL, NULL, &t, &b);
|
||||||
mh = th + t + b;
|
mh = th + t + b;
|
||||||
if (mh > minh) minh = mh;
|
if (mh > *minh) *minh = mh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sfont) free(sfont);
|
if (sfont) free(sfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep->part->type == EDJE_PART_TYPE_TEXT)
|
/* FIXME: Do we really need to call it twice if chosen_desc ? */
|
||||||
{
|
|
||||||
const char *font;
|
|
||||||
char *sfont = NULL;
|
|
||||||
int size;
|
|
||||||
|
|
||||||
font = _edje_text_class_font_get(ed, desc, &size, &sfont);
|
font = _edje_text_class_font_get(ed, desc, &size, &sfont);
|
||||||
free(sfont);
|
free(sfont);
|
||||||
params->type.text.size = size;
|
params->type.text.size = size;
|
||||||
}
|
}
|
||||||
/* rememebr what our size is BEFORE we go limit it */
|
|
||||||
params->req.x = params->x;
|
static void
|
||||||
params->req.y = params->y;
|
_edje_part_recalc_single_min(Edje_Part_Description *desc,
|
||||||
params->req.w = params->w;
|
Edje_Calc_Params *params,
|
||||||
params->req.h = params->h;
|
int minw, int minh,
|
||||||
/* adjust for min size */
|
int flags)
|
||||||
|
{
|
||||||
if (flags & FLAG_X)
|
if (flags & FLAG_X)
|
||||||
{
|
{
|
||||||
if (minw >= 0)
|
if (minw >= 0)
|
||||||
{
|
{
|
||||||
if (params->w < minw)
|
if (params->w < minw)
|
||||||
{
|
{
|
||||||
params->x = params->x +
|
params->x += ((params->w - minw) * desc->align.x);
|
||||||
((params->w - minw) * desc->align.x);
|
|
||||||
params->w = minw;
|
params->w = minw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,13 +858,19 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
{
|
{
|
||||||
if (params->h < minh)
|
if (params->h < minh)
|
||||||
{
|
{
|
||||||
params->y = params->y +
|
params->y += ((params->h - minh) * desc->align.y);
|
||||||
((params->h - minh) * desc->align.y);
|
|
||||||
params->h = minh;
|
params->h = minh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* adjust for max size */
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single_max(Edje_Part_Description *desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int maxw, int maxh,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
if (flags & FLAG_X)
|
if (flags & FLAG_X)
|
||||||
{
|
{
|
||||||
if (maxw >= 0)
|
if (maxw >= 0)
|
||||||
|
@ -950,9 +895,16 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ep->drag)
|
static void
|
||||||
{
|
_edje_part_recalc_single_drag(Edje_Real_Part *ep,
|
||||||
|
Edje_Real_Part *confine_to,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int minw, int minh,
|
||||||
|
int maxw, int maxh,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
/* confine */
|
/* confine */
|
||||||
if (confine_to)
|
if (confine_to)
|
||||||
{
|
{
|
||||||
|
@ -1051,9 +1003,14 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
params->req_drag.h = params->h;
|
params->req_drag.h = params->h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill */
|
static void
|
||||||
|
_edje_part_recalc_single_fill(Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description *desc,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
if (ep->part->type == EDJE_PART_TYPE_GRADIENT && desc->gradient.use_rel && (!desc->gradient.type || !strcmp(desc->gradient.type, "linear")))
|
if (ep->part->type == EDJE_PART_TYPE_GRADIENT && desc->gradient.use_rel && (!desc->gradient.type || !strcmp(desc->gradient.type, "linear")))
|
||||||
{
|
{
|
||||||
int x2, y2;
|
int x2, y2;
|
||||||
|
@ -1129,41 +1086,174 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
params->fill.angle = desc->fill.angle;
|
params->fill.angle = desc->fill.angle;
|
||||||
params->fill.spread = desc->fill.spread;
|
params->fill.spread = desc->fill.spread;
|
||||||
}
|
}
|
||||||
/* colors */
|
|
||||||
|
|
||||||
params->color.r = desc->color.r;
|
}
|
||||||
params->color.g = desc->color.g;
|
|
||||||
params->color.b = desc->color.b;
|
|
||||||
params->color.a = desc->color.a;
|
|
||||||
params->color2.r = desc->color2.r;
|
|
||||||
params->color2.g = desc->color2.g;
|
|
||||||
params->color2.b = desc->color2.b;
|
|
||||||
params->color2.a = desc->color2.a;
|
|
||||||
params->color3.r = desc->color3.r;
|
|
||||||
params->color3.g = desc->color3.g;
|
|
||||||
params->color3.b = desc->color3.b;
|
|
||||||
params->color3.a = desc->color3.a;
|
|
||||||
|
|
||||||
if ((desc->color_class) && (*desc->color_class))
|
static void
|
||||||
|
_edje_part_recalc_single_min_max(double sc,
|
||||||
|
Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description *desc,
|
||||||
|
int *minw, int *minh,
|
||||||
|
int *maxw, int *maxh,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
// if (flags & FLAG_X)
|
||||||
{
|
{
|
||||||
Edje_Color_Class *cc;
|
*minw = desc->min.w;
|
||||||
|
if (ep->part->scale) *minw = (int)(((double)*minw) * sc);
|
||||||
|
if (ep->swallow_params.min.w > desc->min.w)
|
||||||
|
*minw = ep->swallow_params.min.w;
|
||||||
|
|
||||||
|
/* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
|
||||||
|
if ((ep->swallow_params.max.w <= 0) ||
|
||||||
|
(ep->swallow_params.max.w == EDJE_INF_MAX_W))
|
||||||
|
{
|
||||||
|
*maxw = desc->max.w;
|
||||||
|
if (*maxw > 0)
|
||||||
|
{
|
||||||
|
if (ep->part->scale) *maxw = (int)(((double)*maxw) * sc);
|
||||||
|
if (*maxw < 1) *maxw = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (desc->max.w <= 0)
|
||||||
|
*maxw = ep->swallow_params.max.w;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*maxw = desc->max.w;
|
||||||
|
if (maxw > 0)
|
||||||
|
{
|
||||||
|
if (ep->part->scale) *maxw = (int)(((double)*maxw) * sc);
|
||||||
|
if (*maxw < 1) *maxw = 1;
|
||||||
|
}
|
||||||
|
if (ep->swallow_params.max.w < *maxw)
|
||||||
|
*maxw = ep->swallow_params.max.w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*maxw >= 0)
|
||||||
|
{
|
||||||
|
if (*maxw < *minw) *maxw = *minw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (flags & FLAG_Y)
|
||||||
|
{
|
||||||
|
*minh = desc->min.h;
|
||||||
|
if (ep->part->scale) *minh = (int)(((double)*minh) * sc);
|
||||||
|
if (ep->swallow_params.min.h > desc->min.h)
|
||||||
|
*minh = ep->swallow_params.min.h;
|
||||||
|
|
||||||
|
/* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
|
||||||
|
if ((ep->swallow_params.max.h <= 0) ||
|
||||||
|
(ep->swallow_params.max.h == EDJE_INF_MAX_H))
|
||||||
|
{
|
||||||
|
*maxh = desc->max.h;
|
||||||
|
if (*maxh > 0)
|
||||||
|
{
|
||||||
|
if (ep->part->scale) *maxh = (int)(((double)*maxh) * sc);
|
||||||
|
if (*maxh < 1) *maxh = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (desc->max.h <= 0)
|
||||||
|
*maxh = ep->swallow_params.max.h;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*maxh = desc->max.h;
|
||||||
|
if (*maxh > 0)
|
||||||
|
{
|
||||||
|
if (ep->part->scale) *maxh = (int)(((double)*maxh) * sc);
|
||||||
|
if (*maxh < 1) *maxh = 1;
|
||||||
|
}
|
||||||
|
if (ep->swallow_params.max.h < *maxh)
|
||||||
|
*maxh = ep->swallow_params.max.h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*maxh >= 0)
|
||||||
|
{
|
||||||
|
if (*maxh < *minh) *maxh = *minh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edje_part_recalc_single(Edje *ed,
|
||||||
|
Edje_Real_Part *ep,
|
||||||
|
Edje_Part_Description *desc,
|
||||||
|
Edje_Part_Description *chosen_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_Real_Part *confine_to,
|
||||||
|
Edje_Calc_Params *params,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
Edje_Color_Class *cc = NULL;
|
||||||
|
int minw = 0, minh = 0, maxw = 0, maxh = 0;
|
||||||
|
double sc;
|
||||||
|
|
||||||
|
flags = FLAG_XY;
|
||||||
|
|
||||||
|
sc = ed->scale;
|
||||||
|
if (sc == 0.0) sc = _edje_scale;
|
||||||
|
_edje_part_recalc_single_min_max(sc, ep, desc, &minw, &minh, &maxw, &maxh, flags);
|
||||||
|
|
||||||
|
/* relative coords of top left & bottom right */
|
||||||
|
_edje_part_recalc_single_rel(ed, ep, desc, rel1_to_x, rel1_to_y, rel2_to_x, rel2_to_y, params, flags);
|
||||||
|
|
||||||
|
/* aspect */
|
||||||
|
if (((flags | ep->calculated) & FLAG_XY) == FLAG_XY)
|
||||||
|
_edje_part_recalc_single_aspect(ep, desc, params, &minw, &minh, &maxw, &maxh);
|
||||||
|
|
||||||
|
/* size step */
|
||||||
|
_edje_part_recalc_single_step(desc, params, flags);
|
||||||
|
|
||||||
|
/* if we have text that wants to make the min size the text size... */
|
||||||
|
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||||
|
_edje_part_recalc_single_textblock(sc, ed, ep, chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
||||||
|
else if (ep->part->type == EDJE_PART_TYPE_TEXT)
|
||||||
|
_edje_part_recalc_single_text(sc, ed, ep, desc, chosen_desc, params, &minw, &minh, &maxw, &maxh);
|
||||||
|
|
||||||
|
/* remember what our size is BEFORE we go limit it */
|
||||||
|
params->req.x = params->x;
|
||||||
|
params->req.y = params->y;
|
||||||
|
params->req.w = params->w;
|
||||||
|
params->req.h = params->h;
|
||||||
|
|
||||||
|
/* adjust for min size */
|
||||||
|
_edje_part_recalc_single_min(desc, params, minw, minh, flags);
|
||||||
|
|
||||||
|
/* adjust for max size */
|
||||||
|
_edje_part_recalc_single_max(desc, params, maxw, maxh, flags);
|
||||||
|
|
||||||
|
/* take care of dragable part */
|
||||||
|
if (ep->drag)
|
||||||
|
_edje_part_recalc_single_drag(ep, confine_to, params, minw, minh, maxw, maxh, flags);
|
||||||
|
|
||||||
|
/* fill */
|
||||||
|
if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
|
||||||
|
ep->part->type == EDJE_PART_TYPE_GRADIENT)
|
||||||
|
_edje_part_recalc_single_fill(ep, desc, params, flags);
|
||||||
|
|
||||||
|
/* colors */
|
||||||
|
if ((desc->color_class) && (*desc->color_class))
|
||||||
cc = _edje_color_class_find(ed, desc->color_class);
|
cc = _edje_color_class_find(ed, desc->color_class);
|
||||||
|
|
||||||
if (cc)
|
if (cc)
|
||||||
{
|
{
|
||||||
params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
|
params->color.r = (((int)cc->r + 1) * desc->color.r) >> 8;
|
||||||
params->color.g = (((int)cc->g + 1) * desc->color.g) >> 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.b = (((int)cc->b + 1) * desc->color.b) >> 8;
|
||||||
params->color.a = (((int)cc->a + 1) * desc->color.a) >> 8;
|
params->color.a = (((int)cc->a + 1) * desc->color.a) >> 8;
|
||||||
params->color2.r = (((int)cc->r2 + 1) * desc->color2.r) >> 8;
|
|
||||||
params->color2.g = (((int)cc->g2 + 1) * desc->color2.g) >> 8;
|
|
||||||
params->color2.b = (((int)cc->b2 + 1) * desc->color2.b) >> 8;
|
|
||||||
params->color2.a = (((int)cc->a2 + 1) * desc->color2.a) >> 8;
|
|
||||||
params->color3.r = (((int)cc->r3 + 1) * desc->color3.r) >> 8;
|
|
||||||
params->color3.g = (((int)cc->g3 + 1) * desc->color3.g) >> 8;
|
|
||||||
params->color3.b = (((int)cc->b3 + 1) * desc->color3.b) >> 8;
|
|
||||||
params->color3.a = (((int)cc->a3 + 1) * desc->color3.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 */
|
/* visible */
|
||||||
|
@ -1200,6 +1290,30 @@ _edje_part_recalc_single(Edje *ed,
|
||||||
params->type.text.align.y = desc->text.align.y;
|
params->type.text.align.y = desc->text.align.y;
|
||||||
}
|
}
|
||||||
params->type.text.elipsis = desc->text.elipsis;
|
params->type.text.elipsis = desc->text.elipsis;
|
||||||
|
|
||||||
|
/* text colors */
|
||||||
|
if (cc)
|
||||||
|
{
|
||||||
|
params->color2.r = (((int)cc->r2 + 1) * desc->color2.r) >> 8;
|
||||||
|
params->color2.g = (((int)cc->g2 + 1) * desc->color2.g) >> 8;
|
||||||
|
params->color2.b = (((int)cc->b2 + 1) * desc->color2.b) >> 8;
|
||||||
|
params->color2.a = (((int)cc->a2 + 1) * desc->color2.a) >> 8;
|
||||||
|
params->color3.r = (((int)cc->r3 + 1) * desc->color3.r) >> 8;
|
||||||
|
params->color3.g = (((int)cc->g3 + 1) * desc->color3.g) >> 8;
|
||||||
|
params->color3.b = (((int)cc->b3 + 1) * desc->color3.b) >> 8;
|
||||||
|
params->color3.a = (((int)cc->a3 + 1) * desc->color3.a) >> 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
params->color2.r = desc->color2.r;
|
||||||
|
params->color2.g = desc->color2.g;
|
||||||
|
params->color2.b = desc->color2.b;
|
||||||
|
params->color2.a = desc->color2.a;
|
||||||
|
params->color3.r = desc->color3.r;
|
||||||
|
params->color3.g = desc->color3.g;
|
||||||
|
params->color3.b = desc->color3.b;
|
||||||
|
params->color3.a = desc->color3.a;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_RECTANGLE:
|
case EDJE_PART_TYPE_RECTANGLE:
|
||||||
case EDJE_PART_TYPE_BOX:
|
case EDJE_PART_TYPE_BOX:
|
||||||
|
|
Loading…
Reference in New Issue