summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-13 15:12:13 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-13 15:36:10 +0900
commit315c4f761e03de99bff943cd12408db14d39cd2c (patch)
tree57968f9f2d13e80092989f1da19554eb9824ffed
parent71552564228d7163260e56d9549b6a19c7b47a72 (diff)
text: Merge changed,user events
Efl.Ui.Text and Efl.Ui.Text.Interactive were both defining it.
-rw-r--r--src/lib/efl/interfaces/efl_text_types.eot12
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c18
-rw-r--r--src/lib/elementary/efl_ui_text.c17
-rw-r--r--src/lib/elementary/efl_ui_text.eo3
-rw-r--r--src/lib/elementary/efl_ui_text_interactive.eo13
5 files changed, 31 insertions, 32 deletions
diff --git a/src/lib/efl/interfaces/efl_text_types.eot b/src/lib/efl/interfaces/efl_text_types.eot
index d6f764023e..d3f7d204f2 100644
--- a/src/lib/efl/interfaces/efl_text_types.eot
+++ b/src/lib/efl/interfaces/efl_text_types.eot
@@ -7,6 +7,18 @@ enum Efl.Text.Bidirectional_Type {
7 inherit [[Inherit text type]] 7 inherit [[Inherit text type]]
8} 8}
9 9
10struct Efl.Ui.Text.Change_Info {
11 [[This structure includes all the information about content changes.
12
13 It's meant to be used to implement undo/redo.
14 ]]
15 content: string; [[The content added/removed]]
16 position: size; [[The position where it was added/removed]]
17 length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
18 insert: bool; [[$true if the content was inserted, $false if removei]]
19 merge: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
20}
21
10type @extern Efl.Text.Annotate.Annotation: __undefined_type; [[EFL text annotations data structure]] 22type @extern Efl.Text.Annotate.Annotation: __undefined_type; [[EFL text annotations data structure]]
11 23
12type @extern Efl.Text.Cursor.Cursor: __undefined_type; [[Text cursor data structure]] 24type @extern Efl.Text.Cursor.Cursor: __undefined_type; [[Text cursor data structure]]
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c
index b9e97071a0..2f8c8f859a 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -334,7 +334,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U
334 Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); 334 Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS);
335 Ecore_IMF_Event_Delete_Surrounding *ev = event_info; 335 Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
336 Evas_Textblock_Cursor *del_start, *del_end; 336 Evas_Textblock_Cursor *del_start, *del_end;
337 Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; 337 Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
338 int cursor_pos; 338 int cursor_pos;
339 int start, end; 339 int start, end;
340 340
@@ -356,7 +356,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U
356 356
357 char *tmp = efl_canvas_text_range_text_get(obj, en->sel_start, en->sel_end); 357 char *tmp = efl_canvas_text_range_text_get(obj, en->sel_start, en->sel_end);
358 358
359 efl_event_callback_legacy_call(obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); 359 efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info);
360 360
361 free(tmp); 361 free(tmp);
362 362
@@ -585,7 +585,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_
585{ 585{
586 size_t start, end; 586 size_t start, end;
587 char *tmp; 587 char *tmp;
588 Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; 588 Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
589 589
590 start = evas_textblock_cursor_pos_get(cur1); 590 start = evas_textblock_cursor_pos_get(cur1);
591 end = evas_textblock_cursor_pos_get(cur2); 591 end = evas_textblock_cursor_pos_get(cur2);
@@ -599,7 +599,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_
599 tmp = efl_canvas_text_range_text_get(obj, cur1, cur2); 599 tmp = efl_canvas_text_range_text_get(obj, cur1, cur2);
600 info.content = tmp; 600 info.content = tmp;
601 601
602 efl_event_callback_legacy_call(obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); 602 efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info);
603 603
604 if (tmp) free(tmp); 604 if (tmp) free(tmp);
605 605
@@ -616,7 +616,7 @@ _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
616static void 616static void
617_delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos) 617_delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos)
618{ 618{
619 Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; 619 Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
620 Eina_Unicode content[2]; 620 Eina_Unicode content[2];
621 content[0] = efl_text_cursor_content_get(obj, c); 621 content[0] = efl_text_cursor_content_get(obj, c);
622 content[1] = 0; 622 content[1] = 0;
@@ -630,8 +630,7 @@ _delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive
630 info.length = 1; 630 info.length = 1;
631 info.content = tmp; 631 info.content = tmp;
632 632
633 efl_event_callback_legacy_call(obj, 633 efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info);
634 EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
635 if (tmp) free(tmp); 634 if (tmp) free(tmp);
636 635
637 evas_textblock_cursor_char_delete(c); 636 evas_textblock_cursor_char_delete(c);
@@ -712,7 +711,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
712 char *string = (char *)ev->string; 711 char *string = (char *)ev->string;
713 Eina_Bool free_string = EINA_FALSE; 712 Eina_Bool free_string = EINA_FALSE;
714 Eina_Bool changed_user = EINA_FALSE; 713 Eina_Bool changed_user = EINA_FALSE;
715 Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; 714 Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
716 715
717 if (!ev->key) return; 716 if (!ev->key) return;
718 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 717 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
@@ -1057,8 +1056,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
1057end: 1056end:
1058 if (changed_user) 1057 if (changed_user)
1059 { 1058 {
1060 efl_event_callback_call(obj, 1059 efl_event_callback_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info);
1061 EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info);
1062 } 1060 }
1063 (void) 0; 1061 (void) 0;
1064} 1062}
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index b3d2e5f155..2ee45814c3 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -2054,7 +2054,8 @@ _mouse_move_cb(void *data,
2054 2054
2055static void 2055static void
2056_entry_changed_handle(void *data, 2056_entry_changed_handle(void *data,
2057 const Efl_Event_Description* event) 2057 const Efl_Event_Description* event,
2058 Efl_Ui_Text_Change_Info *info)
2058{ 2059{
2059 Evas_Coord minh; 2060 Evas_Coord minh;
2060 const char *text; 2061 const char *text;
@@ -2101,7 +2102,7 @@ _entry_changed_handle(void *data,
2101 /* callback - this could call callbacks that delete the 2102 /* callback - this could call callbacks that delete the
2102 * entry... thus... any access to sd after this could be 2103 * entry... thus... any access to sd after this could be
2103 * invalid */ 2104 * invalid */
2104 efl_event_callback_legacy_call(data, event, NULL); 2105 efl_event_callback_legacy_call(data, event, info);
2105} 2106}
2106 2107
2107static void 2108static void
@@ -2149,7 +2150,7 @@ _entry_preedit_changed_signal_cb(void *data,
2149 const char *emission EINA_UNUSED, 2150 const char *emission EINA_UNUSED,
2150 const char *source EINA_UNUSED) 2151 const char *source EINA_UNUSED)
2151{ 2152{
2152 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_PREEDIT_CHANGED); 2153 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_PREEDIT_CHANGED, NULL);
2153} 2154}
2154 2155
2155static void 2156static void
@@ -3079,7 +3080,7 @@ _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *sd)
3079 (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 3080 (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3080 evas_object_size_hint_align_set 3081 evas_object_size_hint_align_set
3081 (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL); 3082 (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
3082 efl_event_callback_add(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, 3083 efl_event_callback_add(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER,
3083 _efl_ui_text_changed_user_cb, obj); 3084 _efl_ui_text_changed_user_cb, obj);
3084 efl_event_callback_add(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, 3085 efl_event_callback_add(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED,
3085 _efl_ui_text_changed_cb, obj); 3086 _efl_ui_text_changed_cb, obj);
@@ -3302,7 +3303,7 @@ _efl_ui_text_efl_object_destructor(Eo *obj, Efl_Ui_Text_Data *sd)
3302 _clear_text_selection(sd); 3303 _clear_text_selection(sd);
3303 3304
3304 text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); 3305 text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
3305 efl_event_callback_del(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, 3306 efl_event_callback_del(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER,
3306 _efl_ui_text_changed_user_cb, obj); 3307 _efl_ui_text_changed_user_cb, obj);
3307 efl_event_callback_del(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, 3308 efl_event_callback_del(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED,
3308 _efl_ui_text_changed_cb, obj); 3309 _efl_ui_text_changed_cb, obj);
@@ -5238,14 +5239,14 @@ static void
5238_efl_ui_text_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) 5239_efl_ui_text_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
5239{ 5240{
5240 _decoration_defer_all(data); 5241 _decoration_defer_all(data);
5241 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED); 5242 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED, NULL);
5242} 5243}
5243 5244
5244static void 5245static void
5245_efl_ui_text_changed_user_cb(void *data, const Efl_Event *event EINA_UNUSED) 5246_efl_ui_text_changed_user_cb(void *data, const Efl_Event *event)
5246{ 5247{
5247 _decoration_defer_all(data); 5248 _decoration_defer_all(data);
5248 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED_USER); 5249 _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED_USER, event->info);
5249} 5250}
5250 5251
5251static void 5252static void
diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo
index 54b6addf93..60cc19cfc6 100644
--- a/src/lib/elementary/efl_ui_text.eo
+++ b/src/lib/elementary/efl_ui_text.eo
@@ -395,7 +395,8 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
395 events { 395 events {
396 activated; [[Called when entry got activated]] 396 activated; [[Called when entry got activated]]
397 changed; [[Called when entry changed]] 397 changed; [[Called when entry changed]]
398 changed,user; [[Called when object changed due to user interaction]] 398 changed,user: Efl.Ui.Text.Change_Info;
399 [[The text object has changed due to user interaction]]
399 validate; [[Called when validating]] 400 validate; [[Called when validating]]
400 context,open; [[Called when context menu was opened]] 401 context,open; [[Called when context menu was opened]]
401 anchor,clicked; [[Called when anchor was clicked]] 402 anchor,clicked; [[Called when anchor was clicked]]
diff --git a/src/lib/elementary/efl_ui_text_interactive.eo b/src/lib/elementary/efl_ui_text_interactive.eo
index f13e668857..1f19b084ea 100644
--- a/src/lib/elementary/efl_ui_text_interactive.eo
+++ b/src/lib/elementary/efl_ui_text_interactive.eo
@@ -1,17 +1,5 @@
1import efl_text_types; 1import efl_text_types;
2 2
3struct Efl.Ui.Text.Interactive.Change_Info {
4 [[This structure includes all the information about content changes.
5
6 It's meant to be used to implement undo/redo.
7 ]]
8 content: string; [[The content added/removed]]
9 position: size; [[The position where it was added/removed]]
10 length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
11 insert: bool; [[$true if the content was inserted, $false if removei]]
12 merge: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
13}
14
15interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font, 3interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font,
16 Efl.Text.Format, Efl.Text.Style) 4 Efl.Text.Format, Efl.Text.Style)
17{ 5{
@@ -57,7 +45,6 @@ interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font,
57 } 45 }
58 } 46 }
59 events { 47 events {
60 changed,user: Efl.Ui.Text.Interactive.Change_Info; [[The text object has changed due to user interaction]]
61 selection,changed; [[The selection on the object has changed. Query using @.selection_cursors]] 48 selection,changed; [[The selection on the object has changed. Query using @.selection_cursors]]
62 } 49 }
63} 50}