summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/efl_ui_text.c')
-rw-r--r--src/lib/elementary/efl_ui_text.c1013
1 files changed, 314 insertions, 699 deletions
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index a57ca7e..e716f25 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -15,10 +15,10 @@
15 15
16#include "elm_entry_common.h" 16#include "elm_entry_common.h"
17#include "elm_widget_entry.h" 17#include "elm_widget_entry.h"
18#include "efl_ui_text.eo.h"
19#include "elm_hoversel_eo.h" 18#include "elm_hoversel_eo.h"
20#include "efl_ui_text_part.eo.h" 19#include "efl_ui_text_part.eo.h"
21#include "elm_part_helper.h" 20#include "elm_part_helper.h"
21#include "efl_canvas_text_internal.h"
22 22
23typedef struct _Efl_Ui_Text_Data Efl_Ui_Text_Data; 23typedef struct _Efl_Ui_Text_Data Efl_Ui_Text_Data;
24typedef struct _Efl_Ui_Text_Rectangle Efl_Ui_Text_Rectangle; 24typedef struct _Efl_Ui_Text_Rectangle Efl_Ui_Text_Rectangle;
@@ -73,15 +73,9 @@ struct _Efl_Ui_Text_Data
73 int cursor_pos; 73 int cursor_pos;
74 Elm_Scroller_Policy policy_h, policy_v; 74 Elm_Scroller_Policy policy_h, policy_v;
75 Elm_Wrap_Type line_wrap; 75 Elm_Wrap_Type line_wrap;
76 Elm_Input_Panel_Layout input_panel_layout; 76 Efl_Text_Cursor *sel_handler_cursor;
77 Elm_Autocapital_Type autocapital_type;
78 Elm_Input_Panel_Lang input_panel_lang;
79 Elm_Input_Panel_Return_Key_Type input_panel_return_key_type;
80 Elm_Input_Hints input_hints;
81 Efl_Text_Cursor_Cursor *sel_handler_cursor;
82 void *input_panel_imdata; 77 void *input_panel_imdata;
83 int input_panel_imdata_len; 78 int input_panel_imdata_len;
84 int input_panel_layout_variation;
85 int validators; 79 int validators;
86 struct 80 struct
87 { 81 {
@@ -108,43 +102,23 @@ struct _Efl_Ui_Text_Data
108 Eina_Future *primary; 102 Eina_Future *primary;
109 Eina_Future *clipboard; 103 Eina_Future *clipboard;
110 } sel_future; 104 } sel_future;
111 Eina_Bool input_panel_return_key_disabled : 1;
112 Eina_Bool drag_selection_asked : 1;
113 Eina_Bool sel_handler_disabled : 1; 105 Eina_Bool sel_handler_disabled : 1;
114 Eina_Bool start_handler_down : 1; 106 Eina_Bool start_handler_down : 1;
115 Eina_Bool start_handler_shown : 1; 107 Eina_Bool start_handler_shown : 1;
116 Eina_Bool end_handler_down : 1; 108 Eina_Bool end_handler_down : 1;
117 Eina_Bool end_handler_shown : 1; 109 Eina_Bool end_handler_shown : 1;
118 Eina_Bool input_panel_enable : 1;
119 Eina_Bool prediction_allow : 1;
120 Eina_Bool selection_asked : 1;
121 Eina_Bool auto_return_key : 1;
122 Eina_Bool have_selection : 1;
123 Eina_Bool deferred_decoration_selection : 1; 110 Eina_Bool deferred_decoration_selection : 1;
124 Eina_Bool deferred_decoration_cursor : 1; 111 Eina_Bool deferred_decoration_cursor : 1;
125 Eina_Bool deferred_decoration_anchor : 1; 112 Eina_Bool deferred_decoration_anchor : 1;
126 Eina_Bool context_menu : 1; 113 Eina_Bool context_menu : 1;
127 Eina_Bool long_pressed : 1; 114 Eina_Bool long_pressed : 1;
128 Eina_Bool cur_changed : 1;
129 Eina_Bool single_line : 1;
130 Eina_Bool can_write : 1;
131 Eina_Bool auto_save : 1; 115 Eina_Bool auto_save : 1;
132 Eina_Bool password : 1;
133 Eina_Bool editable : 1; // FIXME: This is redundant because of text interactive and should be removed
134 Eina_Bool disabled : 1;
135 Eina_Bool h_bounce : 1;
136 Eina_Bool v_bounce : 1;
137 Eina_Bool has_text : 1; 116 Eina_Bool has_text : 1;
138 Eina_Bool use_down : 1; 117 Eina_Bool use_down : 1;
139 Eina_Bool sel_mode : 1; 118 Eina_Bool sel_mode : 1;
140 Eina_Bool sel_allow : 1;
141 Eina_Bool changed : 1; 119 Eina_Bool changed : 1;
142 Eina_Bool scroll : 1; 120 Eina_Bool scroll : 1;
143 Eina_Bool input_panel_show_on_demand : 1;
144 Eina_Bool anchors_updated : 1;
145 Eina_Bool fallback_item_provider_disabled : 1;
146 Eina_Bool text_changed : 1; 121 Eina_Bool text_changed : 1;
147 Eina_Bool text_resized : 1;
148 Eina_Bool calc_force : 1; 122 Eina_Bool calc_force : 1;
149 Eina_Bool cursor_update : 1; 123 Eina_Bool cursor_update : 1;
150}; 124};
@@ -153,7 +127,7 @@ struct _Anchor
153{ 127{
154 Eo *obj; 128 Eo *obj;
155 char *name; 129 char *name;
156 Efl_Text_Annotate_Annotation *annotation; 130 Efl_Text_Attribute_Handle *annotation;
157 Eina_List *rects; 131 Eina_List *rects;
158 int gen; 132 int gen;
159 Eina_Bool item : 1; 133 Eina_Bool item : 1;
@@ -211,7 +185,8 @@ struct _Selection_Loss_Data
211#define EFL_UI_TEXT_CHUNK_SIZE 10000 185#define EFL_UI_TEXT_CHUNK_SIZE 10000
212#define EFL_UI_TEXT_DELAY_WRITE_TIME 2.0 186#define EFL_UI_TEXT_DELAY_WRITE_TIME 2.0
213 187
214#define ENTRY_PASSWORD_MASK_CHARACTER 0x002A 188#define ENTRY_PASSWORD_MASK_CHARACTER 0x002A
189#define ENTRY_PASSWORD_MASK_CHARACTER_UTF8 "\x2A"
215 190
216static Eina_List *entries = NULL; 191static Eina_List *entries = NULL;
217 192
@@ -233,13 +208,13 @@ static void _update_decorations(Eo *obj);
233static void _create_text_cursors(Eo *obj, Efl_Ui_Text_Data *sd); 208static void _create_text_cursors(Eo *obj, Efl_Ui_Text_Data *sd);
234static void _efl_ui_text_changed_cb(void *data, const Efl_Event *event); 209static void _efl_ui_text_changed_cb(void *data, const Efl_Event *event);
235static void _efl_ui_text_changed_user_cb(void *data, const Efl_Event *event); 210static void _efl_ui_text_changed_user_cb(void *data, const Efl_Event *event);
211static void _efl_ui_text_selection_start_clear_cb(void *data, const Efl_Event *event);
236static void _efl_ui_text_selection_changed_cb(void *data, const Efl_Event *event); 212static void _efl_ui_text_selection_changed_cb(void *data, const Efl_Event *event);
237static void _efl_ui_text_cursor_changed_cb(void *data, const Efl_Event *event); 213static void _efl_ui_text_cursor_changed_cb(void *data, const Efl_Event *event);
238static void _text_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); 214static void _text_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
239static void _scroller_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); 215static void _scroller_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
240static void _text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED); 216static void _text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED);
241static void _efl_ui_text_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); 217static void _efl_ui_text_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
242static void _efl_ui_text_select_none(Eo *obj, Efl_Ui_Text_Data *sd);
243static const char* _efl_ui_text_selection_get(const Eo *obj, Efl_Ui_Text_Data *sd); 218static const char* _efl_ui_text_selection_get(const Eo *obj, Efl_Ui_Text_Data *sd);
244static void _edje_signal_emit(Efl_Ui_Text_Data *obj, const char *sig, const char *src); 219static void _edje_signal_emit(Efl_Ui_Text_Data *obj, const char *sig, const char *src);
245static void _decoration_defer_all(Eo *obj); 220static void _decoration_defer_all(Eo *obj);
@@ -386,25 +361,6 @@ _efl_ui_text_guide_update(Evas_Object *obj,
386} 361}
387 362
388static void 363static void
389_validate(Evas_Object *obj)
390{
391 EFL_UI_TEXT_DATA_GET(obj, sd);
392 Eina_Bool res;
393 Elm_Validate_Content vc;
394 Eina_Strbuf *buf;
395
396 if (sd->validators == 0) return;
397
398 vc.text = edje_object_part_text_get(sd->entry_edje, "efl.text");
399 res = efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_VALIDATE, (void *)&vc);
400 buf = eina_strbuf_new();
401 eina_strbuf_append_printf(buf, "validation,%s,%s", vc.signal, res == EINA_FALSE ? "fail" : "pass");
402 edje_object_signal_emit(sd->scr_edje, eina_strbuf_string_get(buf), "efl");
403 eina_tmpstr_del(vc.signal);
404 eina_strbuf_free(buf);
405}
406
407static void
408_filter_free(Elm_Entry_Markup_Filter *tf) 364_filter_free(Elm_Entry_Markup_Filter *tf)
409{ 365{
410 if (tf->func == elm_entry_filter_limit_size) 366 if (tf->func == elm_entry_filter_limit_size)
@@ -503,7 +459,7 @@ _update_selection_handler(Eo *obj)
503 Evas_Coord sx, sy, sh; 459 Evas_Coord sx, sy, sh;
504 Evas_Coord ex, ey, eh; 460 Evas_Coord ex, ey, eh;
505 461
506 if (!sd->have_selection) 462 if (!efl_text_interactive_have_selection_get(obj))
507 { 463 {
508 _hide_selection_handler(obj); 464 _hide_selection_handler(obj);
509 return; 465 return;
@@ -515,7 +471,8 @@ _update_selection_handler(Eo *obj)
515 Eina_Position2D off; 471 Eina_Position2D off;
516 Evas_Coord hx, hy; 472 Evas_Coord hx, hy;
517 Eina_Bool hidden = EINA_FALSE; 473 Eina_Bool hidden = EINA_FALSE;
518 Efl_Text_Cursor_Cursor *sel_start, *sel_end; 474 Efl_Text_Cursor *sel_start, *sel_end;
475 Eina_Rect rc_tmp;
519 476
520 efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); 477 efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
521 478
@@ -524,10 +481,11 @@ _update_selection_handler(Eo *obj)
524 481
525 //evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL); 482 //evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL);
526 483
527 efl_text_cursor_geometry_get(obj, sel_start, 484 rc_tmp = efl_text_cursor_geometry_get(sel_start, EFL_TEXT_CURSOR_TYPE_BEFORE);
528 EFL_TEXT_CURSOR_TYPE_BEFORE, 485 sx = rc_tmp.x;
529 &sx, &sy, NULL, &sh, 486 sy = rc_tmp.y;
530 NULL, NULL, NULL, NULL); 487 sh = rc_tmp.h;
488
531 off = _decoration_calc_offset(sd); 489 off = _decoration_calc_offset(sd);
532 hx = off.x + sx; 490 hx = off.x + sx;
533 hy = off.y + sy + sh; 491 hy = off.y + sy + sh;
@@ -554,10 +512,11 @@ _update_selection_handler(Eo *obj)
554 } 512 }
555 513
556 hidden = EINA_FALSE; 514 hidden = EINA_FALSE;
557 efl_text_cursor_geometry_get(obj, sel_end, 515 rc_tmp = efl_text_cursor_geometry_get(sel_end, EFL_TEXT_CURSOR_TYPE_BEFORE);
558 EFL_TEXT_CURSOR_TYPE_BEFORE, 516 ex = rc_tmp.x;
559 &ex, &ey, NULL, &eh, 517 ey = rc_tmp.y;
560 NULL, NULL, NULL, NULL); 518 eh = rc_tmp.h;
519
561 hx = off.x + ex; 520 hx = off.x + ex;
562 hy = off.y + ey + eh; 521 hy = off.y + ey + eh;
563 evas_object_move(sd->end_handler, hx, hy); 522 evas_object_move(sd->end_handler, hx, hy);
@@ -601,33 +560,32 @@ static void
601_selection_data_cb(void *data EINA_UNUSED, Eo *obj, 560_selection_data_cb(void *data EINA_UNUSED, Eo *obj,
602 Efl_Ui_Selection_Data *sel_data) 561 Efl_Ui_Selection_Data *sel_data)
603{ 562{
604 Efl_Text_Cursor_Cursor *cur, *start, *end; 563 Efl_Text_Cursor *cur, *start, *end;
605 Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; 564 Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
606 565
607 char *buf = eina_slice_strdup(sel_data->content); 566 char *buf = eina_slice_strdup(sel_data->content);
608 size_t len = sel_data->content.len; 567 size_t len = sel_data->content.len;
609 568
610 efl_text_interactive_selection_cursors_get(obj, &start, &end); 569 efl_text_interactive_selection_cursors_get(obj, &start, &end);
611 if (!efl_text_cursor_equal(obj, start, end)) 570 if (!efl_text_cursor_equal(start, end))
612 { 571 {
613 efl_canvas_text_range_delete(obj, start, end); 572 efl_text_cursor_range_delete(start, end);
614 EFL_UI_TEXT_DATA_GET(obj, sd); 573 efl_text_interactive_all_unselect(obj);
615 _efl_ui_text_select_none(obj, sd);
616 } 574 }
617 cur = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 575 cur = efl_text_interactive_main_cursor_get(obj);
618 info.insert = EINA_TRUE; 576 info.insert = EINA_TRUE;
619 info.position = efl_text_cursor_position_get(obj, cur); 577 info.position = efl_text_cursor_position_get(cur);
620 info.length = len; 578 info.length = len;
621 info.content = buf; 579 info.content = buf;
622 if (sel_data->format == EFL_UI_SELECTION_FORMAT_MARKUP) 580 if (sel_data->format == EFL_UI_SELECTION_FORMAT_MARKUP)
623 { 581 {
624 efl_text_markup_interactive_cursor_markup_insert(obj, cur, buf); 582 efl_text_cursor_markup_insert(cur, buf);
625 } 583 }
626 else // TEXT 584 else // TEXT
627 { 585 {
628 efl_text_cursor_text_insert(obj, cur, buf); 586 efl_text_cursor_text_insert(cur, buf);
629 } 587 }
630 efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info); 588 efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
631 free(buf); 589 free(buf);
632} 590}
633 591
@@ -693,9 +651,7 @@ _dnd_drop_cb(void *data EINA_UNUSED,
693static Elm_Sel_Format 651static Elm_Sel_Format
694_get_drop_format(Evas_Object *obj) 652_get_drop_format(Evas_Object *obj)
695{ 653{
696 EFL_UI_TEXT_DATA_GET(obj, sd); 654 if (efl_text_interactive_editable_get(obj) && (efl_text_multiline_get(obj)) && (!efl_text_password_get(obj)) && (!efl_ui_widget_disabled_get(obj)))
697
698 if ((sd->editable) && (!sd->single_line) && (!sd->password) && (!sd->disabled))
699 return EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; 655 return EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE;
700 return EFL_UI_SELECTION_FORMAT_MARKUP; 656 return EFL_UI_SELECTION_FORMAT_MARKUP;
701} 657}
@@ -721,7 +677,6 @@ _efl_ui_text_efl_ui_widget_disabled_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool
721 edje_object_signal_emit(sd->scr_edje, emission, "efl"); 677 edje_object_signal_emit(sd->scr_edje, emission, "efl");
722 elm_interface_scrollable_freeze_set(obj, efl_ui_widget_disabled_get(obj)); 678 elm_interface_scrollable_freeze_set(obj, efl_ui_widget_disabled_get(obj));
723 } 679 }
724 sd->disabled = efl_ui_widget_disabled_get(obj);
725 680
726 if (!efl_ui_widget_disabled_get(obj)) 681 if (!efl_ui_widget_disabled_get(obj))
727 { 682 {
@@ -763,31 +718,6 @@ _efl_ui_text_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd)
763 elm_widget_element_update(obj, sd->entry_edje, 718 elm_widget_element_update(obj, sd->entry_edje,
764 elm_widget_theme_element_get(obj)); 719 elm_widget_theme_element_get(obj));
765 720
766 if (elm_widget_disabled_get(obj))
767 edje_object_signal_emit(sd->entry_edje, "efl,state,disabled", "efl");
768
769 edje_object_part_text_input_panel_layout_set
770 (sd->entry_edje, "efl.text", (Edje_Input_Panel_Layout)sd->input_panel_layout);
771 edje_object_part_text_input_panel_layout_variation_set
772 (sd->entry_edje, "efl.text", sd->input_panel_layout_variation);
773 edje_object_part_text_autocapital_type_set
774 (sd->entry_edje, "efl.text", (Edje_Text_Autocapital_Type)sd->autocapital_type);
775 edje_object_part_text_prediction_allow_set
776 (sd->entry_edje, "efl.text", sd->prediction_allow);
777 edje_object_part_text_input_hint_set
778 (sd->entry_edje, "efl.text", (Edje_Input_Hints)sd->input_hints);
779 edje_object_part_text_input_panel_enabled_set
780 (sd->entry_edje, "efl.text", sd->input_panel_enable);
781 edje_object_part_text_input_panel_imdata_set
782 (sd->entry_edje, "efl.text", sd->input_panel_imdata,
783 sd->input_panel_imdata_len);
784 edje_object_part_text_input_panel_return_key_type_set
785 (sd->entry_edje, "efl.text", (Edje_Input_Panel_Return_Key_Type)sd->input_panel_return_key_type);
786 edje_object_part_text_input_panel_return_key_disabled_set
787 (sd->entry_edje, "efl.text", sd->input_panel_return_key_disabled);
788 edje_object_part_text_input_panel_show_on_demand_set
789 (sd->entry_edje, "efl.text", sd->input_panel_show_on_demand);
790
791 // elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set 721 // elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set
792 // -> smart_objects_calculate will call all smart calculate functions, 722 // -> smart_objects_calculate will call all smart calculate functions,
793 // and one of them can delete elm_entry. 723 // and one of them can delete elm_entry.
@@ -830,19 +760,23 @@ _cursor_geometry_recalc(Evas_Object *obj)
830 Evas_Coord x, y, w, h; 760 Evas_Coord x, y, w, h;
831 Evas_Coord x2, y2, w2, h2; 761 Evas_Coord x2, y2, w2, h2;
832 Evas_Coord cx, cy, cw, ch; 762 Evas_Coord cx, cy, cw, ch;
763 Eina_Rect rc;
833 764
834 if (!sd->editable) return; 765 if (!efl_text_interactive_editable_get(obj)) return;
835 766
836 cx = cy = cw = ch = 0; 767 cx = cy = cw = ch = 0;
837 x2 = y2 = w2 = h2 = 0; 768 x2 = y2 = w2 = h2 = 0;
838 x = y = w = h = 0; 769 x = y = w = h = 0;
839 770
840 Efl_Text_Cursor_Cursor *main_cur = 771 Efl_Text_Cursor *main_cur =
841 efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 772 efl_text_interactive_main_cursor_get(obj);
773
774 rc = efl_text_cursor_geometry_get(main_cur, EFL_TEXT_CURSOR_TYPE_BEFORE);
775 cx = rc.x;
776 cy = rc.y;
777 cw = rc.w;
778 ch = rc.h;
842 779
843 efl_text_cursor_geometry_get(obj, main_cur,
844 EFL_TEXT_CURSOR_TYPE_BEFORE,
845 &cx, &cy, &cw, &ch, NULL, NULL, NULL, NULL);
846 edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0); 780 edje_object_size_min_restricted_calc(sd->cursor, &cw, NULL, cw, 0);
847 if (cw < 1) cw = 1; 781 if (cw < 1) cw = 1;
848 if (ch < 1) ch = 1; 782 if (ch < 1) ch = 1;
@@ -875,8 +809,6 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd)
875 return; 809 return;
876 } 810 }
877 811
878 sd->single_line = !efl_text_multiline_get(sd->text_obj);
879
880 sd->calc_force = EINA_FALSE; 812 sd->calc_force = EINA_FALSE;
881 sd->last.layout.w = sz.w; 813 sd->last.layout.w = sz.w;
882 sd->last.layout.h = sz.h; 814 sd->last.layout.h = sz.h;
@@ -884,7 +816,7 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd)
884 816
885 if (sd->scroll) 817 if (sd->scroll)
886 { 818 {
887 if (sd->single_line) 819 if (!efl_text_multiline_get(obj))
888 { 820 {
889 efl_ui_internal_text_scroller_mode_set(sd->scroller, 821 efl_ui_internal_text_scroller_mode_set(sd->scroller,
890 EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); 822 EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
@@ -898,7 +830,7 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd)
898 830
899 efl_canvas_group_calculate(sd->scroller); 831 efl_canvas_group_calculate(sd->scroller);
900 min = efl_gfx_hint_size_min_get(sd->scroller); 832 min = efl_gfx_hint_size_min_get(sd->scroller);
901 if (sd->single_line) 833 if (!efl_text_multiline_get(obj))
902 { 834 {
903 efl_ui_internal_text_scroller_mode_set(sd->scroller, 835 efl_ui_internal_text_scroller_mode_set(sd->scroller,
904 EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE); 836 EFL_UI_TEXT_SCROLLER_MODE_SINGLELINE);
@@ -918,10 +850,10 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd)
918 efl_event_freeze(sd->text_obj); 850 efl_event_freeze(sd->text_obj);
919 efl_gfx_entity_size_set(sd->text_obj, EINA_SIZE2D(sz.w, 0)); 851 efl_gfx_entity_size_set(sd->text_obj, EINA_SIZE2D(sz.w, 0));
920 /* ignore current object size for single-line since we always need to know the actual size */ 852 /* ignore current object size for single-line since we always need to know the actual size */
921 if (sd->single_line) 853 if (!efl_text_multiline_get(obj))
922 efl_canvas_text_size_native_get(sd->text_obj, &min.w, &min.h); 854 min = efl_canvas_text_size_native_get(sd->text_obj);
923 else 855 else
924 efl_canvas_text_size_formatted_get(sd->text_obj, &min.w, &min.h); 856 min = efl_canvas_text_size_formatted_get(sd->text_obj);
925 efl_gfx_entity_size_set(sd->text_obj, text_sz); 857 efl_gfx_entity_size_set(sd->text_obj, text_sz);
926 efl_event_thaw(sd->text_obj); 858 efl_event_thaw(sd->text_obj);
927 min.w += edmin.w; 859 min.w += edmin.w;
@@ -930,28 +862,13 @@ _efl_ui_text_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Data *sd)
930 } 862 }
931} 863}
932 864
933static void
934_return_key_enabled_check(Evas_Object *obj)
935{
936 Eina_Bool return_key_disabled = EINA_FALSE;
937
938 EFL_UI_TEXT_DATA_GET(obj, sd);
939
940 if (!sd->auto_return_key) return;
941
942 if (efl_canvas_text_is_empty_get(obj) == EINA_TRUE)
943 return_key_disabled = EINA_TRUE;
944
945 efl_ui_text_input_panel_return_key_disabled_set(obj, return_key_disabled);
946}
947
948EOLIAN static Eina_Bool 865EOLIAN static Eina_Bool
949_efl_ui_text_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Text_Data *sd) 866_efl_ui_text_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Text_Data *sd)
950{ 867{
951 Evas_Object *top; 868 Evas_Object *top;
952 Eina_Bool top_is_win = EINA_FALSE; 869 Eina_Bool top_is_win = EINA_FALSE;
953 870
954 if (!sd->editable) return EINA_FALSE; 871 if (!efl_text_interactive_editable_get(obj)) return EINA_FALSE;
955 872
956 top = elm_widget_top_get(obj); 873 top = elm_widget_top_get(obj);
957 if (top && efl_isa(top, EFL_UI_WIN_CLASS)) 874 if (top && efl_isa(top, EFL_UI_WIN_CLASS))
@@ -965,12 +882,10 @@ _efl_ui_text_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Text_Data *sd)
965 if (sd->scroll) 882 if (sd->scroll)
966 edje_object_signal_emit(sd->scr_edje, "efl,action,focus", "efl"); 883 edje_object_signal_emit(sd->scr_edje, "efl,action,focus", "efl");
967 884
968 if (top && top_is_win && sd->input_panel_enable && !sd->input_panel_show_on_demand) 885 if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj))
969 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); 886 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
970 if (_elm_config->atspi_mode) 887 if (_elm_config->atspi_mode)
971 efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE); 888 efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE);
972 _return_key_enabled_check(obj);
973 _validate(obj);
974 } 889 }
975 else 890 else
976 { 891 {
@@ -981,14 +896,14 @@ _efl_ui_text_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Text_Data *sd)
981 edje_object_signal_emit(sd->scr_edje, "efl,action,unfocus", "efl"); 896 edje_object_signal_emit(sd->scr_edje, "efl,action,unfocus", "efl");
982 evas_object_focus_set(sw, EINA_FALSE); 897 evas_object_focus_set(sw, EINA_FALSE);
983 898
984 if (top && top_is_win && sd->input_panel_enable) 899 if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj))
985 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); 900 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
986 if (_elm_config->atspi_mode) 901 if (_elm_config->atspi_mode)
987 efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_FALSE); 902 efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_FALSE);
988 903
989 if (_elm_config->selection_clear_enable) 904 if (_elm_config->selection_clear_enable)
990 { 905 {
991 if ((sd->have_selection) && (!sd->hoversel)) 906 if ((efl_text_interactive_have_selection_get(obj)) && (!sd->hoversel))
992 { 907 {
993 sd->sel_mode = EINA_FALSE; 908 sd->sel_mode = EINA_FALSE;
994 elm_widget_scroll_hold_pop(obj); 909 elm_widget_scroll_hold_pop(obj);
@@ -1009,13 +924,10 @@ _efl_ui_text_efl_ui_widget_interest_region_get(const Eo *obj EINA_UNUSED, Efl_Ui
1009 Evas_Coord edje_x, edje_y, elm_x, elm_y; 924 Evas_Coord edje_x, edje_y, elm_x, elm_y;
1010 Eina_Rect r = {}; 925 Eina_Rect r = {};
1011 926
1012 efl_text_cursor_geometry_get(obj, 927 r = efl_text_cursor_geometry_get(
1013 efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN), 928 efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
1014 EFL_TEXT_CURSOR_TYPE_BEFORE,
1015 &r.x, &r.y, &r.w, &r.h,
1016 NULL, NULL, NULL, NULL);
1017 929
1018 if (sd->single_line) 930 if (!efl_text_multiline_get(obj))
1019 { 931 {
1020 evas_object_geometry_get(sd->entry_edje, NULL, NULL, NULL, &r.h); 932 evas_object_geometry_get(sd->entry_edje, NULL, NULL, NULL, &r.h);
1021 r.y = 0; 933 r.y = 0;
@@ -1081,7 +993,7 @@ _hover_dismissed_cb(void *data, const Efl_Event *event EINA_UNUSED)
1081 { 993 {
1082 if (!_elm_config->desktop_entry) 994 if (!_elm_config->desktop_entry)
1083 { 995 {
1084 if (!sd->password) 996 if (!efl_text_password_get(data))
1085 edje_object_part_text_select_allow_set 997 edje_object_part_text_select_allow_set
1086 (sd->entry_edje, "efl.text", EINA_TRUE); 998 (sd->entry_edje, "efl.text", EINA_TRUE);
1087 } 999 }
@@ -1098,14 +1010,14 @@ _hover_selected_cb(void *data,
1098{ 1010{
1099 EFL_UI_TEXT_DATA_GET(data, sd); 1011 EFL_UI_TEXT_DATA_GET(data, sd);
1100 1012
1101 if (!sd->sel_allow) return; 1013 if (!efl_text_interactive_selection_allowed_get(obj)) return;
1102 1014
1103 sd->sel_mode = EINA_TRUE; 1015 sd->sel_mode = EINA_TRUE;
1104 edje_object_part_text_select_none(sd->entry_edje, "efl.text"); 1016 edje_object_part_text_select_none(sd->entry_edje, "efl.text");
1105 1017
1106 if (!_elm_config->desktop_entry) 1018 if (!_elm_config->desktop_entry)
1107 { 1019 {
1108 if (!sd->password) 1020 if (!efl_text_password_get(data))
1109 edje_object_part_text_select_allow_set 1021 edje_object_part_text_select_allow_set
1110 (sd->entry_edje, "efl.text", EINA_TRUE); 1022 (sd->entry_edje, "efl.text", EINA_TRUE);
1111 } 1023 }
@@ -1116,44 +1028,21 @@ _hover_selected_cb(void *data,
1116} 1028}
1117 1029
1118static void 1030static void
1119_paste_cb(Eo *obj)
1120{
1121 Efl_Ui_Selection_Format formats = EFL_UI_SELECTION_FORMAT_TEXT |
1122 EFL_UI_SELECTION_FORMAT_MARKUP;
1123
1124 efl_ui_selection_get(obj, EFL_UI_SELECTION_TYPE_CLIPBOARD, formats,
1125 NULL, _selection_data_cb, NULL, 1);
1126
1127}
1128
1129static void
1130_hoversel_item_paste_cb(void *data, 1031_hoversel_item_paste_cb(void *data,
1131 Evas_Object *obj EINA_UNUSED, 1032 Evas_Object *obj EINA_UNUSED,
1132 void *event_info EINA_UNUSED) 1033 void *event_info EINA_UNUSED)
1133{ 1034{
1134 _paste_cb(data); 1035 efl_ui_text_selection_paste(data);
1135}
1136
1137static void
1138_selection_clear(void *data, Efl_Ui_Selection_Type selection)
1139{
1140 EFL_UI_TEXT_DATA_GET(data, sd);
1141
1142 if (!sd->have_selection) return;
1143 if ((selection == EFL_UI_SELECTION_TYPE_CLIPBOARD) ||
1144 (selection == EFL_UI_SELECTION_TYPE_PRIMARY))
1145 {
1146 _efl_ui_text_select_none(data, sd);
1147 }
1148 _selection_defer(data, sd);
1149} 1036}
1150 1037
1151static Eina_Value 1038static Eina_Value
1152_selection_lost_cb(void *data, const Eina_Value value) 1039_selection_lost_cb(void *data, const Eina_Value value)
1153{ 1040{
1154 Selection_Loss_Data *sdata = data; 1041 Selection_Loss_Data *sdata = data;
1155 _selection_clear(sdata->obj, sdata->stype); 1042 EFL_UI_TEXT_DATA_GET(sdata->obj, sd);
1156 EFL_UI_TEXT_DATA_GET(sdata->obj, sd); 1043
1044 efl_text_interactive_all_unselect(sdata->obj);
1045 _selection_defer(sdata->obj, sd);
1157 switch (sdata->stype) 1046 switch (sdata->stype)
1158 { 1047 {
1159 case EFL_UI_SELECTION_TYPE_CLIPBOARD: 1048 case EFL_UI_SELECTION_TYPE_CLIPBOARD:
@@ -1173,7 +1062,7 @@ _selection_store(Efl_Ui_Selection_Type seltype,
1173 Evas_Object *obj) 1062 Evas_Object *obj)
1174{ 1063{
1175 char *sel; 1064 char *sel;
1176 Efl_Text_Cursor_Cursor *start, *end; 1065 Efl_Text_Cursor *start, *end;
1177 Efl_Ui_Selection_Format selformat = EFL_UI_SELECTION_FORMAT_MARKUP; 1066 Efl_Ui_Selection_Format selformat = EFL_UI_SELECTION_FORMAT_MARKUP;
1178 Eina_Slice slice; 1067 Eina_Slice slice;
1179 Selection_Loss_Data *ldata; 1068 Selection_Loss_Data *ldata;
@@ -1182,7 +1071,7 @@ _selection_store(Efl_Ui_Selection_Type seltype,
1182 EFL_UI_TEXT_DATA_GET(obj, sd); 1071 EFL_UI_TEXT_DATA_GET(obj, sd);
1183 1072
1184 efl_text_interactive_selection_cursors_get(obj, &start, &end); 1073 efl_text_interactive_selection_cursors_get(obj, &start, &end);
1185 sel = efl_text_markup_interactive_markup_range_get(obj, start, end); 1074 sel = efl_text_cursor_range_markup_get(start, end);
1186 1075
1187 if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ 1076 if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
1188 1077
@@ -1227,51 +1116,11 @@ end:
1227} 1116}
1228 1117
1229static void 1118static void
1230_cut_cb(Eo *obj)
1231{
1232 Efl_Text_Cursor_Cursor *start, *end;
1233 EFL_UI_TEXT_DATA_GET(obj, sd);
1234
1235 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTION_CUT, NULL);
1236 /* Store it */
1237 sd->sel_mode = EINA_FALSE;
1238 if (!_elm_config->desktop_entry)
1239 edje_object_part_text_select_allow_set
1240 (sd->entry_edje, "efl.text", EINA_FALSE);
1241 edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
1242
1243 if (!_elm_config->desktop_entry)
1244 elm_widget_scroll_hold_pop(obj);
1245
1246 _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
1247 efl_text_interactive_selection_cursors_get(obj, &start, &end);
1248 efl_canvas_text_range_delete(obj, start, end);
1249 _efl_ui_text_select_none(obj, sd);
1250}
1251
1252static void
1253_hoversel_item_cut_cb(void *data, 1119_hoversel_item_cut_cb(void *data,
1254 Evas_Object *obj EINA_UNUSED, 1120 Evas_Object *obj EINA_UNUSED,
1255 void *event_info EINA_UNUSED) 1121 void *event_info EINA_UNUSED)
1256{ 1122{
1257 _cut_cb(data); 1123 efl_ui_text_selection_cut(data);
1258}
1259
1260static void
1261_copy_cb(Eo *obj)
1262{
1263 EFL_UI_TEXT_DATA_GET(obj, sd);
1264
1265 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTION_COPY, NULL);
1266 sd->sel_mode = EINA_FALSE;
1267 if (!_elm_config->desktop_entry)
1268 {
1269 edje_object_part_text_select_allow_set
1270 (sd->entry_edje, "efl.text", EINA_FALSE);
1271 edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
1272 elm_widget_scroll_hold_pop(obj);
1273 }
1274 _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
1275} 1124}
1276 1125
1277static void 1126static void
@@ -1279,7 +1128,7 @@ _hoversel_item_copy_cb(void *data,
1279 Evas_Object *obj EINA_UNUSED, 1128 Evas_Object *obj EINA_UNUSED,
1280 void *event_info EINA_UNUSED) 1129 void *event_info EINA_UNUSED)
1281{ 1130{
1282 _copy_cb(data); 1131 efl_ui_text_selection_copy(data);
1283} 1132}
1284 1133
1285static void 1134static void
@@ -1336,8 +1185,8 @@ _menu_call(Evas_Object *obj)
1336 if (!sd->items) 1185 if (!sd->items)
1337 { 1186 {
1338 /* prevent stupid blank hoversel */ 1187 /* prevent stupid blank hoversel */
1339 if (sd->have_selection && sd->password) return; 1188 if (efl_text_interactive_have_selection_get(obj) && efl_text_password_get(obj)) return;
1340 if (_elm_config->desktop_entry && (!sd->have_selection) && ((!sd->editable) || (!ownersel))) 1189 if (_elm_config->desktop_entry && (!efl_text_interactive_have_selection_get(obj)) && ((!efl_text_interactive_editable_get(obj)) || (!ownersel)))
1341 return; 1190 return;
1342 } 1191 }
1343 if (sd->hoversel) evas_object_del(sd->hoversel); 1192 if (sd->hoversel) evas_object_del(sd->hoversel);
@@ -1360,18 +1209,18 @@ _menu_call(Evas_Object *obj)
1360 1209
1361 efl_event_callback_add 1210 efl_event_callback_add
1362 (sd->hoversel, ELM_HOVERSEL_EVENT_DISMISSED, _hover_dismissed_cb, obj); 1211 (sd->hoversel, ELM_HOVERSEL_EVENT_DISMISSED, _hover_dismissed_cb, obj);
1363 if (sd->have_selection) 1212 if (efl_text_interactive_have_selection_get(obj))
1364 { 1213 {
1365 if (!sd->password) 1214 if (!efl_text_password_get(obj))
1366 { 1215 {
1367 if (sd->editable) 1216 if (efl_text_interactive_editable_get(obj))
1368 elm_hoversel_item_add 1217 elm_hoversel_item_add
1369 (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE, 1218 (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE,
1370 _hoversel_item_cut_cb, obj); 1219 _hoversel_item_cut_cb, obj);
1371 elm_hoversel_item_add 1220 elm_hoversel_item_add
1372 (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE, 1221 (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE,
1373 _hoversel_item_copy_cb, obj); 1222 _hoversel_item_copy_cb, obj);
1374 if (sd->editable && ownersel) 1223 if (efl_text_interactive_editable_get(obj) && ownersel)
1375 elm_hoversel_item_add 1224 elm_hoversel_item_add
1376 (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, 1225 (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
1377 _hoversel_item_paste_cb, obj); 1226 _hoversel_item_paste_cb, obj);
@@ -1384,16 +1233,16 @@ _menu_call(Evas_Object *obj)
1384 { 1233 {
1385 if (!sd->sel_mode) 1234 if (!sd->sel_mode)
1386 { 1235 {
1387 if (sd->sel_allow && !_elm_config->desktop_entry) 1236 if (efl_text_interactive_selection_allowed_get(obj) && !_elm_config->desktop_entry)
1388 { 1237 {
1389 if (!sd->password) 1238 if (!efl_text_password_get(obj))
1390 elm_hoversel_item_add 1239 elm_hoversel_item_add
1391 (sd->hoversel, E_("Select"), NULL, ELM_ICON_NONE, 1240 (sd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
1392 _hover_selected_cb, obj); 1241 _hover_selected_cb, obj);
1393 } 1242 }
1394 if (ownersel) 1243 if (ownersel)
1395 { 1244 {
1396 if (sd->editable) 1245 if (efl_text_interactive_editable_get(obj))
1397 elm_hoversel_item_add 1246 elm_hoversel_item_add
1398 (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE, 1247 (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
1399 _hoversel_item_paste_cb, obj); 1248 _hoversel_item_paste_cb, obj);
@@ -1470,17 +1319,17 @@ _key_down_cb(void *data,
1470 { 1319 {
1471 if (!strncmp(ev->key, "c", 1)) 1320 if (!strncmp(ev->key, "c", 1))
1472 { 1321 {
1473 _copy_cb(data); 1322 efl_ui_text_selection_copy(data);
1474 on_hold = EINA_TRUE; 1323 on_hold = EINA_TRUE;
1475 } 1324 }
1476 else if (!strncmp(ev->key, "x", 1)) 1325 else if (!strncmp(ev->key, "x", 1))
1477 { 1326 {
1478 _cut_cb(data); 1327 efl_ui_text_selection_cut(data);
1479 on_hold = EINA_TRUE; 1328 on_hold = EINA_TRUE;
1480 } 1329 }
1481 else if (!strncmp(ev->key, "v", 1)) 1330 else if (!strncmp(ev->key, "v", 1))
1482 { 1331 {
1483 _paste_cb(data); 1332 efl_ui_text_selection_paste(data);
1484 on_hold = EINA_TRUE; 1333 on_hold = EINA_TRUE;
1485 } 1334 }
1486 } 1335 }
@@ -1499,12 +1348,18 @@ _mouse_down_cb(void *data,
1499 1348
1500 EFL_UI_TEXT_DATA_GET(data, sd); 1349 EFL_UI_TEXT_DATA_GET(data, sd);
1501 1350
1502 if (sd->disabled) return; 1351 if (efl_ui_widget_disabled_get(data)) return;
1503 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 1352 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1504 sd->downx = ev->canvas.x; 1353 sd->downx = ev->canvas.x;
1505 sd->downy = ev->canvas.y; 1354 sd->downy = ev->canvas.y;
1506 sd->long_pressed = EINA_FALSE; 1355 sd->long_pressed = EINA_FALSE;
1507 1356
1357
1358 if (ev->button == 2)
1359 {
1360 efl_ui_text_selection_paste(data);
1361 }
1362
1508 /* If right button is pressed and context menu disabled is true, 1363 /* If right button is pressed and context menu disabled is true,
1509 * then only context menu will appear */ 1364 * then only context menu will appear */
1510 if (ev->button == 3 && (!_elm_config->context_menu_disabled)) 1365 if (ev->button == 3 && (!_elm_config->context_menu_disabled))
@@ -1529,7 +1384,7 @@ _mouse_up_cb(void *data,
1529 1384
1530 EFL_UI_TEXT_DATA_GET(data, sd); 1385 EFL_UI_TEXT_DATA_GET(data, sd);
1531 1386
1532 if (sd->disabled) return; 1387 if (efl_ui_widget_disabled_get(data)) return;
1533 if (ev->button == 1) 1388 if (ev->button == 1)
1534 { 1389 {
1535 efl_input_clickable_longpress_abort(data, 1); 1390 efl_input_clickable_longpress_abort(data, 1);
@@ -1552,7 +1407,7 @@ _mouse_up_cb(void *data,
1552 if (efl_isa(top, EFL_UI_WIN_CLASS)) 1407 if (efl_isa(top, EFL_UI_WIN_CLASS))
1553 top_is_win = EINA_TRUE; 1408 top_is_win = EINA_TRUE;
1554 1409
1555 if (top_is_win && sd->input_panel_enable && sd->input_panel_show_on_demand) 1410 if (top_is_win && efl_input_text_input_panel_autoshow_get(data) && efl_input_text_input_panel_show_on_demand_get(data))
1556 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); 1411 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
1557 } 1412 }
1558 } 1413 }
@@ -1578,7 +1433,7 @@ _mouse_move_cb(void *data,
1578 1433
1579 EFL_UI_TEXT_DATA_GET(data, sd); 1434 EFL_UI_TEXT_DATA_GET(data, sd);
1580 1435
1581 if (sd->disabled) return; 1436 if (efl_ui_widget_disabled_get(data)) return;
1582 if (ev->buttons == 1) 1437 if (ev->buttons == 1)
1583 { 1438 {
1584 if (sd->long_pressed) 1439 if (sd->long_pressed)
@@ -1687,15 +1542,18 @@ _selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler)
1687 Evas_Coord cx, cy, cw, ch; 1542 Evas_Coord cx, cy, cw, ch;
1688 Evas_Coord hh; 1543 Evas_Coord hh;
1689 Eina_Position2D pos; 1544 Eina_Position2D pos;
1545 Eina_Rect rc;
1690 1546
1691 EFL_UI_TEXT_DATA_GET(obj, sd); 1547 EFL_UI_TEXT_DATA_GET(obj, sd);
1692 1548
1693 pos = efl_gfx_entity_position_get(sd->text_obj); 1549 pos = efl_gfx_entity_position_get(sd->text_obj);
1694 efl_text_cursor_geometry_get(obj, 1550 rc = efl_text_cursor_geometry_get(
1695 efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN), 1551 efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
1696 EFL_TEXT_CURSOR_TYPE_BEFORE, 1552 cx = rc.x;
1697 &cx, &cy, &cw, &ch, 1553 cy = rc.y;
1698 NULL, NULL, NULL, NULL); 1554 cw = rc.w;
1555 ch = rc.h;
1556
1699 edje_object_size_min_calc(handler, NULL, &hh); 1557 edje_object_size_min_calc(handler, NULL, &hh);
1700 1558
1701 sd->ox = pos.x + cx + (cw / 2); 1559 sd->ox = pos.x + cx + (cw / 2);
@@ -1721,8 +1579,8 @@ _start_handler_mouse_down_cb(void *data,
1721 EFL_UI_TEXT_DATA_GET(data, sd); 1579 EFL_UI_TEXT_DATA_GET(data, sd);
1722 1580
1723 int start_pos, end_pos, pos; 1581 int start_pos, end_pos, pos;
1724 Efl_Text_Cursor_Cursor *sel_start, *sel_end; 1582 Efl_Text_Cursor *sel_start, *sel_end;
1725 Efl_Text_Cursor_Cursor *main_cur; 1583 Efl_Text_Cursor *main_cur;
1726 1584
1727 Eo *text_obj = sd->text_obj; 1585 Eo *text_obj = sd->text_obj;
1728 1586
@@ -1730,10 +1588,10 @@ _start_handler_mouse_down_cb(void *data,
1730 1588
1731 /* Get the cursors */ 1589 /* Get the cursors */
1732 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); 1590 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
1733 main_cur = efl_text_cursor_get(text_obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 1591 main_cur = efl_text_interactive_main_cursor_get(text_obj);
1734 1592
1735 start_pos = efl_text_cursor_position_get(text_obj, sel_start); 1593 start_pos = efl_text_cursor_position_get(sel_start);
1736 end_pos = efl_text_cursor_position_get(text_obj, sel_end); 1594 end_pos = efl_text_cursor_position_get(sel_end);
1737 1595
1738 if (start_pos <= end_pos) 1596 if (start_pos <= end_pos)
1739 { 1597 {
@@ -1745,7 +1603,7 @@ _start_handler_mouse_down_cb(void *data,
1745 pos = end_pos; 1603 pos = end_pos;
1746 sd->sel_handler_cursor = sel_end; 1604 sd->sel_handler_cursor = sel_end;
1747 } 1605 }
1748 efl_text_cursor_position_set(text_obj, main_cur, pos); 1606 efl_text_cursor_position_set(main_cur, pos);
1749 _selection_handlers_offset_calc(data, sd->start_handler); 1607 _selection_handlers_offset_calc(data, sd->start_handler);
1750} 1608}
1751 1609
@@ -1784,12 +1642,12 @@ _start_handler_mouse_move_cb(void *data,
1784 cy = ev->cur.canvas.y - sd->oy - ey; 1642 cy = ev->cur.canvas.y - sd->oy - ey;
1785 if (cx <= 0) cx = 1; 1643 if (cx <= 0) cx = 1;
1786 1644
1787 efl_text_cursor_coord_set(sd->text_obj, sd->sel_handler_cursor, cx, cy); 1645 efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy));
1788 pos = efl_text_cursor_position_get(sd->text_obj, sd->sel_handler_cursor); 1646 pos = efl_text_cursor_position_get(sd->sel_handler_cursor);
1789 1647
1790 /* Set the main cursor. */ 1648 /* Set the main cursor. */
1791 efl_text_cursor_position_set(sd->text_obj, 1649 efl_text_cursor_position_set(
1792 efl_text_cursor_get(sd->text_obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN), pos); 1650 efl_text_interactive_main_cursor_get(sd->text_obj), pos);
1793 1651
1794 efl_input_clickable_longpress_abort(data, 1); 1652 efl_input_clickable_longpress_abort(data, 1);
1795 sd->long_pressed = EINA_FALSE; 1653 sd->long_pressed = EINA_FALSE;
@@ -1803,8 +1661,8 @@ _end_handler_mouse_down_cb(void *data,
1803{ 1661{
1804 EFL_UI_TEXT_DATA_GET(data, sd); 1662 EFL_UI_TEXT_DATA_GET(data, sd);
1805 1663
1806 Efl_Text_Cursor_Cursor *sel_start, *sel_end; 1664 Efl_Text_Cursor *sel_start, *sel_end;
1807 Efl_Text_Cursor_Cursor *main_cur; 1665 Efl_Text_Cursor *main_cur;
1808 int pos, start_pos, end_pos; 1666 int pos, start_pos, end_pos;
1809 1667
1810 sd->end_handler_down = EINA_TRUE; 1668 sd->end_handler_down = EINA_TRUE;
@@ -1812,10 +1670,10 @@ _end_handler_mouse_down_cb(void *data,
1812 Eo *text_obj = sd->text_obj; 1670 Eo *text_obj = sd->text_obj;
1813 1671
1814 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); 1672 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
1815 main_cur = efl_text_cursor_get(text_obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 1673 main_cur = efl_text_interactive_main_cursor_get(text_obj);
1816 1674
1817 start_pos = efl_text_cursor_position_get(text_obj, sel_start); 1675 start_pos = efl_text_cursor_position_get(sel_start);
1818 end_pos = efl_text_cursor_position_get(text_obj, sel_end); 1676 end_pos = efl_text_cursor_position_get(sel_end);
1819 1677
1820 if (start_pos < end_pos) 1678 if (start_pos < end_pos)
1821 { 1679 {
@@ -1828,7 +1686,7 @@ _end_handler_mouse_down_cb(void *data,
1828 sd->sel_handler_cursor = sel_start; 1686 sd->sel_handler_cursor = sel_start;
1829 } 1687 }
1830 1688
1831 efl_text_cursor_position_set(text_obj, main_cur, pos); 1689 efl_text_cursor_position_set(main_cur, pos);
1832 _selection_handlers_offset_calc(data, sd->end_handler); 1690 _selection_handlers_offset_calc(data, sd->end_handler);
1833} 1691}
1834 1692
@@ -1867,10 +1725,10 @@ _end_handler_mouse_move_cb(void *data,
1867 cy = ev->cur.canvas.y - sd->oy - ey; 1725 cy = ev->cur.canvas.y - sd->oy - ey;
1868 if (cx <= 0) cx = 1; 1726 if (cx <= 0) cx = 1;
1869 1727
1870 efl_text_cursor_coord_set(sd->text_obj, sd->sel_handler_cursor, cx, cy); 1728 efl_text_cursor_char_coord_set(sd->sel_handler_cursor, EINA_POSITION2D(cx, cy));
1871 pos = efl_text_cursor_position_get(sd->text_obj, sd->sel_handler_cursor); 1729 pos = efl_text_cursor_position_get(sd->sel_handler_cursor);
1872 /* Set the main cursor. */ 1730 /* Set the main cursor. */
1873 efl_text_cursor_position_set(sd->text_obj, efl_text_cursor_get(data, EFL_TEXT_CURSOR_GET_TYPE_MAIN), pos); 1731 efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(data), pos);
1874 efl_input_clickable_longpress_abort(data, 1); 1732 efl_input_clickable_longpress_abort(data, 1);
1875 sd->long_pressed = EINA_FALSE; 1733 sd->long_pressed = EINA_FALSE;
1876} 1734}
@@ -1947,30 +1805,6 @@ _efl_ui_text_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_Text_Data *sd, Ev
1947} 1805}
1948 1806
1949static void 1807static void
1950_cb_added(void *data EINA_UNUSED, const Efl_Event *ev)
1951{
1952 const Efl_Callback_Array_Item_Full *event = ev->info;
1953
1954 EFL_UI_TEXT_DATA_GET(ev->object, sd);
1955 // XXX: BUG - not walking the array until a NULL entry
1956 if (event->desc == EFL_UI_TEXT_EVENT_VALIDATE)
1957 sd->validators++;
1958}
1959
1960static void
1961_cb_deleted(void *data EINA_UNUSED, const Efl_Event *ev)
1962{
1963 const Efl_Callback_Array_Item_Full *event = ev->info;
1964
1965 EFL_UI_TEXT_DATA_GET(ev->object, sd);
1966 // XXX: BUG - not walking the array until a NULL entry
1967 if (event->desc == EFL_UI_TEXT_EVENT_VALIDATE)
1968 sd->validators--;
1969 return;
1970
1971}
1972
1973static void
1974_update_guide_text(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd) 1808_update_guide_text(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
1975{ 1809{
1976 const char *txt; 1810 const char *txt;
@@ -2081,7 +1915,8 @@ _update_text_theme(Eo *obj, Efl_Ui_Text_Data *sd)
2081 font_name = edje_object_data_get(wd->resize_obj, "font.name"); 1915 font_name = edje_object_data_get(wd->resize_obj, "font.name");
2082 font_size = edje_object_data_get(wd->resize_obj, "font.size"); 1916 font_size = edje_object_data_get(wd->resize_obj, "font.size");
2083 font_size_n = font_size ? atoi(font_size) : 0; 1917 font_size_n = font_size ? atoi(font_size) : 0;
2084 efl_text_font_set(sd->text_obj, font_name, font_size_n); 1918 efl_text_font_family_set(sd->text_obj, font_name);
1919 efl_text_font_size_set(sd->text_obj, font_size_n);
2085 1920
2086 // color 1921 // color
2087 if (disabled) 1922 if (disabled)
@@ -2097,7 +1932,8 @@ _update_text_theme(Eo *obj, Efl_Ui_Text_Data *sd)
2097 font_name = edje_object_data_get(wd->resize_obj, "guide.font.name"); 1932 font_name = edje_object_data_get(wd->resize_obj, "guide.font.name");
2098 font_size = edje_object_data_get(wd->resize_obj, "guide.font.size"); 1933 font_size = edje_object_data_get(wd->resize_obj, "guide.font.size");
2099 font_size_n = font_size ? atoi(font_size) : 0; 1934 font_size_n = font_size ? atoi(font_size) : 0;
2100 efl_text_font_set(sd->text_guide_obj, font_name, font_size_n); 1935 efl_text_font_family_set(sd->text_guide_obj, font_name);
1936 efl_text_font_size_set(sd->text_guide_obj, font_size_n);
2101 1937
2102 colorcode = NULL; 1938 colorcode = NULL;
2103 // color 1939 // color
@@ -2124,9 +1960,12 @@ _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *sd)
2124 efl_event_callback_add(obj, EFL_INPUT_EVENT_LONGPRESSED, _long_press_cb, obj); 1960 efl_event_callback_add(obj, EFL_INPUT_EVENT_LONGPRESSED, _long_press_cb, obj);
2125 1961
2126 text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); 1962 text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj);
2127 efl_event_callback_forwarder_add(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER, obj); 1963 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, obj);
2128 efl_event_callback_forwarder_add(text_obj, EFL_UI_TEXT_EVENT_CHANGED, obj); 1964 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, obj);
2129 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_TEXT_SELECTION_CHANGED, obj); 1965 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, obj);
1966 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_REDO_REQUEST, obj);
1967 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_UNDO_REQUEST, obj);
1968 efl_event_callback_forwarder_add(text_obj, EFL_TEXT_INTERACTIVE_EVENT_PREEDIT_CHANGED, obj);
2130 sd->text_obj = text_obj; 1969 sd->text_obj = text_obj;
2131 sd->text_guide_obj = efl_add(EFL_CANVAS_TEXT_CLASS, obj); 1970 sd->text_guide_obj = efl_add(EFL_CANVAS_TEXT_CLASS, obj);
2132 sd->text_table = efl_add(EFL_UI_TABLE_CLASS, obj); 1971 sd->text_table = efl_add(EFL_UI_TABLE_CLASS, obj);
@@ -2137,8 +1976,8 @@ _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *sd)
2137 sd->line_wrap = ELM_WRAP_WORD; 1976 sd->line_wrap = ELM_WRAP_WORD;
2138 sd->context_menu = EINA_TRUE; 1977 sd->context_menu = EINA_TRUE;
2139 sd->auto_save = EINA_TRUE; 1978 sd->auto_save = EINA_TRUE;
2140 sd->editable = EINA_TRUE; 1979 efl_text_interactive_editable_set(obj, EINA_TRUE);
2141 sd->sel_allow = EINA_TRUE; 1980 efl_text_interactive_selection_allowed_set(obj, EINA_TRUE);
2142 sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; 1981 sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE;
2143 sd->last.scroll = EINA_SIZE2D(0, 0); 1982 sd->last.scroll = EINA_SIZE2D(0, 0);
2144 sd->sel_handler_disabled = EINA_TRUE; 1983 sd->sel_handler_disabled = EINA_TRUE;
@@ -2167,13 +2006,10 @@ _efl_ui_text_efl_object_finalize(Eo *obj,
2167 CRI("Failed to set layout!"); 2006 CRI("Failed to set layout!");
2168 2007
2169 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY); 2008 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
2170 efl_event_callback_add(obj, EFL_EVENT_CALLBACK_ADD, _cb_added, NULL);
2171 efl_event_callback_add(obj, EFL_EVENT_CALLBACK_DEL, _cb_deleted, NULL);
2172 2009
2173 //TODO: complete the usage of the text theme 2010 //TODO: complete the usage of the text theme
2174 _update_text_theme(obj, sd); 2011 _update_text_theme(obj, sd);
2175 //efl_text_font_set(sd->text_obj, "Sans", 12); 2012 //efl_text_font_set(sd->text_obj, "Sans", 12);
2176 sd->single_line = !efl_text_multiline_get(sd->text_obj);
2177 2013
2178 efl_pack_table(sd->text_table, sd->text_obj, 0, 0, 1, 1); 2014 efl_pack_table(sd->text_table, sd->text_obj, 0, 0, 1, 1);
2179 efl_pack_table(sd->text_table, sd->text_guide_obj, 0, 0, 1, 1); 2015 efl_pack_table(sd->text_table, sd->text_guide_obj, 0, 0, 1, 1);
@@ -2190,13 +2026,15 @@ _efl_ui_text_efl_object_finalize(Eo *obj,
2190 (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 2026 (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2191 evas_object_size_hint_align_set 2027 evas_object_size_hint_align_set
2192 (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL); 2028 (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
2193 efl_event_callback_add(sd->text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER, 2029 efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER,
2194 _efl_ui_text_changed_user_cb, obj); 2030 _efl_ui_text_changed_user_cb, obj);
2195 efl_event_callback_add(sd->text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, 2031 efl_event_callback_add(sd->text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED,
2196 _efl_ui_text_changed_cb, obj); 2032 _efl_ui_text_changed_cb, obj);
2197 efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_TEXT_SELECTION_CHANGED, 2033 efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED,
2034 _efl_ui_text_selection_start_clear_cb, obj);
2035 efl_event_callback_add(sd->text_obj, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
2198 _efl_ui_text_selection_changed_cb, obj); 2036 _efl_ui_text_selection_changed_cb, obj);
2199 efl_event_callback_add(sd->text_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, 2037 efl_event_callback_add(efl_text_interactive_main_cursor_get(sd->text_obj), EFL_TEXT_CURSOR_EVENT_CHANGED,
2200 _efl_ui_text_cursor_changed_cb, obj); 2038 _efl_ui_text_cursor_changed_cb, obj);
2201 efl_event_callback_add(sd->text_obj, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, 2039 efl_event_callback_add(sd->text_obj, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED,
2202 _text_position_changed_cb, obj); 2040 _text_position_changed_cb, obj);
@@ -2216,12 +2054,12 @@ _efl_ui_text_efl_object_finalize(Eo *obj,
2216 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, 2054 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
2217 _text_size_changed_cb, obj); 2055 _text_size_changed_cb, obj);
2218 2056
2219 efl_ui_widget_focus_allow_set(obj, sd->editable); 2057 efl_ui_widget_focus_allow_set(obj, efl_text_interactive_editable_get(obj));
2220 2058
2221 efl_ui_text_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL); 2059 efl_input_text_input_panel_layout_set(obj, EFL_INPUT_TEXT_PANEL_LAYOUT_TYPE_NORMAL);
2222 efl_ui_text_input_panel_enabled_set(obj, EINA_TRUE); 2060 efl_input_text_input_panel_autoshow_set(obj, EINA_TRUE);
2223 efl_ui_text_prediction_allow_set(obj, EINA_TRUE); 2061 efl_input_text_predictable_set(obj, EINA_TRUE);
2224 efl_ui_text_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE); 2062 efl_input_text_input_hint_set(obj, EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE);
2225 2063
2226 _mirrored_set(obj, efl_ui_mirrored_get(obj)); 2064 _mirrored_set(obj, efl_ui_mirrored_get(obj));
2227 2065
@@ -2302,12 +2140,14 @@ _efl_ui_text_efl_object_destructor(Eo *obj, Efl_Ui_Text_Data *sd)
2302} 2140}
2303 2141
2304EOLIAN static void 2142EOLIAN static void
2305_efl_ui_text_password_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool password) 2143_efl_ui_text_efl_text_format_password_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool password)
2306{ 2144{
2307 password = !!password; 2145 password = !!password;
2308 2146
2309 if (sd->password == password) return; 2147 if (efl_text_password_get(obj) == password) return;
2310 sd->password = password; 2148 if (!efl_text_replacement_char_get(obj))
2149 efl_text_replacement_char_set(obj, ENTRY_PASSWORD_MASK_CHARACTER_UTF8);
2150 efl_text_password_set(sd->text_obj, password);
2311 2151
2312 elm_drop_target_del(obj, sd->drop_format, 2152 elm_drop_target_del(obj, sd->drop_format,
2313 _dnd_enter_cb, NULL, 2153 _dnd_enter_cb, NULL,
@@ -2316,33 +2156,27 @@ _efl_ui_text_password_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool password
2316 _dnd_drop_cb, NULL); 2156 _dnd_drop_cb, NULL);
2317 if (password) 2157 if (password)
2318 { 2158 {
2319 sd->single_line = EINA_TRUE; 2159 efl_text_multiline_set(obj, EINA_FALSE);
2320 sd->line_wrap = ELM_WRAP_NONE; 2160 sd->line_wrap = ELM_WRAP_NONE;
2321 efl_ui_text_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA)); 2161 efl_input_text_input_hint_set(obj, ((efl_input_text_input_hint_get(obj) & ~EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE) | EFL_INPUT_TEXT_HINTS_TYPE_SENSITIVE_DATA));
2322 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PASSWORD_TEXT); 2162 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PASSWORD_TEXT);
2323 } 2163 }
2324 else 2164 else
2325 { 2165 {
2166 efl_text_multiline_set(obj, EINA_TRUE);
2326 sd->drop_format = _get_drop_format(obj); 2167 sd->drop_format = _get_drop_format(obj);
2327 elm_drop_target_add(obj, sd->drop_format, 2168 elm_drop_target_add(obj, sd->drop_format,
2328 _dnd_enter_cb, NULL, 2169 _dnd_enter_cb, NULL,
2329 _dnd_leave_cb, NULL, 2170 _dnd_leave_cb, NULL,
2330 _dnd_pos_cb, NULL, 2171 _dnd_pos_cb, NULL,
2331 _dnd_drop_cb, NULL); 2172 _dnd_drop_cb, NULL);
2332 2173 efl_input_text_input_hint_set(obj, ((efl_input_text_input_hint_get(obj) | EFL_INPUT_TEXT_HINTS_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_HINTS_TYPE_SENSITIVE_DATA));
2333 efl_ui_text_input_hint_set(obj, ((sd->input_hints | ELM_INPUT_HINT_AUTO_COMPLETE) & ~ELM_INPUT_HINT_SENSITIVE_DATA));
2334 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY); 2174 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
2335 } 2175 }
2336 2176
2337 efl_ui_widget_theme_apply(obj); 2177 efl_ui_widget_theme_apply(obj);
2338} 2178}
2339 2179
2340EOLIAN static Eina_Bool
2341_efl_ui_text_password_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2342{
2343 return sd->password;
2344}
2345
2346static void 2180static void
2347_efl_ui_text_calc_force(Eo *obj, Efl_Ui_Text_Data *sd) 2181_efl_ui_text_calc_force(Eo *obj, Efl_Ui_Text_Data *sd)
2348{ 2182{
@@ -2352,14 +2186,14 @@ _efl_ui_text_calc_force(Eo *obj, Efl_Ui_Text_Data *sd)
2352} 2186}
2353 2187
2354static const char* 2188static const char*
2355_efl_ui_text_selection_get(const Eo *obj, Efl_Ui_Text_Data *sd) 2189_efl_ui_text_selection_get(const Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED)
2356{ 2190{
2357 Efl_Text_Cursor_Cursor *start_obj, *end_obj; 2191 Efl_Text_Cursor *start_obj, *end_obj;
2358 2192
2359 if ((sd->password)) return NULL; 2193 if ((efl_text_password_get(obj))) return NULL;
2360 2194
2361 efl_text_interactive_selection_cursors_get(obj, &start_obj, &end_obj); 2195 efl_text_interactive_selection_cursors_get(obj, &start_obj, &end_obj);
2362 return efl_canvas_text_range_text_get(obj, start_obj, end_obj); 2196 return efl_text_cursor_range_text_get(start_obj, end_obj);
2363} 2197}
2364 2198
2365EOLIAN static void 2199EOLIAN static void
@@ -2378,18 +2212,33 @@ _efl_ui_text_selection_handler_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Te
2378static void 2212static void
2379_efl_ui_text_entry_insert(Eo *obj, Efl_Ui_Text_Data *sd, const char *entry) 2213_efl_ui_text_entry_insert(Eo *obj, Efl_Ui_Text_Data *sd, const char *entry)
2380{ 2214{
2381 Efl_Text_Cursor_Cursor *cur_obj = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 2215 Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
2382 efl_text_cursor_text_insert(obj, cur_obj, entry); 2216 efl_text_cursor_text_insert(cur_obj, entry);
2383 sd->text_changed = EINA_TRUE; 2217 sd->text_changed = EINA_TRUE;
2384 efl_canvas_group_change(obj); 2218 efl_canvas_group_change(obj);
2385} 2219}
2386 2220
2387EOLIAN static void 2221EOLIAN static void
2222_efl_ui_text_cursor_add(Eo *obj, Efl_Ui_Text_Data *pd, Efl_Text_Cursor *cursor)
2223{
2224 efl_text_cursor_text_object_set(cursor, pd->text_obj, obj);
2225}
2226
2227EOLIAN static Efl_Text_Cursor *
2228_efl_ui_text_cursor_create(Eo *obj, Efl_Ui_Text_Data *pd)
2229{
2230 Eo* cursor = efl_add(EFL_TEXT_CURSOR_CLASS, pd->text_obj);
2231 efl_text_cursor_text_object_set(cursor, pd->text_obj, obj);
2232 return cursor;
2233}
2234
2235EOLIAN static void
2388_efl_ui_text_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool editable) 2236_efl_ui_text_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool editable)
2389{ 2237{
2238 if (efl_text_interactive_editable_get(obj) == editable) return;
2239
2390 efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable); 2240 efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable);
2391 if (sd->editable == editable) return; 2241
2392 sd->editable = editable;
2393 efl_ui_widget_theme_apply(obj); 2242 efl_ui_widget_theme_apply(obj);
2394 efl_ui_widget_focus_allow_set(obj, editable); 2243 efl_ui_widget_focus_allow_set(obj, editable);
2395 2244
@@ -2420,96 +2269,83 @@ _efl_ui_text_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Text_Data *sd, Ei
2420} 2269}
2421 2270
2422static void 2271static void
2423_efl_ui_text_select_none(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd) 2272_efl_ui_text_select_region_set(Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED, int start, int end)
2424{ 2273{
2425 if ((sd->password)) return; 2274 Efl_Text_Cursor *sel_start, *sel_end;
2426 if (sd->sel_mode)
2427 {
2428 sd->sel_mode = EINA_FALSE;
2429 if (!_elm_config->desktop_entry)
2430 edje_object_part_text_select_allow_set
2431 (sd->entry_edje, "efl.text", EINA_FALSE);
2432 edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
2433 }
2434 if (sd->have_selection)
2435 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTION_CLEARED, NULL);
2436 2275
2437 sd->have_selection = EINA_FALSE; 2276 if (efl_text_password_get(obj)) return;
2438 _edje_signal_emit(sd, "selection,cleared", "efl.text");
2439 efl_text_interactive_select_none(sd->text_obj);
2440
2441 _hide_selection_handler(obj);
2442}
2443
2444static void
2445_efl_ui_text_select_region_set(Eo *obj, Efl_Ui_Text_Data *sd, int start, int end)
2446{
2447 Efl_Text_Cursor_Cursor *sel_start, *sel_end;
2448
2449 if ((sd->password)) return;
2450 2277
2451 efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end); 2278 efl_text_interactive_selection_cursors_get(obj, &sel_start, &sel_end);
2452 2279
2453 efl_text_cursor_position_set(obj, sel_start, start); 2280 efl_text_cursor_position_set(sel_start, start);
2454 efl_text_cursor_position_set(obj, sel_end, end); 2281 efl_text_cursor_position_set(sel_end, end);
2455}
2456
2457EOLIAN static void
2458_efl_ui_text_cursor_selection_end(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2459{
2460 edje_object_part_text_select_extend(sd->entry_edje, "efl.text");
2461} 2282}
2462 2283
2463EOLIAN static void 2284EOLIAN static void
2464_efl_ui_text_selection_cut(Eo *obj, Efl_Ui_Text_Data *sd) 2285_efl_ui_text_selection_cut(Eo *obj, Efl_Ui_Text_Data *sd)
2465{ 2286{
2466 if ((sd->password)) return; 2287 Efl_Text_Cursor *start, *end;
2467 _cut_cb(obj); 2288 Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
2468} 2289 char *tmp;
2290 int end_pos, start_pos;
2469 2291
2470EOLIAN static void 2292 /* Store it */
2471_efl_ui_text_selection_copy(Eo *obj, Efl_Ui_Text_Data *sd) 2293 sd->sel_mode = EINA_FALSE;
2472{ 2294 if (!_elm_config->desktop_entry)
2473 if ((sd->password)) return; 2295 edje_object_part_text_select_allow_set
2474 _copy_cb(obj); 2296 (sd->entry_edje, "efl.text", EINA_FALSE);
2475} 2297 edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
2476 2298
2477EOLIAN static void 2299 if (!_elm_config->desktop_entry)
2478_efl_ui_text_selection_paste(Eo *obj, Efl_Ui_Text_Data *sd) 2300 elm_widget_scroll_hold_pop(obj);
2479{ 2301
2480 if ((sd->password)) return; 2302 /*In password mode, cut will remove text only*/
2481 _paste_cb(obj); 2303 if (!efl_text_password_get(obj))
2304 _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
2305 efl_text_interactive_selection_cursors_get(obj, &start, &end);
2306
2307 start_pos = efl_text_cursor_position_get(start);
2308 end_pos = efl_text_cursor_position_get(end);
2309 tmp = efl_text_cursor_range_text_get(start, end);
2310 info.insert = EINA_FALSE;
2311 info.position = start_pos;
2312 info.length = end_pos - start_pos;
2313 info.content = tmp;
2314 efl_text_cursor_range_delete(start, end);
2315 efl_event_callback_call(obj, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
2316 free(tmp);
2317 tmp = NULL;
2318 efl_text_interactive_all_unselect(obj);
2319
2320 efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_SELECTION_CUT, NULL);
2482} 2321}
2483 2322
2484EOLIAN static void 2323EOLIAN static void
2485_efl_ui_text_context_menu_clear(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd) 2324_efl_ui_text_selection_copy(Eo *obj, Efl_Ui_Text_Data *sd)
2486{ 2325{
2487 Elm_Entry_Context_Menu_Item *it; 2326 if (efl_text_password_get(obj)) return;
2488 2327
2489 EINA_LIST_FREE(sd->items, it) 2328 sd->sel_mode = EINA_FALSE;
2329 if (!_elm_config->desktop_entry)
2490 { 2330 {
2491 eina_stringshare_del(it->label); 2331 edje_object_part_text_select_allow_set
2492 eina_stringshare_del(it->icon_file); 2332 (sd->entry_edje, "efl.text", EINA_FALSE);
2493 eina_stringshare_del(it->icon_group); 2333 edje_object_signal_emit(sd->entry_edje, "efl,state,select,off", "efl");
2494 free(it); 2334 elm_widget_scroll_hold_pop(obj);
2495 } 2335 }
2336 _selection_store(EFL_UI_SELECTION_TYPE_CLIPBOARD, obj);
2337 efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_SELECTION_COPY, NULL);
2496} 2338}
2497 2339
2498EOLIAN static void 2340EOLIAN static void
2499_efl_ui_text_context_menu_item_add(Eo *obj, Efl_Ui_Text_Data *sd, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) 2341_efl_ui_text_selection_paste(Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED)
2500{ 2342{
2501 Elm_Entry_Context_Menu_Item *it; 2343 Efl_Ui_Selection_Format formats = EFL_UI_SELECTION_FORMAT_TEXT | EFL_UI_SELECTION_FORMAT_MARKUP;
2502 2344
2503 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item)); 2345 efl_ui_selection_get(obj, EFL_UI_SELECTION_TYPE_CLIPBOARD, formats,
2504 if (!it) return; 2346 NULL, _selection_data_cb, NULL, 1);
2505 2347
2506 sd->items = eina_list_append(sd->items, it); 2348 efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_SELECTION_PASTE, NULL);
2507 it->obj = obj;
2508 it->label = eina_stringshare_add(label);
2509 it->icon_file = eina_stringshare_add(icon_file);
2510 it->icon_type = icon_type;
2511 it->func = func;
2512 it->data = (void *)data;
2513} 2349}
2514 2350
2515EOLIAN static void 2351EOLIAN static void
@@ -2629,198 +2465,6 @@ _efl_ui_text_scrollable_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2629 return sd->scroll; 2465 return sd->scroll;
2630} 2466}
2631 2467
2632EOLIAN static void
2633_efl_ui_text_input_panel_layout_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Input_Panel_Layout layout)
2634{
2635 sd->input_panel_layout = layout;
2636
2637 edje_object_part_text_input_panel_layout_set
2638 (sd->entry_edje, "efl.text", (Edje_Input_Panel_Layout)layout);
2639
2640 if (layout == ELM_INPUT_PANEL_LAYOUT_PASSWORD)
2641 efl_ui_text_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
2642 else if (layout == ELM_INPUT_PANEL_LAYOUT_TERMINAL)
2643 efl_ui_text_input_hint_set(obj, (sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE));
2644}
2645
2646EOLIAN static Elm_Input_Panel_Layout
2647_efl_ui_text_input_panel_layout_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2648{
2649 return sd->input_panel_layout;
2650}
2651
2652EOLIAN static void
2653_efl_ui_text_input_panel_layout_variation_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, int variation)
2654{
2655 sd->input_panel_layout_variation = variation;
2656
2657 edje_object_part_text_input_panel_layout_variation_set
2658 (sd->entry_edje, "efl.text", variation);
2659}
2660
2661EOLIAN static int
2662_efl_ui_text_input_panel_layout_variation_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2663{
2664 return sd->input_panel_layout_variation;
2665}
2666
2667EOLIAN static void
2668_efl_ui_text_autocapital_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Autocapital_Type autocapital_type)
2669{
2670 sd->autocapital_type = autocapital_type;
2671 edje_object_part_text_autocapital_type_set
2672 (sd->entry_edje, "efl.text", (Edje_Text_Autocapital_Type)autocapital_type);
2673}
2674
2675EOLIAN static Elm_Autocapital_Type
2676_efl_ui_text_autocapital_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2677{
2678 return sd->autocapital_type;
2679}
2680
2681EOLIAN static void
2682_efl_ui_text_prediction_allow_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Eina_Bool prediction)
2683{
2684 sd->prediction_allow = prediction;
2685 edje_object_part_text_prediction_allow_set
2686 (sd->entry_edje, "efl.text", prediction);
2687}
2688
2689EOLIAN static Eina_Bool
2690_efl_ui_text_prediction_allow_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2691{
2692 return sd->prediction_allow;
2693}
2694
2695EOLIAN static void
2696_efl_ui_text_input_hint_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Input_Hints hints)
2697{
2698 sd->input_hints = hints;
2699
2700 edje_object_part_text_input_hint_set
2701 (sd->entry_edje, "efl.text", (Edje_Input_Hints)hints);
2702}
2703
2704EOLIAN static Elm_Input_Hints
2705_efl_ui_text_input_hint_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2706{
2707 return sd->input_hints;
2708}
2709
2710EOLIAN static void
2711_efl_ui_text_input_panel_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Eina_Bool enabled)
2712{
2713 sd->input_panel_enable = enabled;
2714 edje_object_part_text_input_panel_enabled_set
2715 (sd->entry_edje, "efl.text", enabled);
2716}
2717
2718EOLIAN static Eina_Bool
2719_efl_ui_text_input_panel_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2720{
2721 return sd->input_panel_enable;
2722}
2723
2724EOLIAN static void
2725_efl_ui_text_input_panel_show(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2726{
2727 edje_object_part_text_input_panel_show(sd->entry_edje, "efl.text");
2728}
2729
2730EOLIAN static void
2731_efl_ui_text_input_panel_hide(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2732{
2733
2734 edje_object_part_text_input_panel_hide(sd->entry_edje, "efl.text");
2735}
2736
2737EOLIAN static void
2738_efl_ui_text_input_panel_language_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Input_Panel_Lang lang)
2739{
2740 sd->input_panel_lang = lang;
2741 edje_object_part_text_input_panel_language_set
2742 (sd->entry_edje, "efl.text", (Edje_Input_Panel_Lang)lang);
2743}
2744
2745EOLIAN static Elm_Input_Panel_Lang
2746_efl_ui_text_input_panel_language_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2747{
2748 return sd->input_panel_lang;
2749}
2750
2751EOLIAN static void
2752_efl_ui_text_input_panel_imdata_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const void *data, int len)
2753{
2754 free(sd->input_panel_imdata);
2755
2756 sd->input_panel_imdata = calloc(1, len);
2757 sd->input_panel_imdata_len = len;
2758 memcpy(sd->input_panel_imdata, data, len);
2759
2760 edje_object_part_text_input_panel_imdata_set
2761 (sd->entry_edje, "efl.text", sd->input_panel_imdata,
2762 sd->input_panel_imdata_len);
2763}
2764
2765EOLIAN static void
2766_efl_ui_text_input_panel_imdata_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, void *data, int *len)
2767{
2768 edje_object_part_text_input_panel_imdata_get
2769 (sd->entry_edje, "efl.text", data, len);
2770}
2771
2772EOLIAN static void
2773_efl_ui_text_input_panel_return_key_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Elm_Input_Panel_Return_Key_Type return_key_type)
2774{
2775 sd->input_panel_return_key_type = return_key_type;
2776
2777 edje_object_part_text_input_panel_return_key_type_set
2778 (sd->entry_edje, "efl.text", (Edje_Input_Panel_Return_Key_Type)return_key_type);
2779}
2780
2781EOLIAN static Elm_Input_Panel_Return_Key_Type
2782_efl_ui_text_input_panel_return_key_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2783{
2784 return sd->input_panel_return_key_type;
2785}
2786
2787EOLIAN static void
2788_efl_ui_text_input_panel_return_key_disabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Eina_Bool disabled)
2789{
2790 sd->input_panel_return_key_disabled = disabled;
2791
2792 edje_object_part_text_input_panel_return_key_disabled_set
2793 (sd->entry_edje, "efl.text", disabled);
2794}
2795
2796EOLIAN static Eina_Bool
2797_efl_ui_text_input_panel_return_key_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2798{
2799 return sd->input_panel_return_key_disabled;
2800}
2801
2802EOLIAN static void
2803_efl_ui_text_input_panel_return_key_autoenabled_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool enabled)
2804{
2805 sd->auto_return_key = enabled;
2806 _return_key_enabled_check(obj);
2807}
2808
2809EOLIAN static void
2810_efl_ui_text_input_panel_show_on_demand_set(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, Eina_Bool ondemand)
2811{
2812 sd->input_panel_show_on_demand = ondemand;
2813
2814 edje_object_part_text_input_panel_show_on_demand_set
2815 (sd->entry_edje, "efl.text", ondemand);
2816}
2817
2818EOLIAN static Eina_Bool
2819_efl_ui_text_input_panel_show_on_demand_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
2820{
2821 return sd->input_panel_show_on_demand;
2822}
2823
2824EOLIAN static Eina_Bool 2468EOLIAN static Eina_Bool
2825_efl_ui_text_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, Efl_Ui_Activate act) 2469_efl_ui_text_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, Efl_Ui_Activate act)
2826{ 2470{
@@ -2832,7 +2476,7 @@ _efl_ui_text_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Text_Data *_pd EIN
2832 !evas_object_freeze_events_get(obj)) 2476 !evas_object_freeze_events_get(obj))
2833 { 2477 {
2834 efl_event_callback_call(obj, EFL_INPUT_EVENT_CLICKED, NULL); 2478 efl_event_callback_call(obj, EFL_INPUT_EVENT_CLICKED, NULL);
2835 if (sd->editable && sd->input_panel_enable) 2479 if (efl_text_interactive_editable_get(obj) && efl_input_text_input_panel_autoshow_get(obj))
2836 edje_object_part_text_input_panel_show(sd->entry_edje, "efl.text"); 2480 edje_object_part_text_input_panel_show(sd->entry_edje, "efl.text");
2837 } 2481 }
2838 return EINA_TRUE; 2482 return EINA_TRUE;
@@ -2848,7 +2492,7 @@ _efl_ui_text_efl_access_text_character_get(const Eo *obj, Efl_Ui_Text_Data *_pd
2848 Eina_Unicode ret = 0; 2492 Eina_Unicode ret = 0;
2849 if (offset < 0) return ret; 2493 if (offset < 0) return ret;
2850 2494
2851 if (_pd->password) return ENTRY_PASSWORD_MASK_CHARACTER; 2495 if (efl_text_password_get(obj)) return ENTRY_PASSWORD_MASK_CHARACTER;
2852 2496
2853 txt = efl_text_get(obj); 2497 txt = efl_text_get(obj);
2854 if (!txt) return ret; 2498 if (!txt) return ret;
@@ -2933,7 +2577,7 @@ _efl_ui_text_efl_access_text_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Text_D
2933 evas_textblock_cursor_free(cur); 2577 evas_textblock_cursor_free(cur);
2934 evas_textblock_cursor_free(cur2); 2578 evas_textblock_cursor_free(cur2);
2935 2579
2936 if (ret && pd->password) 2580 if (ret && efl_text_password_get(obj))
2937 { 2581 {
2938 int i = 0; 2582 int i = 0;
2939 while (ret[i] != '\0') 2583 while (ret[i] != '\0')
@@ -2972,7 +2616,7 @@ _efl_ui_text_efl_access_text_access_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_T
2972 evas_textblock_cursor_free(cur); 2616 evas_textblock_cursor_free(cur);
2973 evas_textblock_cursor_free(cur2); 2617 evas_textblock_cursor_free(cur2);
2974 2618
2975 if (ret && pd->password) 2619 if (ret && efl_text_password_get(obj))
2976 { 2620 {
2977 int i = 0; 2621 int i = 0;
2978 while (ret[i] != '\0') 2622 while (ret[i] != '\0')
@@ -2990,13 +2634,13 @@ fail:
2990EOLIAN static int 2634EOLIAN static int
2991_efl_ui_text_efl_access_text_caret_offset_get(const Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED) 2635_efl_ui_text_efl_access_text_caret_offset_get(const Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED)
2992{ 2636{
2993 return efl_text_cursor_position_get(obj, efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN)); 2637 return efl_text_cursor_position_get(efl_text_interactive_main_cursor_get(obj));
2994} 2638}
2995 2639
2996EOLIAN static Eina_Bool 2640EOLIAN static Eina_Bool
2997_efl_ui_text_efl_access_text_caret_offset_set(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int offset) 2641_efl_ui_text_efl_access_text_caret_offset_set(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int offset)
2998{ 2642{
2999 efl_text_cursor_position_set(obj, efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN), offset); 2643 efl_text_cursor_position_set(efl_text_interactive_main_cursor_get(obj), offset);
3000 return EINA_TRUE; 2644 return EINA_TRUE;
3001} 2645}
3002 2646
@@ -3028,7 +2672,7 @@ EOLIAN static Eina_Bool
3028_efl_ui_text_efl_access_text_selection_remove(Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED, int selection_number) 2672_efl_ui_text_efl_access_text_selection_remove(Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED, int selection_number)
3029{ 2673{
3030 if (selection_number != 0) return EINA_FALSE; 2674 if (selection_number != 0) return EINA_FALSE;
3031 _efl_ui_text_select_none(obj, pd); 2675 efl_text_interactive_all_unselect(obj);
3032 return EINA_TRUE; 2676 return EINA_TRUE;
3033} 2677}
3034 2678
@@ -3159,13 +2803,12 @@ _efl_ui_text_efl_access_text_range_extents_get(const Eo *obj, Efl_Ui_Text_Data *
3159} 2803}
3160 2804
3161static Efl_Access_Text_Attribute* 2805static Efl_Access_Text_Attribute*
3162_textblock_node_format_to_atspi_text_attr(const Eo *obj, 2806_textblock_node_format_to_atspi_text_attr(Efl_Text_Attribute_Handle *annotation)
3163 Efl_Text_Annotate_Annotation *annotation)
3164{ 2807{
3165 Efl_Access_Text_Attribute *ret; 2808 Efl_Access_Text_Attribute *ret;
3166 const char *txt; 2809 const char *txt;
3167 2810
3168 txt = efl_text_annotation_get(obj, annotation); 2811 txt = efl_text_attribute_factory_attribute_get(annotation);
3169 if (!txt) return NULL; 2812 if (!txt) return NULL;
3170 2813
3171 ret = calloc(1, sizeof(Efl_Access_Text_Attribute)); 2814 ret = calloc(1, sizeof(Efl_Access_Text_Attribute));
@@ -3181,34 +2824,35 @@ _textblock_node_format_to_atspi_text_attr(const Eo *obj,
3181EOLIAN static Eina_Bool 2824EOLIAN static Eina_Bool
3182_efl_ui_text_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const char *attr_name EINA_UNUSED, int *start_offset, int *end_offset, char **value) 2825_efl_ui_text_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, const char *attr_name EINA_UNUSED, int *start_offset, int *end_offset, char **value)
3183{ 2826{
3184 Evas_Textblock_Cursor *cur1, *cur2; 2827 Efl_Text_Cursor *cur1, *cur2;
3185 Efl_Access_Text_Attribute *attr; 2828 Efl_Access_Text_Attribute *attr;
3186 Eina_Iterator *annotations; 2829 Eina_Iterator *annotations;
3187 Efl_Text_Annotate_Annotation *an; 2830 Efl_Text_Attribute_Handle *an;
3188 2831
3189 cur1 = evas_object_textblock_cursor_new(obj); 2832 Eo *mobj = (Eo *)obj;
2833 cur1 = efl_ui_text_cursor_create(mobj);
3190 if (!cur1) return EINA_FALSE; 2834 if (!cur1) return EINA_FALSE;
3191 2835
3192 cur2 = evas_object_textblock_cursor_new(obj); 2836 cur2 = efl_ui_text_cursor_create(mobj);
3193 if (!cur2) 2837 if (!cur2)
3194 { 2838 {
3195 evas_textblock_cursor_free(cur1); 2839 efl_del(cur1);
3196 return EINA_FALSE; 2840 return EINA_FALSE;
3197 } 2841 }
3198 2842
3199 evas_textblock_cursor_pos_set(cur1, *start_offset); 2843 efl_text_cursor_position_set(cur1, *start_offset);
3200 evas_textblock_cursor_pos_set(cur2, *end_offset); 2844 efl_text_cursor_position_set(cur2, *end_offset);
3201 2845
3202 annotations = efl_text_range_annotations_get(obj, cur1, cur2); 2846 annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2);
3203 2847
3204 evas_textblock_cursor_free(cur1); 2848 efl_del(cur1);
3205 evas_textblock_cursor_free(cur2); 2849 efl_del(cur2);
3206 2850
3207 if (!annotations) return EINA_FALSE; 2851 if (!annotations) return EINA_FALSE;
3208 2852
3209 EINA_ITERATOR_FOREACH(annotations, an) 2853 EINA_ITERATOR_FOREACH(annotations, an)
3210 { 2854 {
3211 attr = _textblock_node_format_to_atspi_text_attr(obj, an); 2855 attr = _textblock_node_format_to_atspi_text_attr(an);
3212 if (!attr) continue; 2856 if (!attr) continue;
3213 if (!strcmp(attr->name, attr_name)) 2857 if (!strcmp(attr->name, attr_name))
3214 { 2858 {
@@ -3226,35 +2870,35 @@ _efl_ui_text_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Text_Data *_pd
3226EOLIAN static Eina_List* 2870EOLIAN static Eina_List*
3227_efl_ui_text_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED, int *start_offset, int *end_offset) 2871_efl_ui_text_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED, int *start_offset, int *end_offset)
3228{ 2872{
3229 Evas_Textblock_Cursor *cur1, *cur2; 2873 Efl_Text_Cursor *cur1, *cur2;
3230 Eina_List *ret = NULL; 2874 Eina_List *ret = NULL;
3231 Efl_Access_Text_Attribute *attr; 2875 Efl_Access_Text_Attribute *attr;
3232 Eina_Iterator *annotations; 2876 Eina_Iterator *annotations;
3233 Efl_Text_Annotate_Annotation *an; 2877 Efl_Text_Attribute_Handle *an;
3234 2878 Eo *mobj = (Eo *)obj;
3235 cur1 = evas_object_textblock_cursor_new(obj); 2879 cur1 = efl_ui_text_cursor_create(mobj);
3236 if (!cur1) return NULL; 2880 if (!cur1) return NULL;
3237 2881
3238 cur2 = evas_object_textblock_cursor_new(obj); 2882 cur2 = efl_ui_text_cursor_create(mobj);
3239 if (!cur2) 2883 if (!cur2)
3240 { 2884 {
3241 evas_textblock_cursor_free(cur1); 2885 efl_del(cur1);
3242 return NULL; 2886 return NULL;
3243 } 2887 }
3244 2888
3245 evas_textblock_cursor_pos_set(cur1, *start_offset); 2889 efl_text_cursor_position_set(cur1, *start_offset);
3246 evas_textblock_cursor_pos_set(cur2, *end_offset); 2890 efl_text_cursor_position_set(cur2, *end_offset);
3247 2891
3248 annotations = efl_text_range_annotations_get(obj, cur1, cur2); 2892 annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2);
3249 2893
3250 evas_textblock_cursor_free(cur1); 2894 efl_del(cur1);
3251 evas_textblock_cursor_free(cur2); 2895 efl_del(cur2);
3252 2896
3253 if (!annotations) return NULL; 2897 if (!annotations) return NULL;
3254 2898
3255 EINA_ITERATOR_FOREACH(annotations, an) 2899 EINA_ITERATOR_FOREACH(annotations, an)
3256 { 2900 {
3257 attr = _textblock_node_format_to_atspi_text_attr(obj, an); 2901 attr = _textblock_node_format_to_atspi_text_attr(an);
3258 if (!attr) continue; 2902 if (!attr) continue;
3259 ret = eina_list_append(ret, attr); 2903 ret = eina_list_append(ret, attr);
3260 } 2904 }
@@ -3268,23 +2912,23 @@ _efl_ui_text_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Text_D
3268{ 2912{
3269 Eina_List *ret = NULL; 2913 Eina_List *ret = NULL;
3270 Efl_Access_Text_Attribute *attr; 2914 Efl_Access_Text_Attribute *attr;
3271 Efl_Text_Cursor_Cursor *start, *end; 2915 Efl_Text_Cursor *start, *end;
3272 Eina_Iterator *annotations; 2916 Eina_Iterator *annotations;
3273 Efl_Text_Annotate_Annotation *an; 2917 Efl_Text_Attribute_Handle *an;
3274 2918
3275 /* Retrieve all annotations in the text. */ 2919 /* Retrieve all annotations in the text. */
3276 Eo *mobj = (Eo *)obj; /* XXX const */ 2920 Eo *mobj = (Eo *)obj; /* XXX const */
3277 start = efl_text_cursor_new(mobj); 2921 start = efl_ui_text_cursor_create(mobj);
3278 end = efl_text_cursor_new(mobj); 2922 end = efl_ui_text_cursor_create(mobj);
3279 2923
3280 efl_text_cursor_paragraph_first(mobj, start); 2924 efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
3281 efl_text_cursor_paragraph_last(mobj, end); 2925 efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
3282 2926
3283 annotations = efl_text_range_annotations_get(obj, start, end); 2927 annotations = efl_text_attribute_factory_range_attributes_get(start, end);
3284 2928
3285 EINA_ITERATOR_FOREACH(annotations, an) 2929 EINA_ITERATOR_FOREACH(annotations, an)
3286 { 2930 {
3287 attr = _textblock_node_format_to_atspi_text_attr(obj, an); 2931 attr = _textblock_node_format_to_atspi_text_attr(an);
3288 if (!attr) continue; 2932 if (!attr) continue;
3289 ret = eina_list_append(ret, attr); 2933 ret = eina_list_append(ret, attr);
3290 } 2934 }
@@ -3303,8 +2947,8 @@ _efl_ui_text_efl_access_editable_text_text_content_set(Eo *obj, Efl_Ui_Text_Data
3303EOLIAN static Eina_Bool 2947EOLIAN static Eina_Bool
3304_efl_ui_text_efl_access_editable_text_insert(Eo *obj, Efl_Ui_Text_Data *pd, const char *string, int position) 2948_efl_ui_text_efl_access_editable_text_insert(Eo *obj, Efl_Ui_Text_Data *pd, const char *string, int position)
3305{ 2949{
3306 Efl_Text_Cursor_Cursor *cur_obj = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 2950 Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
3307 efl_text_cursor_position_set(obj, cur_obj, position); 2951 efl_text_cursor_position_set(cur_obj, position);
3308 _efl_ui_text_entry_insert(obj, pd, string); 2952 _efl_ui_text_entry_insert(obj, pd, string);
3309 2953
3310 return EINA_TRUE; 2954 return EINA_TRUE;
@@ -3353,8 +2997,8 @@ _efl_ui_text_efl_access_editable_text_delete(Eo *obj, Efl_Ui_Text_Data *pd, int
3353EOLIAN static Eina_Bool 2997EOLIAN static Eina_Bool
3354_efl_ui_text_efl_access_editable_text_paste(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int position) 2998_efl_ui_text_efl_access_editable_text_paste(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED, int position)
3355{ 2999{
3356 Efl_Text_Cursor_Cursor *cur_obj = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN); 3000 Efl_Text_Cursor *cur_obj = efl_text_interactive_main_cursor_get(obj);
3357 efl_text_cursor_position_set(obj, cur_obj, position); 3001 efl_text_cursor_position_set(cur_obj, position);
3358 efl_ui_text_selection_paste(obj); 3002 efl_ui_text_selection_paste(obj);
3359 return EINA_TRUE; 3003 return EINA_TRUE;
3360} 3004}
@@ -3389,13 +3033,6 @@ _efl_ui_text_efl_access_object_i18n_name_get(const Eo *obj, Efl_Ui_Text_Data *pd
3389 return ret; 3033 return ret;
3390} 3034}
3391 3035
3392EOLIAN static Efl_Text_Cursor_Cursor *
3393_efl_ui_text_cursor_new(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd EINA_UNUSED)
3394{
3395 Eo *text_obj = sd->text_obj;
3396 return efl_text_cursor_new(text_obj);
3397}
3398
3399static void 3036static void
3400_edje_signal_emit(Efl_Ui_Text_Data *sd, const char *sig, const char *src) 3037_edje_signal_emit(Efl_Ui_Text_Data *sd, const char *sig, const char *src)
3401{ 3038{
@@ -3459,11 +3096,11 @@ static void
3459_update_text_cursors(Eo *obj) 3096_update_text_cursors(Eo *obj)
3460{ 3097{
3461 Evas_Coord xx, yy, ww, hh; 3098 Evas_Coord xx, yy, ww, hh;
3462 Evas_Coord xx2, yy2;
3463 Eina_Position2D off; 3099 Eina_Position2D off;
3464 Eina_Bool bidi_cursor;
3465 Eo *text_obj; 3100 Eo *text_obj;
3466 3101 Eina_Rect rc_tmp1;
3102 Eina_Rect rc_tmp2;
3103 Eina_Bool bidi_cursor;
3467 3104
3468 EFL_UI_TEXT_DATA_GET(obj, sd); 3105 EFL_UI_TEXT_DATA_GET(obj, sd);
3469 if (!sd->deferred_decoration_cursor) return; 3106 if (!sd->deferred_decoration_cursor) return;
@@ -3473,10 +3110,13 @@ _update_text_cursors(Eo *obj)
3473 3110
3474 xx = yy = ww = hh = -1; 3111 xx = yy = ww = hh = -1;
3475 off =_decoration_calc_offset(sd); 3112 off =_decoration_calc_offset(sd);
3476 bidi_cursor = efl_text_cursor_geometry_get(obj, 3113 rc_tmp1 = efl_text_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), EFL_TEXT_CURSOR_TYPE_BEFORE);
3477 efl_text_cursor_get(text_obj, EFL_TEXT_CURSOR_GET_TYPE_MAIN), 3114 bidi_cursor = efl_text_cursor_lower_cursor_geometry_get(efl_text_interactive_main_cursor_get(text_obj), &rc_tmp2);
3478 EFL_TEXT_CURSOR_TYPE_BEFORE, &xx, &yy, &ww, &hh, &xx2, &yy2, 3115 xx = rc_tmp1.x;
3479 NULL, NULL); 3116 yy = rc_tmp1.y;
3117 ww = rc_tmp1.w;
3118 hh = rc_tmp1.h;
3119
3480 if (ww < 1) ww = 1; 3120 if (ww < 1) ww = 1;
3481 if (hh < 1) hh = 1; 3121 if (hh < 1) hh = 1;
3482 if (sd->cursor) 3122 if (sd->cursor)
@@ -3488,7 +3128,7 @@ _update_text_cursors(Eo *obj)
3488 if (bidi_cursor) 3128 if (bidi_cursor)
3489 { 3129 {
3490 evas_object_geometry_set(sd->cursor_bidi, 3130 evas_object_geometry_set(sd->cursor_bidi,
3491 off.x + xx2, off.y + yy2 + (hh / 2), 3131 off.x + rc_tmp2.x, off.y + rc_tmp2.y + (hh / 2),
3492 ww, hh / 2); 3132 ww, hh / 2);
3493 evas_object_resize(sd->cursor, ww, hh / 2); 3133 evas_object_resize(sd->cursor, ww, hh / 2);
3494 evas_object_show(sd->cursor_bidi); 3134 evas_object_show(sd->cursor_bidi);
@@ -3521,7 +3161,7 @@ static void
3521_update_text_selection(Eo *obj, Eo *text_obj) 3161_update_text_selection(Eo *obj, Eo *text_obj)
3522{ 3162{
3523 Eina_Position2D off; 3163 Eina_Position2D off;
3524 Efl_Text_Cursor_Cursor *sel_start, *sel_end; 3164 Efl_Text_Cursor *sel_start, *sel_end;
3525 3165
3526 Eina_List *l; 3166 Eina_List *l;
3527 Eina_Iterator *range; 3167 Eina_Iterator *range;
@@ -3537,8 +3177,7 @@ _update_text_selection(Eo *obj, Eo *text_obj)
3537 3177
3538 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end); 3178 efl_text_interactive_selection_cursors_get(text_obj, &sel_start, &sel_end);
3539 3179
3540 range = efl_canvas_text_range_simple_geometry_get(text_obj, 3180 range = efl_text_cursor_range_geometry_get(sel_start, sel_end);
3541 sel_start, sel_end);
3542 3181
3543 l = sd->sel; 3182 l = sd->sel;
3544 EINA_ITERATOR_FOREACH(range, r) 3183 EINA_ITERATOR_FOREACH(range, r)
@@ -3643,20 +3282,20 @@ _anchor_format_parse(const char *item)
3643} 3282}
3644 3283
3645static Anchor * 3284static Anchor *
3646_anchor_get(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Text_Annotate_Annotation *an) 3285_anchor_get(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Text_Attribute_Handle *an)
3647{ 3286{
3648 Anchor *anc; 3287 Anchor *anc;
3649 Eina_List *i; 3288 Eina_List *i;
3650 const char *str; 3289 const char *str;
3651 3290
3652 str = efl_text_annotation_get(obj, an); 3291 str = efl_text_attribute_factory_attribute_get(an);
3653 3292
3654 EINA_LIST_FOREACH(sd->anchors, i, anc) 3293 EINA_LIST_FOREACH(sd->anchors, i, anc)
3655 { 3294 {
3656 if (anc->annotation == an) break; 3295 if (anc->annotation == an) break;
3657 } 3296 }
3658 3297
3659 if (!anc && (efl_text_annotation_is_item(obj, an) || !strncmp(str, "a ", 2))) 3298 if (!anc && (efl_text_attribute_factory_attribute_is_item(an) || !strncmp(str, "a ", 2)))
3660 { 3299 {
3661 const char *p; 3300 const char *p;
3662 3301
@@ -3665,7 +3304,7 @@ _anchor_get(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Text_Annotate_Annotation *an)
3665 { 3304 {
3666 anc->obj = obj; 3305 anc->obj = obj;
3667 anc->annotation = an; 3306 anc->annotation = an;
3668 anc->item = efl_text_annotation_is_item(obj, an); 3307 anc->item = efl_text_attribute_factory_attribute_is_item(an);
3669 p = strstr(str, "href="); 3308 p = strstr(str, "href=");
3670 if (p) 3309 if (p)
3671 { 3310 {
@@ -3688,28 +3327,26 @@ _anchors_update(Eo *obj, Efl_Ui_Text_Data *sd)
3688 Evas_Object *smart, *clip; 3327 Evas_Object *smart, *clip;
3689 Eina_Iterator *it; 3328 Eina_Iterator *it;
3690 Eina_Position2D off; 3329 Eina_Position2D off;
3691 Efl_Text_Cursor_Cursor *start, *end; 3330 Efl_Text_Cursor *start, *end;
3692 Efl_Text_Annotate_Annotation *an; 3331 Efl_Text_Attribute_Handle *an;
3693 Eina_List *i, *ii; 3332 Eina_List *i, *ii;
3694 Anchor *anc; 3333 Anchor *anc;
3695 3334
3696 if (!sd->deferred_decoration_anchor) return; 3335 if (!sd->deferred_decoration_anchor) return;
3697 sd->deferred_decoration_anchor = EINA_FALSE; 3336 sd->deferred_decoration_anchor = EINA_FALSE;
3698 3337
3699 if (sd->anchors_updated) return;
3700
3701 sd->gen++; 3338 sd->gen++;
3702 3339
3703 start = efl_text_cursor_new(sd->text_obj); 3340 start = efl_canvas_text_cursor_create(sd->text_obj);
3704 end = efl_text_cursor_new(sd->text_obj); 3341 end = efl_canvas_text_cursor_create(sd->text_obj);
3705 3342
3706 /* Retrieve all annotations in the text. */ 3343 /* Retrieve all annotations in the text. */
3707 efl_text_cursor_paragraph_first(obj, start); 3344 efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
3708 efl_text_cursor_paragraph_last(obj, end); 3345 efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
3709 3346
3710 it = efl_text_range_annotations_get(obj, start, end); 3347 it = efl_text_attribute_factory_range_attributes_get(start, end);
3711 efl_text_cursor_free(sd->text_obj, start); 3348 efl_del(start);
3712 efl_text_cursor_free(sd->text_obj, end); 3349 efl_del(end);
3713 3350
3714 smart = evas_object_smart_parent_get(obj); 3351 smart = evas_object_smart_parent_get(obj);
3715 clip = evas_object_clip_get(sd->text_obj); 3352 clip = evas_object_clip_get(sd->text_obj);
@@ -3749,8 +3386,7 @@ _anchors_update(Eo *obj, Efl_Ui_Text_Data *sd)
3749 } 3386 }
3750 3387
3751 rect = eina_list_data_get(anc->rects); 3388 rect = eina_list_data_get(anc->rects);
3752 efl_text_item_geometry_get(sd->text_obj, 3389 efl_text_attribute_factory_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch);
3753 anc->annotation, &cx, &cy, &cw, &ch);
3754 efl_gfx_entity_size_set(rect->obj, EINA_SIZE2D(cw, ch)); 3390 efl_gfx_entity_size_set(rect->obj, EINA_SIZE2D(cw, ch));
3755 efl_gfx_entity_position_set(rect->obj, 3391 efl_gfx_entity_position_set(rect->obj,
3756 EINA_POSITION2D(off.x + cx, off.y + cy)); 3392 EINA_POSITION2D(off.x + cx, off.y + cy));
@@ -3762,12 +3398,11 @@ _anchors_update(Eo *obj, Efl_Ui_Text_Data *sd)
3762 Eina_List *l; 3398 Eina_List *l;
3763 Eina_Rectangle *r; 3399 Eina_Rectangle *r;
3764 size_t count; 3400 size_t count;
3765 start = efl_text_cursor_new(obj); 3401 start = efl_ui_text_cursor_create(obj);
3766 end = efl_text_cursor_new(obj); 3402 end = efl_ui_text_cursor_create(obj);
3767 efl_text_annotation_positions_get(obj, anc->annotation, 3403 efl_text_attribute_factory_attribute_cursors_get(anc->annotation, start, end);
3768 start, end);
3769 3404
3770 range = efl_canvas_text_range_geometry_get(obj, start, end); 3405 range = efl_text_cursor_range_geometry_get(start, end);
3771 count = eina_list_count(eina_iterator_container_get(range)); 3406 count = eina_list_count(eina_iterator_container_get(range));
3772 3407
3773 // Add additional rectangles if needed 3408 // Add additional rectangles if needed
@@ -3917,7 +3552,7 @@ _efl_ui_text_changed_cb(void *data, const Efl_Event *event)
3917 sd->text_changed = EINA_TRUE; 3552 sd->text_changed = EINA_TRUE;
3918 sd->cursor_update = EINA_TRUE; 3553 sd->cursor_update = EINA_TRUE;
3919 _update_guide_text(data, sd); 3554 _update_guide_text(data, sd);
3920 efl_event_callback_call(event->object, EFL_UI_TEXT_EVENT_CHANGED, NULL); 3555 efl_event_callback_call(data, EFL_UI_TEXT_EVENT_CHANGED, NULL);
3921 efl_canvas_group_change(data); 3556 efl_canvas_group_change(data);
3922 _decoration_defer(data); 3557 _decoration_defer(data);
3923} 3558}
@@ -3940,7 +3575,6 @@ _efl_ui_text_cursor_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
3940{ 3575{
3941 if (efl_invalidated_get(event->object)) return; 3576 if (efl_invalidated_get(event->object)) return;
3942 EFL_UI_TEXT_DATA_GET(data, sd); 3577 EFL_UI_TEXT_DATA_GET(data, sd);
3943 sd->cur_changed = EINA_TRUE;
3944 sd->cursor_update = EINA_TRUE; 3578 sd->cursor_update = EINA_TRUE;
3945 sd->deferred_decoration_cursor = EINA_TRUE; 3579 sd->deferred_decoration_cursor = EINA_TRUE;
3946 _decoration_defer(data); 3580 _decoration_defer(data);
@@ -3971,34 +3605,34 @@ _text_position_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
3971} 3605}
3972 3606
3973static void 3607static void
3974_efl_ui_text_selection_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) 3608_efl_ui_text_selection_start_clear_cb(void *data, const Efl_Event *event EINA_UNUSED)
3975{ 3609{
3976 if (efl_invalidated_get(event->object)) return; 3610 if (efl_invalidated_get(event->object)) return;
3977 Eo *obj = data; 3611 Eo *obj = data;
3978 Efl_Text_Cursor_Cursor *start, *end;
3979 char *text;
3980 EFL_UI_TEXT_DATA_GET(obj, sd); 3612 EFL_UI_TEXT_DATA_GET(obj, sd);
3981 3613
3982 efl_text_interactive_selection_cursors_get(obj, &start, &end); 3614 if (efl_text_interactive_have_selection_get(data))
3983
3984 text = efl_canvas_text_range_text_get(obj, start, end);
3985 if (!text || (text[0] == '\0'))
3986 { 3615 {
3987 _edje_signal_emit(sd, "selection,cleared", "efl.text"); 3616 if (efl_invalidated_get(event->object)) return;
3988 _selection_clear(data, 0); 3617 _edje_signal_emit(sd, "selection,start", "efl.text");
3989 sd->have_selection = EINA_FALSE; 3618 _selection_defer(obj, sd);
3990 } 3619 }
3991 else 3620 else
3992 { 3621 {
3993 if (!sd->have_selection) 3622 Eo *obj = data;
3994 { 3623 _edje_signal_emit(sd, "selection,cleared", "efl.text");
3995 _edje_signal_emit(sd, "selection,start", "efl.text"); 3624 _selection_defer(obj, sd);
3996 }
3997 _edje_signal_emit(sd, "selection,changed", "efl.text");
3998 sd->have_selection = EINA_TRUE;
3999 _selection_store(EFL_UI_SELECTION_TYPE_PRIMARY, obj);
4000 } 3625 }
4001 if (text) free(text); 3626}
3627
3628static void
3629_efl_ui_text_selection_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
3630{
3631 if (efl_invalidated_get(event->object)) return;
3632 Eo *obj = data;
3633 EFL_UI_TEXT_DATA_GET(obj, sd);
3634 _edje_signal_emit(sd, "selection,changed", "efl.text");
3635 _selection_store(EFL_UI_SELECTION_TYPE_PRIMARY, obj);
4002 _selection_defer(obj, sd); 3636 _selection_defer(obj, sd);
4003} 3637}
4004 3638
@@ -4104,22 +3738,3 @@ _efl_ui_text_async_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
4104} 3738}
4105 3739
4106#include "efl_ui_text_async.eo.c" 3740#include "efl_ui_text_async.eo.c"
4107
4108#undef MY_CLASS
4109#define MY_CLASS EFL_UI_TEXT_EDITABLE_CLASS
4110
4111
4112EOLIAN static Eo *
4113_efl_ui_text_editable_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
4114{
4115 // FIXME: should we have to keep this efl_ui_text_xxx classes?
4116 // Then, going to make new theme for these classes? ex) efl/text_editable?
4117 if (!elm_widget_theme_klass_get(obj))
4118 elm_widget_theme_klass_set(obj, "text");
4119 obj = efl_constructor(efl_super(obj, MY_CLASS));
4120 efl_text_interactive_editable_set(obj, EINA_TRUE);
4121
4122 return obj;
4123}
4124
4125#include "efl_ui_text_editable.eo.c"