herdsman pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c0701a1051b94ffb018f54919dc7c462cdaac64f
commit c0701a1051b94ffb018f54919dc7c462cdaac64f Author: Daniel Hirt <daniel.h...@samsung.com> Date: Wed Oct 5 17:09:59 2016 +0300 Canvas text cursor: add simple_geometry_get method The ported geometry_get was actually the legacy simple_geometry_get. For getting simple geometries like selection this was enough, but I forgot that we also need to query more complex geometries e.g. links. This is required to implement link anchors in Ui Text. Now geometry_get and simple_geometry_get are the same as their legacy counterparts. @feature --- src/lib/evas/canvas/efl_canvas_text.eo | 24 +++++++++++++++++++--- src/lib/evas/canvas/evas_object_textblock.c | 32 ++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo index ce13f48..39d1146 100644 --- a/src/lib/evas/canvas/efl_canvas_text.eo +++ b/src/lib/evas/canvas/efl_canvas_text.eo @@ -232,9 +232,27 @@ class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text) return: Efl.Canvas.Text.Annotation *; } range_geometry_get { - [[Get the geometry of a range. The geometry is the geometry in - which rectangles in middle lines of range are merged into one big - rectangle. + [[Get the geometry of a range in the text. + + The geometry is represented as rectangles for each of the line + segments in the given range [$cur1, $cur2]. + + @since 1.19 + ]] + legacy: null; + params { + @in cur1: const(Efl.Canvas.Text.Cursor); + @in cur2: const(Efl.Canvas.Text.Cursor); + } + return: free(own(iterator<Eina.Rectangle>), + eina_iterator_free); + } + range_simple_geometry_get { + [[Get the "simple" geometry of a range. + + The geometry is the geometry in which rectangles in middle lines of + range are merged into one big rectangle. This is an optimized + version of @.range_geometry_get. @since 1.13 ]] diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 4b04b56..30649bd 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -11990,11 +11990,11 @@ evas_textblock_cursor_range_simple_geometry_get(const Efl_Canvas_Text_Cursor *cu { Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS); if (!cur) return NULL; - return efl_canvas_text_range_geometry_get(cur->obj, cur1_obj, cur2_obj); + return efl_canvas_text_range_simple_geometry_get(cur->obj, cur1_obj, cur2_obj); } static EOLIAN Eina_Iterator * -_efl_canvas_text_range_geometry_get(Eo *eo_obj EINA_UNUSED, +_efl_canvas_text_range_simple_geometry_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj) { @@ -12102,8 +12102,10 @@ _efl_canvas_text_range_geometry_get(Eo *eo_obj EINA_UNUSED, return itr; } -EAPI Eina_List * -evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj) +static Eina_List * +_efl_canvas_text_range_geometry_list_get(Eo *eo_obj EINA_UNUSED, + Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1_obj, const + Evas_Textblock_Cursor *cur2_obj) { Evas_Object_Textblock_Line *ln1, *ln2; Evas_Object_Textblock_Item *it1, *it2; @@ -12117,7 +12119,6 @@ evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, if (cur1->obj != cur2->obj) return NULL; Evas_Object_Protected_Data *obj = efl_data_scope_get(cur1->obj, EFL_CANVAS_OBJECT_CLASS); evas_object_async_block(obj); - Efl_Canvas_Text_Data *o = efl_data_scope_get(cur1->obj, MY_CLASS); _relayout_if_needed(cur1->obj, o); @@ -12180,6 +12181,27 @@ evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, return rects; } +EAPI Eina_List * +evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj) +{ + Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS); + Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); + + if (!cur) return NULL; + + return _efl_canvas_text_range_geometry_list_get(cur->obj, o, cur1_obj, cur2_obj); +} + +static EOLIAN Eina_Iterator * +_efl_canvas_text_range_geometry_get(Eo *eo_obj EINA_UNUSED, + Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1_obj, const + Evas_Textblock_Cursor *cur2_obj) +{ + Eina_List *rects = _efl_canvas_text_range_geometry_list_get(eo_obj, + o, cur1_obj, cur2_obj); + return _evas_textblock_selection_iterator_new(rects); +} + static Eina_Bool _evas_textblock_cursor_format_item_geometry_get(const Efl_Canvas_Text_Cursor_Data *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) { --