herdsman pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ed2b4e97c1986e3552fc1c6fcc98eb39abb86b3f
commit ed2b4e97c1986e3552fc1c6fcc98eb39abb86b3f Author: Daniel Hirt <daniel.h...@samsung.com> Date: Wed Oct 5 17:10:14 2016 +0300 Canvas text: add annotation_positions_get method We need a method that allows us to place the cursors at the start and end of an annotation. This is required for things like getting the geometry of a range. @feature --- src/lib/evas/canvas/efl_canvas_text.eo | 18 ++++++++++++++++++ src/lib/evas/canvas/evas_object_textblock.c | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo index 79b3000..4e5dca4 100644 --- a/src/lib/evas/canvas/efl_canvas_text.eo +++ b/src/lib/evas/canvas/efl_canvas_text.eo @@ -341,6 +341,24 @@ class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text) } return: bool; [[$true if given annotation is an object item, $false otherwise]] } + annotation_positions_get { + [[Sets given cursors to the start and end positions of the annotation. + + The cursors $start and $end will be set to the the start and end + positions of the given annotation $annotation. + + @since 1.18 + ]] + legacy: null; + params { + @in annotation: const(Efl.Canvas.Text.Annotation)*; [[Annotation + handle to query]] + @in start: Efl.Canvas.Text.Cursor; [[Cursor to be set to the start + position of the annotation in the text]] + @in end: Efl.Canvas.Text.Cursor; [[Cursor to be set to the end + position of the annotation in the text]] + } + } } implements { Efl.Object.constructor; diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 30649bd..2b01c0a 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -14043,6 +14043,21 @@ _efl_canvas_text_object_item_geometry_get(Eo *eo_obj, Efl_Canvas_Text_Data *o EI return _evas_textblock_cursor_format_item_geometry_get(&cur, cx, cy, cw, ch); } +EOLIAN static void +_efl_canvas_text_annotation_positions_get(Eo *eo_obj, + Efl_Canvas_Text_Data *o EINA_UNUSED, + const Efl_Canvas_Text_Annotation *annotation, + Efl_Canvas_Text_Cursor *start_obj, Efl_Canvas_Text_Cursor *end_obj) +{ + Efl_Canvas_Text_Cursor_Data *start, *end; + + start = efl_data_scope_get(start_obj, EFL_CANVAS_TEXT_CURSOR_CLASS); + end = efl_data_scope_get(end_obj, EFL_CANVAS_TEXT_CURSOR_CLASS); + + _textblock_cursor_pos_at_fnode_set(eo_obj, start, annotation->start_node); + _textblock_cursor_pos_at_fnode_set(eo_obj, end, annotation->end_node); +} + /** * @} */ --