From: Enlightenment S. <no-...@en...> - 2010-09-08 10:00:55
|
Log: Evas textblock: Should not clean the props of the item. Author: tasn Date: 2010-09-08 03:00:47 -0700 (Wed, 08 Sep 2010) New Revision: 51984 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-08 08:38:48 UTC (rev 51983) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-08 10:00:47 UTC (rev 51984) @@ -2216,7 +2216,11 @@ if (it->text) free(it->text); _format_unref_free(c->obj, it->format); #ifdef BIDI_SUPPORT - evas_bidi_props_clean(&it->bidi_props); + /* FIXME: this also unrefs the paragraph props, we should either + * really count the usage of the paragraph props in the items, or just + * not use clean here. I prefer the latter but that might break if we'll + * start doing fancy stuff in clean in the future. */ + /* evas_bidi_props_clean(&it->bidi_props); */ #endif free(it); if (c->ln->items) |
From: Enlightenment S. <no-...@en...> - 2010-09-08 10:22:44
|
Log: Evas textblock: Fixed paragraph char last. Author: tasn Date: 2010-09-08 03:22:38 -0700 (Wed, 08 Sep 2010) New Revision: 51985 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-08 10:00:47 UTC (rev 51984) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-08 10:22:38 UTC (rev 51985) @@ -4735,7 +4735,7 @@ if (!cur) return; if (!cur->node) return; index = eina_ustrbuf_length_get(cur->node->unicode) - 1; - if (index < 0) cur->pos = 0; + if (index < 0) index = 0; cur->pos = index; } |
From: Enlightenment S. <no-...@en...> - 2010-09-14 13:57:33
|
Log: Evas textblock: Fixed the bug with disappearing text with many tabs and text. I removed a function that caused the issue and made no sense at all, honestly, it didn't make any sense. I did a lot of testing trying to see if there are any new bugs after the fix, and nothing, so I guess my instincts were correct. Please if you can, check out the removed function (_layout_walk_back_to_item_word_redo) and see if it makes any sense to you, if it does, please let me know. Author: tasn Date: 2010-09-14 06:57:26 -0700 (Tue, 14 Sep 2010) New Revision: 52243 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-14 12:36:29 UTC (rev 52242) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-14 13:57:26 UTC (rev 52243) @@ -2153,24 +2153,6 @@ /** * @internal - * Checks if the string ends with whitespace - * - * @param str the string to work on. - * @return #EINA_TRUE if it does, #EINA_FALSE otherwise. - */ -static Eina_Bool -_str_ends_with_whitespace(const Eina_Unicode *str) -{ - int p, chr; - - p = eina_unicode_strlen(str) - 1; - if (p < 0) return EINA_FALSE; - chr = GET_NEXT(str, p); - return _is_white(chr); -} - -/** - * @internal * Strips trailing whitespace from the item's text. * * @param c the context to work with - NOT NULL. @@ -2233,24 +2215,6 @@ /** * @internal - * checks if the last item ends with a whitespace. - * - * @param c the context to work with - NOT NULL. - * - * @return #EINA_TRUE if it stripped, #EINA_FALSE otherwise. - */ -static Eina_Bool -_layout_last_item_ends_with_whitespace(Ctxt *c) -{ - Evas_Object_Textblock_Item *it; - - if (!c->ln->items) return EINA_TRUE; - it = (Evas_Object_Textblock_Item *)(EINA_INLIST_GET(c->ln->items))->last; - return _str_ends_with_whitespace(it->text); -} - -/** - * @internal * returns the index of the words end starting from p * * @param str the str to work on - NOT NULL. @@ -2306,98 +2270,6 @@ } /** - * FIXME: doc - */ -static void -_layout_walk_back_to_item_word_redo(Ctxt *c, Evas_Object_Textblock_Item *it) -{ - Evas_Object_Textblock_Item *pit, *new_it = NULL; - Eina_List *remove_items = NULL, *l; - Eina_Inlist *data; - int index, tw, th, inset, adv; - - /* it is not appended yet */ - EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(c->ln->items)), pit) - { - if (_str_ends_with_whitespace(pit->text)) - { - break; - } - index = eina_unicode_strlen(pit->text) - 1; - if (index < 0) index = 0; - index = _layout_word_start(pit->text, index); - if (index == 0) - remove_items = eina_list_prepend(remove_items, pit); - else - { - new_it = _layout_item_new(c, pit->format, pit->text + index); - new_it->source_node = pit->source_node; - new_it->source_pos = pit->source_pos + index; - new_it->bidi_props.start = new_it->source_pos; - new_it->bidi_props.props = new_it->source_node->bidi_props; -# ifdef BIDI_SUPPORT - evas_bidi_shape_string(new_it->text, &new_it->bidi_props, - eina_unicode_strlen(new_it->text)); -# endif - _layout_item_text_cutoff(c, pit, index); - _layout_strip_trailing_whitespace(c, pit->format, pit); - break; - } - } - EINA_LIST_FOREACH(remove_items, l, data) - c->ln->items = (Evas_Object_Textblock_Item *)eina_inlist_remove(EINA_INLIST_GET(c->ln->items), data); - /* new line now */ - if (remove_items) - { - pit = remove_items->data; - _layout_line_advance(c, pit->format); - } - else - { - _layout_line_advance(c, it->format); - } - if (new_it) - { - /* append new_it */ - tw = th = 0; - if (new_it->format->font.font) - c->ENFN->font_string_size_get(c->ENDT, new_it->format->font.font, new_it->text, &new_it->bidi_props, &tw, &th); - new_it->w = tw; - new_it->h = th; - inset = 0; - if (new_it->format->font.font) - inset = c->ENFN->font_inset_get(c->ENDT, new_it->format->font.font, new_it->text); - new_it->inset = inset; - new_it->x = c->x; - adv = 0; - if (new_it->format->font.font) - adv = c->ENFN->font_h_advance_get(c->ENDT, new_it->format->font.font, new_it->text, &new_it->bidi_props); - c->x += adv; - c->ln->items = (Evas_Object_Textblock_Item *)eina_inlist_append(EINA_INLIST_GET(c->ln->items), EINA_INLIST_GET(new_it)); - } - while (remove_items) - { - pit = remove_items->data; - remove_items = eina_list_remove_list(remove_items, remove_items); - /* append pit */ - pit->x = c->x; - adv = c->ENFN->font_h_advance_get(c->ENDT, pit->format->font.font, pit->text, &pit->bidi_props); - c->x += adv; - c->ln->items = (Evas_Object_Textblock_Item *)eina_inlist_append(EINA_INLIST_GET(c->ln->items), EINA_INLIST_GET(pit)); - } - if (it) - { - /* append it */ - it->x = c->x; - adv = 0; - if (it->format->font.font) - adv = c->ENFN->font_h_advance_get(c->ENDT, it->format->font.font, it->text, &it->bidi_props); - c->x += adv; - c->ln->items = (Evas_Object_Textblock_Item *)eina_inlist_append(EINA_INLIST_GET(c->ln->items), EINA_INLIST_GET(it)); - } -} - -/** * @internal * Appends the text from node n starting at start ending at off to the layout. * It uses the fmt for the formatting. @@ -2569,12 +2441,7 @@ /* wrap now is the index of the word START */ index = wrap; ch = GET_NEXT(str, index); - if (!_is_white(ch) && - (!_layout_last_item_ends_with_whitespace(c))) - { - _layout_walk_back_to_item_word_redo(c, it); - goto end; - } + if (c->ln->items) { white_stripped = _layout_item_abort(c, fmt, it); @@ -2582,21 +2449,16 @@ } else { - if (wrap <= 0) + wrap = 0; + twrap = _layout_word_end(it->text, wrap); + wrap = twrap; + if (twrap >= 0) { - wrap = 0; - twrap = _layout_word_end(it->text, wrap); - wrap = twrap; - if (twrap >= 0) - { - ch = GET_NEXT(str, wrap); - _layout_item_text_cutoff(c, it, twrap); - } - if (wrap > 0) - str += wrap; - else - str = NULL; + ch = GET_NEXT(str, wrap); + _layout_item_text_cutoff(c, it, twrap); } + if (wrap > 0) + str += wrap; else str = NULL; } @@ -2612,18 +2474,10 @@ else { /* wrap now is the index of the word START */ - if (wrap <= 0) - { - if (wrap < 0) wrap = 0; - index = wrap; - ch = GET_NEXT(str, index); - if (!_is_white(ch) && - (!_layout_last_item_ends_with_whitespace(c))) - { - _layout_walk_back_to_item_word_redo(c, it); - goto end; - } - } + if (wrap < 0) wrap = 0; + index = wrap; + ch = GET_NEXT(str, index); + if (c->ln->items) { white_stripped = _layout_item_abort(c, fmt, it); @@ -2689,7 +2543,6 @@ _layout_line_advance(c, fmt); } } -end: if (alloc_str) free(alloc_str); } |
From: Enlightenment S. <no-...@en...> - 2010-09-15 10:24:14
|
Log: Evas textblock: Fix and simplify _find_layout_item_line_match which is an helper function used in many parts of textblock. Author: tasn Date: 2010-09-15 03:24:07 -0700 (Wed, 15 Sep 2010) New Revision: 52295 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 09:20:25 UTC (rev 52294) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 10:24:07 UTC (rev 52295) @@ -3026,20 +3026,20 @@ { if (it->source_node == n) { - Evas_Object_Textblock_Item *itn; int p; - itn = (Evas_Object_Textblock_Item *)(((Eina_Inlist *)it)->next); p = (int)(it->source_pos + eina_unicode_strlen(it->text)); - if ((p > pos) || - ((p == pos) && (!lnn) && - ((!itn) || - ((itn) && (itn->source_node != n))))) + if (((pos >= (int) it->source_pos) && (pos < p))) { *lnr = ln; *itr = it; return; } + else if (p == pos) + { + *lnr = ln; + *itr = it; + } } } } |
From: Enlightenment S. <no-...@en...> - 2010-09-15 12:45:21
|
Log: Evas textblock: we should also take width of tabs into account when calculating line width. Author: tasn Date: 2010-09-15 05:45:06 -0700 (Wed, 15 Sep 2010) New Revision: 52297 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 12:09:11 UTC (rev 52296) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 12:45:06 UTC (rev 52297) @@ -2781,6 +2781,7 @@ fi = _layout_format_item_add(c, n, item); fi->x = c->x; fi->w = x2 - c->x; + fi->formatme = 1; c->x = x2; } } |
From: Enlightenment S. <no-...@en...> - 2010-09-15 14:07:16
|
Log: Evas textblock: fix deleting the first tab in 'a<TAB><TAB>a' that caused weird behavior. The solution is that we only delete invisible standalones now, not visible ones, this is correct intuitively and of course fixes the bug. Author: tasn Date: 2010-09-15 07:07:09 -0700 (Wed, 15 Sep 2010) New Revision: 52302 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 13:53:41 UTC (rev 52301) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-15 14:07:09 UTC (rev 52302) @@ -4823,7 +4823,9 @@ /** * @internal * Remove pairs of + and - formats and also remove formats without + or - - * i.e formats that pair to themselves + * i.e formats that pair to themselves. Only removes invisible formats + * that pair themselves, if you want to remove invisible formats that pair + * themselves, please first change fmt->visible to EINA_FALSE. * * @param o the textblock object. * @param fmt the current format. @@ -4867,7 +4869,7 @@ _evas_textblock_node_format_remove(o, fmt, 0); } } - else + else if (!fmt->visible) { _evas_textblock_node_format_remove(o, fmt, 0); } @@ -4958,7 +4960,7 @@ /** * @internal * Sets all the offsets of the format nodes between start and end in the text - * node n to 0. + * node n to 0 and sets visibility to EINA_FALSE. * If end == -1 end means the end of the string. * * @param n the text node the positinos refer to. @@ -5042,6 +5044,7 @@ if (!first) { last_node->offset = 0; + last_node->visible = EINA_FALSE; } else { @@ -5928,6 +5931,11 @@ { merge_nodes = 1; } + /* If a singnular, mark as invisible, so we'll delete it. */ + if (!format || ((*format != '+') && (*format != '-'))) + { + fmt->visible = EINA_FALSE; + } } fmt2 = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur); |
From: Enlightenment S. <no-...@en...> - 2010-09-16 07:12:31
|
Log: Evas textblock: Fixed evas_textblock_range_text_get that didn't work on textblocks with no formats at all (not even newlines or tabs). Author: tasn Date: 2010-09-16 00:12:23 -0700 (Thu, 16 Sep 2010) New Revision: 52339 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-16 07:11:32 UTC (rev 52338) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-16 07:12:23 UTC (rev 52339) @@ -6170,10 +6170,13 @@ } /* Init the offset so the first one will count starting from cur1->pos * and not the previous format node */ - if ((tnode == cur1->node) && fnode) + if (tnode == cur1->node) { - off = _evas_textblock_node_format_pos_get(fnode) - - cur1->pos - fnode->offset; + if (fnode) + { + off = _evas_textblock_node_format_pos_get(fnode) - + cur1->pos - fnode->offset; + } text += cur1->pos; } else |
From: Enlightenment S. <no-...@en...> - 2010-09-16 09:59:46
|
Log: Evas textblock: Added a lot of fixes to evas_textblock_cursor_geometry_get in the case where ctype = EVAS_TEXTBLOCK_CURSOR_BEFORE Author: tasn Date: 2010-09-16 02:59:39 -0700 (Thu, 16 Sep 2010) New Revision: 52341 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-16 07:46:29 UTC (rev 52340) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-16 09:59:39 UTC (rev 52341) @@ -6364,6 +6364,10 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype) { int ret = -1; + const Evas_Textblock_Cursor *dir_cur; + Evas_Textblock_Cursor cur2; + + dir_cur = cur; if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER) { ret = evas_textblock_cursor_char_geometry_get(cur, cx, cy, cw, ch); @@ -6376,36 +6380,54 @@ * just before the current char). */ Evas_Coord x, y, h, w; - if (cur->pos > 0) + /* If it's at the end of the line, we want to get the position, not + * the position of the previous */ + if ((cur->pos > 0) && !_evas_textblock_cursor_is_at_the_end(cur)) { - Evas_Textblock_Cursor cur2; + dir_cur = &cur2; cur2.obj = cur->obj; evas_textblock_cursor_copy(cur, &cur2); cur2.pos--; ret = evas_textblock_cursor_char_geometry_get(&cur2, &x, &y, &w, &h); +#ifdef BIDI_SUPPORT + /* Adjust if the char is an rtl char */ + if (ret >= 0) + { + Evas_BiDi_Props props; + props.props = cur2.node->bidi_props; + props.start = 0; + + if (evas_bidi_is_rtl_char(&props, cur2.pos)) + { + /* Just don't advance the width */ + w = 0; + } + } +#endif + } else { ret = evas_textblock_cursor_char_geometry_get(cur, &x, &y, &w, &h); w = 0; } - if (ret > 0) + if (ret >= 0) { if (cx) *cx = x + w; - if (cy) *cy = y + h; + if (cy) *cy = y; if (cw) *cw = 0; - if (ch) *ch = 0; + if (ch) *ch = h; } } - if (dir && cur && cur->node) + if (dir && dir_cur && dir_cur->node) { #ifdef BIDI_SUPPORT Evas_BiDi_Props props; - props.props = cur->node->bidi_props; + props.props = dir_cur->node->bidi_props; props.start = 0; - *dir = (evas_bidi_is_rtl_char(&props, cur->pos)) ? + *dir = (evas_bidi_is_rtl_char(&props, dir_cur->pos)) ? EVAS_BIDI_DIRECTION_RTL : EVAS_BIDI_DIRECTION_LTR; #else *dir = EVAS_BIDI_DIRECTION_LTR; |
From: Enlightenment S. <no-...@en...> - 2010-09-20 10:06:08
|
Log: Evas textblock: Fixed the mixed usage of a replacement char (e.g * on password textblocks) with formats. Author: tasn Date: 2010-09-20 03:06:01 -0700 (Mon, 20 Sep 2010) New Revision: 52485 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 09:44:48 UTC (rev 52484) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 10:06:01 UTC (rev 52485) @@ -2295,44 +2295,43 @@ if (n) { + int len; + int orig_off = off; + len = eina_ustrbuf_length_get(n->unicode); + if (off == 0) return; + else if (off < 0) off = len - start; + + if (start < 0) + { + start = 0; + } + else if ((start == 0) && (off == 0) && (orig_off == -1)) + { + /* Special case that means that we need to add an empty + * item */ + str = EINA_UNICODE_EMPTY_STRING; + goto skip; + } + else if ((start >= len) || (start + off > len)) + { + return; + } if ((repch) && (eina_ustrbuf_length_get(n->unicode))) { - int i, len, ind; + int i, ind; Eina_Unicode *ptr; Eina_Unicode urepch; - len = eina_ustrbuf_length_get(n->unicode); - str = alloca((len + 1) * sizeof(Eina_Unicode)); + str = alloca((off + 1) * sizeof(Eina_Unicode)); tbase = str; ind = 0; urepch = evas_common_encoding_utf8_get_next(repch, &ind); - for (i = 0, ptr = (Eina_Unicode *)tbase; i < len; ptr++, i++) + for (i = 0, ptr = (Eina_Unicode *)tbase; i < off; ptr++, i++) *ptr = urepch; *ptr = 0; } else { - int len; - int orig_off = off; - len = eina_ustrbuf_length_get(n->unicode); - if (off == 0) return; - else if (off < 0) off = len - start; - - if (start < 0) - { - start = 0; - } - else if ((start == 0) && (off == 0) && (orig_off == -1)) - { - /* Special case that means that we need to add an empty - * item */ - str = EINA_UNICODE_EMPTY_STRING; - goto skip; - } - else if ((start >= len) || (off > len)) - { - return; - } str = eina_ustrbuf_string_get(n->unicode); alloc_str = eina_unicode_strdup(str + start); |
From: Enlightenment S. <no-...@en...> - 2010-09-20 13:04:48
|
Log: Evas textblock: Updated docs. Author: tasn Date: 2010-09-20 06:04:37 -0700 (Mon, 20 Sep 2010) New Revision: 52488 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 12:10:30 UTC (rev 52487) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 13:04:37 UTC (rev 52488) @@ -49,7 +49,9 @@ * is associated with a paragraph. * There are two types of format nodes, visible and invisible: * Visible: formats that a cursor can point to, i.e formats that - * occupy space, for example: newlines, tabs, items and etc. + * occupy space, for example: newlines, tabs, items and etc. Some visible items + * are made of two parts, in this case, only the opening tag is visible. + * A closing tag (i.e a </tag> tag) should NEVER be visible. * Invisible: formats that don't occupy space, for example: bold and underline. * Being able to access format nodes is very important for some uses. For * example, edje uses the "<a>" format to create links in the text (and pop |
From: Enlightenment S. <no-...@en...> - 2010-09-20 14:14:59
|
Log: Evas textblock: Removed the usuned type field from the textblock item. Author: tasn Date: 2010-09-20 07:14:52 -0700 (Mon, 20 Sep 2010) New Revision: 52489 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 13:04:37 UTC (rev 52488) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-20 14:14:52 UTC (rev 52489) @@ -284,7 +284,6 @@ int x, w, h; int inset, baseline; size_t source_pos; - unsigned char type; Evas_BiDi_Props bidi_props; }; |
From: Enlightenment S. <no-...@en...> - 2010-09-21 13:05:42
|
Log: Evas textblock: Fixed deleting the last visual format in a row of visual formats, for example in '<b>ab</b><tab>cd' the tab wouldn't have gotten erased correctly. Author: tasn Date: 2010-09-21 06:05:30 -0700 (Tue, 21 Sep 2010) New Revision: 52540 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-21 12:56:18 UTC (rev 52539) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-21 13:05:30 UTC (rev 52540) @@ -5988,10 +5988,10 @@ if (fmt) { const char *format = NULL; - Evas_Object_Textblock_Node_Format *itr; + Evas_Object_Textblock_Node_Format *last_fmt; /* If there's a PS it must be the last become it delimits paragraphs */ - itr = _evas_textblock_node_format_last_at_off(fmt); - format = eina_strbuf_string_get(fmt->format); + last_fmt = _evas_textblock_node_format_last_at_off(fmt); + format = eina_strbuf_string_get(last_fmt->format); if (format && _IS_PARAGRAPH_SEPARATOR(format)) { merge_nodes = 1; @@ -5999,7 +5999,7 @@ /* If a singnular, mark as invisible, so we'll delete it. */ if (!format || ((*format != '+') && (*format != '-'))) { - fmt->visible = EINA_FALSE; + last_fmt->visible = EINA_FALSE; } } |
From: Enlightenment S. <no-...@en...> - 2010-09-21 15:39:36
|
Log: Evas textblock: merged changes. Author: tasn Date: 2010-09-21 08:39:26 -0700 (Tue, 21 Sep 2010) New Revision: 52544 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-21 15:18:15 UTC (rev 52543) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-09-21 15:39:26 UTC (rev 52544) @@ -2280,7 +2280,7 @@ * @param n the text node. - Not null. * @param start the start position. - in range. * @param off the offset - start + offset in range. if offset is -1, it'll add everything to the end of the string if offset = 0 it'll return with doing nothing. - * @param repch TBD. + * @param repch a replacement char to print instead of the original string, for example, * when working with passwords. */ static void _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Textblock_Node_Text *n, int start, int off, const char *repch) @@ -2292,12 +2292,15 @@ const Eina_Unicode *tbase; Evas_Object_Textblock_Item *it; - /* FIXME: explain the algorithm. */ - + /* prepare a working copy of the string, either filled by the repch or + * filled with the true values */ if (n) { int len; int orig_off = off; + + /* Figure out if we want to bail, work with an empty string, + * or continue with a slice of the passed string */ len = eina_ustrbuf_length_get(n->unicode); if (off == 0) return; else if (off < 0) off = len - start; @@ -2317,6 +2320,9 @@ { return; } + + /* If we work with a replacement char, create a string which is the same + * but with replacement chars instead of regular chars. */ if ((repch) && (eina_ustrbuf_length_get(n->unicode))) { int i, ind; @@ -2331,6 +2337,7 @@ *ptr = urepch; *ptr = 0; } + /* Use the string, just cut the relevant parts */ else { str = eina_ustrbuf_string_get(n->unicode); @@ -2803,8 +2810,8 @@ * * @param obj the evas object - NOT NULL. * @param calc_only true if should only calc sizes false if should also create the layout.. - * @param w the object's w. - * @param h the object's h. + * @param w the object's w, -1 means no wrapping (i.e infinite size) + * @param h the object's h, -1 means inifinte size. * @param w_ret the object's calculated w. * @param h_ret the object's calculated h. */ @@ -2973,8 +2980,11 @@ if (c->paragraphs) _paragraphs_clear(obj, c->paragraphs); } -/** - * FIXME: doc +/* + * @internal + * Relayout the object according to current object size. + * + * @param obj the evas object - NOT NULL. */ static void _relayout(const Evas_Object *obj) |
From: Enlightenment S. <no-...@en...> - 2010-10-03 16:43:03
|
Log: Evas textblock: Added a small comment about where to find textblock style usage example. Author: tasn Date: 2010-10-03 09:42:56 -0700 (Sun, 03 Oct 2010) New Revision: 53001 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-03 15:08:18 UTC (rev 53000) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-03 16:42:56 UTC (rev 53001) @@ -64,6 +64,8 @@ * tags defined in the style, see @ref evas_textblock_style_set * * @subsection textblock_special_formats Special Formats + * This section is not yet written. If you want some info about styles/formats + * and how to use them, expedite's textblock_basic test is a great start. * @todo Write @textblock_special_formats */ |
From: Enlightenment S. <no-...@en...> - 2010-10-05 10:44:47
|
Log: Evas textblock: Selection should work from the start cursor up to before the end cursor, i.e it should *not* include the end cursor. Author: tasn Date: 2010-10-05 03:44:40 -0700 (Tue, 05 Oct 2010) New Revision: 53053 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 09:30:05 UTC (rev 53052) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 10:44:40 UTC (rev 53053) @@ -6076,7 +6076,6 @@ } n1 = cur1->node; n2 = cur2->node; - cur2->pos++; /* Also remove the marked char */ if (n1 == n2) { @@ -6876,7 +6875,7 @@ } return NULL; } - tr->w = cx + cw - tr->x; + tr->w = cx - tr->x; } else { @@ -6921,7 +6920,7 @@ tr->x = lx; tr->y = ly; tr->h = lh; - tr->w = cx + cw - lx; + tr->w = cx - lx; } return rects; } |
From: Enlightenment S. <no-...@en...> - 2010-10-05 10:51:04
|
Log: Evas textblock: In continuation to the previous commit: range get should also work up until the char, not including. Author: tasn Date: 2010-10-05 03:50:58 -0700 (Tue, 05 Oct 2010) New Revision: 53054 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 10:44:40 UTC (rev 53053) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 10:50:58 UTC (rev 53054) @@ -6213,12 +6213,7 @@ cur2 = alloca(sizeof(Evas_Textblock_Cursor)); cur2->obj = _cur2->obj; evas_textblock_cursor_copy(_cur2, cur2); - if (cur2->pos < eina_ustrbuf_length_get(cur2->node->unicode)) - { - /* We want to also copy the pointed to char, only if it's not - * the terminating null. */ - cur2->pos++; - } + /* Parse the text between the cursors. */ for (tnode = cur1->node ; tnode ; tnode = _NODE_TEXT(EINA_INLIST_GET(tnode)->next)) |
From: Enlightenment S. <no-...@en...> - 2010-10-05 16:17:08
|
Log: Evas textblock: Fixed a bug with deleting range when the first char is a visible format. Author: tasn Date: 2010-10-05 09:17:01 -0700 (Tue, 05 Oct 2010) New Revision: 53067 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 15:58:19 UTC (rev 53066) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 16:17:01 UTC (rev 53067) @@ -5121,12 +5121,13 @@ if (!first) { last_node->offset = 0; - last_node->visible = EINA_FALSE; } else { first = 0; } + last_node->visible = EINA_FALSE; + if (!itr || (itr && (itr->text_node != n))) { /* Remove the PS, and return since it's the end of the node */ @@ -5171,6 +5172,7 @@ if (itr) start -= itr->offset; if (offset < 0) offset = 0; + if (end < 0) use_end = 0; while (itr && (itr->text_node == n)) { Evas_Object_Textblock_Node_Format *nnode; @@ -6079,7 +6081,6 @@ if (n1 == n2) { - eina_ustrbuf_remove(n1->unicode, cur1->pos, cur2->pos); if ((cur1->pos == 0) && (cur2->pos == eina_ustrbuf_length_get(n1->unicode))) { @@ -6090,6 +6091,7 @@ should_merge = _evas_textblock_node_text_adjust_offsets_to_start(o, n1, cur1->pos, cur2->pos); } + eina_ustrbuf_remove(n1->unicode, cur1->pos, cur2->pos); _evas_textblock_cursors_update_offset(cur1, cur1->node, cur1->pos, - (cur2->pos - cur1->pos)); } else |
From: Enlightenment S. <no-...@en...> - 2010-10-05 16:17:11
|
Log: Evas textblock: Fix bug with removing formats, format removal should stop at 'end' non-inclusive, just like text removal works. Author: tasn Date: 2010-10-05 09:17:04 -0700 (Tue, 05 Oct 2010) New Revision: 53068 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 16:17:01 UTC (rev 53067) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-05 16:17:04 UTC (rev 53068) @@ -5056,14 +5056,21 @@ int first = 1; int update_format_node; size_t pos = 0; + int orig_end; itr = n->format_node; if (!itr || (itr->text_node != n)) return EINA_FALSE; + orig_end = end; if ((end < 0) || ((size_t) end == eina_ustrbuf_length_get(n->unicode))) { use_end = 0; } + else if (end > 0) + { + /* We don't want the last one */ + end--; + } /* If we are not removing the text node, all should stay in this text * node, otherwise, everything should move to the previous node */ @@ -5097,7 +5104,7 @@ } update_format_node = ((itr == n->format_node) && (new_node != n)); - delta = end - pos; + delta = orig_end - pos; itr->offset -= pos - start; while (itr && (itr->text_node == n)) @@ -5117,7 +5124,7 @@ break; } - delta = end - pos; + delta = orig_end - pos; if (!first) { last_node->offset = 0; @@ -5179,7 +5186,7 @@ int tmp_offset = 0; /* start is negative when this gets relevant */ - if ((offset + start <= 0) && use_end) + if ((offset + start < 0) && use_end) { break; } |
From: Enlightenment S. <no-...@en...> - 2010-10-06 08:45:17
|
Log: Evas textblock: Fixed a type in remove_pair that caused issues with offset adjustment of formats. Author: tasn Date: 2010-10-06 01:45:10 -0700 (Wed, 06 Oct 2010) New Revision: 53092 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-06 07:09:05 UTC (rev 53091) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-06 08:45:10 UTC (rev 53092) @@ -4362,9 +4362,10 @@ } _evas_textblock_cursors_update_offset(&cur, n->text_node, index, -1); } - _evas_textblock_node_format_remove(o, n, 1); + _evas_textblock_node_format_remove(o, n, 0); if (pnode && (pnode != n)) { + /* pnode can never be visible! (it's the closing format) */ _evas_textblock_node_format_remove(o, pnode, 0); } _evas_textblock_changed(o, obj); |
From: Enlightenment S. <no-...@en...> - 2010-10-06 18:26:36
|
Log: Evas textblock: Removed duplicated if. Author: tasn Date: 2010-10-06 11:26:29 -0700 (Wed, 06 Oct 2010) New Revision: 53108 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-06 18:23:01 UTC (rev 53107) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-06 18:26:29 UTC (rev 53108) @@ -6167,14 +6167,11 @@ if (!cur || !cur->node) return NULL; if (evas_textblock_cursor_format_is_visible_get(cur)) { - if (evas_textblock_cursor_format_is_visible_get(cur)) - { - const char *tmp; - tmp = evas_textblock_node_format_text_get( - _evas_textblock_node_visible_at_pos_get( - evas_textblock_cursor_format_get(cur))); - return strdup(tmp); - } + const char *tmp; + tmp = evas_textblock_node_format_text_get( + _evas_textblock_node_visible_at_pos_get( + evas_textblock_cursor_format_get(cur))); + return strdup(tmp); } ustr = eina_ustrbuf_string_get(cur->node->unicode); |
From: Enlightenment S. <no-...@en...> - 2010-10-12 09:37:08
|
Log: Evas text object: Fixed shaping. Author: tasn Date: 2010-10-12 02:36:58 -0700 (Tue, 12 Oct 2010) New Revision: 53301 Modified: trunk/evas/src/lib/canvas/evas_object_text.c Modified: trunk/evas/src/lib/canvas/evas_object_text.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_text.c 2010-10-12 08:59:42 UTC (rev 53300) +++ trunk/evas/src/lib/canvas/evas_object_text.c 2010-10-12 09:36:58 UTC (rev 53301) @@ -326,7 +326,7 @@ evas_object_text_text_set(Evas_Object *obj, const char *_text) { Evas_Object_Text *o; - int is, was; + int is, was, len; Eina_Unicode *text; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); @@ -337,7 +337,7 @@ return; MAGIC_CHECK_END(); - text = evas_common_encoding_utf8_to_unicode(_text, NULL); + text = evas_common_encoding_utf8_to_unicode(_text, &len); if (!text) text = eina_unicode_strdup(EINA_UNICODE_EMPTY_STRING); if ((o->cur.text) && (text) && (!eina_unicode_strcmp(o->cur.text, text))) @@ -353,6 +353,7 @@ #ifdef BIDI_SUPPORT evas_bidi_paragraph_props_unref(o->cur.intl_props.props); o->cur.intl_props.props = evas_bidi_paragraph_props_get(text); + evas_bidi_shape_string(text, &o->cur.intl_props, len); #endif if (o->cur.text) eina_ustringshare_del(o->cur.text); if (o->cur.utf8_text) eina_stringshare_del(o->cur.utf8_text); |
From: Enlightenment S. <no-...@en...> - 2010-10-13 14:14:51
|
Log: Evas text: Fixed inset handling. Author: tasn Date: 2010-10-13 07:14:40 -0700 (Wed, 13 Oct 2010) New Revision: 53357 Modified: trunk/evas/src/lib/canvas/evas_object_text.c Modified: trunk/evas/src/lib/canvas/evas_object_text.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_text.c 2010-10-13 14:11:21 UTC (rev 53356) +++ trunk/evas/src/lib/canvas/evas_object_text.c 2010-10-13 14:14:40 UTC (rev 53357) @@ -608,7 +608,6 @@ Evas_Object_Text *o; int l = 0, r = 0, t = 0, b = 0; int ret, x = 0, y = 0, w = 0, h = 0; - int inset; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return EINA_FALSE; @@ -619,13 +618,11 @@ MAGIC_CHECK_END(); if (!o->engine_data) return EINA_FALSE; if (!o->cur.text) return EINA_FALSE; - inset = - ENFN->font_inset_get(ENDT, o->engine_data, o->cur.text); ret = ENFN->font_char_coords_get(ENDT, o->engine_data, o->cur.text, &o->cur.intl_props, pos, &x, &y, &w, &h); evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b); y += o->max_ascent - t; - x -= inset + l; + x -= l; if (x < 0) { w += x; @@ -661,7 +658,6 @@ evas_object_text_last_up_to_pos(const Evas_Object *obj, Evas_Coord x, Evas_Coord y) { Evas_Object_Text *o; - int inset; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return -1; @@ -672,12 +668,10 @@ MAGIC_CHECK_END(); if (!o->engine_data) return -1; if (!o->cur.text) return -1; - inset = - ENFN->font_inset_get(ENDT, o->engine_data, o->cur.text); return ENFN->font_last_up_to_pos(ENDT, o->engine_data, o->cur.text, &o->cur.intl_props, - x + inset, + x, y - o->max_ascent); } @@ -693,7 +687,6 @@ Evas_Object_Text *o; int l = 0, r = 0, t = 0, b = 0; int ret, rx = 0, ry = 0, rw = 0, rh = 0; - int inset; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return -1; @@ -704,18 +697,16 @@ MAGIC_CHECK_END(); if (!o->engine_data) return -1; if (!o->cur.text) return -1; - inset = - ENFN->font_inset_get(ENDT, o->engine_data, o->cur.text); ret = ENFN->font_char_at_coords_get(ENDT, o->engine_data, o->cur.text, &o->cur.intl_props, - x + inset, + x, y - o->max_ascent, &rx, &ry, &rw, &rh); evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b); ry += o->max_ascent - t; - rx -= inset + l; + rx -= l; if (rx < 0) { rw += rx; @@ -1616,8 +1607,7 @@ context, \ surface, \ o->engine_data, \ - obj->cur.cache.geometry.x + x + sl + ox - \ - ENFN->font_inset_get(ENDT, o->engine_data, o->cur.text), \ + obj->cur.cache.geometry.x + x + sl + ox, \ obj->cur.cache.geometry.y + y + st + oy + \ (int) \ (((o->max_ascent * obj->cur.cache.geometry.h) / obj->cur.geometry.h) - 0.5), \ |
From: Enlightenment S. <no-...@en...> - 2010-10-20 10:30:09
|
Log: Evas textblock: Fixed docs. Patch by Jihoon Kim. Author: tasn Date: 2010-10-20 03:30:02 -0700 (Wed, 20 Oct 2010) New Revision: 53650 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-20 07:59:20 UTC (rev 53649) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-10-20 10:30:02 UTC (rev 53650) @@ -6432,8 +6432,8 @@ * @param cur the cursor. * @param cx the x of the cursor * @param cy the y of the cursor - * @param cw the w of the cursor - * @param ch the h of the cursor + * @param cw the width of the cursor + * @param ch the height of the cursor * @param dir the direction of the cursor, can be NULL. * @param ctype the type of the cursor. * @return line number of the char on success, -1 on error. @@ -6521,8 +6521,8 @@ * @param cur the position of the char. * @param cx the x of the char. * @param cy the y of the char. - * @param cw the w of the char. - * @param ch the h of the char. + * @param cw the width of the char. + * @param ch the height of the char. * @return line number of the char on success, -1 on error. */ EAPI int @@ -6649,8 +6649,8 @@ * @param cur the position of the line. * @param cx the x of the line. * @param cy the y of the line. - * @param cw the w of the line. - * @param ch the h of the line. + * @param cw the width of the line. + * @param ch the height of the line. * @return line number of the line on success, -1 on error. */ EAPI int @@ -7044,7 +7044,7 @@ } /** - * Get the formatted width. This calculates the actual size after restricting + * Get the formatted width and height. This calculates the actual size after restricting * the textblock to the current size of the object. * The main difference between this and @ref evas_object_textblock_size_native_get * is that the "native" function does not wrapping into account @@ -7059,8 +7059,8 @@ * * * @param obj the evas object. - * @param w[out] the w of the object. - * @param h[out] the h of the object + * @param w[out] the width of the object. + * @param h[out] the height of the object * @return Returns no value. * @see evas_object_textblock_size_native_get */ @@ -7074,7 +7074,7 @@ } /** - * Get the native idth. This calculates the actual size without taking account + * Get the native width and height. This calculates the actual size without taking account * the current size of the object. * The main difference between this and @ref evas_object_textblock_size_formatted_get * is that the "native" function does not take wrapping into account |
From: Enlightenment S. <no-...@en...> - 2010-11-08 07:46:51
|
Log: Evas textblock: Fixed range_delete to not move the main cursor if it's not inside the deleted range. Author: tasn Date: 2010-11-07 23:46:43 -0800 (Sun, 07 Nov 2010) New Revision: 54320 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-11-08 05:59:37 UTC (rev 54319) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-11-08 07:46:43 UTC (rev 54320) @@ -6070,7 +6070,7 @@ { Evas_Object_Textblock *o; Evas_Object_Textblock_Node_Text *n1, *n2, *n; - Eina_Bool should_merge = EINA_FALSE; + Eina_Bool should_merge = EINA_FALSE, reset_cursor = EINA_FALSE; if (!cur1 || !cur1->node) return; if (!cur2 || !cur2->node) return; @@ -6086,7 +6086,13 @@ } n1 = cur1->node; n2 = cur2->node; + if ((evas_textblock_cursor_compare(o->cursor, cur1) >= 0) && + (evas_textblock_cursor_compare(cur2, o->cursor) >= 0)) + { + reset_cursor = EINA_TRUE; + } + if (n1 == n2) { if ((cur1->pos == 0) && @@ -6147,7 +6153,9 @@ #endif evas_textblock_cursor_copy(cur1, cur2); - evas_textblock_cursor_copy(cur1, o->cursor); + if (reset_cursor) + evas_textblock_cursor_copy(cur1, o->cursor); + _evas_textblock_changed(o, cur1->obj); } |
From: Enlightenment S. <no-...@en...> - 2010-11-29 15:04:51
|
Log: Evas textblock: Fixed a bug with inserting text before a <PS>. Author: tasn Date: 2010-11-29 07:04:44 -0800 (Mon, 29 Nov 2010) New Revision: 55064 Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c Modified: trunk/evas/src/lib/canvas/evas_object_textblock.c =================================================================== --- trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-11-29 14:04:16 UTC (rev 55063) +++ trunk/evas/src/lib/canvas/evas_object_textblock.c 2010-11-29 15:04:44 UTC (rev 55064) @@ -5695,29 +5695,25 @@ if (n) { Evas_Object_Textblock_Node_Format *nnode; - if (evas_textblock_cursor_format_is_visible_get(cur)) - { - fnode = _evas_textblock_cursor_node_format_before_pos_get(cur); - } - else - { - fnode = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur); - fnode = _evas_textblock_node_format_last_at_off(fnode); - } + fnode = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur); + fnode = _evas_textblock_node_format_last_at_off(fnode); /* find the node after the current in the same paragraph * either we find one and then take the next, or we try to get * the first for the paragraph which must be after our position */ if (fnode) { - nnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next); - if (nnode && (nnode->text_node == n)) + if (!evas_textblock_cursor_format_is_visible_get(cur)) { - fnode = nnode; + nnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next); + if (nnode && (nnode->text_node == n)) + { + fnode = nnode; + } + else + { + fnode = NULL; + } } - else - { - fnode = NULL; - } } else { |