diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 54e431190c..c615b5ed00 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; @@ -536,17 +536,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); @@ -554,17 +554,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 = { @@ -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); @@ -4892,7 +4892,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; @@ -6291,17 +6291,13 @@ 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) { @@ -7997,13 +7993,15 @@ 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; + } } @@ -8430,8 +8428,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; @@ -8971,19 +8969,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; } @@ -9221,8 +9219,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); @@ -9515,14 +9513,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 { @@ -9711,12 +9709,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)); @@ -9739,11 +9737,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; @@ -9877,11 +9875,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)); @@ -9985,11 +9983,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; @@ -10578,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) { @@ -10617,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; @@ -11378,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; @@ -11414,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)) @@ -11521,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); @@ -11530,8 +11528,9 @@ _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); @@ -11814,7 +11813,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; } @@ -11921,11 +11920,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)); @@ -11946,10 +11945,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; @@ -11964,11 +11963,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 @@ -12509,8 +12508,8 @@ evas_object_textblock_coords_recalc(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) { Evas_Textblock_Data *o = type_private_data; int is_v, was_v;