summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-06-06 22:32:03 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-06-06 22:32:03 +0300
commited17f5af5215c76fe468698421e4044bad83baac (patch)
tree965b6d117c28f9ef4606a8bdc5df8071bb4f8857
parentc5a0efab15fa652b60a1dc28e3775223f4ce8dca (diff)
downloadefl-ed17f5af5215c76fe468698421e4044bad83baac.tar.gz
save checkpoint
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo336
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c2070
-rw-r--r--src/lib/evas/canvas/evas_textblock_legacy.h7
3 files changed, 514 insertions, 1899 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index be0f85d0f7..c0b5a1fa91 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -12,6 +12,334 @@ class Efl.Canvas.Text (Efl.Canvas.Object)
[[Efl canvas text class]]
legacy_prefix: evas_object_textblock;
methods {
+ @property is_empty {
+ [[Whether the object is empty (no text) or not
+
+ @since 1.18
+ ]]
+ get {
+ legacy: null;
+ }
+ values {
+ is_empty: bool; [[$true if empty, $false otherwise]]
+ }
+ }
+ visible_range_get {
+ [[Returns the currently visible range.
+
+ The given $start and $end cursor act like an out-variables here,
+ as these are set to the positions of the start and the end of the
+ visible range in the text, respectively.
+
+ @since 1.18
+ ]]
+ return: bool; [[$true on success, $false otherwise]]
+ params {
+ @in start: ptr(Efl.Canvas.Text.Cursor); [[Range start position]]
+ @in end: ptr(Efl.Canvas.Text.Cursor); [[Range end position]]
+ }
+ }
+ @property style_insets {
+ [[Gets the left, right, top and bottom insets of the text.
+
+ The inset is any applied padding on the text.
+
+ @since 1.18
+ ]]
+ get {}
+ values {
+ l: int; [[Left padding]]
+ r: int; [[Right padding]]
+ t: int; [[Top padding]]
+ b: int; [[Bottom padding]]
+ }
+ }
+ @property bidi_delimiters {
+ [[BiDi delimiters are used for in-paragraph separation of bidi
+ segments. This is useful for example in recipients fields of
+ e-mail clients where bidi oddities can occur when mixing RTL
+ and LTR.
+
+ @since 1.18
+ ]]
+ set {}
+ get {}
+ values {
+ delim: string; [[A null terminated string of delimiters, e.g ",|" or $null if empty]]
+ }
+ }
+ @property legacy_newline {
+ [[When $true, newline character will behave as a paragraph separator.
+
+ @since 1.18
+ ]]
+ set {}
+ get {}
+ values {
+ mode: bool; [[$true for legacy mode, $false otherwise]]
+ }
+ }
+ @property style {
+ [[The text style of the object.
+
+ $key is how you reference the style (for deletion or fetching). $NULL
+ as key indicates the style has the highest priority (default style).
+ The style priority is the order of creation, styles created first
+ are applied first with the exception of $NULL which is implicitly
+ first.
+
+ Set $style to $NULL to delete it.
+
+ @since 1.18
+ ]]
+ set {
+ legacy: null;
+ }
+ get {
+ legacy: null;
+ }
+ keys {
+ key: string; [[The name to the style. $NULL is the default style]]
+ }
+ values {
+ style: string; [[The style]]
+ }
+ }
+ @property size_formatted {
+ [[The formatted width and height.
+
+ This calculates the actual size after restricting the
+ textblock to the current size of the object.
+
+ The main difference between this and @.size_native.get
+ is that the "native" function does not wrapping into account
+ it just calculates the real width of the object if it was
+ placed on an infinite canvas, while this function gives the
+ size after wrapping according to the size restrictions of the
+ object.
+
+ For example for a textblock containing the text:
+ "You shall not pass!" with no margins or padding and assuming
+ a monospace font and a size of 7x10 char widths (for simplicity)
+ has a native size of 19x1 and a formatted size of 5x4.
+
+ @since 1.18
+ ]]
+ get {}
+ values {
+ w: int; [[The width of the object.]]
+ h: int; [[The height of the object.]]
+ }
+ }
+ @property size_native {
+ [[The native width and height.
+
+ This calculates the actual size without taking account the
+ current size of the object.
+
+ The main difference between this and @.size_formatted.get
+ is that the "native" function does not take wrapping into
+ account it just calculates the real width of the object if
+ it was placed on an infinite canvas, while the "formatted"
+ function gives the size after wrapping text according to
+ the size restrictions of the object.
+
+ For example for a textblock containing the text:
+ "You shall not pass!" with no margins or padding and assuming
+ a monospace font and a size of 7x10 char widths (for simplicity)
+ has a native size of 19x1 and a formatted size of 5x4.
+
+ @since 1.18
+ ]]
+ get {}
+ values {
+ w: int; [[The width returned.]]
+ h: int; [[The height returned.]]
+ }
+ }
+ range_geometry_get {
+ [[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(ptr(Efl.Canvas.Text.Cursor)); [[Start of range]]
+ @in cur2: const(ptr(Efl.Canvas.Text.Cursor)); [[End of range]]
+ }
+ return: free(own(iterator<Eina.Rectangle>),
+ eina_iterator_free); [[Iterator on all geoemtries of
+ the given range]]
+ }
+ 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.19
+ ]]
+ legacy: null;
+ params {
+ @in cur1: ptr(const(Efl.Canvas.Text.Cursor)); [[Start of range]]
+ @in cur2: ptr(const(Efl.Canvas.Text.Cursor)); [[End of range]]
+ }
+ return: free(own(iterator<Eina.Rectangle>),
+ eina_iterator_free); [[Iterator on all simple
+ geometries of the given range]]
+ }
+ range_delete {
+ [[Deletes the range between given cursors.
+
+ This removes all the text in given range [$start,$end].
+ ]]
+ legacy: null;
+ params {
+ @in cur1: ptr(Efl.Canvas.Text.Cursor); [[Range start position]]
+ @in cur2: ptr(Efl.Canvas.Text.Cursor); [[Range end position]]
+ }
+ }
+ // Obstacles
+ obstacle_add {
+ [[Add obstacle evas object $eo_obs to be observed during layout
+ of text.
+
+ The textblock does the layout of the text according to the
+ position of the obstacle.
+
+ @since 1.18
+ ]]
+ params {
+ @in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
+ }
+ return: bool; [[$true on success, $false otherwise.]]
+ }
+ obstacle_del {
+ [[Removes $eo_obs from observation during text layout.
+
+ @since 1.18
+ ]]
+ params {
+ @in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
+ }
+ return: bool; [[$true on success, $false otherwise.]]
+ }
+ obstacles_update {
+ [[Triggers for relayout due to obstacles' state change.
+
+ The obstacles alone don't affect the layout, until this is
+ called. Use this after doing changes (moving, positioning etc.)
+ in the obstacles that you would like to be considered in the
+ layout.
+
+ For example: if you have just repositioned the obstacles to
+ differrent coordinates relative to the textblock, you need to
+ call this so it will consider this new state and will relayout
+ the text.
+
+ @since 1.18
+ ]]
+ }
+ // Annotation
+ @property annotation {
+ [[A new format for $annotation.
+
+ This will replace the format applied by $annotation with $format.
+ Assumes that $annotation is a handle for an existing annotation,
+ i.e. one that was added using @.annotation_insert to this object.
+ Otherwise, this will fail and return $false.
+
+ @since 1.18
+ ]]
+ set {
+ legacy: null;
+ return: bool; [[$true on success, $false otherwise.]]
+ }
+ get {
+ legacy: null;
+ }
+ keys {
+ annotation: ptr(Efl.Canvas.Text.Annotation); [[Given annotation]]
+ }
+ values {
+ format: string; [[The new format for the given annotation]]
+ }
+ }
+ range_annotations_get {
+ [[Returns an iterator of all the handles in a range.
+
+ @since 1.18
+ ]]
+ legacy: null;
+ params {
+ @in start: ptr(const(Efl.Canvas.Text.Cursor)); [[Start of range]]
+ @in end: ptr(const(Efl.Canvas.Text.Cursor)); [[End of range]]
+ }
+ return: free(own(iterator<ptr(Efl.Canvas.Text.Annotation)>),
+ eina_iterator_free); [[Handle of the Annotation]]
+ }
+ annotation_insert {
+ [[Inserts an annotation format in a specified range [$start, $end - 1].
+
+ The $format will be applied to the given range, and the $annotation
+ handle will be returned for further handling.
+
+ @since 1.18
+ ]]
+ legacy: null;
+ params {
+ @in start: ptr(Efl.Canvas.Text.Cursor); [[Start of range]]
+ @in end: ptr(Efl.Canvas.Text.Cursor); [[End of range]]
+ @in format: string; [[Annotation format]]
+ }
+ return: ptr(Efl.Canvas.Text.Annotation); [[Handle of inserted annotation]]
+ }
+ annotation_del {
+ [[Deletes given annotation.
+
+ All formats applied by $annotation will be removed and it will be
+ deleted.
+
+ @since 1.18
+ ]]
+ legacy: null;
+ params {
+ @in annotation: ptr(Efl.Canvas.Text.Annotation); [[Annotation to be
+ removed]]
+ }
+ return: bool; [[$true on success, $false otherwise.]]
+ }
+ object_item_geometry_get {
+ [[Queries a given object item for its geometry.
+
+ Note that the provided annotation should be an object item type.
+
+ @since 1.18
+ ]]
+ legacy: null;
+ params {
+ @in an: ptr(const(Efl.Canvas.Text.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]]
+ @out h: int; [[Height of the annotation]]
+ }
+ return: bool; [[$true if given annotation is an object item, $false otherwise]]
+ }
+ // Cursor
+ @property cursor {
+ [[The object's main cursor.
+
+ @since 1.18
+ ]]
+ get {
+ return: ptr(Efl.Canvas.Text.Cursor); [[Text cursor object]]
+ }
+ }
@property cursor_position {
set { legacy: null; }
get { legacy: null; }
@@ -175,6 +503,13 @@ class Efl.Canvas.Text (Efl.Canvas.Object)
}
return: int; [[Length of the appended text.]]
}
+ char_delete {
+ [[Deletes a single character from position pointed by given cursor.]]
+ legacy: null;
+ params {
+ cur: ptr(Efl.Canvas.Text.Cursor);
+ }
+ }
cursor_object_item_insert {
[[Inserts a object item at specified position.
@@ -195,5 +530,6 @@ class Efl.Canvas.Text (Efl.Canvas.Object)
events {
cursor,changed;
changed;
+ style_insets,changed; [[Called when the property @.style_insets changed.]]
}
}
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 820cdf951f..1d844bd589 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -733,7 +733,6 @@ static const Evas_Object_Func object_func =
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); \
return (x); \
MAGIC_CHECK_END();
-#if 0
static Eina_Bool _evas_textblock_cursor_is_at_the_end(const Efl_Canvas_Text_Cursor_Data *cur);
static void _evas_textblock_node_text_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Text *n);
static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_before_or_at_pos_get(const Efl_Canvas_Text_Cursor_Data *cur);
@@ -748,7 +747,6 @@ static void _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o, const Evas
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_cursor_copy(Efl_Canvas_Text_Cursor_Data *dst, const Efl_Canvas_Text_Cursor_Data *src);
static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Canvas_Text_Cursor_Data *cur);
static void _evas_textblock_cursor_at_format_set(Efl_Canvas_Text_Cursor_Data *cur, const Evas_Object_Textblock_Node_Format *fmt);
static void _evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor_Data *cur);
@@ -759,19 +757,19 @@ static Evas_Filter_Program *_format_filter_program_get(Efl_Canvas_Text_Data *o,
#include "evas_textblock_hyphenation.x"
#endif
-#endif
-
static int _efl_canvas_text_cursor_text_append(Efl_Canvas_Text_Cursor_Data *cur, const char *text);
static Eina_Bool _evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor_Data *cur);
static Eina_Bool _evas_textblock_cursor_format_append(Efl_Canvas_Text_Cursor *cur, const char *format, Evas_Object_Textblock_Node_Format **_fnode, Eina_Bool is_item);
static int _evas_textblock_cursor_compare(const Efl_Canvas_Text_Cursor_Data *cur1, const Efl_Canvas_Text_Cursor_Data *cur2);
EAPI Eina_Bool evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur);
static void _evas_textblock_cursor_init(Efl_Canvas_Text_Cursor_Data *cur, const Evas_Object *tb);
-static void _evas_textblock_cursor_copy(Efl_Canvas_Text_Cursor *dst, const Efl_Canvas_Text_Cursor *src);
static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Canvas_Text_Cursor *cur);
static void _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr);
-static Eina_Bool _evas_textblock_cursor_is_at_the_end(const Efl_Canvas_Text_Cursor_Data *cur);
-#if 0
+static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_at_pos_get(const Efl_Canvas_Text_Cursor *cur);
+static int _evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor *cur, const char *_text);
+EAPI int evas_textblock_cursor_compare(const Efl_Canvas_Text_Cursor *cur1, const Efl_Canvas_Text_Cursor *cur2);
+static void _evas_textblock_cursor_paragraph_char_first(Efl_Canvas_Text_Cursor_Data *cur);
+static void _evas_textblock_cursor_copy(Efl_Canvas_Text_Cursor *dst, const Efl_Canvas_Text_Cursor *src);
/** selection iterator */
/**
@@ -891,7 +889,6 @@ _style_clear(Evas_Textblock_Style *ts)
_style_replace(ts, NULL);
}
-#endif
/**
* @internal
* Searches inside the tags stored in the style for the tag matching s.
@@ -940,7 +937,6 @@ _style_match_tag(const Evas_Textblock_Style *ts, const char *s, size_t tag_len,
*replace_len = 0;
return NULL;
}
-#if 0
/**
* @internal
@@ -1238,7 +1234,6 @@ static const char escape_strings[] =
"&bull;\0" "\xe2\x80\xa2\0"
;
-#endif
/**
* @internal
* Checks if a char is a whitespace.
@@ -1283,7 +1278,6 @@ _is_white(Eina_Unicode c)
return EINA_FALSE;
}
-#if 0
/**
* @internal
* Prepends the text between s and p to the main cursor of the object.
@@ -2695,7 +2689,6 @@ end:
*val = tmp;
}
-#endif
/**
* @internal
* This function parses the format passed in *s and advances s to point to the
@@ -2742,7 +2735,6 @@ _format_parse(const char **s)
*s = p;
return NULL;
}
-#if 0
/**
* @internal
@@ -3063,7 +3055,6 @@ _layout_line_new(Ctxt *c, Evas_Object_Textblock_Format *fmt)
c->ln->par = c->par;
}
-#endif
static inline Evas_Object_Textblock_Paragraph *
_layout_find_paragraph_by_y(Efl_Canvas_Text_Data *o, Evas_Coord y)
{
@@ -3089,9 +3080,7 @@ _layout_find_paragraph_by_y(Efl_Canvas_Text_Data *o, Evas_Coord y)
return NULL;
}
-#if 0
-#endif
static inline Evas_Object_Textblock_Paragraph *
_layout_find_paragraph_by_line_no(Efl_Canvas_Text_Data *o, int line_no)
{
@@ -3120,8 +3109,6 @@ _layout_find_paragraph_by_line_no(Efl_Canvas_Text_Data *o, int line_no)
return NULL;
}
-#if 0
-
/* End of rbtree index functios */
/**
@@ -3161,7 +3148,6 @@ _layout_paragraph_new(Ctxt *c, Evas_Object_Textblock_Node_Text *n,
c->o->num_paragraphs++;
}
-#endif
#ifdef BIDI_SUPPORT
/**
* @internal
@@ -3212,7 +3198,6 @@ _layout_update_bidi_props(const Efl_Canvas_Text_Data *o,
}
}
#endif
-#if 0
/**
@@ -4509,7 +4494,6 @@ _format_filter_program_get(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Format
return pgm;
}
-#endif
/**
* @internal
* Returns true if the item is a tab
@@ -4540,7 +4524,6 @@ _format_filter_program_get(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Format
#define _IS_PARAGRAPH_SEPARATOR(o, item) \
(_IS_PARAGRAPH_SEPARATOR_SIMPLE(item) || \
(o->legacy_newline && _IS_LINE_SEPARATOR(item))) /* Paragraph separator */
-#if 0
/**
* @internal
@@ -5271,7 +5254,6 @@ _layout_handle_ellipsis(Ctxt *c, Evas_Object_Textblock_Item *it, Eina_List *i)
_layout_line_finalize(c, ellip_ti->parent.format);
}
-#endif
/* Don't do much for the meanwhile. */
static inline void
_layout_paragraph_render(Efl_Canvas_Text_Data *o,
@@ -5283,7 +5265,6 @@ _layout_paragraph_render(Efl_Canvas_Text_Data *o,
(void) o;
}
-#if 0
/* calculates items width in current paragraph */
static inline Evas_Coord
@@ -6522,7 +6503,6 @@ _relayout(const Evas_Object *eo_obj)
#endif
}
-#endif
/*
* @internal
* Check if the object needs a relayout, and if so, execute it.
@@ -6530,7 +6510,6 @@ _relayout(const Evas_Object *eo_obj)
static inline void
_relayout_if_needed(Evas_Object *eo_obj, const Efl_Canvas_Text_Data *o)
{
-#if 0
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
@@ -6539,76 +6518,10 @@ _relayout_if_needed(Evas_Object *eo_obj, const Efl_Canvas_Text_Data *o)
LYDBG("ZZ: relayout\n");
_relayout(eo_obj);
}
-#else
- (void) o;
- (void) eo_obj;
-#endif
}
-#if 0
/**
* @internal
- * Find the layout item and line that match the text node and position passed.
- *
- * @param obj the evas object - NOT NULL.
- * @param n the text node - Not null.
- * @param pos the position to look for - valid.
- * @param[out] lnr the line found - not null.
- * @param[out] tir the item found - not null.
- * @see _find_layout_format_item_line_match()
- */
-static void
-_find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr)
-{
- Evas_Object_Textblock_Paragraph *found_par;
- Evas_Object_Textblock_Line *ln;
- Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
-
- _relayout_if_needed(eo_obj, o);
-
- found_par = n->par;
- if (found_par)
- {
- _layout_paragraph_render(o, found_par);
- EINA_INLIST_FOREACH(found_par->lines, ln)
- {
- Evas_Object_Textblock_Item *it;
-
- EINA_INLIST_FOREACH(ln->items, it)
- {
- size_t p = it->text_pos;
-
- if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
- {
- Evas_Object_Textblock_Text_Item *ti =
- _ITEM_TEXT(it);
-
- p += ti->text_props.text_len;
- }
- else
- {
- p++;
- }
-
- if (((pos >= it->text_pos) && (pos < p)))
- {
- *lnr = ln;
- *itr = it;
- return;
- }
- else if (p == pos)
- {
- *lnr = ln;
- *itr = it;
- }
- }
- }
- }
-}
-
-#endif
-/**
- * @internal
* Return the line number 'line'.
*
* @param obj the evas object - NOT NULL.
@@ -6633,7 +6546,6 @@ _find_layout_line_num(const Evas_Object *eo_obj, int line)
}
return NULL;
}
-#if 0
EAPI Evas_Object *
evas_object_textblock_add(Evas *e)
@@ -6858,7 +6770,6 @@ evas_textblock_style_get(const Evas_Textblock_Style *ts)
return ts->style_text;
}
-#endif
static const char *
_textblock_format_node_from_style_tag(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *fnode, const char *format, size_t format_len)
{
@@ -6892,7 +6803,6 @@ _textblock_format_node_from_style_tag(Efl_Canvas_Text_Data *o, Evas_Object_Textb
}
return match;
}
-#if 0
/* textblock styles */
@@ -7353,7 +7263,6 @@ evas_textblock_string_escape_get(const char *string, int *len_ret)
return _escaped_char_match(string, len_ret);
}
-#endif
static void
_cursor_emit_if_changed(Efl_Canvas_Text_Cursor *cur)
{
@@ -7363,7 +7272,6 @@ _cursor_emit_if_changed(Efl_Canvas_Text_Cursor *cur)
efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
}
-#if 0
/**
* @internal
@@ -7409,16 +7317,17 @@ evas_object_textblock_text_markup_set(Eo *eo_obj, const char *text)
_nodes_clear(eo_obj);
- Efl_Canvas_Text_Cursor_Data *co = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ Efl_Canvas_Text_Cursor_Data *co = o->cursor;
co->node = _evas_textblock_node_text_new();
o->text_nodes = _NODE_TEXT(eina_inlist_append(
EINA_INLIST_GET(o->text_nodes),
EINA_INLIST_GET(co->node)));
- efl_event_freeze(o->cursor);
+ efl_event_freeze(eo_obj);
evas_textblock_cursor_paragraph_first(o->cursor);
evas_object_textblock_text_markup_prepend(o->cursor, text);
+ efl_event_freeze(eo_obj);
/* Point all the cursors to the starrt */
{
Eina_List *l;
@@ -7427,26 +7336,19 @@ evas_object_textblock_text_markup_set(Eo *eo_obj, const char *text)
evas_textblock_cursor_paragraph_first(o->cursor);
EINA_LIST_FOREACH(o->cursors, l, data)
{
- efl_event_freeze(data);
evas_textblock_cursor_paragraph_first(data);
}
- EINA_LIST_FOREACH(o->cursors, l, data)
- {
- efl_event_thaw(data);
- efl_event_callback_legacy_call(data, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
- }
}
- efl_event_thaw(o->cursor);
- efl_event_callback_legacy_call(o->cursor, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
+ efl_event_thaw(eo_obj);
+ efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
o->markup_text = text;
}
EAPI void
-evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur_obj, const char *text)
+evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur, const char *text)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return;
Evas_Object *eo_obj = cur->obj;
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
@@ -7486,19 +7388,19 @@ evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur_obj, const
{
memcpy(ttag, tag_start, ttag_len);
ttag[ttag_len] = 0;
- evas_textblock_cursor_format_prepend(cur_obj, ttag);
+ evas_textblock_cursor_format_prepend(cur, ttag);
free(ttag);
}
tag_start = tag_end = NULL;
}
else if (esc_end)
{
- _prepend_escaped_char(cur_obj, esc_start, esc_end + 1);
+ _prepend_escaped_char(cur, esc_start, esc_end + 1);
esc_start = esc_end = NULL;
}
else if (*p == 0)
{
- _prepend_text_run(cur_obj, s, p);
+ _prepend_text_run(cur, s, p);
s = NULL;
}
if (*p == 0)
@@ -7512,7 +7414,7 @@ evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur_obj, const
* the start of the tag */
tag_start = p;
tag_end = NULL;
- _prepend_text_run(cur_obj, s, p);
+ _prepend_text_run(cur, s, p);
s = NULL;
}
}
@@ -7532,7 +7434,7 @@ evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur_obj, const
* the start of the escape sequence */
esc_start = p;
esc_end = NULL;
- _prepend_text_run(cur_obj, s, p);
+ _prepend_text_run(cur, s, p);
s = NULL;
}
}
@@ -7557,7 +7459,7 @@ evas_object_textblock_text_markup_prepend(Efl_Canvas_Text_Cursor *cur_obj, const
/*FIXME: currently just remove them, maybe do something
* fancier in the future, atm it breaks if this char
* is inside <> */
- _prepend_text_run(cur_obj, s, p);
+ _prepend_text_run(cur, s, p);
/* it's also advanced later in this loop need +text_len
in total*/
p += text_len - 1;
@@ -8197,7 +8099,7 @@ _evas_textblock_cursor_nodes_merge(Efl_Canvas_Text_Cursor_Data *cur)
_evas_textblock_nodes_merge(o, cur->node);
_evas_textblock_cursors_update_offset(cur, nnode, 0, len);
_evas_textblock_cursors_set_node(o, nnode, cur->node);
- Efl_Canvas_Text_Cursor_Data *co = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ Efl_Canvas_Text_Cursor_Data *co = o->cursor;
if (nnode == co->node)
{
co->node = cur->node;
@@ -8207,43 +8109,6 @@ _evas_textblock_cursor_nodes_merge(Efl_Canvas_Text_Cursor_Data *cur)
/**
* @internal
- * Return the format at a specific position.
- *
- * @param cur the cursor to the position.
- * @return the format node at the specific position or NULL if not found.
- */
-static Evas_Object_Textblock_Node_Format *
-_evas_textblock_cursor_node_format_at_pos_get(const Efl_Canvas_Text_Cursor_Data *cur)
-{
- Evas_Object_Textblock_Node_Format *node;
- Evas_Object_Textblock_Node_Format *itr;
- int position = 0;
-
- TB_NULL_CHECK(cur->node, NULL);
-
- node = cur->node->format_node;
- if (!node) return NULL;
- /* If there is no exclusive format node to this paragraph return the
- * previous's node */
- /* Find the main format node */
- EINA_INLIST_FOREACH(node, itr)
- {
- if (itr->text_node != cur->node)
- {
- return NULL;
- }
- if ((position + itr->offset) == cur->pos)
- {
- return itr;
- }
- position += itr->offset;
- }
- return NULL;
-}
-
-#endif
-/**
- * @internal
* Return the last format node at the position of the format node n.
*
* @param n a format node at the position.
@@ -8266,7 +8131,6 @@ _evas_textblock_node_format_last_at_off(const Evas_Object_Textblock_Node_Format
return (Evas_Object_Textblock_Node_Format *) n;
}
-#if 0
/**
* @internal
@@ -8345,7 +8209,6 @@ _evas_textblock_cursor_node_format_before_or_at_pos_get(const Efl_Canvas_Text_Cu
return pitr;
}
-#endif
/**
* @internal
* Find the layout item and line that match the cursor.
@@ -8381,18 +8244,6 @@ _find_layout_item_match(const Efl_Canvas_Text_Cursor_Data *cur, Evas_Object_Text
}
return previous_format;
}
-#if 0
-
-EOLIAN static Efl_Object *
-_efl_canvas_text_cursor_efl_object_finalize(Eo *obj, Efl_Canvas_Text_Cursor_Data *pd)
-{
- if (!pd->obj)
- {
- return NULL;
- }
-
- return obj;
-}
static void
_evas_textblock_cursor_init(Efl_Canvas_Text_Cursor_Data *cur, const Evas_Object *tb)
@@ -8404,48 +8255,49 @@ _evas_textblock_cursor_init(Efl_Canvas_Text_Cursor_Data *cur, const Evas_Object
cur->pos = 0;
}
-EOLIAN static void
-_efl_canvas_text_cursor_text_object_set(Eo *obj, Efl_Canvas_Text_Cursor_Data *pd, const Evas_Object *tb)
-{
- if (efl_finalized_get(obj))
- {
- ERR("Can't change the cursor's textblock after creation.");
- return;
- }
-
- Efl_Canvas_Text_Data *o = efl_data_scope_get(tb, MY_CLASS);
- _evas_textblock_cursor_init(pd, tb);
- o->cursors = eina_list_append(o->cursors, obj);
-}
-
-EOLIAN static const Evas_Object *
-_efl_canvas_text_cursor_text_object_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *pd)
+EAPI void
+evas_textblock_cursor_free(Evas_Textblock_Cursor *cur)
{
- return pd->obj;
+ Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
+ if (cur == o->cursor) return;
+ o->cursors = eina_list_remove(o->cursors, cur);
+ free(cur);
}
-EAPI Efl_Canvas_Text_Cursor *
-evas_object_textblock_cursor_new(const Eo *eo_obj)
+/**
+ * @internal
+ * Return the format at a specific position.
+ *
+ * @param cur the cursor to the position.
+ * @return the format node at the specific position or NULL if not found.
+ */
+static Evas_Object_Textblock_Node_Format *
+_evas_textblock_cursor_node_format_at_pos_get(const Efl_Canvas_Text_Cursor *cur)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL);
- // XXX; Discarding const here
- return efl_add(EFL_CANVAS_TEXT_CURSOR_CLASS, (Eo *) eo_obj,
- efl_canvas_text_cursor_text_object_set(efl_added, eo_obj));
-}
+ Evas_Object_Textblock_Node_Format *node;
+ Evas_Object_Textblock_Node_Format *itr;
+ int position = 0;
-EOLIAN static void
-_efl_canvas_text_cursor_efl_object_destructor(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- efl_destructor(efl_super(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS));
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- if (cur_obj == o->cursor) return;
- o->cursors = eina_list_remove(o->cursors, cur_obj);
-}
+ TB_NULL_CHECK(cur->node, NULL);
-EAPI void
-evas_textblock_cursor_free(Evas_Textblock_Cursor *cur)
-{
- efl_del(cur);
+ node = cur->node->format_node;
+ if (!node) return NULL;
+ /* If there is no exclusive format node to this paragraph return the
+ * previous's node */
+ /* Find the main format node */
+ EINA_INLIST_FOREACH(node, itr)
+ {
+ if (itr->text_node != cur->node)
+ {
+ return NULL;
+ }
+ if ((position + itr->offset) == cur->pos)
+ {
+ return itr;
+ }
+ position += itr->offset;
+ }
+ return NULL;
}
EAPI Eina_Bool
@@ -8459,9 +8311,8 @@ _evas_textblock_cursor_is_format(const Efl_Canvas_Text_Cursor_Data *cur)
}
EAPI Eina_Bool
-evas_textblock_cursor_is_format(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_is_format(const Evas_Textblock_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_is_format(cur);
}
@@ -8629,14 +8480,6 @@ _canvas_text_cursor_paragraph_first(Efl_Canvas_Text_Cursor_Data *cur)
cur->pos = 0;
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_first(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _canvas_text_cursor_paragraph_first(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
-
static void
_canvas_text_cursor_paragraph_last(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -8660,13 +8503,6 @@ _canvas_text_cursor_paragraph_last(Efl_Canvas_Text_Cursor_Data *cur)
}
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_last(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _canvas_text_cursor_paragraph_last(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static Eina_Bool
_evas_textblock_cursor_paragraph_next(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -8692,20 +8528,12 @@ _evas_textblock_cursor_paragraph_next(Efl_Canvas_Text_Cursor_Data *cur)
}
EAPI Eina_Bool
-evas_textblock_cursor_paragraph_next(Efl_Canvas_Text_Cursor *obj)
+evas_textblock_cursor_paragraph_next(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
return _evas_textblock_cursor_paragraph_next(cur);
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_next(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_paragraph_next(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static Eina_Bool
_evas_textblock_cursor_paragraph_prev(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -8735,20 +8563,12 @@ _evas_textblock_cursor_paragraph_prev(Efl_Canvas_Text_Cursor_Data *cur)
}
EAPI Eina_Bool
-evas_textblock_cursor_paragraph_prev(Efl_Canvas_Text_Cursor *obj)
+evas_textblock_cursor_paragraph_prev(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
return _evas_textblock_cursor_paragraph_prev(cur);
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_prev(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_paragraph_prev(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
EAPI void
evas_textblock_cursor_set_at_format(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *n)
{
@@ -8756,11 +8576,10 @@ evas_textblock_cursor_set_at_format(Evas_Textblock_Cursor *cur, const Evas_Objec
}
EAPI Eina_Bool
-evas_textblock_cursor_format_next(Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_format_next(Evas_Textblock_Cursor *cur)
{
Evas_Object_Textblock_Node_Format *node;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -8796,15 +8615,14 @@ evas_textblock_cursor_format_next(Evas_Textblock_Cursor *cur_obj)
}
EAPI Eina_Bool
-evas_textblock_cursor_format_prev(Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_format_prev(Evas_Textblock_Cursor *cur)
{
const Evas_Object_Textblock_Node_Format *node;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
TB_NULL_CHECK(cur->node, EINA_FALSE);
- node = evas_textblock_cursor_format_get(cur_obj);
+ node = evas_textblock_cursor_format_get(cur);
if (!node)
{
node = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur);
@@ -8833,17 +8651,14 @@ evas_textblock_cursor_format_prev(Evas_Textblock_Cursor *cur_obj)
return EINA_FALSE;
}
-#endif
/* BREAK_AFTER: true if we can break after the current char.
* Both macros assume str[i] is not the terminating nul */
#define BREAK_AFTER(i) \
(breaks[i] == WORDBREAK_BREAK)
-#if 0
EAPI Eina_Bool
-evas_textblock_cursor_word_start(Efl_Canvas_Text_Cursor *cur_obj)
+evas_textblock_cursor_word_start(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
const Eina_Unicode *text;
size_t i;
@@ -8878,7 +8693,7 @@ evas_textblock_cursor_word_start(Efl_Canvas_Text_Cursor *cur_obj)
len = eina_ustrbuf_length_get(cur->node->unicode);
cur->pos = len - 1;
free(breaks);
- return evas_textblock_cursor_word_start(cur_obj);
+ return evas_textblock_cursor_word_start(cur);
}
else
{
@@ -8901,17 +8716,9 @@ evas_textblock_cursor_word_start(Efl_Canvas_Text_Cursor *cur_obj)
return EINA_TRUE;
}
-EOLIAN static void
-_efl_canvas_text_cursor_word_start(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur EINA_UNUSED)
-{
- evas_textblock_cursor_word_start(cur_obj);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
EAPI Eina_Bool
-evas_textblock_cursor_word_end(Efl_Canvas_Text_Cursor *cur_obj)
+evas_textblock_cursor_word_end(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
const Eina_Unicode *text;
size_t i;
@@ -8944,7 +8751,7 @@ evas_textblock_cursor_word_end(Efl_Canvas_Text_Cursor *cur_obj)
cur->node = nnode;
cur->pos = 0;
free(breaks);
- return evas_textblock_cursor_word_end(cur_obj);
+ return evas_textblock_cursor_word_end(cur);
}
}
@@ -8963,13 +8770,6 @@ evas_textblock_cursor_word_end(Efl_Canvas_Text_Cursor *cur_obj)
return EINA_TRUE;
}
-EOLIAN static void
-_efl_canvas_text_cursor_word_end(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur EINA_UNUSED)
-{
- evas_textblock_cursor_word_end(cur_obj);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static Eina_Bool
_evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -9011,20 +8811,12 @@ _evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor_Data *cur)
}
EAPI Eina_Bool
-evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor *obj)
+evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
return _evas_textblock_cursor_char_next(cur);
}
-EOLIAN static void
-_efl_canvas_text_cursor_char_next(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_char_next(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static Eina_Bool
_evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -9041,20 +8833,12 @@ _evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor_Data *cur)
}
EAPI Eina_Bool
-evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor *obj)
+evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
return _evas_textblock_cursor_char_prev(cur);
}
-EOLIAN static void
-_efl_canvas_text_cursor_char_prev(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_char_prev(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static void
_evas_textblock_cursor_paragraph_char_first(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -9064,13 +8848,6 @@ _evas_textblock_cursor_paragraph_char_first(Efl_Canvas_Text_Cursor_Data *cur)
cur->pos = 0;
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_char_first(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_paragraph_char_first(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static void
_evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -9092,13 +8869,6 @@ _evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor_Data *cur)
cur->pos = 0;
}
-EOLIAN static void
-_efl_canvas_text_cursor_paragraph_char_last(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_paragraph_char_last(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
static void
_cursor_line_first_char_get(Evas_Object_Textblock_Line *ln,
Efl_Canvas_Text_Cursor_Data *cur,
@@ -9126,31 +8896,8 @@ _cursor_line_first_char_get(Evas_Object_Textblock_Line *ln,
}
}
-EOLIAN static void
-_efl_canvas_text_cursor_line_char_first(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- Evas_Object_Textblock_Line *ln = NULL;
- Evas_Object_Textblock_Item *it = NULL;
-
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
- _relayout_if_needed(cur->obj, o);
-
- /* We don't actually need 'it', but it needs to be non NULL */
- _find_layout_item_match(cur, &ln, &it);
-
- if (!ln) return;
-
- _cursor_line_first_char_get(ln, cur, o);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
-#endif
static void
-_evas_textblock_cursor_line_char_last(Efl_Canvas_Text_Cursor_Data *cur)
+evas_textblock_cursor_line_char_last(Efl_Canvas_Text_Cursor_Data *cur)
{
Evas_Object_Textblock_Line *ln = NULL;
Evas_Object_Textblock_Item *it = NULL;
@@ -9196,16 +8943,7 @@ _evas_textblock_cursor_line_char_last(Efl_Canvas_Text_Cursor_Data *cur)
}
}
}
-#if 0
-
-EOLIAN static void
-_efl_canvas_text_cursor_line_char_last(Evas_Textblock_Cursor *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
-{
- _evas_textblock_cursor_line_char_last(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-#endif
/**
* @internal
* checks if a format (as a string) is visible/changes format and sets the
@@ -9262,7 +9000,6 @@ _evas_textblock_format_is_visible(Evas_Object_Textblock_Node_Format *fnode,
}
}
}
-#if 0
/**
* Sets the cursor to the position of where the fmt points to.
@@ -9385,7 +9122,6 @@ _evas_textblock_node_format_remove_matching(Efl_Canvas_Text_Data *o,
eina_list_free(formats);
}
-#endif
/**
* @internal
* Add the offset (may be negative) to the first node after fmt which is
@@ -9415,7 +9151,6 @@ _evas_textblock_node_format_adjust_offset(Efl_Canvas_Text_Data *o,
fmt->offset += offset;
}
}
-#if 0
/**
* @internal
@@ -9618,7 +9353,6 @@ _evas_textblock_node_text_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_
_evas_textblock_node_text_free(n);
}
-#endif
/**
* @internal
* Return the position where the formats starts at.
@@ -9648,27 +9382,6 @@ _evas_textblock_node_format_pos_get(const Evas_Object_Textblock_Node_Format *fmt
}
return position + fmt->offset;
}
-#if 0
-
-EOLIAN static int
-_efl_canvas_text_cursor_position_get(Eo *cur_obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *cur)
-{
- Evas_Object_Textblock_Node_Text *n;
- size_t npos = 0;
-
- if (!cur) return -1;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, 0);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- n = o->text_nodes;
- while (n != cur->node)
- {
- npos += eina_ustrbuf_length_get(n->unicode);
- n = _NODE_TEXT(EINA_INLIST_GET(n)->next);
- }
- return npos + cur->pos;
-}
static void
_evas_textblock_cursor_pos_set(Efl_Canvas_Text_Cursor_Data *cur, int _pos)
@@ -9716,19 +9429,11 @@ _evas_textblock_cursor_pos_set(Efl_Canvas_Text_Cursor_Data *cur, int _pos)
}
}
-EOLIAN static void
-_efl_canvas_text_cursor_position_set(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur, int _pos)
-{
- _evas_textblock_cursor_pos_set(cur, _pos);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
EAPI Eina_Bool
-evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur_obj, int line)
+evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line)
{
Evas_Object_Textblock_Line *ln;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -9745,55 +9450,6 @@ evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur_obj, int line)
return EINA_TRUE;
}
-EOLIAN static void
-_efl_canvas_text_cursor_line_jump_by(Eo *c, Efl_Canvas_Text_Cursor_Data *pd EINA_UNUSED, int by)
-{
- int ln;
-
- ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
- Evas_Object *o = (Eo *) efl_canvas_text_cursor_text_object_get(c);
- Evas_Coord cx, cw;
- Evas_Coord lx, ly, lw, lh;
- int last;
-
- evas_textblock_cursor_geometry_get(c, &cx, NULL, &cw, NULL, NULL, EVAS_TEXTBLOCK_CURSOR_UNDER);
- cx += (cw / 2);
- evas_textblock_cursor_paragraph_last(c);
- last = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
-
- if (ln < 0)
- {
- evas_textblock_cursor_paragraph_first(c);
- return;
- }
- if (ln > last)
- {
- evas_textblock_cursor_paragraph_last(c);
- return;
- }
-
- if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
- return;
- if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
- return;
- evas_textblock_cursor_line_set(c, ln);
- if (cx < (lx + (lw / 2)))
- {
- if (ln == last) evas_textblock_cursor_paragraph_last(c);
- evas_textblock_cursor_line_char_first(c);
- }
- else
- {
- if (ln == last)
- evas_textblock_cursor_paragraph_last(c);
- else
- evas_textblock_cursor_line_char_last(c);
- }
-
- efl_event_callback_legacy_call(c, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
-}
-
-#endif
static int
_evas_textblock_cursor_compare(const Efl_Canvas_Text_Cursor_Data *cur1,
const Efl_Canvas_Text_Cursor_Data *cur2)
@@ -9822,61 +9478,6 @@ _evas_textblock_cursor_compare(const Efl_Canvas_Text_Cursor_Data *cur1,
}
return 0;
}
-#if 0
-
-EOLIAN static int
-_efl_canvas_text_cursor_compare(const Eo *cur_obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *cur, const Efl_Canvas_Text_Cursor *cur2_obj)
-{
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- return _evas_textblock_cursor_compare(cur1, cur2);
-}
-
-EOLIAN static Eina_Bool
-_efl_canvas_text_cursor_equal(const Eo *cur_obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *cur, const Efl_Canvas_Text_Cursor *cur2_obj)
-{
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- return ((cur->node == cur2->node) && (cur->pos == cur2->pos));
-}
-
-EAPI void
-evas_textblock_cursor_copy(const Evas_Textblock_Cursor *cur_src, Efl_Canvas_Text_Cursor *cur_dest)
-{
- if (!cur_src || !cur_dest) return;
- efl_canvas_text_cursor_copy(cur_dest, cur_src);
-}
-
-static void
-_evas_textblock_cursor_copy(Efl_Canvas_Text_Cursor_Data *dst,
- const Efl_Canvas_Text_Cursor_Data *src)
-{
- if (!src) return;
- if (!dst) return;
- if (src->obj != dst->obj)
- {
- ERR("Tried copying a cursor from the wrong object");
- return;
- }
- dst->pos = src->pos;
- dst->node = src->node;
-}
-
-static EOLIAN void
-_efl_canvas_text_cursor_copy(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur,
- const Efl_Canvas_Text_Cursor *src_obj)
-{
- Efl_Canvas_Text_Cursor_Data *src = efl_data_scope_get(src_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
-
- if (!efl_canvas_text_cursor_equal(cur_obj, src_obj))
- {
- _evas_textblock_cursor_copy(cur, src);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
- }
-}
/* text controls */
/**
@@ -9899,7 +9500,6 @@ _evas_textblock_node_text_free(Evas_Object_Textblock_Node_Text *n)
free(n);
}
-#endif
/**
* @internal
* Create a new text node
@@ -10004,7 +9604,6 @@ _evas_textblock_cursor_break_paragraph(Efl_Canvas_Text_Cursor_Data *cur,
n->format_node = fnode;
}
}
-#if 0
/**
* @internal
@@ -10020,8 +9619,8 @@ _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o,
Evas_Object_Textblock_Node_Text *new_node)
{
Eina_List *l;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
- Efl_Canvas_Text_Cursor *data_obj;
+ Efl_Canvas_Text_Cursor_Data *cur = o->cursor;
+ Efl_Canvas_Text_Cursor_Data *data;
if (n == cur->node)
{
@@ -10029,10 +9628,8 @@ _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o,
cur->node = new_node;
cur->changed = EINA_TRUE;
}
- EINA_LIST_FOREACH(o->cursors, l, data_obj)
+ EINA_LIST_FOREACH(o->cursors, l, data)
{
- Efl_Canvas_Text_Cursor_Data *data =
- efl_data_scope_get(data_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (n == data->node)
{
data->pos = 0;
@@ -10082,19 +9679,17 @@ _evas_textblock_cursors_update_offset(const Efl_Canvas_Text_Cursor_Data *cur,
size_t start, int offset)
{
Eina_List *l;
- Efl_Canvas_Text_Cursor *ocur_obj;
Efl_Canvas_Text_Cursor_Data *ocur;
Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- ocur = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ ocur = o->cursor;
if (cur != ocur)
{
_cursor_update_offset(ocur, o, n, start, offset);
}
- EINA_LIST_FOREACH(o->cursors, l, ocur_obj)
+ EINA_LIST_FOREACH(o->cursors, l, ocur)
{
- ocur = efl_data_scope_get(ocur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (ocur != cur)
{
_cursor_update_offset(ocur, o, n, start, offset);
@@ -10102,7 +9697,6 @@ _evas_textblock_cursors_update_offset(const Efl_Canvas_Text_Cursor_Data *cur,
}
}
-#endif
/**
* @internal
* Mark that the textblock has changed.
@@ -10135,7 +9729,6 @@ _evas_textblock_changed(Efl_Canvas_Text_Data *o, Evas_Object *eo_obj)
evas_object_change(eo_obj, obj);
}
-#if 0
static void
_evas_textblock_invalidate_all(Efl_Canvas_Text_Data *o)
@@ -10220,16 +9813,15 @@ _evas_textblock_cursor_text_append(Efl_Canvas_Text_Cursor_Data *cur, const char
n->dirty = EINA_TRUE;
free(text);
- main_cur = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ main_cur = o->cursor;
if (!main_cur->node)
main_cur->node = o->text_nodes;
return len;
}
EAPI int
-evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur_obj, const char *_text)
+evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *_text)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_text_append(cur, _text);
}
@@ -10248,21 +9840,11 @@ _evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor_Data *cur, const char
}
EAPI int
-evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor *cur_obj, const char *_text)
+evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor *cur, const char *_text)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_text_prepend(cur, _text);
}
-EOLIAN static int
-_efl_canvas_text_cursor_text_insert(Eo *cur_obj,
- Efl_Canvas_Text_Cursor_Data *cur, const char *_text)
-{
- int len = _efl_canvas_text_cursor_text_append(cur, _text);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
- return len;
-}
-
/**
* @internal
* Free a format node
@@ -10284,7 +9866,6 @@ _evas_textblock_node_format_free(Efl_Canvas_Text_Data *o,
free(n);
}
-#endif
/**
* @internal
* Create a new format node.
@@ -10417,7 +9998,6 @@ _evas_textblock_node_format_new(Efl_Canvas_Text_Data *o, const char *_format,
return n;
}
-#if 0
static Eina_Bool
_evas_textblock_cursor_is_at_the_end(const Efl_Canvas_Text_Cursor_Data *cur)
@@ -10565,7 +10145,7 @@ _evas_textblock_cursor_format_append(Efl_Canvas_Text_Cursor_Data *cur,
_evas_textblock_changed(o, cur->obj);
- Efl_Canvas_Text_Cursor_Data *ocur = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ Efl_Canvas_Text_Cursor_Data *ocur = o->cursor;
if (!ocur->node)
ocur->node = o->text_nodes;
@@ -10574,9 +10154,8 @@ _evas_textblock_cursor_format_append(Efl_Canvas_Text_Cursor_Data *cur,
}
EAPI Eina_Bool
-evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur_obj, const char *format)
+evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *format)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_format_append(cur, format, NULL, EINA_FALSE);
}
@@ -10600,9 +10179,8 @@ _evas_textblock_cursor_format_prepend(Efl_Canvas_Text_Cursor_Data *cur, const ch
}
EAPI Eina_Bool
-evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur_obj, const char *format)
+evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *format)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_format_prepend(cur, format);
}
@@ -10685,52 +10263,45 @@ _evas_textblock_cursor_char_delete(Efl_Canvas_Text_Cursor_Data *cur)
}
EOLIAN static void
-_efl_canvas_text_cursor_char_delete(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur)
+_efl_canvas_text_cursor_char_delete(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur)
{
_evas_textblock_cursor_char_delete(cur);
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
+ efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
EAPI void
-evas_textblock_cursor_range_delete(Efl_Canvas_Text_Cursor *cur1_obj, Evas_Textblock_Cursor *cur2_obj)
+evas_textblock_cursor_range_delete(Efl_Canvas_Text_Cursor *cur1, Efl_Canvas_Text_Cursor *cur2)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- if (!cur) return;
- efl_canvas_text_range_delete(cur->obj, cur1_obj, cur2_obj);
+ if (!cur1) return;
+ efl_canvas_text_range_delete(cur1->obj, cur1, cur2);
}
EOLIAN static void
_efl_canvas_text_range_delete(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED,
- Efl_Canvas_Text_Cursor *cur1_obj, Evas_Textblock_Cursor *cur2_obj)
+ Efl_Canvas_Text_Cursor *cur1, Evas_Textblock_Cursor *cur2)
{
Evas_Object_Textblock_Node_Format *fnode = NULL;
Evas_Object_Textblock_Node_Text *n1, *n2;
Eina_Bool should_merge = EINA_FALSE, reset_cursor = EINA_FALSE;
- Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur1 || !cur1->node) return;
if (!cur2 || !cur2->node) return;
if (cur1->obj != cur2->obj) return;
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);
- if (evas_textblock_cursor_compare(cur1_obj, cur2_obj) > 0)
+ if (evas_textblock_cursor_compare(cur1, cur2) > 0)
{
- Efl_Canvas_Text_Cursor *tc_obj;
Efl_Canvas_Text_Cursor_Data *tc;
- tc_obj = cur1_obj;
- cur1_obj = cur2_obj;
- cur2_obj = tc_obj;
tc = cur1;
cur1 = cur2;
cur2 = tc;
}
n1 = cur1->node;
n2 = cur2->node;
- if ((evas_textblock_cursor_compare(o->cursor, cur1_obj) >= 0) &&
- (evas_textblock_cursor_compare(cur2_obj, o->cursor) >= 0))
+ if ((evas_textblock_cursor_compare(o->cursor, cur1) >= 0) &&
+ (evas_textblock_cursor_compare(cur2, o->cursor) >= 0))
{
reset_cursor = EINA_TRUE;
}
@@ -10804,34 +10375,26 @@ _efl_canvas_text_range_delete(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *pd E
}
_evas_textblock_node_format_remove_matching(o, fnode);
- evas_textblock_cursor_copy(cur1_obj, cur2_obj);
+ evas_textblock_cursor_copy(cur1, cur2);
if (reset_cursor)
- evas_textblock_cursor_copy(cur1_obj, o->cursor);
+ evas_textblock_cursor_copy(cur1, o->cursor);
_evas_textblock_changed(o, cur1->obj);
}
-
-EOLIAN static Eina_Unicode
-_efl_canvas_text_cursor_content_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *pd)
-{
- return eina_ustrbuf_string_get(pd->node->unicode)[pd->pos];
-}
-
EAPI char *
-evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur || !cur->node) return NULL;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
- if (evas_textblock_cursor_format_is_visible_get(cur_obj))
+ if (evas_textblock_cursor_format_is_visible_get(cur))
{
Eina_Strbuf *buf;
Evas_Object_Textblock_Node_Format *fnode;
char *ret;
fnode = _evas_textblock_node_visible_at_pos_get(
- evas_textblock_cursor_format_get(cur_obj));
+ evas_textblock_cursor_format_get(cur));
buf = eina_strbuf_new();
_markup_get_format_append(buf, fnode);
@@ -10845,7 +10408,7 @@ evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur_obj)
Eina_Unicode buf[2];
char *s;
- buf[0] = efl_canvas_text_cursor_content_get(cur_obj);
+ buf[0] = efl_canvas_text_cursor_content_get(cur->obj, cur);
buf[1] = 0;
s = eina_unicode_unicode_to_utf8(buf, NULL);
@@ -11018,14 +10581,12 @@ _evas_textblock_cursor_range_text_plain_get(const Efl_Canvas_Text_Cursor_Data *c
}
EAPI Eina_List *
-evas_textblock_cursor_range_formats_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj)
+evas_textblock_cursor_range_formats_get(const Efl_Canvas_Text_Cursor *cur1, const Evas_Textblock_Cursor *cur2)
{
Evas_Object *eo_obj;
Eina_List *ret = NULL;
Evas_Object_Textblock_Node_Text *n1, *n2;
Evas_Object_Textblock_Node_Format *first, *last;
- const Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- const Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur1 || !cur1->node) return NULL;
if (!cur2 || !cur2->node) return NULL;
if (cur1->obj != cur2->obj) return NULL;
@@ -11110,30 +10671,26 @@ _evas_textblock_cursor_range_text_get(const Efl_Canvas_Text_Cursor_Data *cur1, c
}
+// Add to legacy api
EAPI char *
-evas_textblock_cursor_range_text_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj, Evas_Textblock_Text_Type format)
+evas_textblock_cursor_range_text_get(const Efl_Canvas_Text_Cursor *cur1, const Evas_Textblock_Cursor *cur2, Evas_Textblock_Text_Type format)
{
- const Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- const Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_range_text_get(cur1, cur2, format);
}
static EOLIAN char *
_efl_canvas_text_range_text_get(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Text_Data *pd EINA_UNUSED,
- const Efl_Canvas_Text_Cursor *cur1_obj,
- const Evas_Textblock_Cursor *cur2_obj)
+ const Efl_Canvas_Text_Cursor *cur1,
+ const Evas_Textblock_Cursor *cur2)
{
- const Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- const Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_range_text_get(cur1, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN);
}
EAPI const char *
-evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur)
{
Efl_Canvas_Text_Cursor_Data cur1, cur2;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return NULL;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11154,10 +10711,9 @@ evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur_obj)
}
EAPI int
-evas_textblock_cursor_paragraph_text_length_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_paragraph_text_length_get(const Evas_Textblock_Cursor *cur)
{
int len;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11171,9 +10727,8 @@ evas_textblock_cursor_paragraph_text_length_get(const Evas_Textblock_Cursor *cur
}
EAPI const Evas_Object_Textblock_Node_Format *
-evas_textblock_cursor_format_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_format_get(const Evas_Textblock_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return NULL;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11233,9 +10788,8 @@ _evas_textblock_cursor_at_format_set(Efl_Canvas_Text_Cursor_Data *cur,
}
EAPI void
-evas_textblock_cursor_at_format_set(Evas_Textblock_Cursor *cur_obj, const Evas_Object_Textblock_Node_Format *fmt)
+evas_textblock_cursor_at_format_set(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *fmt)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
_evas_textblock_cursor_at_format_set(cur, fmt);
}
@@ -11254,13 +10808,11 @@ _evas_textblock_cursor_format_is_visible_get(const Efl_Canvas_Text_Cursor_Data *
}
EAPI Eina_Bool
-evas_textblock_cursor_format_is_visible_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_format_is_visible_get(const Evas_Textblock_Cursor *cur)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_format_is_visible_get(cur);
}
-#endif
#ifdef BIDI_SUPPORT
static Evas_Object_Textblock_Line*
_find_layout_line_by_item(Evas_Object_Textblock_Paragraph *par, Evas_Object_Textblock_Item *_it)
@@ -11280,209 +10832,21 @@ _find_layout_line_by_item(Evas_Object_Textblock_Paragraph *par, Evas_Object_Text
return NULL;
}
#endif
-#if 0
EAPI Eina_Bool
-evas_textblock_cursor_geometry_bidi_get(const Efl_Canvas_Text_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2, Evas_Textblock_Cursor_Type ctype)
+evas_textblock_cursor_geometry_bidi_get(const Efl_Canvas_Text_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2, Evas_Textblock_Cursor_Type ctype)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
- return efl_canvas_text_cursor_geometry_get(cur_obj,
+ return efl_canvas_text_cursor_geometry_get(cur->obj, cur,
(ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE) ?
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE : EFL_CANVAS_TEXT_CURSOR_TYPE_UNDER,
cx, cy, cw, ch, cx2, cy2, cw2, ch2);
}
-EOLIAN static Eina_Bool
-_efl_canvas_text_cursor_geometry_get(Eo *cur_obj EINA_UNUSED, Efl_Canvas_Text_Cursor_Data *cur, Efl_Canvas_Text_Cursor_Type ctype, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2)
-{
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- evas_object_async_block(obj);
-
- _relayout_if_needed(cur->obj, o);
-
- if (ctype == EFL_CANVAS_TEXT_CURSOR_TYPE_UNDER)
- {
- evas_textblock_cursor_pen_geometry_get(cur_obj, cx, cy, cw, ch);
- return EINA_FALSE;
- }
-
-#ifdef BIDI_SUPPORT
-#define IS_RTL(par) ((par) % 2)
-#define IS_DIFFERENT_DIR(l1, l2) (IS_RTL(l1) != IS_RTL(l2))
- else
- {
- Evas_Object_Textblock_Line *ln = NULL;
- Evas_Object_Textblock_Item *it = NULL;
- _find_layout_item_match(cur, &ln, &it);
- if (ln && it)
- {
- if (ln->par->is_bidi)
- {
- if (cw) *cw = 0;
- if (cw2) *cw2 = 0;
-
- /* If we are at the start or the end of the item there's a chance
- * we'll want a split cursor. */
- Evas_Object_Textblock_Item *previt = NULL;
- Evas_Object_Textblock_Item *it1 = NULL, *it2 = NULL;
- Evas_Coord adv1 = 0, adv2 = 0;
-
- if (cur->pos == it->text_pos)
- {
- EvasBiDiLevel par_level, it_level, previt_level;
-
- _layout_update_bidi_props(o, ln->par);
- par_level = *(ln->par->bidi_props->embedding_levels);
- it_level = ln->par->bidi_props->embedding_levels[it->text_pos];
- /* Get the logically previous item. */
- {
- Eina_List *itr;
- Evas_Object_Textblock_Item *ititr;
-
- EINA_LIST_FOREACH(ln->par->logical_items, itr, ititr)
- {
- if (ititr == it)
- break;
- previt = ititr;
- }
-
- if (previt)
- {
- previt_level = ln->par->bidi_props->embedding_levels[previt->text_pos];
- }
- }
-
- if (previt && (it_level != previt_level))
- {
- Evas_Object_Textblock_Item *curit = NULL, *curit_opp = NULL;
- EvasBiDiLevel cur_level;
-
- if (it_level > previt_level)
- {
- curit = it;
- curit_opp = previt;
- cur_level = it_level;
- }
- else
- {
- curit = previt;
- curit_opp = it;
- cur_level = previt_level;
- }
-
- if (((curit == it) && (!IS_RTL(par_level))) ||
- ((curit == previt) && (IS_RTL(par_level))))
- {
- adv1 = (IS_DIFFERENT_DIR(cur_level, par_level)) ?
- curit_opp->adv : 0;
- adv2 = curit->adv;
- }
- else if (((curit == previt) && (!IS_RTL(par_level))) ||
- ((curit == it) && (IS_RTL(par_level))))
- {
- adv1 = (IS_DIFFERENT_DIR(cur_level, par_level)) ?
- 0 : curit->adv;
- adv2 = 0;
- }
-
- if (!IS_DIFFERENT_DIR(cur_level, par_level))
- curit_opp = curit;
-
- it1 = curit_opp;
- it2 = curit;
- }
- /* Clear the bidi props because we don't need them anymore. */
- evas_bidi_paragraph_props_unref(ln->par->bidi_props);
- ln->par->bidi_props = NULL;
- }
- /* Handling last char in line (or in paragraph).
- * T.e. prev condition didn't work, so we are not standing in the beginning of item,
- * but in the end of line or paragraph. */
- else if (evas_textblock_cursor_eol_get(cur_obj))
- {
- EvasBiDiLevel par_level, it_level;
-
- _layout_update_bidi_props(o, ln->par);
- par_level = *(ln->par->bidi_props->embedding_levels);
- it_level = ln->par->bidi_props->embedding_levels[it->text_pos];
-
- if (it_level > par_level)
- {
- Evas_Object_Textblock_Item *lastit = it;
-
- if (IS_RTL(par_level)) /* RTL par*/
- {
- /* We know, that all the items before current are of the same or bigger embedding level.
- * So search backwards for the first one. */
- while (EINA_INLIST_GET(lastit)->prev)
- {
- lastit = _EINA_INLIST_CONTAINER(it, EINA_INLIST_GET(lastit)->prev);
- }
-
- adv1 = 0;
- adv2 = it->adv;
- }
- else /* LTR par */
- {
- /* We know, that all the items after current are of bigger or same embedding level.
- * So search forward for the last one. */
- while (EINA_INLIST_GET(lastit)->next)
- {
- lastit = _EINA_INLIST_CONTAINER(it, EINA_INLIST_GET(lastit)->next);
- }
-
- adv1 = lastit->adv;
- adv2 = 0;
- }
-
- it1 = lastit;
- it2 = it;
- }
- /* Clear the bidi props because we don't need them anymore. */
- evas_bidi_paragraph_props_unref(ln->par->bidi_props);
- ln->par->bidi_props = NULL;
- }
-
- if (it1 && it2)
- {
- Evas_Object_Textblock_Line *ln1 = NULL, *ln2 = NULL;
- ln1 = _find_layout_line_by_item(ln->par, it1);
- if (cx) *cx = ln1->x + it1->x + adv1;
- if (cy) *cy = ln1->par->y + ln1->y;
- if (ch) *ch = ln1->h;
-
- ln2 = _find_layout_line_by_item(ln->par, it2);
- if (cx2) *cx2 = ln2->x + it2->x + adv2;
- if (cy2) *cy2 = ln2->par->y + ln2->y;
- if (ch2) *ch2 = ln2->h;
-
- return EINA_TRUE;
- }
- }
- }
- }
-#undef IS_DIFFERENT_DIR
-#undef IS_RTL
-#else
- (void) cx2;
- (void) cy2;
- (void) cw2;
- (void) ch2;
-#endif
- evas_textblock_cursor_geometry_get(cur_obj, cx, cy, cw, ch, NULL,
- (ctype == EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE) ?
- EVAS_TEXTBLOCK_CURSOR_BEFORE : EVAS_TEXTBLOCK_CURSOR_UNDER);
- return EINA_FALSE;
-}
-
EAPI int
-evas_textblock_cursor_geometry_get(const Efl_Canvas_Text_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype)
+evas_textblock_cursor_geometry_get(const Efl_Canvas_Text_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype)
{
int ret = -1;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11495,7 +10859,7 @@ evas_textblock_cursor_geometry_get(const Efl_Canvas_Text_Cursor *cur_obj, Evas_C
Evas_Object_Textblock_Line *ln;
Evas_Object_Textblock_Item *it;
- ret = evas_textblock_cursor_pen_geometry_get(cur_obj, cx, cy, cw, ch);
+ ret = evas_textblock_cursor_pen_geometry_get(cur, cx, cy, cw, ch);
_find_layout_item_match(cur, &ln, &it);
if (ret >= 0)
{
@@ -11515,7 +10879,7 @@ evas_textblock_cursor_geometry_get(const Efl_Canvas_Text_Cursor *cur_obj, Evas_C
Evas_Object_Textblock_Line *ln;
Evas_Object_Textblock_Item *it;
- ret = evas_textblock_cursor_pen_geometry_get(cur_obj, &x, &y, &w, &h);
+ ret = evas_textblock_cursor_pen_geometry_get(cur, &x, &y, &w, &h);
_find_layout_item_match(cur, &ln, &it);
if (ret >= 0)
{
@@ -11554,7 +10918,7 @@ evas_textblock_cursor_geometry_get(const Efl_Canvas_Text_Cursor *cur_obj, Evas_C
* @return line number of the char on success, -1 on error.
*/
static int
-_evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch), const Evas_Textblock_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
+_evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *data, Evas_Font_Set *font, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch), const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
Evas_Object_Textblock_Line *ln = NULL;
Evas_Object_Textblock_Item *it = NULL;
@@ -11564,7 +10928,6 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
int pos;
Eina_Bool previous_format;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
@@ -11671,35 +11034,32 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
}
EAPI int
-evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
+evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
return _evas_textblock_cursor_char_pen_geometry_common_get(
- ENFN->font_char_coords_get, cur_obj, cx, cy, cw, ch);
+ ENFN->font_char_coords_get, cur, cx, cy, cw, ch);
}
EAPI int
-evas_textblock_cursor_pen_geometry_get(const Evas_Textblock_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
+evas_textblock_cursor_pen_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
return _evas_textblock_cursor_char_pen_geometry_common_get(
- ENFN->font_pen_coords_get, cur_obj, cx, cy, cw, ch);
+ ENFN->font_pen_coords_get, cur, cx, cy, cw, ch);
}
EAPI int
-evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
+evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
Evas_Object_Textblock_Line *ln = NULL;
Evas_Object_Textblock_Item *it = NULL;
int x, y, w, h;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11728,16 +11088,15 @@ evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur_obj, Ev
}
EAPI Eina_Bool
-evas_textblock_cursor_visible_range_get(Efl_Canvas_Text_Cursor *start_obj, Evas_Textblock_Cursor *end_obj)
+evas_textblock_cursor_visible_range_get(Efl_Canvas_Text_Cursor *start, Evas_Textblock_Cursor *end)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(start_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- return efl_canvas_text_visible_range_get(cur->obj, start_obj, end_obj);
+ return efl_canvas_text_visible_range_get(start->obj, start, end);
}
EOLIAN static Eina_Bool
_efl_canvas_text_visible_range_get(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Text_Data *pd EINA_UNUSED,
- Efl_Canvas_Text_Cursor *start_obj, Evas_Textblock_Cursor *end_obj)
+ Efl_Canvas_Text_Cursor *start, Evas_Textblock_Cursor *end)
{
Evas *eo_e;
Evas_Coord cy, ch;
@@ -11748,18 +11107,17 @@ _efl_canvas_text_visible_range_get(Eo *eo_obj EINA_UNUSED,
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
cy = 0 - obj->cur->geometry.y;
ch = e->viewport.h;
- evas_textblock_cursor_line_coord_set(start_obj, cy);
- evas_textblock_cursor_line_coord_set(end_obj, cy + ch);
- evas_textblock_cursor_line_char_last(end_obj);
+ evas_textblock_cursor_line_coord_set(start, cy);
+ evas_textblock_cursor_line_coord_set(end, cy + ch);
+ evas_textblock_cursor_line_char_last(end);
return EINA_TRUE;
}
EAPI Eina_Bool
-evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord x, Evas_Coord y)
+evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
Evas_Object_Textblock_Paragraph *found_par;
Evas_Object_Textblock_Line *ln;
Evas_Object_Textblock_Item *it = NULL;
@@ -11791,11 +11149,11 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
cur->node = found_par->text_node;
if (found_par->direction == EVAS_BIDI_DIRECTION_RTL)
{
- evas_textblock_cursor_line_char_last(cur_obj);
+ evas_textblock_cursor_line_char_last(cur);
}
else
{
- evas_textblock_cursor_line_char_first(cur_obj);
+ evas_textblock_cursor_line_char_first(cur);
}
ret = EINA_TRUE;
goto end;
@@ -11806,11 +11164,11 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
cur->node = found_par->text_node;
if (found_par->direction == EVAS_BIDI_DIRECTION_RTL)
{
- evas_textblock_cursor_line_char_first(cur_obj);
+ evas_textblock_cursor_line_char_first(cur);
}
else
{
- evas_textblock_cursor_line_char_last(cur_obj);
+ evas_textblock_cursor_line_char_last(cur);
}
ret = EINA_TRUE;
goto end;
@@ -11872,13 +11230,13 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
{
/* If we are after the last paragraph, use the last position in the
* text. */
- evas_textblock_cursor_paragraph_last(cur_obj);
+ evas_textblock_cursor_paragraph_last(cur);
ret = EINA_TRUE;
goto end;
}
else if (o->paragraphs && (y < (o->paragraphs->y + first_line->y)))
{
- evas_textblock_cursor_paragraph_first(cur_obj);
+ evas_textblock_cursor_paragraph_first(cur);
ret = EINA_TRUE;
goto end;
}
@@ -11887,25 +11245,17 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
end:
if (ret)
{
- efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED, NULL);
+ efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
return ret;
}
-EOLIAN static void
-_efl_canvas_text_cursor_coord_set(Eo *cur_obj, Efl_Canvas_Text_Cursor_Data *cur EINA_UNUSED,
- Evas_Coord x, Evas_Coord y)
-{
- evas_textblock_cursor_char_coord_set(cur_obj, x, y);
-}
-
EAPI int
-evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord y)
+evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y)
{
Evas_Object_Textblock_Paragraph *found_par;
Evas_Object_Textblock_Line *ln;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return -1;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
@@ -11922,7 +11272,7 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
/* If we are before the first paragraph, use the first position in the text */
if ((found_par->y >= y) && (!EINA_INLIST_GET(found_par)->prev))
{
- evas_textblock_cursor_paragraph_first(cur_obj);
+ evas_textblock_cursor_paragraph_first(cur);
return 0;
}
@@ -11932,7 +11282,7 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
if (ln->par->y + ln->y > y) break;
if ((ln->par->y + ln->y <= y) && ((ln->par->y + ln->y + ln->h) > y))
{
- evas_textblock_cursor_line_set(cur_obj, ln->par->line_no +
+ evas_textblock_cursor_line_set(cur, ln->par->line_no +
ln->line_no);
return ln->par->line_no + ln->line_no;
}
@@ -11943,7 +11293,7 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
int line_no = 0;
/* If we are after the last paragraph, use the last position in the
* text. */
- evas_textblock_cursor_paragraph_last(cur_obj);
+ evas_textblock_cursor_paragraph_last(cur);
if (cur->node && cur->node->par)
{
line_no = cur->node->par->line_no;
@@ -11958,7 +11308,7 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur_obj, Evas_Coord
else if (o->paragraphs && (y < o->paragraphs->y))
{
int line_no = 0;
- evas_textblock_cursor_paragraph_first(cur_obj);
+ evas_textblock_cursor_paragraph_first(cur);
if (cur->node && cur->node->par)
{
line_no = cur->node->par->line_no;
@@ -12325,25 +11675,22 @@ _line_fill_rect_get(const Evas_Object_Textblock_Line *ln,
}
EAPI Eina_Iterator *
-evas_textblock_cursor_range_simple_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj)
+evas_textblock_cursor_range_simple_geometry_get(const Efl_Canvas_Text_Cursor *cur1, const Evas_Textblock_Cursor *cur2)
{
- 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_simple_geometry_get(cur->obj, cur1_obj, cur2_obj);
+ if (!cur1) return NULL;
+ return efl_canvas_text_range_simple_geometry_get(cur1->obj, cur1, cur2);
}
static EOLIAN Eina_Iterator *
_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)
+ Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1, const
+ Evas_Textblock_Cursor *cur2)
{
Evas_Object_Textblock_Line *ln1, *ln2;
Evas_Object_Textblock_Item *it1, *it2;
Eina_List *rects = NULL;
Eina_Iterator *itr = NULL;
- const Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- const Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur1 || !cur1->node) return NULL;
if (!cur2 || !cur2->node) return NULL;
if (cur1->obj != cur2->obj) return NULL;
@@ -12443,16 +11790,14 @@ _efl_canvas_text_range_simple_geometry_get(Eo *eo_obj EINA_UNUSED,
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)
+ Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1, const
+ Evas_Textblock_Cursor *cur2)
{
Evas_Object_Textblock_Line *ln1, *ln2;
Evas_Object_Textblock_Item *it1, *it2;
Eina_List *rects = NULL;
Evas_Textblock_Rectangle *tr;
- const Efl_Canvas_Text_Cursor_Data *cur1 = efl_data_scope_get(cur1_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- const Efl_Canvas_Text_Cursor_Data *cur2 = efl_data_scope_get(cur2_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur1 || !cur1->node) return NULL;
if (!cur2 || !cur2->node) return NULL;
if (cur1->obj != cur2->obj) return NULL;
@@ -12521,25 +11866,24 @@ _efl_canvas_text_range_geometry_list_get(Eo *eo_obj EINA_UNUSED,
}
EAPI Eina_List *
-evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1_obj, const Evas_Textblock_Cursor *cur2_obj)
+evas_textblock_cursor_range_geometry_get(const Efl_Canvas_Text_Cursor *cur1, 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;
- if (!cur) return NULL;
+ if (!cur1) return NULL;
- o = efl_data_scope_get(cur->obj, MY_CLASS);
+ o = efl_data_scope_get(cur1->obj, MY_CLASS);
- return _efl_canvas_text_range_geometry_list_get(cur->obj, o, cur1_obj, cur2_obj);
+ return _efl_canvas_text_range_geometry_list_get(cur1->obj, o, cur1, 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)
+ Efl_Canvas_Text_Data *o, const Efl_Canvas_Text_Cursor *cur1, const
+ Evas_Textblock_Cursor *cur2)
{
Eina_List *rects = _efl_canvas_text_range_geometry_list_get(eo_obj,
- o, cur1_obj, cur2_obj);
+ o, cur1, cur2);
return _evas_textblock_selection_iterator_new(rects);
}
@@ -12575,25 +11919,23 @@ _evas_textblock_cursor_format_item_geometry_get(const Efl_Canvas_Text_Cursor_Dat
}
EAPI Eina_Bool
-evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur_obj, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
+evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
return _evas_textblock_cursor_format_item_geometry_get(cur, cx, cy, cw, ch);
}
EAPI Eina_Bool
-evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur_obj)
+evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur)
{
Eina_Bool ret = EINA_FALSE;
Efl_Canvas_Text_Cursor_Data cur2;
- Efl_Canvas_Text_Cursor_Data *cur = efl_data_scope_get(cur_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
if (!cur) return EINA_FALSE;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
evas_object_async_block(obj);
_evas_textblock_cursor_init(&cur2, cur->obj);
_evas_textblock_cursor_copy(&cur2, cur);
- _evas_textblock_cursor_line_char_last(&cur2);
+ evas_textblock_cursor_line_char_last(&cur2);
if (cur2.pos == cur->pos)
{
ret = EINA_TRUE;
@@ -12601,7 +11943,6 @@ evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur_obj)
return ret;
}
-#endif
/* general controls */
EAPI Eina_Bool
evas_object_textblock_line_number_geometry_get(const Eo *eo_obj, int line, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
@@ -12623,7 +11964,6 @@ evas_object_textblock_line_number_geometry_get(const Eo *eo_obj, int line, Evas_
if (ch) *ch = ln->h;
return EINA_TRUE;
}
-#if 0
static void
_evas_object_textblock_clear(Evas_Object *eo_obj)
@@ -12642,16 +11982,15 @@ _evas_object_textblock_clear(Evas_Object *eo_obj)
}
_nodes_clear(eo_obj);
- co = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ co = o->cursor;
co->node = NULL;
co->pos = 0;
co->changed = EINA_TRUE;
EINA_LIST_FOREACH(o->cursors, l, cur)
{
- co = efl_data_scope_get(cur, EFL_CANVAS_TEXT_CURSOR_CLASS);
- co->node = NULL;
- co->pos = 0;
- co->changed = EINA_TRUE;
+ cur->node = NULL;
+ cur->pos = 0;
+ cur->changed = EINA_TRUE;
}
_evas_textblock_changed(o, eo_obj);
@@ -13011,7 +12350,7 @@ evas_object_textblock_init(Evas_Object *eo_obj)
}
o = obj->private_data;
- Efl_Canvas_Text_Cursor_Data *co = efl_data_scope_get(o->cursor, EFL_CANVAS_TEXT_CURSOR_CLASS);
+ Efl_Canvas_Text_Cursor_Data *co = o->cursor;
co->obj = eo_obj;
evas_object_textblock_text_markup_set(eo_obj, "");
@@ -13059,14 +12398,14 @@ evas_object_textblock_free(Evas_Object *eo_obj)
{
evas_object_textblock_style_user_pop(eo_obj);
}
- efl_del(o->cursor);
+ evas_textblock_cursor_free(o->cursor);
while (o->cursors)
{
Efl_Canvas_Text_Cursor *cur;
cur = (Efl_Canvas_Text_Cursor *)o->cursors->data;
o->cursors = eina_list_remove_list(o->cursors, o->cursors);
- efl_del(cur);
+ evas_textblock_cursor_free(cur);
}
if (o->repch) eina_stringshare_del(o->repch);
if (o->ellip_ti) _item_free(eo_obj, NULL, _ITEM(o->ellip_ti));
@@ -14532,7 +13871,7 @@ _efl_canvas_text_efl_text_text_set(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUS
const char *text)
{
evas_object_textblock_text_markup_set(eo_obj, "");
- efl_canvas_text_cursor_text_insert(o->cursor, text);
+ efl_canvas_text_cursor_text_insert(eo_obj, o->cursor, text);
efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL);
}
@@ -14544,8 +13883,8 @@ _canvas_text_get_all(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED)
_evas_textblock_cursor_init(&start, eo_obj);
_evas_textblock_cursor_init(&end, eo_obj);
- _canvas_text_cursor_paragraph_first(&start);
- _canvas_text_cursor_paragraph_last(&end);
+ evas_textblock_cursor_paragraph_first(&start);
+ evas_textblock_cursor_paragraph_last(&end);
return _evas_textblock_cursor_range_text_get(&start, &end, EVAS_TEXTBLOCK_TEXT_PLAIN);
}
@@ -14635,7 +13974,6 @@ _textblock_cursor_pos_at_fnode_set(Eo *eo_obj EINA_UNUSED,
cur->pos = _evas_textblock_node_format_pos_get(fnode);
}
-#endif
static Eina_Bool
_textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o,
Efl_Canvas_Text_Annotation *an,
@@ -14675,7 +14013,6 @@ _textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o,
o->format_changed = EINA_TRUE;
return EINA_TRUE;
}
-#if 0
EOLIAN static const char *
_efl_canvas_text_annotation_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED,
@@ -14785,7 +14122,6 @@ _efl_canvas_text_annotation_del(Eo *eo_obj EINA_UNUSED,
return EINA_TRUE;
}
-#endif
static Efl_Canvas_Text_Annotation *
_textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
Efl_Canvas_Text_Cursor_Data *start, Efl_Canvas_Text_Cursor_Data *end,
@@ -14850,16 +14186,13 @@ _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
return ret;
}
-#if 0
EOLIAN static Efl_Canvas_Text_Annotation *
_efl_canvas_text_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
- Efl_Canvas_Text_Cursor *start_obj, Efl_Canvas_Text_Cursor *end_obj,
+ Efl_Canvas_Text_Cursor *start, Efl_Canvas_Text_Cursor *end,
const char *format)
{
Efl_Canvas_Text_Annotation *ret;
- Efl_Canvas_Text_Cursor_Data *start = efl_data_scope_get(start_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- Efl_Canvas_Text_Cursor_Data *end = efl_data_scope_get(end_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
ret = _textblock_annotation_insert(eo_obj, o, start, end, format,
EINA_FALSE);
@@ -14869,12 +14202,10 @@ _efl_canvas_text_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o,
EOLIAN static Eina_Iterator *
_efl_canvas_text_range_annotations_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED,
- const Evas_Textblock_Cursor *start_obj, const Evas_Textblock_Cursor *end_obj)
+ const Evas_Textblock_Cursor *start, const Evas_Textblock_Cursor *end)
{
Eina_List *lst = NULL;
Efl_Canvas_Text_Annotation *it;
- Efl_Canvas_Text_Cursor_Data *start = efl_data_scope_get(start_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
- Efl_Canvas_Text_Cursor_Data *end = efl_data_scope_get(end_obj, EFL_CANVAS_TEXT_CURSOR_CLASS);
EINA_INLIST_FOREACH(o->annotations, it)
{
@@ -14896,17 +14227,6 @@ _efl_canvas_text_range_annotations_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_D
}
EOLIAN static Efl_Canvas_Text_Annotation *
-_efl_canvas_text_cursor_object_item_insert(Eo *cur_obj EINA_UNUSED,
- Efl_Canvas_Text_Cursor_Data *cur, const char *format)
-{
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- Efl_Canvas_Text_Annotation *ret =
- _textblock_annotation_insert(cur->obj, o, cur, cur, format, EINA_TRUE);
- efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL);
- return ret;
-}
-
-EOLIAN static Efl_Canvas_Text_Annotation *
_efl_canvas_text_cursor_object_item_annotation_get(Eo *cur_obj EINA_UNUSED,
Efl_Canvas_Text_Cursor_Data *cur)
{
@@ -14914,7 +14234,7 @@ _efl_canvas_text_cursor_object_item_annotation_get(Eo *cur_obj EINA_UNUSED,
Efl_Canvas_Text_Annotation *data, *ret = NULL;
it = efl_canvas_text_range_annotations_get(cur->obj,
- cur_obj, cur_obj);
+ cur, cur);
EINA_ITERATOR_FOREACH(it, data)
{
if (data->is_item)
@@ -14946,13 +14266,8 @@ 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 *start, Efl_Canvas_Text_Cursor *end)
{
- 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);
}
@@ -15716,30 +15031,12 @@ ppar(Evas_Object_Textblock_Paragraph *par)
#define EFL_CANVAS_TEXT_EXTRA_OPS \
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_canvas_text_efl_object_dbg_info_get)
-#include "canvas/efl_canvas_text_cursor.eo.c"
-#else
-EOLIAN static Eo *
-_efl_canvas_text_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Text_Data *class_data EINA_UNUSED)
-{
- return eo_obj;
-}
-
EOLIAN static Efl_Canvas_Text_Cursor *
_efl_canvas_text_cursor_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
{
return o->cursor;
}
-static void
-_evas_textblock_cursor_init(Efl_Canvas_Text_Cursor *cur, const Evas_Object *tb)
-{
- cur->obj = (Eo *) tb;
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- cur->node = o->text_nodes;
- cur->pos = 0;
-}
-
-
EOLIAN static Efl_Canvas_Text_Cursor *
_efl_canvas_text_cursor_new(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
{
@@ -15804,52 +15101,6 @@ _efl_canvas_text_cursor_copy(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_U
}
}
-static void
-_evas_textblock_cursor_pos_set(Efl_Canvas_Text_Cursor *cur, int _pos)
-{
- Evas_Object_Textblock_Node_Text *n;
- size_t pos;
- if (!cur) return;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
-
- if (_pos < 0)
- {
- pos = 0;
- }
- else
- {
- pos = (size_t) _pos;
- }
-
- n = o->text_nodes;
- while (n && (pos >= eina_ustrbuf_length_get(n->unicode)))
- {
- pos -= eina_ustrbuf_length_get(n->unicode);
- n = _NODE_TEXT(EINA_INLIST_GET(n)->next);
- }
-
- if (n)
- {
- cur->node = n;
- cur->pos = pos;
- }
- else if (o->text_nodes)
- {
- /* In case we went pass the last node, we need to put the cursor
- * at the absolute end. */
- Evas_Object_Textblock_Node_Text *last_n;
-
- last_n = _NODE_TEXT(EINA_INLIST_GET(o->text_nodes)->last);
- pos = eina_ustrbuf_length_get(last_n->unicode);
-
- cur->node = last_n;
- cur->pos = pos;
- }
-}
-
EOLIAN static void
_efl_canvas_text_cursor_position_set(Eo *cur_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur, int _pos)
{
@@ -15876,77 +15127,6 @@ _efl_canvas_text_cursor_position_get(Eo *cur_obj EINA_UNUSED, Efl_Canvas_Text_Da
return npos + cur->pos;
}
-static Eina_Bool
-_evas_textblock_cursor_paragraph_next(Efl_Canvas_Text_Cursor *cur)
-{
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
- /* If there is a current text node, return the next text node (if exists)
- * otherwise, just return False. */
- if (cur->node)
- {
- Evas_Object_Textblock_Node_Text *nnode;
- nnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->next);
- if (nnode)
- {
- cur->node = nnode;
- cur->pos = 0;
-
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
-}
-
-static Eina_Bool
-_evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor *cur)
-{
- int ind;
- const Eina_Unicode *text;
-
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
-
- ind = cur->pos;
- text = eina_ustrbuf_string_get(cur->node->unicode);
- if (text[ind]) ind++;
- /* Only allow pointing a null if it's the last paragraph.
- * because we don't have a PS there. */
- if (text[ind])
- {
- cur->pos = ind;
- return EINA_TRUE;
- }
- else
- {
- if (!_evas_textblock_cursor_paragraph_next(cur))
- {
- /* If we already were at the end, that means we don't have
- * where to go next we should return FALSE */
- if (cur->pos == (size_t) ind)
- return EINA_FALSE;
-
- cur->pos = ind;
- return EINA_TRUE;
- }
- else
- {
- return EINA_TRUE;
- }
- }
-}
-
-EAPI Eina_Bool
-evas_textblock_cursor_char_next(Efl_Canvas_Text_Cursor *cur)
-{
- if (!cur) return EINA_FALSE;
- return _evas_textblock_cursor_char_next(cur);
-}
-
// FIXME: add to legacy header
static void
evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor *cur)
@@ -15969,56 +15149,6 @@ evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor *cur)
cur->pos = 0;
}
-static Eina_Bool
-_evas_textblock_cursor_paragraph_prev(Efl_Canvas_Text_Cursor *cur)
-{
- Evas_Object_Textblock_Node_Text *node;
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
- /* If the current node is a text node, just get the prev if any,
- * if it's a format, get the current text node out of the format and return
- * the prev text node if any. */
- node = cur->node;
- /* If there is a current text node, return the prev text node
- * (if exists) otherwise, just return False. */
- if (node)
- {
- Evas_Object_Textblock_Node_Text *pnode;
- pnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->prev);
- if (pnode)
- {
- cur->node = pnode;
- evas_textblock_cursor_paragraph_char_last(cur);
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
-}
-
-static Eina_Bool
-_evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor *cur)
-{
-
- if (!cur) return EINA_FALSE;
- TB_NULL_CHECK(cur->node, EINA_FALSE);
-
- if (cur->pos != 0)
- {
- cur->pos--;
- return EINA_TRUE;
- }
- return _evas_textblock_cursor_paragraph_prev(cur);
-}
-
-EAPI Eina_Bool
-evas_textblock_cursor_char_prev(Efl_Canvas_Text_Cursor *cur)
-{
- if (!cur) return EINA_FALSE;
- return _evas_textblock_cursor_char_prev(cur);
-}
-
EOLIAN static void
_efl_canvas_text_cursor_char_prev(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur)
{
@@ -16050,66 +15180,6 @@ _efl_canvas_text_cursor_paragraph_char_last(Eo *eo_obj, Efl_Canvas_Text_Data *o
efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
-EAPI Eina_Bool
-evas_textblock_cursor_word_start(Efl_Canvas_Text_Cursor *cur)
-{
- if (!cur) return EINA_FALSE;
- const Eina_Unicode *text;
- size_t i;
- char *breaks;
-
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
-
- size_t len = eina_ustrbuf_length_get(cur->node->unicode);
-
- text = eina_ustrbuf_string_get(cur->node->unicode);
-
- {
- const char *lang = ""; /* FIXME: get lang */
- breaks = malloc(len);
- set_wordbreaks_utf32((const utf32_t *) text, len, lang, breaks);
- }
-
- if ((cur->pos > 0) && (cur->pos == len))
- cur->pos--;
-
- for (i = cur->pos ; _is_white(text[i]) && BREAK_AFTER(i) ; i--)
- {
- if (i == 0)
- {
- Evas_Object_Textblock_Node_Text *pnode;
- pnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->prev);
- if (pnode)
- {
- cur->node = pnode;
- len = eina_ustrbuf_length_get(cur->node->unicode);
- cur->pos = len - 1;
- free(breaks);
- return evas_textblock_cursor_word_start(cur);
- }
- else
- {
- break;
- }
- }
- }
-
- for ( ; i > 0 ; i--)
- {
- if (BREAK_AFTER(i - 1))
- {
- break;
- }
- }
-
- cur->pos = i;
-
- free(breaks);
- return EINA_TRUE;
-}
-
EOLIAN static void
_efl_canvas_text_cursor_word_start(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur EINA_UNUSED)
{
@@ -16117,60 +15187,6 @@ _efl_canvas_text_cursor_word_start(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUS
efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
-EAPI Eina_Bool
-evas_textblock_cursor_word_end(Efl_Canvas_Text_Cursor *cur)
-{
- if (!cur) return EINA_FALSE;
- const Eina_Unicode *text;
- size_t i;
- char *breaks;
-
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
-
- size_t len = eina_ustrbuf_length_get(cur->node->unicode);
-
- if (cur->pos == len)
- return EINA_TRUE;
-
- text = eina_ustrbuf_string_get(cur->node->unicode);
-
- {
- const char *lang = ""; /* FIXME: get lang */
- breaks = malloc(len);
- set_wordbreaks_utf32((const utf32_t *) text, len, lang, breaks);
- }
-
- for (i = cur->pos; text[i] && _is_white(text[i]) && (BREAK_AFTER(i)) ; i++);
- if (i == len)
- {
- Evas_Object_Textblock_Node_Text *nnode;
- nnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->next);
- if (nnode)
- {
- cur->node = nnode;
- cur->pos = 0;
- free(breaks);
- return evas_textblock_cursor_word_end(cur);
- }
- }
-
- for ( ; text[i] ; i++)
- {
- if (BREAK_AFTER(i))
- {
- /* This is the one to break after. */
- break;
- }
- }
-
- cur->pos = i;
-
- free(breaks);
- return EINA_TRUE;
-}
-
EOLIAN static void
_efl_canvas_text_cursor_word_end(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur EINA_UNUSED)
{
@@ -16178,106 +15194,6 @@ _efl_canvas_text_cursor_word_end(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED
efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
-static void
-_cursor_line_first_char_get(Evas_Object_Textblock_Line *ln,
- Efl_Canvas_Text_Cursor *cur,
- Efl_Canvas_Text_Data *o)
-{
- if (ln->items)
- {
- Evas_Object_Textblock_Item *it;
- size_t pos;
- pos = ln->items->text_pos;
- EINA_INLIST_FOREACH(EINA_INLIST_GET(ln->items)->next, it)
- {
- if (it->text_pos < pos)
- {
- pos = it->text_pos;
- }
- }
- cur->pos = pos;
- cur->node = ln->items->text_node;
- }
- else
- {
- cur->pos = 0;
- cur->node = o->text_nodes;
- }
-}
-
-static Eina_Bool
-_evas_textblock_cursor_is_at_the_end(const Efl_Canvas_Text_Cursor *cur)
-{
- const Eina_Unicode *text;
-
- if (!cur) return EINA_FALSE;
- TB_NULL_CHECK(cur->node, EINA_FALSE);
- text = eina_ustrbuf_string_get(cur->node->unicode);
- if ((cur->pos - 1) > eina_ustrbuf_length_get(cur->node->unicode)) return EINA_FALSE;
- return ((text[cur->pos] == 0) && (!EINA_INLIST_GET(cur->node)->next)) ?
- EINA_TRUE : EINA_FALSE;
-}
-
-/**
- * @internal
- * Return the format at a specific position.
- *
- * @param cur the cursor to the position.
- * @return the format node at the specific position or NULL if not found.
- */
-static Evas_Object_Textblock_Node_Format *
-_evas_textblock_cursor_node_format_at_pos_get(const Efl_Canvas_Text_Cursor *cur)
-{
- Evas_Object_Textblock_Node_Format *node;
- Evas_Object_Textblock_Node_Format *itr;
- int position = 0;
-
- TB_NULL_CHECK(cur->node, NULL);
-
- node = cur->node->format_node;
- if (!node) return NULL;
- /* If there is no exclusive format node to this paragraph return the
- * previous's node */
- /* Find the main format node */
- EINA_INLIST_FOREACH(node, itr)
- {
- if (itr->text_node != cur->node)
- {
- return NULL;
- }
- if ((position + itr->offset) == cur->pos)
- {
- return itr;
- }
- position += itr->offset;
- }
- return NULL;
-}
-
-EAPI Eina_Bool
-_evas_textblock_cursor_is_format(const Efl_Canvas_Text_Cursor *cur)
-{
- if ((!cur) || (!cur->node)) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- return (_evas_textblock_cursor_node_format_at_pos_get(cur)) ?
- EINA_TRUE : EINA_FALSE;
-}
-
-static Eina_Bool
-_evas_textblock_cursor_format_is_visible_get(const Efl_Canvas_Text_Cursor *cur)
-{
- const Eina_Unicode *text;
-
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node, EINA_FALSE);
- if (!_evas_textblock_cursor_is_format(cur)) return EINA_FALSE;
- text = eina_ustrbuf_string_get(cur->node->unicode);
- return EVAS_TEXTBLOCK_IS_VISIBLE_FORMAT_CHAR(text[cur->pos]);
-}
-
/**
* @internal
* Find the layout item and line that match the text node and position passed.
@@ -16338,8 +15254,7 @@ _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Tex
}
}
-//FIXME: add to legacy header
-static void
+EAPI void
evas_textblock_cursor_line_char_first(Efl_Canvas_Text_Cursor *cur)
{
Evas_Object_Textblock_Line *ln = NULL;
@@ -16369,55 +15284,6 @@ _efl_canvas_text_cursor_line_char_first(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA
efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
}
-static void
-evas_textblock_cursor_line_char_last(Efl_Canvas_Text_Cursor *cur)
-{
- Evas_Object_Textblock_Line *ln = NULL;
- Evas_Object_Textblock_Item *it = NULL;
-
- if (!cur) return;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- TB_NULL_CHECK(cur->node);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
- _relayout_if_needed(cur->obj, o);
-
- _find_layout_item_match(cur, &ln, &it);
-
- if (!ln) return;
- if (ln->items)
- {
- Evas_Object_Textblock_Item *i;
- it = ln->items;
- EINA_INLIST_FOREACH(ln->items, i)
- {
- if (it->text_pos < i->text_pos)
- {
- it = i;
- }
- }
- }
- if (it)
- {
- size_t ind;
-
- 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;
- if (!IS_AT_END(_ITEM_TEXT(it), ind)) ind++;
- cur->pos += ind;
- }
- else if (!EINA_INLIST_GET(ln)->next && !EINA_INLIST_GET(ln->par)->next)
- {
- cur->pos++;
- }
- }
-}
-
-//FIXME: add to legacy header
EOLIAN static void
_efl_canvas_text_cursor_line_char_last(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur)
{
@@ -16426,7 +15292,7 @@ _efl_canvas_text_cursor_line_char_last(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_
}
//FIXME: add to legacy header
-static void
+EAPI void
evas_textblock_cursor_paragraph_first(Efl_Canvas_Text_Cursor *cur)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
@@ -16444,7 +15310,7 @@ _efl_canvas_text_cursor_paragraph_first(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA
}
//FIXME: add to legacy header
-static void
+EAPI void
evas_textblock_cursor_paragraph_last(Efl_Canvas_Text_Cursor *cur)
{
Evas_Object_Textblock_Node_Text *node;
@@ -16560,142 +15426,6 @@ _efl_canvas_text_cursor_compare(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o
return evas_textblock_cursor_compare(cur1, cur2);
}
-EAPI Eina_Bool
-evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y)
-{
- Evas_Object_Textblock_Paragraph *found_par;
- Evas_Object_Textblock_Line *ln;
- Evas_Object_Textblock_Item *it = NULL;
- Eina_Bool ret = EINA_FALSE;
-
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
- _relayout_if_needed(cur->obj, o);
-
- x += o->style_pad.l;
- y += o->style_pad.t;
-
- found_par = _layout_find_paragraph_by_y(o, y);
- if (found_par)
- {
- _layout_paragraph_render(o, found_par);
- EINA_INLIST_FOREACH(found_par->lines, ln)
- {
- if (ln->par->y + ln->y > y) break;
- if ((ln->par->y + ln->y <= y) && ((ln->par->y + ln->y + ln->h) > y))
- {
- /* If before or after the line, go to start/end according
- * to paragraph direction. */
- if (x < ln->x)
- {
- cur->pos = ln->items->text_pos;
- cur->node = found_par->text_node;
- if (found_par->direction == EVAS_BIDI_DIRECTION_RTL)
- {
- evas_textblock_cursor_line_char_last(cur);
- }
- else
- {
- evas_textblock_cursor_line_char_first(cur);
- }
- ret = EINA_TRUE;
- goto end;
- }
- else if (x >= ln->x + ln->w)
- {
- cur->pos = ln->items->text_pos;
- cur->node = found_par->text_node;
- if (found_par->direction == EVAS_BIDI_DIRECTION_RTL)
- {
- evas_textblock_cursor_line_char_first(cur);
- }
- else
- {
- evas_textblock_cursor_line_char_last(cur);
- }
- ret = EINA_TRUE;
- goto end;
- }
-
- EINA_INLIST_FOREACH(ln->items, it)
- {
- if (((it->x + ln->x) <= x) && (((it->x + ln->x) + it->adv) > x))
- {
- if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT)
- {
- int pos;
- int cx, cy, cw, ch;
- Evas_Object_Textblock_Text_Item *ti;
- ti = _ITEM_TEXT(it);
-
- pos = -1;
- if (ti->parent.format->font.font)
- pos = ENFN->font_char_at_coords_get(
- ENDT,
- ti->parent.format->font.font,
- &ti->text_props,
- x - it->x - ln->x, 0,
- &cx, &cy, &cw, &ch);
- if (pos < 0)
- goto end;
- cur->pos = pos + it->text_pos;
- cur->node = it->text_node;
- ret = EINA_TRUE;
- goto end;
- }
- else
- {
- Evas_Object_Textblock_Format_Item *fi;
- fi = _ITEM_FORMAT(it);
- /* Lets keep cur position half way for easy positioning */
- if (x > (ln->x + it->x + (it->adv / 2)))
- {
- cur->pos = fi->parent.text_pos + 1;
- }
- else
- {
- cur->pos = fi->parent.text_pos;
- }
- cur->node = found_par->text_node;
- ret = EINA_TRUE;
- goto end;
- }
- }
- }
- }
- }
- }
-
- if (o->paragraphs)
- {
- Evas_Object_Textblock_Line *first_line = o->paragraphs->lines;
- if (y >= o->paragraphs->y + o->formatted.h)
- {
- /* If we are after the last paragraph, use the last position in the
- * text. */
- evas_textblock_cursor_paragraph_last(cur);
- ret = EINA_TRUE;
- goto end;
- }
- else if (o->paragraphs && (y < (o->paragraphs->y + first_line->y)))
- {
- evas_textblock_cursor_paragraph_first(cur);
- ret = EINA_TRUE;
- goto end;
- }
- }
-
-end:
- if (ret)
- {
- // XXX: maybe should be moved to efl_canvas_text_cursor_coord_set?
- efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL);
- }
- return ret;
-}
-
EOLIAN static void
_efl_canvas_text_cursor_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Canvas_Text_Cursor *cur EINA_UNUSED,
Evas_Coord x, Evas_Coord y)
@@ -16703,444 +15433,6 @@ _efl_canvas_text_cursor_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *
evas_textblock_cursor_char_coord_set(cur, x, y);
}
-/**
- * @internal
- * Return the last format that applies to a specific cursor or at the specific
- * position the cursor points to. This means either a cursor at or before the
- * position of the cursor in the text node is returned or the previous's text
- * node's format node.
- *
- * @param cur the position to look at.
- * @return the format node found.
- */
-static Evas_Object_Textblock_Node_Format *
-_evas_textblock_cursor_node_format_before_or_at_pos_get(const Efl_Canvas_Text_Cursor *cur)
-{
- Evas_Object_Textblock_Node_Format *node, *pitr = NULL;
- Evas_Object_Textblock_Node_Format *itr;
- size_t position = 0;
-
- TB_NULL_CHECK(cur->node, NULL);
-
- node = cur->node->format_node;
- if (!node) return NULL;
- /* If there is no exclusive format node to this paragraph return the
- * previous's node */
- if (node->text_node != cur->node)
- {
- return node;
- }
- else if (node->offset > cur->pos)
- {
- return _NODE_FORMAT(EINA_INLIST_GET(node)->prev);
- }
- /* Find the main format node */
- pitr = _NODE_FORMAT(EINA_INLIST_GET(node)->prev);
- EINA_INLIST_FOREACH(node, itr)
- {
- if ((itr->text_node != cur->node) ||
- ((position + itr->offset) > cur->pos))
- {
- return pitr;
- }
- else if ((position + itr->offset) == cur->pos)
- {
- return itr;
- }
- pitr = itr;
- position += itr->offset;
- }
- return pitr;
-}
-
-static inline void
-_cursor_update_offset(Efl_Canvas_Text_Cursor *cur, Efl_Canvas_Text_Data *o,
- const Evas_Object_Textblock_Node_Text *n, size_t start, int offset)
-{
- if ((n == cur->node) &&
- (cur->pos > start))
- {
- if ((offset < 0) && (cur->pos <= (size_t) (-1 * offset)))
- {
- cur->pos = 0;
- }
- else
- {
- cur->pos += offset;
- }
- cur->changed = EINA_TRUE;
- }
- else if (!cur->node)
- {
- cur->node = o->text_nodes;
- cur->pos = 0;
- cur->changed = EINA_TRUE;
- }
-}
-
-/**
- * @internal
- * Update the offset of all the cursors after cur.
- *
- * @param cur the cursor.
- * @param n the current textblock node.
- * @param start the starting pos.
- * @param offset how much to adjust (can be negative).
- */
-static void
-_evas_textblock_cursors_update_offset(const Efl_Canvas_Text_Cursor *cur,
- const Evas_Object_Textblock_Node_Text *n,
- size_t start, int offset)
-{
- Eina_List *l;
- Efl_Canvas_Text_Cursor *ocur_obj;
- Efl_Canvas_Text_Cursor *ocur;
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
- ocur = o->cursor;
- if (cur != ocur)
- {
- _cursor_update_offset(ocur, o, n, start, offset);
- }
-
- EINA_LIST_FOREACH(o->cursors, l, ocur_obj)
- {
- ocur = ocur_obj;
- if (ocur != cur)
- {
- _cursor_update_offset(ocur, o, n, start, offset);
- }
- }
-}
-
-static int
-_evas_textblock_cursor_text_append(Efl_Canvas_Text_Cursor *cur, const char *_text)
-{
- Evas_Object_Textblock_Node_Text *n;
- Evas_Object_Textblock_Node_Format *fnode = NULL;
- Eina_Unicode *text;
- Efl_Canvas_Text_Cursor *main_cur;
- int len = 0;
-
- if (!cur) return 0;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- text = eina_unicode_utf8_to_unicode(_text, &len);
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
-
- n = cur->node;
- if (n)
- {
- Evas_Object_Textblock_Node_Format *nnode;
- fnode = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur);
- fnode = _evas_textblock_node_format_last_at_off(fnode);
- /* find the node after the current in the same paragraph
- * either we find one and then take the next, or we try to get
- * the first for the paragraph which must be after our position */
- if (fnode)
- {
- if (!_evas_textblock_cursor_format_is_visible_get(cur))
- {
- nnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next);
- if (nnode && (nnode->text_node == n))
- {
- fnode = nnode;
- }
- else
- {
- fnode = NULL;
- }
- }
- }
- else
- {
- fnode = n->format_node;
- }
- }
- else if (o->text_nodes)
- {
- n = cur->node = o->text_nodes;
- cur->pos = 0;
- cur->changed = EINA_TRUE;
- }
- else
- {
- n = _evas_textblock_node_text_new();
- o->text_nodes = _NODE_TEXT(eina_inlist_append(
- EINA_INLIST_GET(o->text_nodes),
- EINA_INLIST_GET(n)));
- cur->node = n;
- cur->changed = EINA_TRUE;
- }
-
- eina_ustrbuf_insert_length(n->unicode, text, len, cur->pos);
- /* Advance the formats */
- if (fnode && (fnode->text_node == cur->node))
- fnode->offset += len;
-
- /* Update all the cursors after our position. */
- _evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, len);
-
- _evas_textblock_changed(o, cur->obj);
- n->dirty = EINA_TRUE;
- free(text);
-
- main_cur = o->cursor;
- if (!main_cur->node)
- main_cur->node = o->text_nodes;
- return len;
-}
-
-static int
-_evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor *cur, const char *_text)
-{
- int len;
- /*append is essentially prepend without advancing */
- if (!cur) return 0;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- len = _evas_textblock_cursor_text_append(cur, _text);
- if (len == 0) return 0;
- cur->pos += len; /*Advance */
- return len;
-}
-
-EAPI int
-evas_textblock_cursor_text_prepend(Efl_Canvas_Text_Cursor *cur, const char *_text)
-{
- return _evas_textblock_cursor_text_prepend(cur, _text);
-}
-
-static int
-_prepend_text_run2(Efl_Canvas_Text_Cursor *cur, const char *s, const char *p)
-{
- if ((s) && (p > s))
- {
- char *ts;
-
- ts = alloca(p - s + 1);
- strncpy(ts, s, p - s);
- ts[p - s] = 0;
- return _evas_textblock_cursor_text_prepend(cur, ts);
- }
- return 0;
-}
-
-static Eina_Bool
-_evas_textblock_cursor_format_append(Efl_Canvas_Text_Cursor *cur,
- const char *format, Evas_Object_Textblock_Node_Format **_fnode,
- Eina_Bool is_item)
-{
- Evas_Object_Textblock_Node_Format *n;
- Eina_Bool is_visible;
-
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- if ((!format) || (format[0] == 0)) return EINA_FALSE;
- Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS);
- /* We should always have at least one text node */
- if (!o->text_nodes)
- {
- _evas_textblock_cursor_text_prepend(cur, "");
- }
-
- n = _evas_textblock_node_format_new(o, format, is_item);
- is_visible = n->visible;
- format = n->format;
- if (!cur->node)
- {
- o->format_nodes = _NODE_FORMAT(eina_inlist_append(
- EINA_INLIST_GET(o->format_nodes),
- EINA_INLIST_GET(n)));
- 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->changed = EINA_TRUE;
- }
- else
- {
- Evas_Object_Textblock_Node_Format *fmt;
- fmt = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur);
- n->text_node = cur->node;
- if (!fmt)
- {
- o->format_nodes = _NODE_FORMAT(eina_inlist_prepend(
- EINA_INLIST_GET(o->format_nodes),
- EINA_INLIST_GET(n)));
- n->offset = cur->pos;
- }
- else
- {
- fmt = _evas_textblock_node_format_last_at_off(fmt);
- if (_evas_textblock_cursor_format_is_visible_get(cur))
- {
- o->format_nodes = _NODE_FORMAT(eina_inlist_prepend_relative(
- EINA_INLIST_GET(o->format_nodes),
- EINA_INLIST_GET(n),
- EINA_INLIST_GET(fmt)
- ));
- n->offset = fmt->offset;
- if (fmt->text_node->format_node == fmt)
- {
- fmt->text_node->format_node = n;
- }
- }
- else
- {
- o->format_nodes = _NODE_FORMAT(eina_inlist_append_relative(
- EINA_INLIST_GET(o->format_nodes),
- EINA_INLIST_GET(n),
- EINA_INLIST_GET(fmt)
- ));
- if (fmt->text_node != cur->node)
- {
- n->offset = cur->pos;
- }
- else
- {
- n->offset = cur->pos -
- _evas_textblock_node_format_pos_get(fmt);
- }
- }
- }
- /* Adjust differently if we insert a format char */
- if (is_visible)
- {
- _evas_textblock_node_format_adjust_offset(o, cur->node, n,
- -(n->offset - 1));
- }
- else
- {
- _evas_textblock_node_format_adjust_offset(o, cur->node, n,
- -n->offset);
- }
-
- if (!fmt || (fmt->text_node != cur->node))
- {
- cur->node->format_node = n;
- }
- }
- if (is_visible && cur->node)
- {
- Eina_Unicode insert_char;
- /* Insert a visual representation according to the type of the
- format */
- if (_IS_PARAGRAPH_SEPARATOR(o, format))
- insert_char = _PARAGRAPH_SEPARATOR;
- else if (_IS_LINE_SEPARATOR(format))
- insert_char = _NEWLINE;
- else if (_IS_TAB(format))
- insert_char = _TAB;
- else
- insert_char = _REPLACEMENT_CHAR;
-
- eina_ustrbuf_insert_char(cur->node->unicode, insert_char, cur->pos);
-
- /* Advance all the cursors after our cursor */
- _evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, 1);
- if (_IS_PARAGRAPH_SEPARATOR(o, format))
- {
- _evas_textblock_cursor_break_paragraph(cur, n, EINA_TRUE);
- }
- else
- {
- /* Handle visible format nodes here */
- cur->node->dirty = EINA_TRUE;
- n->is_new = EINA_FALSE;
- }
- }
- else
- {
- o->format_changed = EINA_TRUE;
- }
-
- _evas_textblock_changed(o, cur->obj);
-
- Efl_Canvas_Text_Cursor_Data *ocur = o->cursor;
- if (!ocur->node)
- ocur->node = o->text_nodes;
-
- if (_fnode) *_fnode = n;
- return is_visible;
-}
-
-EAPI Eina_Bool
-evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *format)
-{
- return _evas_textblock_cursor_format_append(cur, format, NULL, EINA_FALSE);
-}
-
-static Eina_Bool
-_evas_textblock_cursor_format_prepend(Efl_Canvas_Text_Cursor *cur, const char *format)
-{
- Eina_Bool is_visible;
-
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
- /* append is essentially prepend without advancing */
- is_visible = _evas_textblock_cursor_format_append(cur, format, NULL, EINA_FALSE);
- if (is_visible)
- {
- /* Advance after the replacement char */
- _evas_textblock_cursor_char_next(cur);
- }
-
- return is_visible;
-}
-
-EAPI Eina_Bool
-evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *format)
-{
- return _evas_textblock_cursor_format_prepend(cur, format);
-}
-
-static int
-_efl_canvas_text_cursor_text_append(Efl_Canvas_Text_Cursor *cur,
- const char *text)
-{
- if (!text) return 0;
-
- const char *off = text;
- int len = 0;
-
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
-
- while (*off)
- {
- char *format = NULL;
- int n = 1;
- if (!strncmp(_PARAGRAPH_SEPARATOR_UTF8, off,
- strlen(_PARAGRAPH_SEPARATOR_UTF8)))
- {
- format = "ps";
- n = strlen(_PARAGRAPH_SEPARATOR_UTF8);
- }
- else if (!strncmp(_NEWLINE_UTF8, off, strlen(_NEWLINE_UTF8)))
- {
- format = "br";
- n = strlen(_NEWLINE_UTF8);
- }
-
- if (format)
- {
- len += _prepend_text_run2(cur, text, off);
- if (_evas_textblock_cursor_format_prepend(cur, format))
- {
- len++;
- }
- text = off + n; /* sync text with next segment */
- }
- off += n;
- }
- len += _prepend_text_run2(cur, text, off);
- return len;
-}
-
EOLIAN static int
_efl_canvas_text_cursor_text_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED,
Efl_Canvas_Text_Cursor *cur, const char *_text)
@@ -17166,27 +15458,8 @@ _efl_canvas_text_cursor_content_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *p
return eina_ustrbuf_string_get(cur->node->unicode)[cur->pos];
}
-EAPI Eina_Bool
-evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur)
-{
- Eina_Bool ret = EINA_FALSE;
- Efl_Canvas_Text_Cursor_Data cur2;
- if (!cur) return EINA_FALSE;
- Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
- evas_object_async_block(obj);
-
- _evas_textblock_cursor_init(&cur2, cur->obj);
- _evas_textblock_cursor_copy(&cur2, cur);
- _evas_textblock_cursor_line_char_last(&cur2);
- if (cur2.pos == cur->pos)
- {
- ret = EINA_TRUE;
- }
- return ret;
-}
-
-EOLIAN static
-Eina_Bool _efl_canvas_text_cursor_geometry_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const Efl_Canvas_Text_Cursor *cur, Efl_Canvas_Text_Cursor_Type ctype, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2)
+EOLIAN static Eina_Bool
+_efl_canvas_text_cursor_geometry_get(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const Efl_Canvas_Text_Cursor *cur, Efl_Canvas_Text_Cursor_Type ctype, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2)
{
if (!cur) return EINA_FALSE;
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
@@ -17369,5 +15642,4 @@ Eina_Bool _efl_canvas_text_cursor_geometry_get(Eo *eo_obj EINA_UNUSED, Efl_Canva
return EINA_FALSE;
}
-#endif
#include "canvas/efl_canvas_text.eo.c"
diff --git a/src/lib/evas/canvas/evas_textblock_legacy.h b/src/lib/evas/canvas/evas_textblock_legacy.h
index d03e9ee79d..5fa755f1f3 100644
--- a/src/lib/evas/canvas/evas_textblock_legacy.h
+++ b/src/lib/evas/canvas/evas_textblock_legacy.h
@@ -908,6 +908,13 @@ EAPI void evas_object_textblock_valign_set(Evas_Object *obj, double align);
*/
EAPI double evas_object_textblock_valign_get(const Evas_Object *obj);
+EAPI void evas_textblock_cursor_paragraph_first(Efl_Canvas_Text_Cursor *cur);
+
+EAPI void evas_textblock_cursor_paragraph_last(Efl_Canvas_Text_Cursor *cur);
+
+EAPI int evas_textblock_cursor_compare(const Efl_Canvas_Text_Cursor *cur1, const Efl_Canvas_Text_Cursor *cur2);
+
+EAPI void evas_textblock_cursor_line_char_first(Efl_Canvas_Text_Cursor *cur);
//#include "canvas/efl_canvas_text_cursor.eo.legacy.h"
#include "canvas/efl_canvas_text.eo.legacy.h"
/**