Canvas text cursor: move to Efl.Canvas.Text namespace

Originally it was its own object.
There are some valid claims that there is no justification for it to
remain an object.
Furthermore, it's apparent that it added little benefit: changes of
each cursors, in practice, triggered a query for all objects of the
same textblock. There wasn't real advantage to have a finer resolution
of controlling the cursors with their own events.

This ports back a lot of code, and changes a lot of other code in the
higher-up widgets, such as Efl.Ui.Text and co.

The usage was replaces from:
  efl_canvas_text_cursor_char_next(cur_obj)
to
  efl_canvas_text_cursor_char_next(text_obj, cur_obj)
that is, it is an operations on the TEXT OBJECT, rather than on the
(now removed) cursor object.

So, one less efl object to worry about now.
Hopefully, the port went smooth.
This commit is contained in:
Daniel Hirt 2017-06-05 14:52:10 +03:00
parent 716cc6be5b
commit 49b838c448
15 changed files with 809 additions and 854 deletions

View File

@ -116,9 +116,9 @@ elm_public_eolian_files = \
lib/elementary/elm_fileselector_internal_part.eo \
lib/elementary/elm_multibuttonentry_internal_part.eo \
lib/elementary/elm_code_widget.eo \
lib/elementary/efl_ui_text_interactive.eo \
lib/elementary/efl_ui_text.eo \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_ui_text_interactive.eo \
lib/elementary/efl_ui_text.eo \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_config_global.eo \
lib/elementary/efl_ui_clock.eo \
lib/elementary/efl_ui_image_factory.eo \
@ -131,7 +131,7 @@ elm_public_eolian_files = \
# Private classes (not exposed or shipped)
elm_private_eolian_files = \
lib/elementary/efl_ui_internal_text_interactive.eo \
lib/elementary/efl_ui_internal_text_interactive.eo \
lib/elementary/efl_ui_win_internal_part.eo \
tests/elementary/focus_test.eo \
tests/elementary/focus_test_sub_main.eo \
@ -587,8 +587,8 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/elm_diskselector.c \
lib/elementary/elm_entry.c \
lib/elementary/efl_ui_flip.c \
lib/elementary/efl_ui_internal_text_interactive.c \
lib/elementary/efl_ui_internal_text_interactive.h \
lib/elementary/efl_ui_internal_text_interactive.c \
lib/elementary/efl_ui_internal_text_interactive.h \
lib/elementary/elm_flipselector.c \
lib/elementary/elm_font.c \
lib/elementary/efl_ui_frame.c \
@ -797,7 +797,6 @@ bin/elementary/test_genlist.c \
bin/elementary/test_gesture_layer.c \
bin/elementary/test_gesture_layer2.c \
bin/elementary/test_gesture_layer3.c \
bin/elementary/test_gfx_filters.c \
bin/elementary/test_glview_simple.c \
bin/elementary/test_glview.c \
bin/elementary/test_glview_manygears.c \
@ -860,7 +859,6 @@ bin/elementary/test_win_socket.c \
bin/elementary/test_win_plug.c \
bin/elementary/test_win_state.c \
bin/elementary/test_win_wm_rotation.c \
bin/elementary/test_win_dialog.c \
bin/elementary/test_win_modal.c \
bin/elementary/test_efl_ui_text.c \
bin/elementary/test_win_stack.c \

View File

@ -7,7 +7,6 @@ evas_eolian_pub_files = \
lib/evas/canvas/efl_canvas_polygon.eo \
lib/evas/canvas/efl_canvas_rectangle.eo \
lib/evas/canvas/efl_canvas_text.eo \
lib/evas/canvas/efl_canvas_text_cursor.eo \
lib/evas/canvas/efl_canvas_group.eo \
lib/evas/canvas/evas_canvas.eo \
lib/evas/canvas/efl_canvas_image_internal.eo \

View File

@ -292,7 +292,7 @@ void test_dnd_genlist_gengrid(void *data, Evas_Object *obj, void *event_info);
void test_dnd_multi_features(void *data, Evas_Object *obj, void *event_info);
void test_dnd_types(void *data, Evas_Object *obj, void *event_info);
void test_task_switcher(void *data, Evas_Object *obj, void *event_info);
void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
//void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
void test_win_modal(void *data, Evas_Object *obj, void *event_info);
void test_box_disable(void *data, Evas_Object *obj, void *event_info);
void test_layout_disable(void *data, Evas_Object *obj, void *event_info);
@ -310,7 +310,7 @@ void test_code_diff_inline(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_text(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_text_label(void *data, Evas_Object *obj, void *event_info);
void test_evas_mask(void *data, Edje_Object *obj, void *event_info);
void test_gfx_filters(void *data, Evas_Object *obj, void *event_info);
//void test_gfx_filters(void *data, Evas_Object *obj, void *event_info);
void test_evas_snapshot(void *data, Evas_Object *obj, void *event_info);
void test_evas_map(void *data, Edje_Object *obj, void *event_info);
void test_efl_gfx_map(void *data, Edje_Object *obj, void *event_info);
@ -667,7 +667,7 @@ add_tests:
ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket);
ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug);
ADD_TEST(NULL, "Window / Background", "Window WM Rotation", test_win_wm_rotation);
ADD_TEST(NULL, "Window / Background", "Window Standard/Dialog", test_win_dialog);
// ADD_TEST(NULL, "Window / Background", "Window Standard/Dialog", test_win_dialog);
ADD_TEST(NULL, "Window / Background", "Window Keygrab Set", test_win_keygrab);
ADD_TEST(NULL, "Window / Background", "Window Modal", test_win_modal);
ADD_TEST(NULL, "Window / Background", "Window Stack", test_win_stack);
@ -1032,7 +1032,7 @@ add_tests:
//------------------------------//
ADD_TEST(NULL, "Evas", "Masking", test_evas_mask);
ADD_TEST(NULL, "Evas", "Gfx Filters", test_gfx_filters);
// ADD_TEST(NULL, "Evas", "Gfx Filters", test_gfx_filters);
ADD_TEST(NULL, "Evas", "Snapshot", test_evas_snapshot);
ADD_TEST(NULL, "Evas", "Map", test_evas_map);
ADD_TEST(NULL, "Evas", "Gfx Map", test_efl_gfx_map);

View File

