summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabdulleh Ghujeh <a.ghujeh@samsung.com>2020-02-03 09:57:57 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-04 09:54:58 +0100
commit7c058d5e61b3dba29bd36e21f6a9245dce9edde5 (patch)
treeac02aa33e2177cc9ee3db33113cab8aa6e74a516
parentdd4bad3037f052b5b3cc56c7715d7b89bfe3636d (diff)
efl_text_change_info: change text change type property( bool -> enum)
changed the insertion property to be an enum instead of a boolean property. this will be clearer for usage and provide the ability to add more types in the future. Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D11272
-rw-r--r--src/lib/efl/interfaces/efl_text_types.eot8
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c12
-rw-r--r--src/lib/elementary/efl_ui_textbox.c4
3 files changed, 15 insertions, 9 deletions
diff --git a/src/lib/efl/interfaces/efl_text_types.eot b/src/lib/efl/interfaces/efl_text_types.eot
index 956a8085c1..9f3e0d2690 100644
--- a/src/lib/efl/interfaces/efl_text_types.eot
+++ b/src/lib/efl/interfaces/efl_text_types.eot
@@ -10,6 +10,12 @@ enum Efl.Text_Bidirectional_Type {
10 inherit [[Inherit text type]] 10 inherit [[Inherit text type]]
11} 11}
12 12
13enum @beta Efl.Text_Change_Type {
14 [[Text change type.]]
15 insert = 0, [[the content was inserted.]]
16 remove [[the content was removed.]]
17}
18
13struct @beta Efl.Text_Change_Info { 19struct @beta Efl.Text_Change_Info {
14 [[This structure includes all the information about content changes. 20 [[This structure includes all the information about content changes.
15 21
@@ -18,6 +24,6 @@ struct @beta Efl.Text_Change_Info {
18 content: string; [[The content added/removed]] 24 content: string; [[The content added/removed]]
19 position: size; [[The position where it was added/removed]] 25 position: size; [[The position where it was added/removed]]
20 length: size; [[The length of content in characters (not bytes, actual unicode characters)]] 26 length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
21 insertion: bool; [[$true if the content was inserted, $false if removed]] 27 type: Efl.Text_Change_Type; [[Text change type]]
22 mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]] 28 mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
23} 29}
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c
index fc43e6fbe9..81cf950efe 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -289,7 +289,7 @@ _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_
289 if (changeinfo) 289 if (changeinfo)
290 { 290 {
291 info = calloc(1, sizeof(*info)); 291 info = calloc(1, sizeof(*info));
292 info->insertion = EINA_TRUE; 292 info->type = EFL_TEXT_CHANGE_TYPE_INSERT;
293 info->content = eina_stringshare_add(text); 293 info->content = eina_stringshare_add(text);
294 info->length = 294 info->length =
295 eina_unicode_utf8_get_len(info->content); 295 eina_unicode_utf8_get_len(info->content);
@@ -611,7 +611,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U
611 611
612 tmp = efl_text_cursor_range_text_get(del_start, del_end); 612 tmp = efl_text_cursor_range_text_get(del_start, del_end);
613 613
614 info.insertion = EINA_FALSE; 614 info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
615 info.position = start; 615 info.position = start;
616 info.length = end - start; 616 info.length = end - start;
617 info.content = tmp; 617 info.content = tmp;
@@ -955,7 +955,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor *cur1, Efl_Text_Cursor *cur2)
955 if (start == end) 955 if (start == end)
956 return; 956 return;
957 957
958 info.insertion = EINA_FALSE; 958 info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
959 info.position = start; 959 info.position = start;
960 info.length = end - start; 960 info.length = end - start;
961 961
@@ -1001,7 +1001,7 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data
1001 1001
1002 Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; 1002 Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
1003 char *tmp = NULL; 1003 char *tmp = NULL;
1004 info.insertion = EINA_FALSE; 1004 info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
1005 if (backspace) 1005 if (backspace)
1006 { 1006 {
1007 1007
@@ -1047,7 +1047,7 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data
1047 evas_textblock_cursor_free(cc); 1047 evas_textblock_cursor_free(cc);
1048 } 1048 }
1049 1049
1050 info.insertion = EINA_FALSE; 1050 info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
1051 info.position = pos; 1051 info.position = pos;
1052 info.length = 1; 1052 info.length = 1;
1053 info.content = tmp; 1053 info.content = tmp;
@@ -1531,7 +1531,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
1531 _sel_range_del_emit(obj, en); 1531 _sel_range_del_emit(obj, en);
1532 info.mergeable = EINA_TRUE; 1532 info.mergeable = EINA_TRUE;
1533 } 1533 }
1534 info.insertion = EINA_TRUE; 1534 info.type = EFL_TEXT_CHANGE_TYPE_INSERT;
1535 info.content = string; 1535 info.content = string;
1536 info.position = efl_text_cursor_position_get(cur); 1536 info.position = efl_text_cursor_position_get(cur);
1537 info.length = eina_unicode_utf8_get_len(string); 1537 info.length = eina_unicode_utf8_get_len(string);
diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c
index 024181cc21..936471c643 100644
--- a/src/lib/elementary/efl_ui_textbox.c
+++ b/src/lib/elementary/efl_ui_textbox.c
@@ -424,7 +424,7 @@ _selection_data_cb(void *data EINA_UNUSED, Eo *obj,
424 efl_text_interactive_all_unselect(obj); 424 efl_text_interactive_all_unselect(obj);
425 } 425 }
426 cur = efl_text_interactive_main_cursor_get(obj); 426 cur = efl_text_interactive_main_cursor_get(obj);
427 info.insertion = EINA_TRUE; 427 info.type = EFL_TEXT_CHANGE_TYPE_INSERT;
428 info.position = efl_text_cursor_position_get(cur); 428 info.position = efl_text_cursor_position_get(cur);
429 info.length = len; 429 info.length = len;
430 info.content = buf; 430 info.content = buf;
@@ -1945,7 +1945,7 @@ _efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd)
1945 start_pos = efl_text_cursor_position_get(start); 1945 start_pos = efl_text_cursor_position_get(start);
1946 end_pos = efl_text_cursor_position_get(end); 1946 end_pos = efl_text_cursor_position_get(end);
1947 tmp = efl_text_cursor_range_text_get(start, end); 1947 tmp = efl_text_cursor_range_text_get(start, end);
1948 info.insertion = EINA_FALSE; 1948 info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
1949 info.position = start_pos; 1949 info.position = start_pos;
1950 info.length = end_pos - start_pos; 1950 info.length = end_pos - start_pos;
1951 info.content = tmp; 1951 info.content = tmp;