forked from enlightenment/efl
Evas textblock: Fixed line coords to be relative to the paragraphs coords and not standalone like they were.
SVN revision: 56489
This commit is contained in:
parent
6f24144e55
commit
50ed367970
|
@ -2212,7 +2212,7 @@ _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt,
|
||||||
if (endx > c->ln->w) c->ln->w = endx;
|
if (endx > c->ln->w) c->ln->w = endx;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->ln->y = c->y + c->o->style_pad.t;
|
c->ln->y = (c->y - c->par->y) + c->o->style_pad.t;
|
||||||
c->ln->h = c->maxascent + c->maxdescent;
|
c->ln->h = c->maxascent + c->maxdescent;
|
||||||
c->ln->baseline = c->maxascent;
|
c->ln->baseline = c->maxascent;
|
||||||
if (c->have_underline2)
|
if (c->have_underline2)
|
||||||
|
@ -2233,7 +2233,7 @@ _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt,
|
||||||
c->y += c->maxascent + c->maxdescent;
|
c->y += c->maxascent + c->maxdescent;
|
||||||
if (c->w >= 0)
|
if (c->w >= 0)
|
||||||
{
|
{
|
||||||
c->ln->x = c->marginl + c->o->style_pad.l +
|
c->ln->x = c->par->x + c->marginl + c->o->style_pad.l +
|
||||||
((c->w - c->ln->w -
|
((c->w - c->ln->w -
|
||||||
c->o->style_pad.l - c->o->style_pad.r -
|
c->o->style_pad.l - c->o->style_pad.r -
|
||||||
c->marginl - c->marginr) * _layout_line_align_get(c));
|
c->marginl - c->marginr) * _layout_line_align_get(c));
|
||||||
|
@ -2242,15 +2242,12 @@ _layout_line_advance(Ctxt *c, Evas_Object_Textblock_Format *fmt,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c->ln->x = c->marginl + c->o->style_pad.l;
|
c->ln->x = c->par->x + c->marginl + c->o->style_pad.l;
|
||||||
if ((c->ln->x + c->ln->w + c->marginr - c->o->style_pad.l) > c->wmax)
|
if ((c->ln->x + c->ln->w + c->marginr - c->o->style_pad.l) > c->wmax)
|
||||||
c->wmax = c->ln->x + c->ln->w + c->marginl + c->marginr - c->o->style_pad.l;
|
c->wmax = c->ln->x + c->ln->w + c->marginl + c->marginr - c->o->style_pad.l;
|
||||||
}
|
}
|
||||||
c->par->h += c->ln->h;
|
c->par->h += c->ln->h;
|
||||||
if (c->par->w < c->ln->w)
|
c->par->w = c->w;
|
||||||
{
|
|
||||||
c->par->w = c->ln->w;
|
|
||||||
}
|
|
||||||
if (add_line)
|
if (add_line)
|
||||||
_layout_line_new(c, fmt);
|
_layout_line_new(c, fmt);
|
||||||
}
|
}
|
||||||
|
@ -3213,7 +3210,7 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ln->y + ln->h) > c->hmax) c->hmax = ln->y + ln->h;
|
if ((ln->par->y + ln->y + ln->h) > c->hmax) c->hmax = ln->par->y + ln->y + ln->h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Remove the lines we marked for removal, mostly lines added after
|
/* Remove the lines we marked for removal, mostly lines added after
|
||||||
|
@ -6836,8 +6833,8 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
|
||||||
if (!o->paragraphs) return -1;
|
if (!o->paragraphs) return -1;
|
||||||
ln = o->paragraphs->lines;
|
ln = o->paragraphs->lines;
|
||||||
if (!ln) return -1;
|
if (!ln) return -1;
|
||||||
if (cx) *cx = ln->x;
|
if (cx) *cx = ln->par->x + ln->x;
|
||||||
if (cy) *cy = ln->y;
|
if (cy) *cy = ln->par->y + ln->y;
|
||||||
if (cw) *cw = ln->w;
|
if (cw) *cw = ln->w;
|
||||||
if (ch) *ch = ln->h;
|
if (ch) *ch = ln->h;
|
||||||
return ln->par->line_no + ln->line_no;
|
return ln->par->line_no + ln->line_no;
|
||||||
|
@ -6876,13 +6873,13 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
|
||||||
&x, &y, &w, &h);
|
&x, &y, &w, &h);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += ln->x + _ITEM(ti)->x;
|
x += ln->par->x + ln->x + _ITEM(ti)->x;
|
||||||
|
|
||||||
if (x < ln->x)
|
if (x < ln->par->x + ln->x)
|
||||||
{
|
{
|
||||||
x = ln->x;
|
x = ln->par->x + ln->x;
|
||||||
}
|
}
|
||||||
y = ln->y;
|
y = ln->par->y + ln->y;
|
||||||
h = ln->h;
|
h = ln->h;
|
||||||
}
|
}
|
||||||
else if (ln && fi)
|
else if (ln && fi)
|
||||||
|
@ -6893,7 +6890,7 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
|
||||||
eina_strbuf_string_get(fi->source_node->format)))
|
eina_strbuf_string_get(fi->source_node->format)))
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
y = ln->y + ln->h;
|
y = ln->par->y + ln->y + ln->h;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -6901,22 +6898,22 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
|
||||||
if (EVAS_BIDI_PARAGRAPH_DIRECTION_IS_RTL(
|
if (EVAS_BIDI_PARAGRAPH_DIRECTION_IS_RTL(
|
||||||
fi->parent.text_node->bidi_props))
|
fi->parent.text_node->bidi_props))
|
||||||
{
|
{
|
||||||
x = ln->x;
|
x = ln->par->x + ln->x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
x = ln->x + ln->w;
|
x = ln->par->x + ln->x + ln->w;
|
||||||
}
|
}
|
||||||
y = ln->y;
|
y = ln->par->y + ln->y;
|
||||||
}
|
}
|
||||||
w = 0;
|
w = 0;
|
||||||
h = ln->h;
|
h = ln->h;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = ln->x + _ITEM(fi)->x;
|
x = ln->par->x + ln->x + _ITEM(fi)->x;
|
||||||
y = ln->y;
|
y = ln->par->y + ln->y;
|
||||||
w = _ITEM(fi)->w;
|
w = _ITEM(fi)->w;
|
||||||
h = ln->h;
|
h = ln->h;
|
||||||
}
|
}
|
||||||
|
@ -6996,8 +6993,8 @@ evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C
|
||||||
_find_layout_item_match(cur, &ln, &it);
|
_find_layout_item_match(cur, &ln, &it);
|
||||||
}
|
}
|
||||||
if (!ln) return -1;
|
if (!ln) return -1;
|
||||||
x = ln->x;
|
x = ln->par->x + ln->x;
|
||||||
y = ln->y;
|
y = ln->par->y + ln->y;
|
||||||
w = ln->w;
|
w = ln->w;
|
||||||
h = ln->h;
|
h = ln->h;
|
||||||
if (cx) *cx = x;
|
if (cx) *cx = x;
|
||||||
|
@ -7041,17 +7038,17 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, E
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(found_par->lines, ln)
|
EINA_INLIST_FOREACH(found_par->lines, ln)
|
||||||
{
|
{
|
||||||
if (ln->y > y) break;
|
if (ln->par->y + ln->y > y) break;
|
||||||
if ((ln->y <= y) && ((ln->y + ln->h) > y))
|
if ((ln->par->y + ln->y <= y) && ((ln->par->y + ln->y + ln->h) > y))
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(ln->items, it)
|
EINA_INLIST_FOREACH(ln->items, it)
|
||||||
{
|
{
|
||||||
if ((it->x + ln->x) > x)
|
if ((it->x + ln->par->x + ln->x) > x)
|
||||||
{
|
{
|
||||||
it_break = it;
|
it_break = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (((it->x + ln->x) <= x) && (((it->x + ln->x) + it->adv) > x))
|
if (((it->x + ln->par->x + ln->x) <= x) && (((it->x + ln->par->x + ln->x) + it->adv) > x))
|
||||||
{
|
{
|
||||||
if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
|
if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
|
||||||
{
|
{
|
||||||
|
@ -7066,7 +7063,7 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, E
|
||||||
cur->ENDT,
|
cur->ENDT,
|
||||||
ti->format->font.font,
|
ti->format->font.font,
|
||||||
ti->text, &ti->parent.text_props,
|
ti->text, &ti->parent.text_props,
|
||||||
x - it->x - ln->x, 0,
|
x - it->x - ln->par->x - ln->x, 0,
|
||||||
&cx, &cy, &cw, &ch);
|
&cx, &cy, &cw, &ch);
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -7138,8 +7135,8 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y)
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(found_par->lines, ln)
|
EINA_INLIST_FOREACH(found_par->lines, ln)
|
||||||
{
|
{
|
||||||
if (ln->y > y) break;
|
if (ln->par->y + ln->y > y) break;
|
||||||
if ((ln->y <= y) && ((ln->y + ln->h) > y))
|
if ((ln->par->y + ln->y <= y) && ((ln->par->y + ln->y + ln->h) > y))
|
||||||
{
|
{
|
||||||
evas_textblock_cursor_line_set(cur, ln->par->line_no +
|
evas_textblock_cursor_line_set(cur, ln->par->line_no +
|
||||||
ln->line_no);
|
ln->line_no);
|
||||||
|
@ -7324,8 +7321,8 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
{
|
{
|
||||||
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
||||||
rects = eina_list_append(rects, tr);
|
rects = eina_list_append(rects, tr);
|
||||||
tr->x = ln->x + it1->x + x;
|
tr->x = ln->par->x + ln->x + it1->x + x;
|
||||||
tr->y = ln->y;
|
tr->y = ln->par->y + ln->y;
|
||||||
tr->h = ln->h;
|
tr->h = ln->h;
|
||||||
tr->w = w;
|
tr->w = w;
|
||||||
}
|
}
|
||||||
|
@ -7372,8 +7369,8 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
{
|
{
|
||||||
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
||||||
rects = eina_list_append(rects, tr);
|
rects = eina_list_append(rects, tr);
|
||||||
tr->x = ln->x + it1->x + x;
|
tr->x = ln->par->x + ln->x + it1->x + x;
|
||||||
tr->y = ln->y;
|
tr->y = ln->par->y + ln->y;
|
||||||
tr->h = ln->h;
|
tr->h = ln->h;
|
||||||
tr->w = w;
|
tr->w = w;
|
||||||
}
|
}
|
||||||
|
@ -7387,8 +7384,8 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
{
|
{
|
||||||
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
||||||
rects = eina_list_append(rects, tr);
|
rects = eina_list_append(rects, tr);
|
||||||
tr->x = ln->x + min_x;
|
tr->x = ln->par->x + ln->x + min_x;
|
||||||
tr->y = ln->y;
|
tr->y = ln->par->y + ln->y;
|
||||||
tr->h = ln->h;
|
tr->h = ln->h;
|
||||||
tr->w = max_x - min_x;
|
tr->w = max_x - min_x;
|
||||||
}
|
}
|
||||||
|
@ -7426,8 +7423,8 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
{
|
{
|
||||||
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
||||||
rects = eina_list_append(rects, tr);
|
rects = eina_list_append(rects, tr);
|
||||||
tr->x = ln->x + it2->x + x;
|
tr->x = ln->par->x + ln->x + it2->x + x;
|
||||||
tr->y = ln->y;
|
tr->y = ln->par->y + ln->y;
|
||||||
tr->h = ln->h;
|
tr->h = ln->h;
|
||||||
tr->w = w;
|
tr->w = w;
|
||||||
}
|
}
|
||||||
|
@ -7527,8 +7524,8 @@ evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur,
|
||||||
_find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln,
|
_find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln,
|
||||||
(Evas_Object_Textblock_Item **) &fi);
|
(Evas_Object_Textblock_Item **) &fi);
|
||||||
if ((!ln) || (!fi)) return EINA_FALSE;
|
if ((!ln) || (!fi)) return EINA_FALSE;
|
||||||
x = ln->x + fi->parent.x;
|
x = ln->par->x + ln->x + fi->parent.x;
|
||||||
y = ln->y + ln->baseline + fi->y;
|
y = ln->par->y + ln->y + ln->baseline + fi->y;
|
||||||
w = fi->parent.w;
|
w = fi->parent.w;
|
||||||
h = fi->parent.h;
|
h = fi->parent.h;
|
||||||
if (cx) *cx = x;
|
if (cx) *cx = x;
|
||||||
|
@ -7580,8 +7577,8 @@ evas_object_textblock_line_number_geometry_get(const Evas_Object *obj, int line,
|
||||||
TB_HEAD_RETURN(0);
|
TB_HEAD_RETURN(0);
|
||||||
ln = _find_layout_line_num(obj, line);
|
ln = _find_layout_line_num(obj, line);
|
||||||
if (!ln) return EINA_FALSE;
|
if (!ln) return EINA_FALSE;
|
||||||
if (cx) *cx = ln->x;
|
if (cx) *cx = ln->par->x + ln->x;
|
||||||
if (cy) *cy = ln->y;
|
if (cy) *cy = ln->par->y + ln->y;
|
||||||
if (cw) *cw = ln->w;
|
if (cw) *cw = ln->w;
|
||||||
if (ch) *ch = ln->h;
|
if (ch) *ch = ln->h;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -7815,9 +7812,9 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
|
||||||
pbacking = punderline = punderline2 = pstrikethrough = 0; \
|
pbacking = punderline = punderline2 = pstrikethrough = 0; \
|
||||||
if (clip) \
|
if (clip) \
|
||||||
{ \
|
{ \
|
||||||
if ((obj->cur.geometry.y + y + ln->y + ln->h) < (cy - 20)) \
|
if ((obj->cur.geometry.y + y + ln->par->y + ln->y + ln->h) < (cy - 20)) \
|
||||||
continue; \
|
continue; \
|
||||||
if ((obj->cur.geometry.y + y + ln->y) > (cy + ch + 20)) \
|
if ((obj->cur.geometry.y + y + ln->par->y + ln->y) > (cy + ch + 20)) \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
EINA_INLIST_FOREACH(ln->items, itr) \
|
EINA_INLIST_FOREACH(ln->items, itr) \
|
||||||
|
@ -7833,9 +7830,9 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
|
||||||
yoff = (ti->format->valign * (double)(ln->h - ti->parent.h)) + ti->baseline; \
|
yoff = (ti->format->valign * (double)(ln->h - ti->parent.h)) + ti->baseline; \
|
||||||
if (clip) \
|
if (clip) \
|
||||||
{ \
|
{ \
|
||||||
if ((obj->cur.geometry.x + x + ln->x + ti->parent.x + ti->parent.w) < (cx - 20)) \
|
if ((obj->cur.geometry.x + x + ln->par->x + ln->x + ti->parent.x + ti->parent.w) < (cx - 20)) \
|
||||||
continue; \
|
continue; \
|
||||||
if ((obj->cur.geometry.x + x + ln->x + ti->parent.x) > (cx + cw + 20)) \
|
if ((obj->cur.geometry.x + x + ln->par->x + ln->x + ti->parent.x) > (cx + cw + 20)) \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
@ -7861,12 +7858,12 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
|
||||||
(obj->cur.cache.clip.a * ti->format->color.col.a * (amul)) / 65025);
|
(obj->cur.cache.clip.a * ti->format->color.col.a * (amul)) / 65025);
|
||||||
#define DRAW_TEXT(ox, oy) \
|
#define DRAW_TEXT(ox, oy) \
|
||||||
if (ti->format->font.font) ENFN->font_draw(output, context, surface, ti->format->font.font, \
|
if (ti->format->font.font) ENFN->font_draw(output, context, surface, ti->format->font.font, \
|
||||||
obj->cur.geometry.x + ln->x + ti->parent.x + x + (ox), \
|
obj->cur.geometry.x + ln->par->x + ln->x + ti->parent.x + x + (ox), \
|
||||||
obj->cur.geometry.y + ln->y + yoff + y + (oy), \
|
obj->cur.geometry.y + ln->par->y + ln->y + yoff + y + (oy), \
|
||||||
ti->parent.w, ti->parent.h, ti->parent.w, ti->parent.h, ti->text, &ti->parent.text_props);
|
ti->parent.w, ti->parent.h, ti->parent.w, ti->parent.h, ti->text, &ti->parent.text_props);
|
||||||
#define ITEM_WALK_LINE_SKIP_DROP() \
|
#define ITEM_WALK_LINE_SKIP_DROP() \
|
||||||
if ((ln->y + ln->h) <= 0) continue; \
|
if ((ln->par->y + ln->y + ln->h) <= 0) continue; \
|
||||||
if (ln->y > obj->cur.geometry.h) break
|
if (ln->par->y + ln->y > obj->cur.geometry.h) break
|
||||||
|
|
||||||
|
|
||||||
/* backing */
|
/* backing */
|
||||||
|
@ -7882,8 +7879,8 @@ evas_object_textblock_render(Evas_Object *obj, void *output, void *context, void
|
||||||
ENFN->rectangle_draw(output, \
|
ENFN->rectangle_draw(output, \
|
||||||
context, \
|
context, \
|
||||||
surface, \
|
surface, \
|
||||||
obj->cur.geometry.x + ln->x + x + (ox), \
|
obj->cur.geometry.x + ln->par->x + ln->x + x + (ox), \
|
||||||
obj->cur.geometry.y + ln->y + y + (oy), \
|
obj->cur.geometry.y + ln->par->y + ln->y + y + (oy), \
|
||||||
(ow), \
|
(ow), \
|
||||||
(oh)); \
|
(oh)); \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in New Issue