forked from enlightenment/efl
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
This commit is contained in:
parent
dd4bad3037
commit
7c058d5e61
|
@ -10,6 +10,12 @@ enum Efl.Text_Bidirectional_Type {
|
||||||
inherit [[Inherit text type]]
|
inherit [[Inherit text type]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum @beta Efl.Text_Change_Type {
|
||||||
|
[[Text change type.]]
|
||||||
|
insert = 0, [[the content was inserted.]]
|
||||||
|
remove [[the content was removed.]]
|
||||||
|
}
|
||||||
|
|
||||||
struct @beta Efl.Text_Change_Info {
|
struct @beta Efl.Text_Change_Info {
|
||||||
[[This structure includes all the information about content changes.
|
[[This structure includes all the information about content changes.
|
||||||
|
|
||||||
|
@ -18,6 +24,6 @@ struct @beta Efl.Text_Change_Info {
|
||||||
content: string; [[The content added/removed]]
|
content: string; [[The content added/removed]]
|
||||||
position: size; [[The position where it was added/removed]]
|
position: size; [[The position where it was added/removed]]
|
||||||
length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
|
length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
|
||||||
insertion: bool; [[$true if the content was inserted, $false if removed]]
|
type: Efl.Text_Change_Type; [[Text change type]]
|
||||||
mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
|
mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ _text_filter_markup_prepend_internal(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_
|
||||||
if (changeinfo)
|
if (changeinfo)
|
||||||
{
|
{
|
||||||
info = calloc(1, sizeof(*info));
|
info = calloc(1, sizeof(*info));
|
||||||
info->insertion = EINA_TRUE;
|
info->type = EFL_TEXT_CHANGE_TYPE_INSERT;
|
||||||
info->content = eina_stringshare_add(text);
|
info->content = eina_stringshare_add(text);
|
||||||
info->length =
|
info->length =
|
||||||
eina_unicode_utf8_get_len(info->content);
|
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
|
||||||
|
|
||||||
tmp = efl_text_cursor_range_text_get(del_start, del_end);
|
tmp = efl_text_cursor_range_text_get(del_start, del_end);
|
||||||
|
|
||||||
info.insertion = EINA_FALSE;
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
||||||
info.position = start;
|
info.position = start;
|
||||||
info.length = end - start;
|
info.length = end - start;
|
||||||
info.content = tmp;
|
info.content = tmp;
|
||||||
|
@ -955,7 +955,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor *cur1, Efl_Text_Cursor *cur2)
|
||||||
if (start == end)
|
if (start == end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info.insertion = EINA_FALSE;
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
||||||
info.position = start;
|
info.position = start;
|
||||||
info.length = end - start;
|
info.length = end - start;
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data
|
||||||
|
|
||||||
Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
|
Efl_Text_Change_Info info = { NULL, 0, 0, 0, 0 };
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
info.insertion = EINA_FALSE;
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
||||||
if (backspace)
|
if (backspace)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1047,7 +1047,7 @@ _delete_emit(Eo *obj, Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data
|
||||||
evas_textblock_cursor_free(cc);
|
evas_textblock_cursor_free(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.insertion = EINA_FALSE;
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
||||||
info.position = pos;
|
info.position = pos;
|
||||||
info.length = 1;
|
info.length = 1;
|
||||||
info.content = tmp;
|
info.content = tmp;
|
||||||
|
@ -1531,7 +1531,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
|
||||||
_sel_range_del_emit(obj, en);
|
_sel_range_del_emit(obj, en);
|
||||||
info.mergeable = EINA_TRUE;
|
info.mergeable = EINA_TRUE;
|
||||||
}
|
}
|
||||||
info.insertion = EINA_TRUE;
|
info.type = EFL_TEXT_CHANGE_TYPE_INSERT;
|
||||||
info.content = string;
|
info.content = string;
|
||||||
info.position = efl_text_cursor_position_get(cur);
|
info.position = efl_text_cursor_position_get(cur);
|
||||||
info.length = eina_unicode_utf8_get_len(string);
|
info.length = eina_unicode_utf8_get_len(string);
|
||||||
|
|
|
@ -424,7 +424,7 @@ _selection_data_cb(void *data EINA_UNUSED, Eo *obj,
|
||||||
efl_text_interactive_all_unselect(obj);
|
efl_text_interactive_all_unselect(obj);
|
||||||
}
|
}
|
||||||
cur = efl_text_interactive_main_cursor_get(obj);
|
cur = efl_text_interactive_main_cursor_get(obj);
|
||||||
info.insertion = EINA_TRUE;
|
info.type = EFL_TEXT_CHANGE_TYPE_INSERT;
|
||||||
info.position = efl_text_cursor_position_get(cur);
|
info.position = efl_text_cursor_position_get(cur);
|
||||||
info.length = len;
|
info.length = len;
|
||||||
info.content = buf;
|
info.content = buf;
|
||||||
|
@ -1945,7 +1945,7 @@ _efl_ui_textbox_selection_cut(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
||||||
start_pos = efl_text_cursor_position_get(start);
|
start_pos = efl_text_cursor_position_get(start);
|
||||||
end_pos = efl_text_cursor_position_get(end);
|
end_pos = efl_text_cursor_position_get(end);
|
||||||
tmp = efl_text_cursor_range_text_get(start, end);
|
tmp = efl_text_cursor_range_text_get(start, end);
|
||||||
info.insertion = EINA_FALSE;
|
info.type = EFL_TEXT_CHANGE_TYPE_REMOVE;
|
||||||
info.position = start_pos;
|
info.position = start_pos;
|
||||||
info.length = end_pos - start_pos;
|
info.length = end_pos - start_pos;
|
||||||
info.content = tmp;
|
info.content = tmp;
|
||||||
|
|
Loading…
Reference in New Issue