From: JinYong Park Date: Mon, 31 Oct 2016 08:29:01 +0000 (+0900) Subject: edje_entry: Add edje_object_part_text_select_disable_set X-Git-Tag: accepted/tizen/common/20170102.152350~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aea6658b035dc77f6a711f4c079725c7a8d4a67d;p=platform%2Fupstream%2Fefl.git edje_entry: Add edje_object_part_text_select_disable_set Change-Id: I8eeee540667033d0495777b299d7951fb341c1e9 Signed-off-by: Jinyong Park --- diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index bad8a1b..05474c6 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -54,6 +54,9 @@ struct _Entry // TIZEN_ONLY(20150716): Add edje_object_part_text_freeze, thaw APIs for freezing cursor movements. Eina_Bool freeze : 1; // + /* TIZEN_ONLY(2161031): Add edje_object_part_text_select_disable_set API */ + Eina_Bool select_disable; + /* END */ #ifdef HAVE_ECORE_IMF Eina_Bool have_preedit : 1; @@ -797,8 +800,13 @@ _edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; en = rp->typedata.text->entry_data; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) && (en->select_allow)) + */ + if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) && + (!en->select_disable && en->select_allow)) + /* END */ return; ignored = rp->ignore_flags & ev->event_flags; @@ -847,8 +855,13 @@ _edje_anchor_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ if (!n) n = ""; len = 200 + strlen(n); buf = alloca(len); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if ((rp->part->select_mode != EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || (!en->select_allow)) + */ + if ((rp->part->select_mode != EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || + (en->select_disable || !en->select_allow)) + /* END */ { if ((!ev->event_flags) || (!ignored)) { @@ -900,8 +913,13 @@ _edje_anchor_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; en = rp->typedata.text->entry_data; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) && (en->select_allow)) + */ + if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) && + (!en->select_disable && en->select_allow)) + /* END */ return; ignored = rp->ignore_flags & ev->event_flags; @@ -1684,7 +1702,14 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, { _compose_seq_reset(en); // dead keys here. Escape for now (should emit these) + /* TIZEN_ONLY(20161118): selection clear when escape key down _edje_emit(ed, "entry,key,escape", rp->part->name); + */ + if (en->have_selection) + _sel_clear(ed, en->cursor, rp->object, en); + else + _edje_emit(ed, "entry,key,escape", rp->part->name); + /* END */ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } else if (!strcmp(ev->key, "Up") || @@ -1696,7 +1721,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, if (en->have_selection && (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end))) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) { @@ -1714,7 +1743,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } if (_curs_up(en->cursor, rp->object, en)) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1732,7 +1765,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, if (en->have_selection && (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end))) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) { @@ -1750,7 +1787,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } if (_curs_down(en->cursor, rp->object, en)) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1766,7 +1807,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, if (en->have_selection && (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end))) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) { @@ -1795,7 +1840,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, /* If control is pressed, go to the start of the word */ if (control) evas_textblock_cursor_word_start(en->cursor); #endif + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1810,7 +1859,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, if (en->have_selection && (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end))) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) { @@ -1839,7 +1892,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, //if (evas_textblock_cursor_char_next(en->cursor)) if (evas_textblock_cursor_cluster_next(en->cursor)) ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1932,7 +1989,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, ((!strcmp(ev->key, "KP_Home")) && !ev->string))) { _compose_seq_reset(en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_start(en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1941,7 +2002,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _curs_start(en->cursor, rp->object, en); else _curs_lin_start(en->cursor, rp->object, en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); } @@ -1954,7 +2019,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, ((!strcmp(ev->key, "KP_End")) && !ev->string))) { _compose_seq_reset(en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_start(en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -1963,7 +2032,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, _curs_end(en->cursor, rp->object, en); else _curs_lin_end(en->cursor, rp->object, en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); } @@ -2136,7 +2209,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, (!strcmp(ev->key, "KP_Prior") && !ev->string)) { _compose_seq_reset(en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_start(en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -2146,7 +2223,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, evas_textblock_cursor_line_set(en->cursor, 0); _curs_lin_start(en->cursor, rp->object, en); } + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -2159,7 +2240,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, (!strcmp(ev->key, "KP_Next") && !ev->string)) { _compose_seq_reset(en); + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_start(en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -2170,7 +2255,11 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, evas_textblock_cursor_line_set(en->cursor, last); _curs_lin_end(en->cursor, rp->object, en); } + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable) + /* END */ { if (shift) _sel_extend(ed, en->cursor, rp->object, en); else _sel_clear(ed, en->cursor, rp->object, en); @@ -2411,7 +2500,11 @@ _edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ en->select_mod_start = EINA_FALSE; en->select_mod_end = EINA_FALSE; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow && ev->button != 2) dosel = EINA_TRUE; + */ + if (!en->select_disable && en->select_allow && ev->button != 2) dosel = EINA_TRUE; + /* END */ if (dosel) { if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) @@ -2717,7 +2810,11 @@ _edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN } } } + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable && en->select_allow) + /* END */ { if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) { @@ -2822,7 +2919,11 @@ _edje_part_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ _curs_lin_end(en->cursor, rp->object, en); } } + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API if (en->select_allow) + */ + if (!en->select_disable && en->select_allow) + /* END */ { if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) { @@ -2969,6 +3070,10 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp, Ecore_IMF_Context *ic) txt = (Edje_Part_Description_Text *)rp->chosen_description; en->select_allow = EINA_FALSE; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ + en->select_disable = EINA_TRUE; + /* END */ + if (txt && edje_string_get(&txt->text.repch)) evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch)); else @@ -3657,6 +3762,33 @@ _edje_entry_select_allow_get(const Edje_Real_Part *rp) return en->select_allow; } +/* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ +void +_edje_entry_select_disable_set(Edje_Real_Part *rp, Eina_Bool disable) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + if (!en) return; + + en->select_disable = disable; +} + +Eina_Bool +_edje_entry_select_disable_get(const Edje_Real_Part *rp) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return EINA_FALSE; + en = rp->typedata.text->entry_data; + if (!en) return EINA_FALSE; + return en->select_disable; +} +/* END */ + void _edje_entry_select_abort(Edje_Real_Part *rp) { diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index c4df8fe..72e3caa 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -609,6 +609,25 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) @in allow: bool; [[true to enable, false otherwise]] } } + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ + part_text_select_disable_set @internal @const { + [[Enables selection if the entry is an EXPLICIT selection mode + type. + + The default is to not allow selection. This function only affects user + selection, functions such as edje_object_part_text_select_all() and + edje_object_part_text_select_none() are not affected. + + \@if MOBILE \@since_tizen 3.0 + \@elseif WEARABLE \@since_tizen 3.0 + \@endif + ]] + params { + @in part: const(char)*; [[The part name]] + @in disable: bool; [[true to enable, false otherwise]] + } + } + /* END */ part_state_get @const { [[Returns the state of the Edje part. diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index a0bb795..9a74af8 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2772,6 +2772,10 @@ void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Co void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text); void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow); Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp); +/* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ +void _edje_entry_select_disable_set(Edje_Real_Part *rp, Eina_Bool disable); +Eina_Bool _edje_entry_select_disable_get(const Edje_Real_Part *rp); +/* END */ void _edje_entry_select_abort(Edje_Real_Part *rp); void *_edje_entry_imf_context_get(Edje_Real_Part *rp); Eina_Bool _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur); @@ -2946,6 +2950,9 @@ void _part_text_item_geometry_get(Eo *obj, void *_pd, va_list *list); void _part_text_cursor_geometry_get(Eo *obj, void *_pd, va_list *list); void _part_text_user_insert(Eo *obj, void *_pd, va_list *list); void _part_text_select_allow_set(Eo *obj, void *_pd, va_list *list); +/* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ +void _part_text_select_disable_set(Eo *obj, void *_pd, va_list *list); +/* END */ void _part_text_select_abort(Eo *obj, void *_pd, va_list *list); void _part_text_select_begin(Eo *obj, void *_pd, va_list *list); void _part_text_select_extend(Eo *obj, void *_pd, va_list *list); diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c index bc36558..f7e8e3c 100644 --- a/src/lib/edje/edje_program.c +++ b/src/lib/edje/edje_program.c @@ -1627,7 +1627,11 @@ _edje_param_native_get(Edje *ed, Edje_Real_Part *rp, const char *name, Edje_Exte { param->name = name; param->type = EDJE_EXTERNAL_PARAM_TYPE_BOOL; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API param->i = _edje_entry_select_allow_get(rp); + */ + param->i = !_edje_entry_select_disable_get(rp); + /* END */ return param; } } @@ -1762,7 +1766,11 @@ _edje_param_native_set(Edje *ed, Edje_Real_Part *rp, const char *name, const Edj { if (param->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL) return EINA_FALSE; + /* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API _edje_entry_select_allow_set(rp, param->i); + */ + _edje_entry_select_disable_set(rp, !param->i); + /* END */ return EINA_TRUE; } } diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 68782f7..18c6541 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -2713,6 +2713,20 @@ _edje_object_part_text_select_allow_set(Eo *obj EINA_UNUSED, Edje *ed, const cha _edje_entry_select_allow_set(rp, allow); } +/* TIZEN_ONLY(20161031): Add edje_object_part_text_select_disable_set API */ +EOLIAN void +_edje_object_part_text_select_disable_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool disable) +{ + Edje_Real_Part *rp; + + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(&ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + _edje_entry_select_disable_set(rp, disable); +} +/* END */ + EOLIAN void _edje_object_part_text_select_abort(Eo *obj EINA_UNUSED, Edje *ed, const char *part) {