diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index d579efdafa..05d0050d0b 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; @@ -530,17 +530,17 @@ struct _Evas_Textblock_Selection_Iterator /* private methods for textblock objects */ static void evas_object_textblock_init(Evas_Object *eo_obj); static void evas_object_textblock_render(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data, - void *output, void *context, void *surface, - int x, int y, Eina_Bool do_async); + Evas_Object_Protected_Data *obj, + void *type_private_data, + void *output, void *context, void *surface, + int x, int y, Eina_Bool do_async); static void evas_object_textblock_free(Evas_Object *eo_obj); static void evas_object_textblock_render_pre(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static void evas_object_textblock_render_post(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static Evas_Object_Textblock_Node_Text *_evas_textblock_node_text_new(void); static unsigned int evas_object_textblock_id_get(Evas_Object *eo_obj); @@ -548,17 +548,17 @@ static unsigned int evas_object_textblock_visual_id_get(Evas_Object *eo_obj); static void *evas_object_textblock_engine_data_get(Evas_Object *eo_obj); static int evas_object_textblock_is_opaque(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static int evas_object_textblock_was_opaque(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static void evas_object_textblock_coords_recalc(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static void evas_object_textblock_scale_update(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data); + Evas_Object_Protected_Data *obj, + void *type_private_data); static const Evas_Object_Func object_func = { @@ -705,13 +705,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; @@ -745,12 +745,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 */ @@ -785,9 +785,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); @@ -4625,7 +4625,7 @@ _layout_handle_ellipsis(Ctxt *c, Evas_Object_Textblock_Item *it, Eina_List *i) /* Don't do much for the meanwhile. */ static inline void _layout_paragraph_render(Evas_Textblock_Data *o, - Evas_Object_Textblock_Paragraph *par) + Evas_Object_Textblock_Paragraph *par) { if (par->rendered) return; @@ -5996,13 +5996,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) { @@ -7657,15 +7661,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; } } @@ -8041,8 +8043,8 @@ evas_textblock_cursor_line_char_first(Evas_Textblock_Cursor *cur) } if (it) { - cur->pos = it->text_pos; - cur->node = it->text_node; + cur->pos = it->text_pos; + cur->node = it->text_node; } } @@ -8079,8 +8081,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; @@ -8605,13 +8607,12 @@ evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line) it = (Evas_Object_Textblock_Item *)ln->items; if (it) { - cur->pos = it->text_pos; - cur->node = it->text_node; + cur->pos = it->text_pos; + cur->node = it->text_node; } else { cur->pos = 0; - cur->node = o->text_nodes; } return EINA_TRUE; @@ -8630,19 +8631,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; } @@ -8880,8 +8881,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); @@ -9174,14 +9175,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 { @@ -9370,12 +9371,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)); @@ -9398,11 +9399,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; @@ -9539,11 +9540,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)); @@ -9650,11 +9651,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; @@ -10237,8 +10238,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) { @@ -10276,7 +10277,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; @@ -10985,11 +10986,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; @@ -11021,12 +11022,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)) @@ -11128,8 +11129,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); @@ -11137,9 +11138,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); @@ -11422,7 +11422,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; } @@ -11526,11 +11526,11 @@ 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)); @@ -11543,10 +11543,10 @@ evas_object_textblock_free(Evas_Object *eo_obj) static void evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, - Evas_Object_Protected_Data *obj, - void *type_private_data, - void *output, void *context, void *surface, - int x, int y, Eina_Bool do_async) + Evas_Object_Protected_Data *obj, + void *type_private_data, + void *output, void *context, void *surface, + int x, int y, Eina_Bool do_async) { Evas_Object_Textblock_Paragraph *par, *start = NULL; Evas_Object_Textblock_Item *itr; @@ -11561,11 +11561,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 @@ -12073,15 +12073,15 @@ evas_object_textblock_coords_recalc(Evas_Object *eo_obj EINA_UNUSED, ) { LYDBG("ZZ: invalidate 2 %p ## %i != %i || %3.3f || %i && %i != %i | %i %i\n", eo_obj, obj->cur->geometry.w, o->last_w, o->valign, o->have_ellipsis, obj->cur->geometry.h, o->last_h, o->content_changed, o->format_changed); - o->formatted.valid = 0; - o->changed = 1; + o->formatted.valid = 0; + o->changed = 1; } } static void evas_object_textblock_render_pre(Evas_Object *eo_obj, - Evas_Object_Protected_Data *obj, - void *type_private_data) + Evas_Object_Protected_Data *obj, + void *type_private_data) { Evas_Textblock_Data *o = type_private_data; int is_v, was_v;