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
]]
{
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)
{
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;
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);
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)
{