summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-12-09 14:17:42 +0000
committerTom Hacohen <tom@stosb.com>2015-01-14 08:45:41 +0000
commit4371d05eb9d48fa00568b55ef6f36d57f0e95757 (patch)
tree7e61b5becd82fa6dc314c3a5dbe898cd39546b79
parent93d0a25bd867d8eaafecd40c79c9fb5187183372 (diff)
downloadefl-4371d05eb9d48fa00568b55ef6f36d57f0e95757.tar.gz
Remove ellipsis handling atm.
-rw-r--r--src/lib/evas/canvas/evas_textblock2.c308
1 files changed, 0 insertions, 308 deletions
diff --git a/src/lib/evas/canvas/evas_textblock2.c b/src/lib/evas/canvas/evas_textblock2.c
index d3a58605e9..43f08af89b 100644
--- a/src/lib/evas/canvas/evas_textblock2.c
+++ b/src/lib/evas/canvas/evas_textblock2.c
@@ -3771,163 +3771,6 @@ _it_break_position_get(Evas_Object_Textblock2_Item *it, const char *breaks)
return -1;
}
-static Evas_Object_Textblock2_Text_Item *
-_layout_ellipsis_item_new(Ctxt *c, const Evas_Object_Textblock2_Item *cur_it)
-{
- const Eina_Unicode _ellip_str[2] = { 0x2026, '\0' };
- Evas_Object_Textblock2_Text_Item *ellip_ti;
- Evas_Script_Type script;
- Evas_Font_Instance *script_fi = NULL, *cur_fi;
- size_t len = 1; /* The length of _ellip_str */
-
- /* We can free it here, cause there's only one ellipsis item per tb. */
- if (c->o->ellip_ti) _item_free(c->obj, NULL, _ITEM(c->o->ellip_ti));
- c->o->ellip_ti = ellip_ti = _layout_text_item_new(c, cur_it->format);
- ellip_ti->parent.text_node = cur_it->text_node;
- ellip_ti->parent.text_pos = cur_it->text_pos;
- script = evas_common_language_script_type_get(_ellip_str, len);
-
- evas_common_text_props_bidi_set(&ellip_ti->text_props,
- c->par->bidi_props, ellip_ti->parent.text_pos);
- evas_common_text_props_script_set (&ellip_ti->text_props, script);
-
- if (ellip_ti->parent.format->font.font)
- {
- Evas_Object_Protected_Data *obj = eo_data_scope_get(c->obj, EVAS_OBJECT_CLASS);
- /* It's only 1 char anyway, we don't need the run end. */
- (void) ENFN->font_run_end_get(ENDT,
- ellip_ti->parent.format->font.font, &script_fi, &cur_fi,
- script, _ellip_str, len);
-
- ENFN->font_text_props_info_create(ENDT,
- cur_fi, _ellip_str, &ellip_ti->text_props,
- c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
- }
-
- _text_item_update_sizes(c, ellip_ti);
-
- if (cur_it->type == EVAS_TEXTBLOCK2_ITEM_TEXT)
- {
- ellip_ti->parent.text_pos += _ITEM_TEXT(cur_it)->text_props.text_len
- - 1;
- }
- else
- {
- ellip_ti->parent.text_pos++;
- }
-
- return ellip_ti;
-}
-
-/**
- * @internel
- * Handle ellipsis
- */
-static inline void
-_layout_handle_ellipsis(Ctxt *c, Evas_Object_Textblock2_Item *it, Eina_List *i)
-{
- Evas_Object_Textblock2_Text_Item *ti, *ellip_ti;
- Evas_Object_Textblock2_Item *last_it;
- Evas_Coord save_cx;
- int wrap;
- ellip_ti = _layout_ellipsis_item_new(c, it);
- last_it = it;
-
- save_cx = c->x;
- c->w -= ellip_ti->parent.w;
-
- /* If there is no enough space for ellipsis item, remove all of items */
- if (c->w <= 0)
- {
- while (c->ln->items)
- {
- last_it = _ITEM(EINA_INLIST_GET(c->ln->items)->last);
- c->ln->items = _ITEM(eina_inlist_remove(
- EINA_INLIST_GET(c->ln->items),
- EINA_INLIST_GET(last_it)));
- }
- last_it = NULL;
- }
-
- while (last_it)
- {
- if (last_it->type == EVAS_TEXTBLOCK2_ITEM_TEXT)
- {
- ti = _ITEM_TEXT(last_it);
-
- wrap = _layout_text_cutoff_get(c, last_it->format, ti);
-
- if ((wrap > 0) && !IS_AT_END(ti, (size_t) wrap))
- {
- _layout_item_text_split_strip_white(c, ti, i, wrap);
- break;
- }
- else if (wrap < 0)
- {
- break;
- }
- }
- else
- {
- /* We will ignore format items. ex) tab
- * But, if there is <item> tag and size is acceptable, we have to insert it to line. */
- if (!strncmp(_ITEM_FORMAT(last_it)->item, "item", 4) &&
- ((c->w - c->o->style_pad.l - c->o->style_pad.r - c->marginl - c->marginr) >= (c->x + last_it->adv)))
- {
- break;
- }
- }
-
- if (c->ln->items && last_it != it)
- {
- c->ln->items = _ITEM(eina_inlist_remove(
- EINA_INLIST_GET(c->ln->items),
- EINA_INLIST_GET(last_it)));
- }
-
- last_it = (c->ln->items) ? _ITEM(EINA_INLIST_GET(c->ln->items)->last) : NULL;
-
- if (last_it)
- {
- /* We need to renew ellipsis item.
- * Because, base format is changed to last_it.
- * We can't reuse it. */
- c->w += ellip_ti->parent.w;
- ellip_ti = _layout_ellipsis_item_new(c, last_it);
- c->w -= ellip_ti->parent.w;
- c->x -= last_it->adv;
- if (c->x < 0)
- c->x = 0;
- save_cx = c->x;
- }
- }
-
- c->x = save_cx;
- c->w += ellip_ti->parent.w;
- /* If we should add this item, do it */
- if (last_it == it)
- {
- c->ln->items = (Evas_Object_Textblock2_Item *)
- eina_inlist_append(EINA_INLIST_GET(c->ln->items),
- EINA_INLIST_GET(it));
- it->ln = c->ln;
- if (it->type == EVAS_TEXTBLOCK2_ITEM_FORMAT)
- {
- Evas_Object_Textblock2_Format_Item *fi;
- fi = _ITEM_FORMAT(it);
- fi->y = c->y;
- }
- }
- c->ln->items = (Evas_Object_Textblock2_Item *)
- eina_inlist_append(EINA_INLIST_GET(c->ln->items),
- EINA_INLIST_GET(_ITEM(ellip_ti)));
- _ITEM(ellip_ti)->ln = c->ln;
-
- c->position = (c->position == TEXTBLOCK2_POSITION_START) ?
- TEXTBLOCK2_POSITION_SINGLE : TEXTBLOCK2_POSITION_END;
- _layout_line_finalize(c, ellip_ti->parent.format);
-}
-
/* Don't do much for the meanwhile. */
static inline void
_layout_paragraph_render(Evas_Textblock2_Data *o,
@@ -3940,142 +3783,6 @@ _layout_paragraph_render(Evas_Textblock2_Data *o,
(void) o;
}
-/* calculates items width in current paragraph */
-static inline Evas_Coord
-_calc_items_width(Ctxt *c)
-{
- Evas_Object_Textblock2_Item *it, *last_it = NULL;
- Eina_List *i;
- Evas_Coord w = 0;
-
- if (!c->par->logical_items)
- return 0;
-
- EINA_LIST_FOREACH(c->par->logical_items, i, it)
- {
- w += it->adv;
- last_it = it;
- }
-
- //reaching this point when it is the last item
- if (last_it)
- w += last_it->w - last_it->adv;
- return w;
-}
-
-static inline int
-_item_get_cutoff(Ctxt *c, Evas_Object_Textblock2_Item *it, Evas_Coord x)
-{
- int pos = -1;
- Evas_Object_Textblock2_Text_Item *ti;
- Evas_Object_Protected_Data *obj = eo_data_scope_get(c->obj, EVAS_OBJECT_CLASS);
-
- ti = (it->type == EVAS_TEXTBLOCK2_ITEM_TEXT) ? _ITEM_TEXT(it) : NULL;
- if (ti && ti->parent.format->font.font)
- {
- pos = ENFN->font_last_up_to_pos(ENDT, ti->parent.format->font.font,
- &ti->text_props, x, 0);
- }
- return pos;
-}
-
-/**
- * @internal
- * This handles ellipsis prior most of the work in _layout_par.
- * Currently it is here to handle all value in the range of 0.0 to 0.9999 (<1).
- * It starts by getting the total width of items, and calculates the 'block' of
- * text that needs to be removed i.e. sets low and high boundaries
- * of that block.
- * All text items that intersect this block will be cut: the edge items (ones
- * that don't intersect in whole) will be split, and the rest are set to be
- * visually-deleted.
- * Note that a special case for visible format items does not
- * split them, but instead just visually-deletes them (because there are no
- * characters to split).
- */
-static inline void
-_layout_par_ellipsis_items(Ctxt *c, double ellip)
-{
- Evas_Object_Textblock2_Item *it;
- Evas_Object_Textblock2_Text_Item *ellip_ti;
- Eina_List *i, *j;
- Evas_Coord items_width, exceed, items_cut;
- Evas_Coord l, h, off;
- int pos;
-
- c->o->ellip_prev_it = NULL;
-
- /* calc exceed amount */
- items_width = _calc_items_width(c);
- exceed = items_width - (c->w - c->o->style_pad.l - c->o->style_pad.r
- - c->marginl - c->marginr);
-
- if (exceed <= 0)
- return;
-
- {
- Evas_Object_Textblock2_Item *first_it =
- _ITEM(eina_list_data_get(c->par->logical_items));
- ellip_ti = _layout_ellipsis_item_new(c, first_it);
- }
- exceed += ellip_ti->parent.adv;
- items_cut = items_width * ellip;
- l = items_cut - (exceed * ellip);
- h = l + exceed; //h = items_cut - (exceed * (1 - ellip))
-
- off = 0;
- /* look for the item that is being cut by the lower boundary */
- i = c->par->logical_items;
- EINA_LIST_FOREACH(c->par->logical_items, i, it)
- {
- if (it->w > (l - off))
- break;
- off += it->adv;
- }
- c->o->ellip_prev_it = i;
- if (it) _layout_ellipsis_item_new(c, it);
-
-
- pos = (it && it->type == EVAS_TEXTBLOCK2_ITEM_TEXT) ?
- (_item_get_cutoff(c, it, l - off)) : -1;
- if (pos >= 0)
- {
- _layout_item_text_split_strip_white(c, _ITEM_TEXT(it), i, pos);
- off += it->adv;
- i = eina_list_next(i);
- }
-
- /* look for the item that is being cut by the upper boundary */
- EINA_LIST_FOREACH(i, j, it)
- {
- if (it->w > (h - off))
- break;
- off += it->adv;
- /* if item is not being cut by the upper boundary, then
- * it is contained in the area that we are supposed to
- * visually remove */
- it->visually_deleted = EINA_TRUE;
- }
-
- pos = (it && it->type == EVAS_TEXTBLOCK2_ITEM_TEXT) ?
- (_item_get_cutoff(c, it, h - off)) : -1;
- if (pos >= 0)
- _layout_item_text_split_strip_white(c, _ITEM_TEXT(it), j, pos + 1);
- if (it)
- it->visually_deleted = EINA_TRUE;
-}
-
-static inline void
-_layout_par_append_ellipsis(Ctxt *c)
-{
- Evas_Object_Textblock2_Text_Item *ellip_ti = c->o->ellip_ti;
- c->ln->items = (Evas_Object_Textblock2_Item *)
- eina_inlist_append(EINA_INLIST_GET(c->ln->items),
- EINA_INLIST_GET(_ITEM(ellip_ti)));
- ellip_ti->parent.ln = c->ln;
- c->x += ellip_ti->parent.adv;
-}
-
static int
_layout_par_wrap_find(Ctxt *c, Evas_Object_Textblock2_Format *fmt, Evas_Object_Textblock2_Item *it, const char *line_breaks)
{
@@ -4199,17 +3906,6 @@ _layout_par(Ctxt *c)
/* We walk on our own because we want to be able to add items from
* inside the list and then walk them on the next iteration. */
- /* TODO: We need to consider where ellipsis is used in the current text.
- Currently, we assume that ellipsis is at the beginning of the
- paragraph. This is a safe assumption for now, as other usages
- seem a bit unnatural.*/
- {
- double ellip;
- ellip = it->format->ellipsis;
- if ((0 <= ellip) && (ellip < 1.0))
- _layout_par_ellipsis_items(c, ellip);
- }
-
{
const char *lang = "";
size_t len = eina_ustrbuf_length_get(c->par->text_node->unicode);
@@ -4228,10 +3924,6 @@ _layout_par(Ctxt *c)
/* Skip visually deleted items */
if (it->visually_deleted)
{
- //one more chance for ellipsis special cases
- if (c->o->ellip_prev_it == i)
- _layout_par_append_ellipsis(c);
-
i = eina_list_next(i);
continue;
}