From 4923945f817c3b834e970187e1431db55d022d47 Mon Sep 17 00:00:00 2001 From: Daniel Hirt Date: Mon, 17 Jul 2017 17:38:28 +0300 Subject: [PATCH] Text: move Annotation type to Efl.Text.Annotate namespace --- src/lib/efl/Efl.h | 2 +- src/lib/efl/interfaces/efl_text_annotate.eo | 16 ++++---- src/lib/efl/interfaces/efl_text_types.eot | 2 +- src/lib/elementary/efl_ui_text.c | 12 +++--- src/lib/evas/canvas/evas_object_textblock.c | 62 ++++++++++++++--------------- src/tests/evas/evas_test_textblock.c | 4 +- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 0b9c481..c1cc00e 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -53,7 +53,7 @@ extern "C" { typedef struct tm Efl_Time; typedef struct _Efl_Text_Cursor_Cursor Efl_Text_Cursor_Cursor; -typedef struct _Efl_Canvas_Text_Annotation Efl_Canvas_Text_Annotation; +typedef struct _Efl_Text_Annotate_Annotation Efl_Text_Annotate_Annotation; #ifdef EFL_BETA_API_SUPPORT diff --git a/src/lib/efl/interfaces/efl_text_annotate.eo b/src/lib/efl/interfaces/efl_text_annotate.eo index 82921b8..4349805 100644 --- a/src/lib/efl/interfaces/efl_text_annotate.eo +++ b/src/lib/efl/interfaces/efl_text_annotate.eo @@ -27,7 +27,7 @@ interface Efl.Text.Annotate { legacy: null; } keys { - annotation: ptr(Efl.Canvas.Text.Annotation); [[Given annotation]] + annotation: ptr(Efl.Text.Annotate.Annotation); [[Given annotation]] } values { format: string; [[The new format for the given annotation]] @@ -43,7 +43,7 @@ interface Efl.Text.Annotate { @in start: ptr(const(Efl.Text.Cursor.Cursor)); [[Start of range]] @in end: ptr(const(Efl.Text.Cursor.Cursor)); [[End of range]] } - return: free(own(iterator), + return: free(own(iterator), eina_iterator_free); [[Handle of the Annotation]] } annotation_insert { @@ -60,7 +60,7 @@ interface Efl.Text.Annotate { @in end: ptr(Efl.Text.Cursor.Cursor); [[End of range]] @in format: string; [[Annotation format]] } - return: ptr(Efl.Canvas.Text.Annotation); [[Handle of inserted annotation]] + return: ptr(Efl.Text.Annotate.Annotation); [[Handle of inserted annotation]] } annotation_del { [[Deletes given annotation. @@ -72,7 +72,7 @@ interface Efl.Text.Annotate { ]] legacy: null; params { - @in annotation: ptr(Efl.Canvas.Text.Annotation); [[Annotation to be + @in annotation: ptr(Efl.Text.Annotate.Annotation); [[Annotation to be removed]] } return: bool; [[$true on success, $false otherwise.]] @@ -86,7 +86,7 @@ interface Efl.Text.Annotate { ]] legacy: null; params { - @in an: ptr(const(Efl.Canvas.Text.Annotation)); [[Given annotation to query]] + @in an: ptr(const(Efl.Text.Annotate.Annotation)); [[Given annotation to query]] @out x: int; [[X coordinate of the annotation]] @out y: int; [[Y coordinate of the annotation]] @out w: int; [[Width of the annotation]] @@ -104,7 +104,7 @@ interface Efl.Text.Annotate { ]] legacy: null; params { - @in annotation: ptr(const(Efl.Canvas.Text.Annotation)); [[Annotation + @in annotation: ptr(const(Efl.Text.Annotate.Annotation)); [[Annotation handle to query]] @in start: ptr(Efl.Text.Cursor.Cursor); [[Cursor to be set to the start position of the annotation in the text]] @@ -119,7 +119,7 @@ interface Efl.Text.Annotate { legacy: null; } values { - annotation: ptr(Efl.Canvas.Text.Annotation); [[Annotation]] + annotation: ptr(Efl.Text.Annotate.Annotation); [[Annotation]] } keys { cur: ptr(Efl.Text.Cursor.Cursor); @@ -138,7 +138,7 @@ interface Efl.Text.Annotate { @in format: string; [[Format of the inserted item. See Format styles.]] } - return: ptr(Efl.Canvas.Text.Annotation); [[The annotation handle of the + return: ptr(Efl.Text.Annotate.Annotation); [[The annotation handle of the inserted item.]] } } diff --git a/src/lib/efl/interfaces/efl_text_types.eot b/src/lib/efl/interfaces/efl_text_types.eot index d83ee1f..d6f7640 100644 --- a/src/lib/efl/interfaces/efl_text_types.eot +++ b/src/lib/efl/interfaces/efl_text_types.eot @@ -7,7 +7,7 @@ enum Efl.Text.Bidirectional_Type { inherit [[Inherit text type]] } -type @extern Efl.Canvas.Text.Annotation: __undefined_type; [[EFL text annotations data structure]] +type @extern Efl.Text.Annotate.Annotation: __undefined_type; [[EFL text annotations data structure]] type @extern Efl.Text.Cursor.Cursor: __undefined_type; [[Text cursor data structure]] diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index f712324..9bb136b 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -134,7 +134,7 @@ struct _Anchor { Eo *obj; char *name; - Efl_Canvas_Text_Annotation *annotation; + Efl_Text_Annotate_Annotation *annotation; Eina_List *sel; Eina_Bool item : 1; }; @@ -4395,7 +4395,7 @@ _efl_ui_text_elm_interface_atspi_text_range_extents_get(Eo *obj, Efl_Ui_Text_Dat static Elm_Atspi_Text_Attribute* _textblock_node_format_to_atspi_text_attr(Eo *obj, - Efl_Canvas_Text_Annotation *annotation) + Efl_Text_Annotate_Annotation *annotation) { Elm_Atspi_Text_Attribute *ret; const char *txt; @@ -4419,7 +4419,7 @@ _efl_ui_text_elm_interface_atspi_text_attribute_get(Eo *obj, Efl_Ui_Text_Data *_ Evas_Textblock_Cursor *cur1, *cur2; Elm_Atspi_Text_Attribute *attr; Eina_Iterator *annotations; - Efl_Canvas_Text_Annotation *an; + Efl_Text_Annotate_Annotation *an; cur1 = evas_object_textblock_cursor_new(obj); if (!cur1) return EINA_FALSE; @@ -4465,7 +4465,7 @@ _efl_ui_text_elm_interface_atspi_text_attributes_get(Eo *obj, Efl_Ui_Text_Data * Eina_List *ret = NULL; Elm_Atspi_Text_Attribute *attr; Eina_Iterator *annotations; - Efl_Canvas_Text_Annotation *an; + Efl_Text_Annotate_Annotation *an; cur1 = evas_object_textblock_cursor_new(obj); if (!cur1) return NULL; @@ -4505,7 +4505,7 @@ _efl_ui_text_elm_interface_atspi_text_default_attributes_get(Eo *obj, Efl_Ui_Tex Elm_Atspi_Text_Attribute *attr; Efl_Text_Cursor_Cursor *start, *end; Eina_Iterator *annotations; - Efl_Canvas_Text_Annotation *an; + Efl_Text_Annotate_Annotation *an; /* Retrieve all annotations in the text. */ start = efl_text_cursor_new(obj); @@ -4983,7 +4983,7 @@ _anchors_create(Eo *obj, Efl_Ui_Text_Data *sd) Eina_Iterator *it; Anchor *an = NULL; Efl_Text_Cursor_Cursor *start, *end; - Efl_Canvas_Text_Annotation *anchor; + Efl_Text_Annotate_Annotation *anchor; Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); _anchors_clear_all(obj, sd); diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index f0b53da..d2a7147 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -215,10 +215,10 @@ typedef struct _Evas_Object_Textblock_Format Evas_Object_Textblock_Format; typedef struct _Evas_Textblock_Selection_Iterator Evas_Textblock_Selection_Iterator; /** * @internal - * @typedef Efl_Canvas_Text_Annotation_Iterator + * @typedef Efl_Text_Annotate_Annotation_Iterator * A textblock annotation iterator. */ -typedef struct _Efl_Canvas_Text_Annotation_Iterator Efl_Canvas_Text_Annotation_Iterator; +typedef struct _Efl_Text_Annotate_Annotation_Iterator Efl_Text_Annotate_Annotation_Iterator; /** * @internal * @typedef Efl_Canvas_Text_Filter @@ -336,7 +336,7 @@ struct _Evas_Textblock_Node_Format const char *format; /**< Cached, parsed and translated version of orig_format. */ const char *orig_format; /**< Original format information. */ Evas_Object_Textblock_Node_Text *text_node; /**< The text node it's pointing to. */ - Efl_Canvas_Text_Annotation *annotation; /**< Pointer to this node's annotation handle (if exists). */ + Efl_Text_Annotate_Annotation *annotation; /**< Pointer to this node's annotation handle (if exists). */ size_t offset; /**< Offset from the last format node of the same text. */ struct { unsigned char l, r, t, b; @@ -566,7 +566,7 @@ struct _Efl_Text_Cursor_Cursor Eina_Bool changed : 1; }; -struct _Efl_Canvas_Text_Annotation +struct _Efl_Text_Annotate_Annotation { EINA_INLIST; Evas_Object *obj; @@ -598,7 +598,7 @@ struct _Evas_Object_Textblock Eina_List *anchors_item; Eina_List *obstacles; Eina_List *hyphen_items; /* Hyphen items storage to free when clearing lines */ - Efl_Canvas_Text_Annotation *annotations; /* All currently applied annotations on the text. */ + Efl_Text_Annotate_Annotation *annotations; /* All currently applied annotations on the text. */ int last_w, last_h; struct { int l, r, t, b; @@ -658,7 +658,7 @@ struct _Evas_Textblock_Selection_Iterator Eina_List *current; /**< Current node in loop. */ }; -struct _Efl_Canvas_Text_Annotation_Iterator +struct _Efl_Text_Annotate_Annotation_Iterator { Eina_Iterator iterator; /**< Eina Iterator. */ Eina_List *list; /**< Head of list. */ @@ -750,7 +750,7 @@ static void _evas_textblock_invalidate_all(Efl_Canvas_Text_Data *o); static void _evas_textblock_cursors_update_offset(const Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Text *n, size_t start, int offset); static void _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o, const Evas_Object_Textblock_Node_Text *n, Evas_Object_Textblock_Node_Text *new_node); static void _evas_textblock_annotations_clear(Efl_Canvas_Text_Data *o); -static void _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, Efl_Canvas_Text_Annotation *an, Eina_Bool remove_nodes); +static void _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes); static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Text_Cursor_Cursor *cur); static void _evas_textblock_cursor_at_format_set(Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Format *fmt); @@ -9309,7 +9309,7 @@ _evas_textblock_node_format_remove_matching(Efl_Canvas_Text_Data *o, if (_FORMAT_IS_CLOSER_OF( fnode->orig_format, fstr + 1, fstr_len - 1)) { - Efl_Canvas_Text_Annotation *an = fmt->annotation; + Efl_Text_Annotate_Annotation *an = fmt->annotation; fnode = eina_list_data_get(i); formats = eina_list_remove_list(formats, i); @@ -14469,7 +14469,7 @@ _efl_canvas_text_efl_text_text_get(Eo *eo_obj, Efl_Canvas_Text_Data *o) * @return EINA_FALSE if unsuccessful. Otherwise, returns EINA_TRUE. */ static Eina_Bool -_evas_textblock_annotation_iterator_next(Efl_Canvas_Text_Annotation_Iterator *it, void **data) +_evas_textblock_annotation_iterator_next(Efl_Text_Annotate_Annotation_Iterator *it, void **data) { if (!it->current) return EINA_FALSE; @@ -14487,7 +14487,7 @@ _evas_textblock_annotation_iterator_next(Efl_Canvas_Text_Annotation_Iterator *it * @return EINA_FALSE if unsuccessful. Otherwise, returns EINA_TRUE. */ static Eina_Bool -_evas_textblock_annotation_iterator_free(Efl_Canvas_Text_Annotation_Iterator *it) +_evas_textblock_annotation_iterator_free(Efl_Text_Annotate_Annotation_Iterator *it) { EINA_MAGIC_SET(&it->iterator, 0); it->current = NULL; @@ -14508,7 +14508,7 @@ _evas_textblock_annotation_iterator_new(Eina_List *list) { Evas_Textblock_Selection_Iterator *it; - it = calloc(1, sizeof(Efl_Canvas_Text_Annotation_Iterator)); + it = calloc(1, sizeof(Efl_Text_Annotate_Annotation_Iterator)); if (!it) return NULL; EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); @@ -14535,7 +14535,7 @@ _textblock_cursor_pos_at_fnode_set(Eo *eo_obj EINA_UNUSED, static Eina_Bool _textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, - Efl_Canvas_Text_Annotation *an, + Efl_Text_Annotate_Annotation *an, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, const char *format, Eina_Bool is_item) { @@ -14575,7 +14575,7 @@ _textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, EOLIAN static const char * _efl_canvas_text_efl_text_annotate_annotation_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, - Efl_Canvas_Text_Annotation *annotation) + Efl_Text_Annotate_Annotation *annotation) { if (!annotation || (annotation->obj != eo_obj)) { @@ -14588,7 +14588,7 @@ _efl_canvas_text_efl_text_annotate_annotation_get(Eo *eo_obj EINA_UNUSED, Efl_Ca EOLIAN static Eina_Bool _efl_canvas_text_efl_text_annotate_annotation_set(Eo *eo_obj, - Efl_Canvas_Text_Data *o, Efl_Canvas_Text_Annotation *annotation, + Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *annotation, const char *format) { Efl_Text_Cursor_Cursor start, end; @@ -14624,7 +14624,7 @@ _efl_canvas_text_efl_text_annotate_annotation_set(Eo *eo_obj, static void _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, - Efl_Canvas_Text_Annotation *an, Eina_Bool remove_nodes) + Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes) { if (remove_nodes) { @@ -14640,7 +14640,7 @@ _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, _evas_textblock_node_format_remove(o, an->start_node, 0); _evas_textblock_node_format_remove(o, an->end_node, 0); } - o->annotations = (Efl_Canvas_Text_Annotation *) + o->annotations = (Efl_Text_Annotate_Annotation *) eina_inlist_remove(EINA_INLIST_GET(o->annotations), EINA_INLIST_GET(an)); free(an); @@ -14649,7 +14649,7 @@ _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, static void _evas_textblock_annotations_clear(Efl_Canvas_Text_Data *o) { - Efl_Canvas_Text_Annotation *an; + Efl_Text_Annotate_Annotation *an; EINA_INLIST_FREE(o->annotations, an) { @@ -14659,7 +14659,7 @@ _evas_textblock_annotations_clear(Efl_Canvas_Text_Data *o) EOLIAN static Eina_Bool _efl_canvas_text_efl_text_annotate_annotation_del(Eo *eo_obj EINA_UNUSED, - Efl_Canvas_Text_Data *o, Efl_Canvas_Text_Annotation *annotation) + Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *annotation) { if (!annotation || (annotation->obj != eo_obj)) { @@ -14681,12 +14681,12 @@ _efl_canvas_text_efl_text_annotate_annotation_del(Eo *eo_obj EINA_UNUSED, return EINA_TRUE; } -static Efl_Canvas_Text_Annotation * +static Efl_Text_Annotate_Annotation * _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, const char *format, Eina_Bool is_item) { - Efl_Canvas_Text_Annotation *ret = NULL; + Efl_Text_Annotate_Annotation *ret = NULL; Eina_Strbuf *buf; Eina_Bool first = EINA_TRUE; const char *item; @@ -14728,10 +14728,10 @@ _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, format = eina_strbuf_string_get(buf); if (format && (format[0] != '\0')) { - ret = calloc(1, sizeof(Efl_Canvas_Text_Annotation)); + ret = calloc(1, sizeof(Efl_Text_Annotate_Annotation)); ret->obj = eo_obj; - o->annotations = (Efl_Canvas_Text_Annotation *) + o->annotations = (Efl_Text_Annotate_Annotation *) eina_inlist_append(EINA_INLIST_GET(o->annotations), EINA_INLIST_GET(ret)); @@ -14746,12 +14746,12 @@ _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, return ret; } -EOLIAN static Efl_Canvas_Text_Annotation * +EOLIAN static Efl_Text_Annotate_Annotation * _efl_canvas_text_efl_text_annotate_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, const char *format) { - Efl_Canvas_Text_Annotation *ret; + Efl_Text_Annotate_Annotation *ret; ret = _textblock_annotation_insert(eo_obj, o, start, end, format, EINA_FALSE); @@ -14764,7 +14764,7 @@ _efl_canvas_text_efl_text_annotate_range_annotations_get(Eo *eo_obj EINA_UNUSED, const Evas_Textblock_Cursor *start, const Evas_Textblock_Cursor *end) { Eina_List *lst = NULL; - Efl_Canvas_Text_Annotation *it; + Efl_Text_Annotate_Annotation *it; EINA_INLIST_FOREACH(o->annotations, it) { @@ -14785,21 +14785,21 @@ _efl_canvas_text_efl_text_annotate_range_annotations_get(Eo *eo_obj EINA_UNUSED, return _evas_textblock_annotation_iterator_new(lst); } -EOLIAN static Efl_Canvas_Text_Annotation * +EOLIAN static Efl_Text_Annotate_Annotation * _efl_canvas_text_efl_text_annotate_cursor_object_item_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, const char *format) { - Efl_Canvas_Text_Annotation *ret = + Efl_Text_Annotate_Annotation *ret = _textblock_annotation_insert(cur->obj, o, cur, cur, format, EINA_TRUE); efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); return ret; } -EOLIAN static Efl_Canvas_Text_Annotation * +EOLIAN static Efl_Text_Annotate_Annotation * _efl_canvas_text_efl_text_annotate_cursor_object_item_annotation_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) { Eina_Iterator *it; - Efl_Canvas_Text_Annotation *data, *ret = NULL; + Efl_Text_Annotate_Annotation *data, *ret = NULL; it = efl_text_range_annotations_get(cur->obj, cur, cur); @@ -14817,7 +14817,7 @@ _efl_canvas_text_efl_text_annotate_cursor_object_item_annotation_get(Eo *eo_obj EOLIAN static Eina_Bool _efl_canvas_text_efl_text_annotate_object_item_geometry_get(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, - const Efl_Canvas_Text_Annotation *an, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) + const Efl_Text_Annotate_Annotation *an, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) { Efl_Text_Cursor_Cursor cur; @@ -14833,7 +14833,7 @@ _efl_canvas_text_efl_text_annotate_object_item_geometry_get(Eo *eo_obj, Efl_Canv EOLIAN static void _efl_canvas_text_efl_text_annotate_annotation_positions_get(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, - const Efl_Canvas_Text_Annotation *annotation, + const Efl_Text_Annotate_Annotation *annotation, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end) { _textblock_cursor_pos_at_fnode_set(eo_obj, start, annotation->start_node); diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 50ce8b5..b3c60c9 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -4156,7 +4156,7 @@ _test_check_annotation(Evas_Object *tb, size_t start_pos, size_t end_pos, size_t len, const char **formats) { - Efl_Canvas_Text_Annotation *an; + Efl_Text_Annotate_Annotation *an; Efl_Text_Cursor_Cursor *start, *end; start = evas_object_textblock_cursor_new(tb); @@ -4196,7 +4196,7 @@ _test_check_annotation(Evas_Object *tb, START_TEST(evas_textblock_annotation) { START_TB_TEST(); - Efl_Canvas_Text_Annotation *an, *an2; + Efl_Text_Annotate_Annotation *an, *an2; Efl_Text_Cursor_Cursor *start, *end; start = evas_object_textblock_cursor_new(tb); -- 2.7.4