@ -12,10 +12,10 @@ _apply_style(Eo *obj, size_t start_pos, size_t end_pos, const char *style)
Efl_Canvas_Text_Cursor *start, *end;
start = efl_canvas_text_cursor_get(obj);
end = efl_ui_text_cursor_new(obj);
end = efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_position_set(start, start_pos);
efl_canvas_text_cursor_position_set(end, end_pos);
efl_canvas_text_cursor_position_set(obj, start, start_pos);
efl_canvas_text_cursor_position_set(obj, end, end_pos);
efl_canvas_text_annotation_insert(obj, start, end, style);
}
@ -95,14 +95,14 @@ my_efl_ui_text_anchor_hover_opened(void *data EINA_UNUSED, const Efl_Event *even
static void
my_efl_ui_text_bt_3(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *sel_start, *sel_end;
Efl_Canvas_Text_Cursor *sel_start, *sel_end;
efl_ui_text_interactive_selection_cursors_get(data, &sel_start, &sel_end);
const char *s = efl_canvas_text_range_text_get(data, sel_start, sel_end);
printf("SELECTION REGION: %d - %d\n",
efl_canvas_text_cursor_position_get(sel_start),
efl_canvas_text_cursor_position_get(sel_end));
efl_canvas_text_cursor_position_get(obj, sel_start),
efl_canvas_text_cursor_position_get(obj, sel_end));
printf("SELECTION:\n");
if (s) printf("%s\n", s);
}
@ -111,7 +111,7 @@ static void
my_efl_ui_text_bt_4(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *en = data;
efl_canvas_text_cursor_object_item_insert(efl_canvas_text_cursor_get(en),
efl_canvas_text_cursor_object_item_insert(obj, efl_canvas_text_cursor_get(en),
"size=32x32 href=emoticon");
}
@ -179,15 +179,15 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
efl_text_style_normal_color_set(en, 255, 255, 255, 255);
main_cur = efl_canvas_text_cursor_get(en);
cur = efl_ui_text_cursor_new(en);
cur = efl_canvas_text_cursor_new(en);
efl_canvas_text_cursor_position_set(cur, 2);
efl_canvas_text_cursor_object_item_insert(cur, "size=32x32 href=emoticon");
efl_canvas_text_cursor_position_set(cur, 50);
efl_canvas_text_cursor_object_item_insert(cur, "size=32x32 href=emoticon");
efl_canvas_text_cursor_position_set(en, cur, 2);
efl_canvas_text_cursor_object_item_insert(en, cur, "size=32x32 href=emoticon");
efl_canvas_text_cursor_position_set(en, cur, 50);
efl_canvas_text_cursor_object_item_insert(en, cur, "size=32x32 href=emoticon");
efl_canvas_text_cursor_position_set(main_cur, 5);
efl_canvas_text_cursor_position_set(cur, 20);
efl_canvas_text_cursor_position_set(en, main_cur, 5);
efl_canvas_text_cursor_position_set(en, cur, 20);
efl_canvas_text_annotation_insert(en, main_cur, cur, "a href=#hello");

View File

@ -8,3 +8,4 @@ enum Efl.Text.Bidirectional_Type {
}
struct Efl.Canvas.Text.Annotation; [[EFL text annotations data structure]]
struct Efl.Canvas.Text.Cursor; [[Text cursor data structure]]

View File

@ -39,7 +39,7 @@ static void _sel_enable(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EIN
static void _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en);
static void _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en);
static const char *_entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, Efl_Ui_Internal_Text_Interactive_Data *en);
static void _entry_imf_cursor_info_set(Evas_Textblock_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en);
static void _entry_imf_cursor_info_set(Eo *obj, Evas_Textblock_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en);
#ifdef HAVE_ECORE_IMF
static void
@ -61,11 +61,11 @@ _preedit_clear(Efl_Ui_Internal_Text_Interactive_Data *en)
}
static void
_preedit_del(Efl_Ui_Internal_Text_Interactive_Data *en)
_preedit_del(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
{
if (!en || !en->have_preedit) return;
if (!en->preedit_start || !en->preedit_end) return;
if (efl_canvas_text_cursor_equal(en->preedit_start, en->preedit_end)) return;
if (efl_canvas_text_cursor_equal(obj, en->preedit_start, en->preedit_end)) return;
/* delete the preedit characters */
evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
@ -118,7 +118,7 @@ _entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void
}
/* delete preedit characters */
_preedit_del(en);
_preedit_del(obj, en);
_preedit_clear(en);
// Skipping commit process when it is useless
@ -213,7 +213,7 @@ _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUS
_sel_range_del_emit(obj, en);
/* delete preedit characters */
_preedit_del(en);
_preedit_del(obj, en);
preedit_start_pos = evas_textblock_cursor_pos_get(cur);
@ -314,7 +314,7 @@ _entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUS
evas_textblock_cursor_pos_set(cur, preedit_start_pos + cursor_pos);
}
_entry_imf_cursor_info_set(cur, en);
_entry_imf_cursor_info_set(obj, cur, en);
/* delete attribute list */
if (attrs)
@ -362,7 +362,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U
evas_textblock_cursor_range_delete(del_start, del_end);
_entry_imf_cursor_info_set(cur, en);
_entry_imf_cursor_info_set(obj, cur, en);
end:
evas_textblock_cursor_free(del_start);
@ -379,7 +379,7 @@ _entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED
if (ev->start == ev->end)
{
efl_canvas_text_cursor_position_set(cur, ev->start);
efl_canvas_text_cursor_position_set(obj, cur, ev->start);
}
else
{
@ -415,13 +415,13 @@ _entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED,
#endif
static void
_entry_imf_cursor_location_set(Efl_Canvas_Text_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en)
_entry_imf_cursor_location_set(Eo *obj, Efl_Canvas_Text_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en)
{
#ifdef HAVE_ECORE_IMF
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
if (!en->imf_context) return;
efl_canvas_text_cursor_geometry_get(cur, EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE, &cx, &cy, &cw, &ch, NULL, NULL, NULL, NULL);
efl_canvas_text_cursor_geometry_get(obj, cur, EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE, &cx, &cy, &cw, &ch, NULL, NULL, NULL, NULL);
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
// FIXME: ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir);
#else
@ -430,7 +430,7 @@ _entry_imf_cursor_location_set(Efl_Canvas_Text_Cursor *cur, Efl_Ui_Internal_Text
}
static void
_entry_imf_cursor_info_set(Evas_Textblock_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en)
_entry_imf_cursor_info_set(Eo *obj, Evas_Textblock_Cursor *cur, Efl_Ui_Internal_Text_Interactive_Data *en)
{
int cursor_pos;
@ -449,7 +449,7 @@ _entry_imf_cursor_info_set(Evas_Textblock_Cursor *cur, Efl_Ui_Internal_Text_Inte
ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos);
_entry_imf_cursor_location_set(cur, en);
_entry_imf_cursor_location_set(obj, cur, en);
#else
(void)en;
#endif
@ -466,7 +466,7 @@ _focus_in_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
cur = efl_canvas_text_cursor_get(obj);
ecore_imf_context_focus_in(en->imf_context);
_entry_imf_cursor_info_set(cur, en);
_entry_imf_cursor_info_set(obj, cur, en);
#endif
}
@ -506,7 +506,7 @@ _entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, Efl_Ui_Internal_Text
static void
_sel_cursor_changed(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Canvas_Text_Cursor *obj = data;
Eo *obj = data;
efl_event_callback_legacy_call(obj, EFL_UI_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, NULL);
}
@ -550,11 +550,11 @@ _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Inter
{
if (!en->sel_end) return;
_sel_enable(c, o, en);
if (efl_canvas_text_cursor_equal(c, en->sel_end)) return;
if (efl_canvas_text_cursor_equal(o, c, en->sel_end)) return;
evas_textblock_cursor_copy(c, en->sel_end);
_entry_imf_cursor_info_set(c, en);
_entry_imf_cursor_info_set(o, c, en);
if (en->selection)
{
@ -576,7 +576,7 @@ _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en
{
en->have_selection = EINA_FALSE;
efl_canvas_text_cursor_copy(en->sel_start, en->sel_end);
efl_canvas_text_cursor_copy(o, en->sel_start, en->sel_end);
}
}
@ -614,11 +614,11 @@ _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
}
static void
_delete_emit(Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos)
_delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos)
{
Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 };
Eina_Unicode content[2];
content[0] = efl_canvas_text_cursor_content_get(c);
content[0] = efl_canvas_text_cursor_content_get(obj, c);
content[1] = 0;
if (!content[0])
return;
@ -630,7 +630,7 @@ _delete_emit(Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en
info.length = 1;
info.content = tmp;
efl_event_callback_legacy_call((Eo *) efl_canvas_text_cursor_text_object_get(c),
efl_event_callback_legacy_call(obj,
EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
if (tmp) free(tmp);
@ -770,7 +770,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
efl_canvas_text_cursor_line_jump_by(cur, -1);
efl_canvas_text_cursor_line_jump_by(obj, cur, -1);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
@ -784,7 +784,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
_key_down_sel_pre(obj, cur, en, shift, EINA_TRUE);
efl_canvas_text_cursor_line_jump_by(cur, 1);
efl_canvas_text_cursor_line_jump_by(obj, cur, 1);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
@ -796,12 +796,12 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_compose_seq_reset(en);
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
efl_canvas_text_cursor_char_prev(cur);
efl_canvas_text_cursor_char_prev(obj, cur);
#if defined(__APPLE__) && defined(__MACH__)
if (altgr) efl_canvas_text_cursor_word_start(cur);
#else
/* If control is pressed, go to the start of the word */
if (control) efl_canvas_text_cursor_word_start(cur);
if (control) efl_canvas_text_cursor_word_start(obj, cur);
#endif
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@ -817,9 +817,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
if (altgr) efl_canvas_text_cursor_word_end(cur);
#else
/* If control is pressed, go to the end of the word */
if (control) efl_canvas_text_cursor_word_end(cur);
if (control) efl_canvas_text_cursor_word_end(obj, cur);
#endif
efl_canvas_text_cursor_char_next(cur);
efl_canvas_text_cursor_char_next(obj, cur);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
@ -832,13 +832,14 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
// del to start of previous word
Evas_Textblock_Cursor *tc = evas_object_textblock_cursor_new(obj);
efl_canvas_text_cursor_copy(tc, cur);
efl_canvas_text_cursor_copy(obj, tc, cur);
evas_textblock_cursor_char_prev(cur);
evas_textblock_cursor_word_start(cur);
_range_del_emit(obj, cur, tc);
efl_del(tc);
//efl_del(tc);
efl_canvas_text_cursor_free(obj, tc);
}
else if ((alt) && (shift))
{
@ -854,7 +855,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
if (evas_textblock_cursor_char_prev(cur))
{
_delete_emit(cur, en, old_cur_pos - 1);
_delete_emit(obj, cur, en, old_cur_pos - 1);
}
}
}
@ -870,13 +871,14 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
// del to end of next word
Evas_Textblock_Cursor *tc = evas_object_textblock_cursor_new(obj);
efl_canvas_text_cursor_copy(tc, cur);
efl_canvas_text_cursor_copy(obj, tc, cur);
evas_textblock_cursor_word_end(cur);
evas_textblock_cursor_char_next(cur);
_range_del_emit(obj, cur, tc);
efl_del(tc);
//efl_del(tc);
efl_canvas_text_cursor_free(obj, tc);
}
else if (shift)
{
@ -890,7 +892,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
}
else
{
_delete_emit(cur, en, old_cur_pos);
_delete_emit(obj, cur, en, old_cur_pos);
}
}
_sel_clear(obj, en);
@ -904,9 +906,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
if ((control) && (multiline))
efl_canvas_text_cursor_paragraph_first(cur);
efl_canvas_text_cursor_paragraph_first(obj, cur);
else
efl_canvas_text_cursor_line_char_first(cur);
efl_canvas_text_cursor_line_char_first(obj, cur);
_key_down_sel_post(obj, cur, en, shift);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@ -919,9 +921,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_key_down_sel_pre(obj, cur, en, shift, EINA_TRUE);
if ((control) && (multiline))
efl_canvas_text_cursor_paragraph_last(cur);
efl_canvas_text_cursor_paragraph_last(obj, cur);
else
efl_canvas_text_cursor_line_char_last(cur);
efl_canvas_text_cursor_line_char_last(obj, cur);
_key_down_sel_post(obj, cur, en, shift);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@ -946,7 +948,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_compose_seq_reset(en);
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
efl_canvas_text_cursor_line_jump_by(cur, -10);
efl_canvas_text_cursor_line_jump_by(obj, cur, -10);
_key_down_sel_post(obj, cur, en, shift);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@ -957,7 +959,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_compose_seq_reset(en);
_key_down_sel_pre(obj, cur, en, shift, EINA_TRUE);
efl_canvas_text_cursor_line_jump_by(cur, 10);
efl_canvas_text_cursor_line_jump_by(obj, cur, 10);
_key_down_sel_post(obj, cur, en, shift);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@ -1037,13 +1039,13 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
}
info.insert = EINA_TRUE;
info.content = string;
info.position = efl_canvas_text_cursor_position_get(cur);
info.position = efl_canvas_text_cursor_position_get(obj, cur);
info.length = eina_unicode_utf8_get_len(string);
efl_canvas_text_cursor_text_insert(obj, cur, string);
efl_event_callback_legacy_call(obj,
EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
efl_canvas_text_cursor_text_insert(cur, string);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (free_string) free(string);
@ -1231,7 +1233,7 @@ _mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
if (en->select_allow)
{
efl_canvas_text_cursor_copy(en->sel_end, cur);
efl_canvas_text_cursor_copy(obj, en->sel_end, cur);
}
if (en->selecting)
{
@ -1240,7 +1242,7 @@ _mouse_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
en->selecting = EINA_FALSE;
}
_entry_imf_cursor_info_set(cur, en);
_entry_imf_cursor_info_set(obj, cur, en);
}
static void
@ -1278,21 +1280,21 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo
if (multiline)
{
efl_canvas_text_cursor_coord_set(cur, cx, cy);
efl_canvas_text_cursor_coord_set(obj, cur, cx, cy);
}
else
{
Evas_Coord lx, ly, lw, lh;
evas_textblock_cursor_paragraph_first(cur);
evas_textblock_cursor_line_geometry_get(cur, &lx, &ly, &lw, &lh);
efl_canvas_text_cursor_coord_set(cur, cx, ly + (lh / 2));
efl_canvas_text_cursor_coord_set(obj, cur, cx, ly + (lh / 2));
}
if (en->select_allow)
{
_sel_extend(cur, obj, en);
if (!efl_canvas_text_cursor_equal(en->sel_start, en->sel_end))
if (!efl_canvas_text_cursor_equal(obj, en->sel_start, en->sel_end))
_sel_enable(cur, obj, en);
}
evas_textblock_cursor_free(tc);
@ -1320,9 +1322,9 @@ _efl_ui_internal_text_interactive_efl_object_finalize(Eo *obj, Efl_Ui_Internal_T
en->sel_start = evas_object_textblock_cursor_new(obj);
en->sel_end = evas_object_textblock_cursor_new(obj);
efl_event_callback_add(en->sel_start, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED,
efl_event_callback_add(obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED,
_sel_cursor_changed, obj);
efl_event_callback_add(en->sel_end, EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED,
efl_event_callback_add(obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED,
_sel_cursor_changed, obj);
en->input_panel_enable = EINA_TRUE;

View File

@ -76,7 +76,7 @@ struct _Efl_Ui_Text_Data
Elm_Input_Panel_Lang input_panel_lang;
Elm_Input_Panel_Return_Key_Type input_panel_return_key_type;
Elm_Input_Hints input_hints;
Eo *sel_handler_cursor;
Efl_Canvas_Text_Cursor *sel_handler_cursor;
void *input_panel_imdata;
int input_panel_imdata_len;
int input_panel_layout_variation;
@ -576,7 +576,7 @@ _update_selection_handler(Eo *obj)
evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL);
efl_canvas_text_cursor_geometry_get(sel_start,
efl_canvas_text_cursor_geometry_get(obj, sel_start,
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE,
&sx, &sy, NULL, &sh,
NULL, NULL, NULL, NULL);
@ -602,7 +602,7 @@ _update_selection_handler(Eo *obj)
sd->start_handler_shown = EINA_FALSE;
}
efl_canvas_text_cursor_geometry_get(sel_end,
efl_canvas_text_cursor_geometry_get(obj, sel_end,
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE,
&ex, &ey, NULL, &eh,
NULL, NULL, NULL, NULL);
@ -756,12 +756,12 @@ _selection_data_cb(void *data EINA_UNUSED,
{
Efl_Canvas_Text_Cursor *cur, *start, *end;
efl_ui_text_interactive_selection_cursors_get(obj, &start, &end);
if (!efl_canvas_text_cursor_equal(start, end))
if (!efl_canvas_text_cursor_equal(obj, start, end))
{
efl_canvas_text_range_delete(obj, start, end);
}
cur = efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_text_insert(cur, buf);
efl_canvas_text_cursor_text_insert(obj, cur, buf);
}
free(buf);
@ -1050,7 +1050,7 @@ _cursor_geometry_recalc(Evas_Object *obj)
Efl_Canvas_Text_Cursor *main_cur =
efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_geometry_get(main_cur,
efl_canvas_text_cursor_geometry_get(obj, main_cur,
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE,
&cx, &cy, &cw, &ch, NULL, NULL, NULL, NULL);
edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0);
@ -2770,7 +2770,7 @@ _selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler, Evas_Coo
EFL_UI_TEXT_DATA_GET(obj, sd);
evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL);
efl_canvas_text_cursor_geometry_get(
efl_canvas_text_cursor_geometry_get(obj,
efl_canvas_text_cursor_get(obj),
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE,
&cx, &cy, &cw, &ch,
@ -2814,8 +2814,8 @@ _start_handler_mouse_down_cb(void *data,
efl_ui_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
main_cur = efl_canvas_text_cursor_get(text_obj);
start_pos = efl_canvas_text_cursor_position_get(sel_start);
end_pos = efl_canvas_text_cursor_position_get(sel_end);
start_pos = efl_canvas_text_cursor_position_get(obj, sel_start);
end_pos = efl_canvas_text_cursor_position_get(obj, sel_end);
if (start_pos <= end_pos)
{
@ -2827,7 +2827,7 @@ _start_handler_mouse_down_cb(void *data,
pos = end_pos;
sd->sel_handler_cursor = sel_end;
}
efl_canvas_text_cursor_position_set(main_cur, pos);
efl_canvas_text_cursor_position_set(obj, main_cur, pos);
_selection_handlers_offset_calc(data, sd->start_handler, ev->canvas.x, ev->canvas.y);
}
@ -2868,11 +2868,11 @@ _start_handler_mouse_move_cb(void *data,
cy = ev->cur.canvas.y - sd->oy - ey;
if (cx <= 0) cx = 1;
efl_canvas_text_cursor_coord_set(sd->sel_handler_cursor, cx, cy);
pos = efl_canvas_text_cursor_position_get(sd->sel_handler_cursor);
efl_canvas_text_cursor_coord_set(obj, sd->sel_handler_cursor, cx, cy);
pos = efl_canvas_text_cursor_position_get(obj, sd->sel_handler_cursor);
/* Set the main cursor. */
efl_canvas_text_cursor_position_set(efl_canvas_text_cursor_get(data), pos);
efl_canvas_text_cursor_position_set(obj, efl_canvas_text_cursor_get(data), pos);
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
sd->long_pressed = EINA_FALSE;
@ -2900,8 +2900,8 @@ _end_handler_mouse_down_cb(void *data,
efl_ui_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
main_cur = efl_canvas_text_cursor_get(text_obj);
start_pos = efl_canvas_text_cursor_position_get(sel_start);
end_pos = efl_canvas_text_cursor_position_get(sel_end);
start_pos = efl_canvas_text_cursor_position_get(obj, sel_start);
end_pos = efl_canvas_text_cursor_position_get(obj, sel_end);
if (start_pos < end_pos)
{
@ -2914,7 +2914,7 @@ _end_handler_mouse_down_cb(void *data,
sd->sel_handler_cursor = sel_start;
}
efl_canvas_text_cursor_position_set(main_cur, pos);
efl_canvas_text_cursor_position_set(obj, main_cur, pos);
_selection_handlers_offset_calc(data, sd->end_handler, ev->canvas.x, ev->canvas.y);
}
@ -2955,10 +2955,10 @@ _end_handler_mouse_move_cb(void *data,
cy = ev->cur.canvas.y - sd->oy - ey;
if (cx <= 0) cx = 1;
efl_canvas_text_cursor_coord_set(sd->sel_handler_cursor, cx, cy);
pos = efl_canvas_text_cursor_position_get(sd->sel_handler_cursor);
efl_canvas_text_cursor_coord_set(obj, sd->sel_handler_cursor, cx, cy);
pos = efl_canvas_text_cursor_position_get(obj, sd->sel_handler_cursor);
/* Set the main cursor. */
efl_canvas_text_cursor_position_set(efl_canvas_text_cursor_get(data), pos);
efl_canvas_text_cursor_position_set(obj, efl_canvas_text_cursor_get(data), pos);
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
sd->long_pressed = EINA_FALSE;
if (_elm_config->magnifier_enable)
@ -3012,9 +3012,10 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv)
_efl_ui_text_changed_cb, obj);
efl_event_callback_add(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED,
_efl_ui_text_changed_cb, obj);
printf("ui: text_obj = %p\n", text_obj);
efl_event_callback_add(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
_efl_ui_text_selection_changed_cb, obj);
efl_event_callback_add(efl_canvas_text_cursor_get(text_obj), EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED,
efl_event_callback_add(text_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED,
_efl_ui_text_cursor_changed_cb, obj);
evas_object_event_callback_add(priv->entry_edje, EVAS_CALLBACK_MOVE,
_efl_ui_text_move_cb, obj);
@ -3255,7 +3256,7 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd)
_efl_ui_text_changed_cb, obj);
efl_event_callback_del(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
_efl_ui_text_selection_changed_cb, obj);
efl_event_callback_del(efl_canvas_text_cursor_get(text_obj), EFL_CANVAS_TEXT_CURSOR_EVENT_CHANGED,
efl_event_callback_del(text_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED,
_efl_ui_text_cursor_changed_cb, obj);
evas_object_event_callback_del_full(sd->entry_edje, EVAS_CALLBACK_MOVE,
_efl_ui_text_move_cb, obj);
@ -3446,7 +3447,7 @@ static void
_efl_ui_text_entry_insert(Eo *obj, Efl_Ui_Text_Data *sd, const char *entry)
{
Efl_Canvas_Text_Cursor *cur_obj = efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_text_insert(cur_obj, entry);
efl_canvas_text_cursor_text_insert(obj, cur_obj, entry);
sd->changed = EINA_TRUE;
elm_layout_sizing_eval(obj);
}
@ -3510,14 +3511,14 @@ _efl_ui_text_select_none(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
static void
_efl_ui_text_select_region_set(Eo *obj, Efl_Ui_Text_Data *sd, int start, int end)
{
Eo *sel_start, *sel_end;
Efl_Canvas_Text_Cursor *sel_start, *sel_end;
if ((sd->password)) return;
efl_ui_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
efl_canvas_text_cursor_position_set(sel_start, start);
efl_canvas_text_cursor_position_set(sel_end, end);
efl_canvas_text_cursor_position_set(obj, sel_start, start);
efl_canvas_text_cursor_position_set(obj, sel_end, end);
}
EOLIAN static void
@ -4211,13 +4212,13 @@ fail:
EOLIAN static int
_efl_ui_text_elm_interface_atspi_text_caret_offset_get(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED)
{
return efl_canvas_text_cursor_position_get(obj);
return efl_canvas_text_cursor_position_get(obj, efl_canvas_text_cursor_get(obj));
}
EOLIAN static Eina_Bool
_efl_ui_text_elm_interface_atspi_text_caret_offset_set(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int offset)
{
efl_canvas_text_cursor_position_set(obj, offset);
efl_canvas_text_cursor_position_set(obj, efl_canvas_text_cursor_get(obj), offset);
return EINA_TRUE;
}
@ -4489,16 +4490,16 @@ _efl_ui_text_elm_interface_atspi_text_default_attributes_get(Eo *obj, Efl_Ui_Tex
{
Eina_List *ret = NULL;
Elm_Atspi_Text_Attribute *attr;
Eo *start, *end;
Efl_Canvas_Text_Cursor *start, *end;
Eina_Iterator *annotations;
Efl_Canvas_Text_Annotation *an;
/* Retrieve all annotations in the text. */
start = efl_ui_text_cursor_new(obj);
end = efl_ui_text_cursor_new(obj);
start = efl_canvas_text_cursor_new(obj);
end = efl_canvas_text_cursor_new(obj);
efl_canvas_text_cursor_paragraph_first(start);
efl_canvas_text_cursor_paragraph_last(end);
efl_canvas_text_cursor_paragraph_first(obj, start);
efl_canvas_text_cursor_paragraph_last(obj, end);
annotations = efl_canvas_text_range_annotations_get(obj, start, end);
@ -4524,7 +4525,7 @@ EOLIAN static Eina_Bool
_efl_ui_text_elm_interface_atspi_text_editable_insert(Eo *obj, Efl_Ui_Text_Data *pd, const char *string, int position)
{
Efl_Canvas_Text_Cursor *cur_obj = efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_position_set(cur_obj, position);
efl_canvas_text_cursor_position_set(obj, cur_obj, position);
_efl_ui_text_entry_insert(obj, pd, string);
return EINA_TRUE;
@ -4574,7 +4575,7 @@ EOLIAN static Eina_Bool
_efl_ui_text_elm_interface_atspi_text_editable_paste(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int position)
{
Efl_Canvas_Text_Cursor *cur_obj = efl_canvas_text_cursor_get(obj);
efl_canvas_text_cursor_position_set(cur_obj, position);
efl_canvas_text_cursor_position_set(obj, cur_obj, position);
efl_ui_text_selection_paste(obj);
return EINA_TRUE;
}
@ -4610,11 +4611,10 @@ _efl_ui_text_elm_interface_atspi_accessible_name_get(Eo *obj, Efl_Ui_Text_Data *
}
EOLIAN static Efl_Canvas_Text_Cursor *
_efl_ui_text_cursor_new(Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED)
_efl_ui_text_cursor_new(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd EINA_UNUSED)
{
Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
return efl_add(EFL_CANVAS_TEXT_CURSOR_CLASS, (Eo *) obj,
efl_canvas_text_cursor_text_object_set(efl_added, text_obj));
return efl_canvas_text_cursor_new(text_obj);
}
static void
@ -4695,7 +4695,7 @@ _update_text_cursors(Eo *obj)
x = y = w = h = -1;
xx = yy = ww = hh = -1;
_decoration_calc_offset(sd, &x, &y);
bidi_cursor = efl_canvas_text_cursor_geometry_get(
bidi_cursor = efl_canvas_text_cursor_geometry_get(obj,
efl_canvas_text_cursor_get(text_obj),
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE, &xx, &yy, &ww, &hh, &xx2, &yy2,
NULL, NULL);
@ -4964,18 +4964,16 @@ _anchors_create(Eo *obj, Efl_Ui_Text_Data *sd)
Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
_anchors_clear_all(obj, sd);
start = efl_add(EFL_CANVAS_TEXT_CURSOR_CLASS, obj,
efl_canvas_text_cursor_text_object_set(efl_added, text_obj));
end = efl_add(EFL_CANVAS_TEXT_CURSOR_CLASS, obj,
efl_canvas_text_cursor_text_object_set(efl_added, text_obj));
start = efl_canvas_text_cursor_new(text_obj);
end = efl_canvas_text_cursor_new(text_obj);
/* Retrieve all annotations in the text. */
efl_canvas_text_cursor_paragraph_first(start);
efl_canvas_text_cursor_paragraph_last(end);
efl_canvas_text_cursor_paragraph_first(obj, start);
efl_canvas_text_cursor_paragraph_last(obj, end);
it = efl_canvas_text_range_annotations_get(obj, start, end);
efl_del(start);
efl_del(end);
efl_canvas_text_cursor_free(text_obj, start);
efl_canvas_text_cursor_free(text_obj, end);
EINA_ITERATOR_FOREACH(it, anchor)
{
@ -5113,12 +5111,12 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd)
else
{
Eina_Iterator *range;
Eo *start, *end;
Efl_Canvas_Text_Cursor *start, *end;
Eina_List *range_list;
Eina_Rectangle *r;
start = efl_ui_text_cursor_new(o);
end = efl_ui_text_cursor_new(o);
start = efl_canvas_text_cursor_new(o);
end = efl_canvas_text_cursor_new(o);
efl_canvas_text_annotation_positions_get(o, an->annotation,
start, end);
@ -5304,7 +5302,7 @@ static void
_efl_ui_text_selection_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Eo *obj = data;
Eo *start, *end;
Efl_Canvas_Text_Cursor *start, *end;
char *text;
EFL_UI_TEXT_DATA_GET(obj, sd);

View File

@ -393,7 +393,7 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
}
cursor_new {
[[Creates and returns a new cursor for the text.]]
return: Efl.Canvas.Text.Cursor; [[Text cursor]]
return: ptr(Efl.Canvas.Text.Cursor); [[Text cursor]]
}
}
implements {

View File

@ -1,3 +1,5 @@
import efl_text_types;
struct Efl.Ui.Text.Interactive.Change_Info {
[[This structure includes all the information about content changes.
@ -26,7 +28,7 @@ interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font,
@property selection_cursors {
[[The cursors used for selection handling.
If the cursors are equal (@Efl.Canvas.Text.Cursor.equal), there is
If the cursors are equal, there is
no selection.
You are allowed to retain and modify them. Modifying them modifies
@ -34,8 +36,8 @@ interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font,
]]
get {}
values {
start: Efl.Canvas.Text.Cursor; [[The start of the selection]]
end: Efl.Canvas.Text.Cursor; [[The end of the selection]]
start: ptr(Efl.Canvas.Text.Cursor); [[The start of the selection]]
end: ptr(Efl.Canvas.Text.Cursor); [[The end of the selection]]
}
}
@property editable {

View File

@ -26,7 +26,7 @@
*
* @{
*/
#include "canvas/efl_canvas_text_cursor.eo.h"
//#include "canvas/efl_canvas_text_cursor.eo.h"
#include "canvas/efl_canvas_text.eo.h"
/**
* @}

View File

@ -1,11 +1,60 @@
struct Efl.Canvas.Text.Style; [[EFL text style data structure]]
enum Efl.Canvas.Text.Cursor.Type
{
[[Text cursor types]]
before, [[Cursor type before]]
under [[Cursor type under]]
}
class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text, Efl.Text.Properties, Efl.Canvas.Filter.Internal,
Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
{
[[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
@ -83,15 +132,6 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
h: int; [[The height of the object.]]
}
}
@property cursor {
[[The object's main cursor.
@since 1.18
]]
get {
return: Efl.Canvas.Text.Cursor; [[Text cursor object]]
}
}
@property size_native {
[[The native width and height.
@ -118,33 +158,65 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
h: int; [[The height returned.]]
}
}
@property style_insets {
[[Gets the left, right, top and bottom insets of the text.
The inset is any applied padding on the text.
range_text_get {
[[Returns the text in the range between $cur1 and $cur2.
@since 1.18
]]
get {}
values {
l: int; [[Left padding]]
r: int; [[Right padding]]
t: int; [[Top padding]]
b: int; [[Bottom padding]]
legacy: null;
return: own(ptr(char)); [[The text in the given range]]
params {
@in cur1: const(ptr(Efl.Canvas.Text.Cursor)); [[Start of range]]
@in cur2: const(ptr(Efl.Canvas.Text.Cursor)); [[End of range]]
}
}
@property is_empty {
[[Whether the object is empty (no text) or not
range_geometry_get {
[[Get the geometry of a range in the text.
@since 1.18
The geometry is represented as rectangles for each of the line
segments in the given range [$cur1, $cur2].
@since 1.19
]]
get {
legacy: null;
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]]
}
values {
is_empty: bool; [[$true if empty, $false otherwise]]
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.
@ -185,6 +257,7 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
@since 1.18
]]
}
// Annotation
@property annotation {
[[A new format for $annotation.
@ -216,8 +289,8 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
]]
legacy: null;
params {
@in start: const(Efl.Canvas.Text.Cursor); [[Start of range]]
@in end: const(Efl.Canvas.Text.Cursor); [[End of range]]
@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]]
@ -232,8 +305,8 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
]]
legacy: null;
params {
@in start: Efl.Canvas.Text.Cursor; [[Start of range]]
@in end: Efl.Canvas.Text.Cursor; [[End of range]]
@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]]
@ -253,79 +326,6 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
}
return: bool; [[$true on success, $false otherwise.]]
}
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(Efl.Canvas.Text.Cursor); [[Start of range]]
@in cur2: const(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: const(Efl.Canvas.Text.Cursor); [[Start of range]]
@in cur2: 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: Efl.Canvas.Text.Cursor; [[Range start position]]
@in cur2: Efl.Canvas.Text.Cursor; [[Range end position]]
}
}
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: Efl.Canvas.Text.Cursor; [[Range start position]]
@in end: Efl.Canvas.Text.Cursor; [[Range end position]]
}
}
range_text_get {
[[Returns the text in the range between $cur1 and $cur2.
@since 1.18
]]
legacy: null;
return: own(ptr(char)); [[The text in the given range]]
params {
@in cur1: const(Efl.Canvas.Text.Cursor); [[Start of range]]
@in cur2: const(Efl.Canvas.Text.Cursor); [[End of range]]
}
}
object_item_geometry_get {
[[Queries a given object item for its geometry.
@ -355,12 +355,240 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
params {
@in annotation: ptr(const(Efl.Canvas.Text.Annotation)); [[Annotation
handle to query]]
@in start: Efl.Canvas.Text.Cursor; [[Cursor to be set to the start
@in start: ptr(Efl.Canvas.Text.Cursor); [[Cursor to be set to the start
position of the annotation in the text]]
@in end: Efl.Canvas.Text.Cursor; [[Cursor to be set to the end
@in end: ptr(Efl.Canvas.Text.Cursor); [[Cursor to be set to the end
position of the annotation in the text]]
}
}
// 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; }
values {
position: int;
}
keys {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
@property cursor_content {
[[The content of the cursor (the character under the cursor)]]
get {
legacy: null;
}
values {
content: Eina.Unicode; [[The unicode codepoint of the character]]
}
keys {
cur: ptr(const(Efl.Canvas.Text.Cursor));
}
}
@property cursor_geometry {
[[Returns the geometry of two cursors ("split cursor"), if logical cursor is
between LTR/RTL text, also considering paragraph direction.
Upper cursor is shown for the text of the same direction as paragraph,
lower cursor - for opposite.
Split cursor geometry is valid only in '|' cursor mode.
In this case $true is returned and $cx2, $cy2, $cw2, $ch2 are set.
]]
get {
legacy: null;
return: bool; [[ $true if split cursor, $false otherwise.]]
}
keys {
cur: ptr(const(Efl.Canvas.Text.Cursor));
ctype: Efl.Canvas.Text.Cursor.Type; [[The type of the cursor.]]
}
values {
cx: int; [[The x of the cursor (or upper cursor)]]
cy: int; [[The y of the cursor (or upper cursor)]]
cw: int; [[The width of the cursor (or upper cursor)]]
ch: int; [[The height of the cursor (or upper cursor)]]
cx2: int; [[The x of the lower cursor]]
cy2: int; [[The y of the lower cursor]]
cw2: int; [[The width of the lower cursor]]
ch2: int; [[The height of the lower cursor]]
}
}
@property cursor_object_item_annotation {
[[The object-item annotation at the cursor's position.]]
get {
legacy: null;
}
values {
annotation: ptr(Efl.Canvas.Text.Annotation); [[Annotation]]
}
keys {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_new {
legacy: null;
return: ptr(Efl.Canvas.Text.Cursor);
}
cursor_free {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_equal {
legacy: null;
params {
cur1: ptr(const(Efl.Canvas.Text.Cursor));
cur2: ptr(const(Efl.Canvas.Text.Cursor));
}
return: bool;
}
cursor_compare {
legacy: null;
params {
cur1: ptr(const(Efl.Canvas.Text.Cursor));
cur2: ptr(const(Efl.Canvas.Text.Cursor));
}
return: int;
}
cursor_copy {
legacy: null;
params {
dst: ptr(Efl.Canvas.Text.Cursor);
src: ptr(const(Efl.Canvas.Text.Cursor));
}
}
cursor_char_next {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_char_prev {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_char_first {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_char_last {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_word_start {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_word_end {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_line_char_first {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_line_char_last {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_first {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_last {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_next {
[[Advances to the start of the next text node]]
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_paragraph_prev {
[[Advances to the end of the previous text node]]
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
}
}
cursor_line_jump_by {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
by: int;
}
}
cursor_coord_set {
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
@in x: int; [[X coord to set by.]]
@in y: int; [[Y coord to set by.]]
}
}
cursor_text_insert {
[[Adds text to the current cursor position and set the cursor to
*after* the start of the text just added.
]]
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
@in text: string; [[Text to append (UTF-8 format).]]
}
return: int; [[Length of the appended text.]]
}
cursor_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.
This adds a placeholder to be queried by higher-level code,
which in turn place graphics on top of it. It essentially places an
OBJECT REPLACEMENT CHARACTER and set a special annotation to it.
]]
legacy: null;
params {
cur: ptr(Efl.Canvas.Text.Cursor);
@in format: string; [[Format of the inserted item.
See Format styles.]]
}
return: ptr(Efl.Canvas.Text.Annotation); [[The annotation handle of the
inserted item.]]
}
}
implements {
Efl.Object.constructor;
@ -411,7 +639,8 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
Efl.Text.Format.format_replacement_char { get; set; }
}
events {
changed; [[Called when the content (text or annotations) changed.]]
cursor,changed;
changed;
style_insets,changed; [[Called when the property @.style_insets changed.]]
}
}

View File

@ -1,216 +0,0 @@
enum Efl.Canvas.Text.Cursor.Type
{
[[Text cursor types]]
before, [[Cursor type before]]
under [[Cursor type under]]
}
class Efl.Canvas.Text.Cursor (Efl.Object)
{
[[Efl canvas text cursor class]]
legacy_prefix: evas_textblock_cursor;
methods {
@property text_object {
[[The text object the cursor is associated with.]]
set {
legacy: null;
}
get {
legacy: null;
}
values {
tb: const(Efl.Canvas.Object); [[The text object]] /* XXX: It should be textblock only. */
}
}
@property position {
[[Sets position of cursor to given pos. ]]
set {
legacy: evas_textblock_cursor_pos_set;
}
get {
legacy: evas_textblock_cursor_pos_get;
}
values {
position: int; [[Position in the text to move the cursor.]]
}
}
@property geometry {
[[Returns the geometry of two cursors ("split cursor"), if logical cursor is
between LTR/RTL text, also considering paragraph direction.
Upper cursor is shown for the text of the same direction as paragraph,
lower cursor - for opposite.
Split cursor geometry is valid only in '|' cursor mode.
In this case $true is returned and $cx2, $cy2, $cw2, $ch2 are set.
]]
get {
legacy: null;
return: bool; [[ $true if split cursor, $false otherwise.]]
}
keys {
ctype: Efl.Canvas.Text.Cursor.Type; [[The type of the cursor.]]
}
values {
cx: int; [[The x of the cursor (or upper cursor)]]
cy: int; [[The y of the cursor (or upper cursor)]]
cw: int; [[The width of the cursor (or upper cursor)]]
ch: int; [[The height of the cursor (or upper cursor)]]
cx2: int; [[The x of the lower cursor]]
cy2: int; [[The y of the lower cursor]]
cw2: int; [[The width of the lower cursor]]
ch2: int; [[The height of the lower cursor]]
}
}
copy {
[[Copies source cursor.]]
legacy: null;
params {
@in src: const(Efl.Canvas.Text.Cursor); [[Source cursor.]]
}
}
text_insert {
[[Adds text to the current cursor position and set the cursor to *after*
the start of the text just added.
]]
legacy: null;
params {
@in text: string; [[Text to append (UTF-8 format).]]
}
return: int; [[Length of the appended text.]]
}
char_prev {
[[Advances the cursor one char backwards.]]
legacy: null;
}
char_next {
[[Advances the cursor one char forward.]]
legacy: null;
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
paragraph_first {
[[Sets the cursor to the start of the first text node]]
}
paragraph_last {
[[Sets the cursor to the end of the last text node]]
}
paragraph_next {
[[Advances to the start of the next text node]]
legacy: null;
}
paragraph_prev {
[[Advances to the end of the previous text node]]
legacy: null;
}
paragraph_char_first {
[[Go to the first char in the node the cursor is pointing on.]]
}
paragraph_char_last {
[[Go to the last char in a text node.]]
}
word_start {
[[Moves the cursor to the start of the word under the cursor]]
legacy: null;
}
word_end {
[[Moves the cursor to the end of the word under the cursor]]
legacy: null;
}
line_char_first {
[[Go to the start of the current line]]
}
line_char_last {
[[Go to the end of the current line]]
}
line_jump_by {
[[Move the cursor $by lines up if negative, down if positive.
If jumping by $by means jumping outside of the textblock, move the
cursor before the first char of the textblock if jumping up, and
after the last if jumping down.
]]
legacy: null;
params {
by: int; [[How many lines to jump by. Negative values are also supported.]]
}
}
@property content {
[[The content of the cursor (the character under the cursor)]]
get {
legacy: null;
}
values {
content: Eina.Unicode; [[The unicode codepoint of the character]]
}
}
compare @const {
[[Compares two cursors.
Note that 0 will be returned if they are cursors of different
textblock objects.
See @.equal for a faster equality check.
]]
return: int; [[-1 if cur1 < cur2, 0 if cur1 == cur2, 1 otherwise.]]
params {
@in cur: const(Efl.Canvas.Text.Cursor); [[The second cursor.]]
}
}
equal @const {
[[Checks if two cursors are equal
This is faster than @.compare so it should be used if all we care
about is equality.
@since 1.18
]]
return: bool; [[$true if equal]]
params {
@in cur: const(Efl.Canvas.Text.Cursor); [[The second cursor.]]
}
}
coord_set {
[[Sets the position of the cursor according to the X and Y coordinates.]]
legacy: null;
params {
@in x: int; [[X coord to set by.]]
@in y: int; [[Y coord to set by.]]
}
}
@property object_item_annotation {
[[The object-item annotation at the cursor's position.]]
get {
legacy: null;
}
values {
annotation: ptr(Efl.Canvas.Text.Annotation); [[Annotation]]
}
}
object_item_insert {
[[Inserts a object item at specified position.
This adds a placeholder to be queried by higher-level code,
which in turn place graphics on top of it. It essentially places an
OBJECT REPLACEMENT CHARACTER and set a special annotation to it.
]]
legacy: null;
params {
@in format: string; [[Format of the inserted item.
See Format styles.]]
}
return: ptr(Efl.Canvas.Text.Annotation); [[The annotation handle of the
inserted item.]]
}
}
implements {
Efl.Object.destructor;
Efl.Object.finalize;
}
events {
changed; [[The cursor position has changed]]
}
constructors {
Efl.Canvas.Text.Cursor.text_object;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -146,7 +146,7 @@ typedef struct _Efl_Canvas_Text_Style Evas_Textblock_Style;
* @see evas_object_textblock_cursor_new
*
*/
typedef Eo Evas_Textblock_Cursor;
typedef struct _Efl_Canvas_Text_Cursor Evas_Textblock_Cursor;
/**
* @typedef Evas_Object_Textblock_Node_Format
@ -841,7 +841,7 @@ EAPI void evas_textblock_cursor_copy(const E
* @param obj The textblock to which the new cursor will associate.
* @return Returns a new cursor associated with the given textblock object.
*/
EAPI Evas_Textblock_Cursor *evas_object_textblock_cursor_new(const Evas_Object *obj);
EAPI Evas_Textblock_Cursor *evas_object_textblock_cursor_new(Evas_Object *obj);
/**
* @brief Sets the position of the cursor according to the X and Y coordinates.
@ -908,7 +908,24 @@ EAPI void evas_object_textblock_valign_set(Evas_Object *obj, double align);
*/
EAPI double evas_object_textblock_valign_get(const Evas_Object *obj);
#include "canvas/efl_canvas_text_cursor.eo.legacy.h"
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);
EAPI void evas_textblock_cursor_line_char_last(Efl_Canvas_Text_Cursor *cur);
EAPI void evas_textblock_cursor_pos_set(Efl_Canvas_Text_Cursor *cur, int _pos);
EAPI void evas_textblock_cursor_paragraph_char_first(Efl_Canvas_Text_Cursor *cur);
EAPI void evas_textblock_cursor_paragraph_char_last(Efl_Canvas_Text_Cursor *cur);
EAPI void evas_textblock_cursor_char_delete(Efl_Canvas_Text_Cursor *cur);
//#include "canvas/efl_canvas_text_cursor.eo.legacy.h"
#include "canvas/efl_canvas_text.eo.legacy.h"
/**
* @}

View File

@ -4157,7 +4157,7 @@ _test_check_annotation(Evas_Object *tb,
size_t len, const char **formats)
{
Efl_Canvas_Text_Annotation *an;
Eo *start, *end;
Efl_Canvas_Text_Cursor *start, *end;
start = evas_object_textblock_cursor_new(tb);
end = evas_object_textblock_cursor_new(tb);
@ -4197,7 +4197,7 @@ START_TEST(evas_textblock_annotation)
{
START_TB_TEST();
Efl_Canvas_Text_Annotation *an, *an2;
Eo *start, *end;
Efl_Canvas_Text_Cursor *start, *end;
start = evas_object_textblock_cursor_new(tb);
end = evas_object_textblock_cursor_new(tb);
@ -4318,12 +4318,12 @@ START_TEST(evas_textblock_annotation)
/* Check "item" annotations */
efl_text_set(tb, "abcd");
evas_textblock_cursor_pos_set(cur, 4);
an = efl_canvas_text_cursor_object_item_insert(cur, "size=16x16");
an = efl_canvas_text_cursor_object_item_insert(tb, cur, "size=16x16");
_test_check_annotation(tb, 4, 4, _COMP_PARAMS("size=16x16"));
/* Check that format is not extended if it's an "object item" */
evas_textblock_cursor_pos_set(cur, 5);
efl_canvas_text_cursor_text_insert(cur, "a");
efl_canvas_text_cursor_text_insert(tb, cur, "a");
_test_check_annotation(tb, 5, 7, _COMP_PARAMS());
_test_check_annotation(tb, 0, 3, _COMP_PARAMS());
@ -4346,7 +4346,7 @@ START_TEST(evas_textblock_annotation)
_test_check_annotation(tb, 3, 3, _COMP_PARAMS("color=#fff"));
/* Old API */
evas_textblock_cursor_pos_set(cur, 5);
efl_canvas_text_cursor_text_insert(cur, "a");
efl_canvas_text_cursor_text_insert(tb, cur, "a");
_test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
_test_check_annotation(tb, 5, 5, _COMP_PARAMS());
@ -4358,18 +4358,18 @@ START_TEST(evas_textblock_annotation)
_test_check_annotation(tb, 4, 4, _COMP_PARAMS("color=#fff"));
evas_textblock_cursor_pos_set(cur, 4);
/* Cursor position is now: hello|\nworld */
efl_canvas_text_cursor_text_insert(cur, "a");
efl_canvas_text_cursor_text_insert(tb, cur, "a");
_test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
_test_check_annotation(tb, 5, 5, _COMP_PARAMS("color=#fff"));
/* Test getting of object item */
evas_textblock_cursor_pos_set(cur, 4);
an = efl_canvas_text_cursor_object_item_annotation_get(cur);
an = efl_canvas_text_cursor_object_item_annotation_get(tb, cur);
ck_assert(!an);
an = efl_canvas_text_cursor_object_item_insert(cur, "size=16x16");
an = efl_canvas_text_cursor_object_item_insert(tb, cur, "size=16x16");
evas_textblock_cursor_pos_set(cur, 4);
an = efl_canvas_text_cursor_object_item_annotation_get(cur);
an = efl_canvas_text_cursor_object_item_annotation_get(tb, cur);
ck_assert(an);
ck_assert_str_eq("size=16x16", efl_canvas_text_annotation_get(tb, an));
@ -4395,7 +4395,7 @@ START_TEST(efl_canvas_text_cursor)
/* Logical cursor after "test " */
evas_textblock_cursor_pos_set(cur, 6);
fail_if(!efl_canvas_text_cursor_geometry_get(cur,
fail_if(!efl_canvas_text_cursor_geometry_get(tb, cur,
EFL_CANVAS_TEXT_CURSOR_TYPE_BEFORE, &cx, NULL, NULL, NULL, &cx2,
NULL, NULL, NULL));
evas_textblock_cursor_pos_set(cur, 18);