forked from enlightenment/efl
Evas textblock: Moved item (of type SIZE) size calculation to actual line finalizing because it depends on the object scale and where it was before will break when scale changes.
SVN revision: 56514
This commit is contained in:
parent
fb07723f3d
commit
80004f3d0b
|
@ -2202,31 +2202,52 @@ _layout_line_finalize(Ctxt *c, Evas_Object_Textblock_Format *fmt)
|
||||||
if (!fi->formatme) continue;
|
if (!fi->formatme) continue;
|
||||||
fi->ascent = c->maxascent;
|
fi->ascent = c->maxascent;
|
||||||
fi->descent = c->maxdescent;
|
fi->descent = c->maxdescent;
|
||||||
/* Adjust relsize */
|
/* Adjust sizes according to current line height/scale */
|
||||||
if (fi->size == SIZE_REL)
|
|
||||||
{
|
{
|
||||||
Evas_Coord w = 1, h = 1;
|
Evas_Coord w, h;
|
||||||
const char *p, *s;
|
const char *p, *s;
|
||||||
|
|
||||||
s = eina_strbuf_string_get(fi->source_node->format);
|
s = eina_strbuf_string_get(fi->source_node->format);
|
||||||
p = strstr((char *) s, " relsize=");
|
w = fi->parent.w;
|
||||||
p += 9;
|
h = fi->parent.h;
|
||||||
if (sscanf(p, "%ix%i", &w, &h) == 2)
|
switch (fi->size)
|
||||||
{
|
{
|
||||||
int sz = 1;
|
case SIZE:
|
||||||
if (fi->vsize == VSIZE_FULL)
|
p = strstr(s, " size=");
|
||||||
{
|
p += 6;
|
||||||
sz = c->maxdescent + c->maxascent;
|
if (sscanf(p, "%ix%i", &w, &h) == 2)
|
||||||
}
|
{
|
||||||
else if (fi->vsize == VSIZE_ASCENT)
|
w = w * c->obj->cur.scale;
|
||||||
{
|
h = h * c->obj->cur.scale;
|
||||||
sz = c->maxascent;
|
}
|
||||||
}
|
break;
|
||||||
w = (w * sz) / h;
|
case SIZE_REL:
|
||||||
h = sz;
|
p = strstr((char *) s, " relsize=");
|
||||||
|
p += 9;
|
||||||
|
if (sscanf(p, "%ix%i", &w, &h) == 2)
|
||||||
|
{
|
||||||
|
int sz = 1;
|
||||||
|
if (fi->vsize == VSIZE_FULL)
|
||||||
|
{
|
||||||
|
sz = c->maxdescent + c->maxascent;
|
||||||
|
}
|
||||||
|
else if (fi->vsize == VSIZE_ASCENT)
|
||||||
|
{
|
||||||
|
sz = c->maxascent;
|
||||||
|
}
|
||||||
|
w = (w * sz) / h;
|
||||||
|
h = sz;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SIZE_ABS:
|
||||||
|
/* Nothing to do */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
fi->parent.w = fi->parent.adv = w;
|
fi->parent.w = fi->parent.adv = w;
|
||||||
fi->parent.h = h;
|
fi->parent.h = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fi->size)
|
switch (fi->size)
|
||||||
{
|
{
|
||||||
case SIZE:
|
case SIZE:
|
||||||
|
@ -2815,7 +2836,7 @@ _layout_format_item_add(Ctxt *c, Evas_Object_Textblock_Node_Format *n, const cha
|
||||||
* @param style_pad_b the pad to update.
|
* @param style_pad_b the pad to update.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
_layout_do_format(const Evas_Object *obj, Ctxt *c,
|
_layout_do_format(const Evas_Object *obj __UNUSED__, Ctxt *c,
|
||||||
Evas_Object_Textblock_Format **_fmt, Evas_Object_Textblock_Node_Format *n,
|
Evas_Object_Textblock_Format **_fmt, Evas_Object_Textblock_Node_Format *n,
|
||||||
int *style_pad_l, int *style_pad_r, int *style_pad_t, int *style_pad_b)
|
int *style_pad_l, int *style_pad_r, int *style_pad_t, int *style_pad_b)
|
||||||
{
|
{
|
||||||
|
@ -2866,8 +2887,10 @@ _layout_do_format(const Evas_Object *obj, Ctxt *c,
|
||||||
p += 6;
|
p += 6;
|
||||||
if (sscanf(p, "%ix%i", &w, &h) == 2)
|
if (sscanf(p, "%ix%i", &w, &h) == 2)
|
||||||
{
|
{
|
||||||
w = w * obj->cur.scale;
|
/* this is handled somewhere else because it depends
|
||||||
h = h * obj->cur.scale;
|
* on the current scaling factor of the object which
|
||||||
|
* may change and break because the results of this
|
||||||
|
* function are cached */
|
||||||
size = SIZE;
|
size = SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2887,8 +2910,11 @@ _layout_do_format(const Evas_Object *obj, Ctxt *c,
|
||||||
p = strstr(s, " relsize=");
|
p = strstr(s, " relsize=");
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
/* relsize in handled somewhere else, pretty hacky, but
|
/* this is handled somewhere else because it depends
|
||||||
* couldn't think of another solution atm. */
|
* on the line it resides in, which is not defined
|
||||||
|
* at this point and will change anyway, which will
|
||||||
|
* break because the results of this function are
|
||||||
|
* cached */
|
||||||
size = SIZE_REL;
|
size = SIZE_REL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue