diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index c615b5ed00..bfa7cf5eac 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -431,9 +431,9 @@ struct _Evas_Object_Textblock_Format } font; struct { struct { - unsigned char r, g, b, a; + unsigned char r, g, b, a; } normal, underline, underline2, underline_dash, outline, shadow, glow, glow2, backing, - strikethrough; + strikethrough; } color; struct { int l, r; @@ -719,13 +719,13 @@ _style_replace(Evas_Textblock_Style *ts, const char *style_text) if (ts->default_tag) free(ts->default_tag); while (ts->tags) { - Evas_Object_Style_Tag *tag; + Evas_Object_Style_Tag *tag; - tag = (Evas_Object_Style_Tag *)ts->tags; - ts->tags = (Evas_Object_Style_Tag *)eina_inlist_remove(EINA_INLIST_GET(ts->tags), EINA_INLIST_GET(tag)); - free(tag->tag.tag); - free(tag->tag.replace); - free(tag); + tag = (Evas_Object_Style_Tag *)ts->tags; + ts->tags = (Evas_Object_Style_Tag *)eina_inlist_remove(EINA_INLIST_GET(ts->tags), EINA_INLIST_GET(tag)); + free(tag->tag.tag); + free(tag->tag.replace); + free(tag); } ts->default_tag = NULL; ts->tags = NULL; @@ -759,12 +759,12 @@ _style_match_tag(const Evas_Textblock_Style *ts, const char *s, size_t tag_len, /* Try the style tags */ EINA_INLIST_FOREACH(ts->tags, tag) { - if (tag->tag.tag_len != tag_len) continue; - if (!strncmp(tag->tag.tag, s, tag_len)) - { - *replace_len = tag->tag.replace_len; - return tag->tag.replace; - } + if (tag->tag.tag_len != tag_len) continue; + if (!strncmp(tag->tag.tag, s, tag_len)) + { + *replace_len = tag->tag.replace_len; + return tag->tag.replace; + } } /* Try the default tags */ @@ -799,9 +799,9 @@ _nodes_clear(const Evas_Object *eo_obj) Evas_Textblock_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); while (o->text_nodes) { - Evas_Object_Textblock_Node_Text *n; + Evas_Object_Textblock_Node_Text *n; - n = o->text_nodes; + n = o->text_nodes; o->text_nodes = _NODE_TEXT(eina_inlist_remove( EINA_INLIST_GET(o->text_nodes), EINA_INLIST_GET(n))); _evas_textblock_node_text_free(n); @@ -6291,13 +6291,17 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text) { if (!key_start) { - if (!isspace((unsigned char)(*p))) - key_start = p; + if (!isspace((unsigned char)(*p))) + { + key_start = p; + } } else if (!key_stop) { - if ((*p == '=') || (isspace((unsigned char)(*p)))) - key_stop = p; + if ((*p == '=') || (isspace((unsigned char)(*p)))) + { + key_stop = p; + } } else if (!val_start) { @@ -7993,15 +7997,13 @@ evas_textblock_cursor_paragraph_last(Evas_Textblock_Cursor *cur) { node = _NODE_TEXT(EINA_INLIST_GET(node)->last); cur->node = node; - cur->pos = 0; - - evas_textblock_cursor_paragraph_char_last(cur); + cur->pos = 0; + evas_textblock_cursor_paragraph_char_last(cur); } else { - cur->node = NULL; - cur->pos = 0; - + cur->node = NULL; + cur->pos = 0; } } @@ -8428,8 +8430,8 @@ evas_textblock_cursor_line_char_last(Evas_Textblock_Cursor *cur) { size_t ind; - cur->node = it->text_node; - cur->pos = it->text_pos; + cur->node = it->text_node; + cur->pos = it->text_pos; if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) { ind = _ITEM_TEXT(it)->text_props.text_len - 1; @@ -8969,19 +8971,19 @@ evas_textblock_cursor_compare(const Evas_Textblock_Cursor *cur1, const Evas_Text if ((!cur1->node) || (!cur2->node)) return 0; if (cur1->node == cur2->node) { - if (cur1->pos < cur2->pos) return -1; /* cur1 < cur2 */ - else if (cur1->pos > cur2->pos) return 1; /* cur2 < cur1 */ - return 0; + if (cur1->pos < cur2->pos) return -1; /* cur1 < cur2 */ + else if (cur1->pos > cur2->pos) return 1; /* cur2 < cur1 */ + return 0; } for (l1 = EINA_INLIST_GET(cur1->node), l2 = EINA_INLIST_GET(cur1->node); (l1) || (l2);) { - if (l1 == EINA_INLIST_GET(cur2->node)) return 1; /* cur2 < cur 1 */ - else if (l2 == EINA_INLIST_GET(cur2->node)) return -1; /* cur1 < cur 2 */ - else if (!l1) return -1; /* cur1 < cur 2 */ - else if (!l2) return 1; /* cur2 < cur 1 */ - l1 = l1->prev; - l2 = l2->next; + if (l1 == EINA_INLIST_GET(cur2->node)) return 1; /* cur2 < cur 1 */ + else if (l2 == EINA_INLIST_GET(cur2->node)) return -1; /* cur1 < cur 2 */ + else if (!l1) return -1; /* cur1 < cur 2 */ + else if (!l2) return 1; /* cur2 < cur 1 */ + l1 = l1->prev; + l2 = l2->next; } return 0; } @@ -9219,8 +9221,8 @@ _evas_textblock_changed(Evas_Textblock_Data *o, Evas_Object *eo_obj) o->content_changed = 1; if (o->markup_text) { - free(o->markup_text); - o->markup_text = NULL; + free(o->markup_text); + o->markup_text = NULL; } evas_object_change(eo_obj, obj); @@ -9513,14 +9515,14 @@ evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *form format = n->format; if (!cur->node) { - o->format_nodes = _NODE_FORMAT(eina_inlist_append( + o->format_nodes = _NODE_FORMAT(eina_inlist_append( EINA_INLIST_GET(o->format_nodes), EINA_INLIST_GET(n))); - cur->pos = 0; + cur->pos = 0; n->text_node = (EINA_INLIST_GET(n)->prev) ? _NODE_FORMAT(EINA_INLIST_GET(n)->prev)->text_node : o->text_nodes; - cur->node = n->text_node; + cur->node = n->text_node; } else { @@ -9709,12 +9711,12 @@ evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur) if (cur->pos == eina_ustrbuf_length_get(n->unicode)) { - n2 = _NODE_TEXT(EINA_INLIST_GET(n)->next); - if (n2) - { - cur->node = n2; - cur->pos = 0; - } + n2 = _NODE_TEXT(EINA_INLIST_GET(n)->next); + if (n2) + { + cur->node = n2; + cur->pos = 0; + } } _evas_textblock_cursors_update_offset(cur, n, ppos, -(ind - ppos)); @@ -9737,11 +9739,11 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C Evas_Textblock_Data *o = eo_data_scope_get(cur1->obj, MY_CLASS); if (evas_textblock_cursor_compare(cur1, cur2) > 0) { - Evas_Textblock_Cursor *tc; + Evas_Textblock_Cursor *tc; - tc = cur1; - cur1 = cur2; - cur2 = tc; + tc = cur1; + cur1 = cur2; + cur2 = tc; } n1 = cur1->node; n2 = cur2->node; @@ -9751,7 +9753,6 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C reset_cursor = EINA_TRUE; } - if (n1 == n2) { if ((cur1->pos == 0) && @@ -9875,11 +9876,11 @@ _evas_textblock_cursor_range_text_markup_get(const Evas_Textblock_Cursor *cur1, if (evas_textblock_cursor_compare(cur1, _cur2) > 0) { - const Evas_Textblock_Cursor *tc; + const Evas_Textblock_Cursor *tc; - tc = cur1; - cur1 = _cur2; - _cur2 = tc; + tc = cur1; + cur1 = _cur2; + _cur2 = tc; } /* Work on a local copy of the cur */ cur2 = alloca(sizeof(Evas_Textblock_Cursor)); @@ -9983,11 +9984,11 @@ _evas_textblock_cursor_range_text_plain_get(const Evas_Textblock_Cursor *cur1, c if (evas_textblock_cursor_compare(cur1, _cur2) > 0) { - const Evas_Textblock_Cursor *tc; + const Evas_Textblock_Cursor *tc; - tc = cur1; - cur1 = _cur2; - _cur2 = tc; + tc = cur1; + cur1 = _cur2; + _cur2 = tc; } n1 = cur1->node; n2 = _cur2->node; @@ -9996,7 +9997,6 @@ _evas_textblock_cursor_range_text_plain_get(const Evas_Textblock_Cursor *cur1, c cur2->obj = _cur2->obj; evas_textblock_cursor_copy(_cur2, cur2); - if (n1 == n2) { const Eina_Unicode *tmp; @@ -10576,8 +10576,8 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat { x = ln->x; } - y = ln->par->y + ln->y; - h = ln->h; + y = ln->par->y + ln->y; + h = ln->h; } else if (ln && fi) { @@ -10615,7 +10615,7 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat } else { - return -1; + return -1; } if (cx) *cx = x; if (cy) *cy = y; @@ -11376,11 +11376,11 @@ evas_textblock_cursor_range_geometry_get(const Evas_Textblock_Cursor *cur1, cons if (evas_textblock_cursor_compare(cur1, cur2) > 0) { - const Evas_Textblock_Cursor *tc; + const Evas_Textblock_Cursor *tc; - tc = cur1; - cur1 = cur2; - cur2 = tc; + tc = cur1; + cur1 = cur2; + cur2 = tc; } ln1 = ln2 = NULL; @@ -11412,12 +11412,12 @@ evas_textblock_cursor_range_geometry_get(const Evas_Textblock_Cursor *cur1, cons } while (lni && (lni != ln2)) { - tr = calloc(1, sizeof(Evas_Textblock_Rectangle)); - rects = eina_list_append(rects, tr); - tr->x = lni->x; - tr->y = lni->par->y + lni->y; - tr->h = lni->h; - tr->w = lni->w; + tr = calloc(1, sizeof(Evas_Textblock_Rectangle)); + rects = eina_list_append(rects, tr); + tr->x = lni->x; + tr->y = lni->par->y + lni->y; + tr->h = lni->h; + tr->w = lni->w; plni = lni; lni = (Evas_Object_Textblock_Line *) EINA_INLIST_GET(lni)->next; if (!lni && (plni->par != ln2->par)) @@ -11519,8 +11519,8 @@ _evas_textblock_clear(Eo *eo_obj, Evas_Textblock_Data *o) evas_object_async_block(obj); if (o->paragraphs) { - _paragraphs_free(eo_obj, o->paragraphs); - o->paragraphs = NULL; + _paragraphs_free(eo_obj, o->paragraphs); + o->paragraphs = NULL; } _nodes_clear(eo_obj); @@ -11528,9 +11528,8 @@ _evas_textblock_clear(Eo *eo_obj, Evas_Textblock_Data *o) o->cursor->pos = 0; EINA_LIST_FOREACH(o->cursors, l, cur) { - cur->node = NULL; - cur->pos = 0; - + cur->node = NULL; + cur->pos = 0; } _evas_textblock_changed(o, eo_obj); @@ -11813,7 +11812,7 @@ _evas_textblock_size_native_get(Eo *eo_obj, Evas_Textblock_Data *o, Evas_Coord * o->native.w = wmax; o->native.h = hmax; - o->native.valid = 1; + o->native.valid = 1; o->content_changed = 0; o->format_changed = EINA_FALSE; } @@ -11920,19 +11919,19 @@ evas_object_textblock_free(Evas_Object *eo_obj) free(o->cursor); while (o->cursors) { - Evas_Textblock_Cursor *cur; + Evas_Textblock_Cursor *cur; - cur = (Evas_Textblock_Cursor *)o->cursors->data; - o->cursors = eina_list_remove_list(o->cursors, o->cursors); - free(cur); + cur = (Evas_Textblock_Cursor *)o->cursors->data; + o->cursors = eina_list_remove_list(o->cursors, o->cursors); + free(cur); } if (o->repch) eina_stringshare_del(o->repch); if (o->ellip_ti) _item_free(eo_obj, NULL, _ITEM(o->ellip_ti)); if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters); - _format_command_shutdown(); + _format_command_shutdown(); - /* remove obstacles */ - _obstacles_free(eo_obj, o); + /* remove obstacles */ + _obstacles_free(eo_obj, o); #ifdef HAVE_HYPHEN /* Hyphenation */ @@ -11963,11 +11962,11 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, int na, nr, ng, nb; const char vals[5][5] = { - {0, 1, 2, 1, 0}, - {1, 3, 4, 3, 1}, - {2, 4, 5, 4, 2}, - {1, 3, 4, 3, 1}, - {0, 1, 2, 1, 0} + {0, 1, 2, 1, 0}, + {1, 3, 4, 3, 1}, + {2, 4, 5, 4, 2}, + {1, 3, 4, 3, 1}, + {0, 1, 2, 1, 0} }; /* [FIXME!!!] rare case when relayout was not called: cache.clip made