2008-10-13 02:19:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2010-09-27 17:24:44 -07:00
|
|
|
static Eina_Bool _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
|
2012-01-17 20:38:04 -08:00
|
|
|
static void _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
|
|
|
|
static void _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
|
|
|
|
static void _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx, void *event);
|
2014-01-22 18:26:52 -08:00
|
|
|
static void _edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
|
|
|
|
static Eina_Bool _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx, char **text);
|
2009-05-13 15:11:06 -07:00
|
|
|
#endif
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
typedef struct _Entry Entry;
|
|
|
|
typedef struct _Sel Sel;
|
2008-10-16 23:40:46 -07:00
|
|
|
typedef struct _Anchor Anchor;
|
2016-01-12 05:20:19 -08:00
|
|
|
typedef struct _Item_Obj Item_Obj;
|
2008-10-13 02:19:04 -07:00
|
|
|
|
2012-12-21 03:39:36 -08:00
|
|
|
static void _edje_entry_imf_cursor_location_set(Entry *en);
|
2011-07-28 22:56:09 -07:00
|
|
|
static void _edje_entry_imf_cursor_info_set(Entry *en);
|
2013-03-29 03:42:54 -07:00
|
|
|
static void _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Entry *en);
|
2013-04-06 10:18:48 -07:00
|
|
|
static void _text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, const char *text);
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
static void _free_entry_change_info(void *_info);
|
2011-07-28 22:56:09 -07:00
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
struct _Entry
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Edje *ed;
|
|
|
|
Evas_Coord ox, oy;
|
|
|
|
Evas_Object *cursor_bg;
|
|
|
|
Evas_Object *cursor_fg, *cursor_fg2;
|
2019-01-16 12:02:43 -08:00
|
|
|
/* CHANGE EDJE_ENTRY_NUM_CURSOR_OBJS IF YOU ADD MORE OBJECTS HERE */
|
2008-10-13 02:19:04 -07:00
|
|
|
Evas_Textblock_Cursor *cursor;
|
|
|
|
Evas_Textblock_Cursor *sel_start, *sel_end;
|
2010-09-06 23:56:16 -07:00
|
|
|
Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
|
|
|
|
Evas_Textblock_Cursor *preedit_start, *preedit_end;
|
2015-06-08 11:43:00 -07:00
|
|
|
Ecore_Timer *pw_timer;
|
|
|
|
Eina_List *sel;
|
|
|
|
Eina_List *anchors;
|
|
|
|
Eina_List *anchorlist;
|
|
|
|
Eina_List *itemlist;
|
|
|
|
Eina_List *seq;
|
2016-01-12 05:20:19 -08:00
|
|
|
Item_Obj *item_objs;
|
2015-06-08 11:43:00 -07:00
|
|
|
char *selection;
|
|
|
|
Edje_Input_Panel_Lang input_panel_lang;
|
|
|
|
Eina_Bool composing : 1;
|
|
|
|
Eina_Bool selecting : 1;
|
|
|
|
Eina_Bool have_selection : 1;
|
|
|
|
Eina_Bool select_allow : 1;
|
|
|
|
Eina_Bool select_mod_start : 1;
|
|
|
|
Eina_Bool select_mod_end : 1;
|
|
|
|
Eina_Bool had_sel : 1;
|
|
|
|
Eina_Bool input_panel_enable : 1;
|
|
|
|
Eina_Bool prediction_allow : 1;
|
|
|
|
Eina_Bool anchors_updated : 1;
|
2016-07-11 02:26:29 -07:00
|
|
|
Eina_Bool have_link_pressed : 1;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2015-06-08 11:43:00 -07:00
|
|
|
Eina_Bool have_preedit : 1;
|
|
|
|
Eina_Bool commit_cancel : 1; // For skipping useless commit
|
|
|
|
Ecore_IMF_Context *imf_context;
|
2011-02-20 17:48:41 -08:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
};
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
struct _Sel
|
|
|
|
{
|
|
|
|
Evas_Textblock_Rectangle rect;
|
2015-06-08 11:43:00 -07:00
|
|
|
Evas_Object *obj_fg, *obj_bg, *obj, *sobj;
|
2008-10-16 23:40:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Anchor
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Entry *en;
|
|
|
|
char *name;
|
2008-10-16 23:40:46 -07:00
|
|
|
Evas_Textblock_Cursor *start, *end;
|
2015-06-08 11:43:00 -07:00
|
|
|
Eina_List *sel;
|
|
|
|
Eina_Bool item : 1;
|
2008-10-15 02:58:25 -07:00
|
|
|
};
|
|
|
|
|
2016-01-12 05:20:19 -08:00
|
|
|
struct _Item_Obj
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
|
|
|
Anchor *an;
|
|
|
|
char *name;
|
|
|
|
Evas_Object *obj;
|
|
|
|
};
|
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
static void
|
|
|
|
_preedit_clear(Entry *en)
|
|
|
|
{
|
|
|
|
if (en->preedit_start)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(en->preedit_start);
|
|
|
|
en->preedit_start = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (en->preedit_end)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(en->preedit_end);
|
|
|
|
en->preedit_end = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
en->have_preedit = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_preedit_del(Entry *en)
|
|
|
|
{
|
|
|
|
if (!en || !en->have_preedit) return;
|
|
|
|
if (!en->preedit_start || !en->preedit_end) return;
|
|
|
|
if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return;
|
|
|
|
|
|
|
|
/* delete the preedit characters */
|
|
|
|
evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
|
|
|
|
}
|
|
|
|
|
2011-02-20 17:48:41 -08:00
|
|
|
static void
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_entry_focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source EINA_UNUSED)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Efl_Input_Device *seat;
|
|
|
|
const char *seat_name;
|
2009-08-24 10:20:33 -07:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Entry *en;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed;
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2009-08-24 10:20:33 -07:00
|
|
|
rp = data;
|
2012-12-19 18:28:12 -08:00
|
|
|
if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) ||
|
2012-09-11 06:14:51 -07:00
|
|
|
(!rp->typedata.text)) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
if (!rp->typedata.text->entry_data) return;
|
|
|
|
|
|
|
|
ed = _edje_fetch(o);
|
2013-11-25 15:48:21 -08:00
|
|
|
if (!ed) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
en = rp->typedata.text->entry_data;
|
2010-09-12 01:15:35 -07:00
|
|
|
if (!en || !en->imf_context) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
seat_name = emission + sizeof("focus,part,in,") - 1;
|
|
|
|
seat = _edje_seat_get(ed, seat_name);
|
|
|
|
|
2017-03-02 11:06:15 -08:00
|
|
|
if (efl_canvas_object_seat_focus_check(ed->obj, seat))
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
ecore_imf_context_focus_in(en->imf_context);
|
2011-08-02 22:36:01 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-12 01:15:35 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_entry_focus_out_cb(void *data, Evas_Object *o EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2009-08-24 10:20:33 -07:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
rp = data;
|
2012-12-19 18:28:12 -08:00
|
|
|
if ((!rp) || (rp->type != EDJE_RP_TYPE_TEXT) ||
|
2012-09-11 06:14:51 -07:00
|
|
|
(!rp->typedata.text)) return;
|
2012-12-19 18:28:12 -08:00
|
|
|
if (!rp->typedata.text->entry_data) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
en = rp->typedata.text->entry_data;
|
2010-09-19 01:08:17 -07:00
|
|
|
if (!en || !en->imf_context) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
|
|
|
ecore_imf_context_reset(en->imf_context);
|
|
|
|
ecore_imf_context_focus_out(en->imf_context);
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
|
|
|
|
2010-09-05 00:20:47 -07:00
|
|
|
static void
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_focus_in(Edje *ed, Efl_Input_Device *seat)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2011-04-05 18:20:59 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2009-05-13 06:29:30 -07:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Entry *en;
|
|
|
|
#endif
|
2010-08-09 09:25:45 -07:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_seat_emit(ed, seat, "focus,in", "");
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2017-09-18 09:37:06 -07:00
|
|
|
rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!rp) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2011-04-05 18:20:59 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
|
2009-05-13 06:29:30 -07:00
|
|
|
return;
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2010-11-09 05:36:52 -08:00
|
|
|
if (!en->imf_context) return;
|
|
|
|
|
|
|
|
ecore_imf_context_focus_in(en->imf_context);
|
2011-08-02 22:36:01 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2010-09-12 01:15:35 -07:00
|
|
|
static void
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_focus_in_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Input_Focus *ev = event->info;
|
|
|
|
|
|
|
|
_edje_focus_in(data, efl_input_device_get(ev));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_focus_out(Edje *ed, Efl_Input_Device *seat)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2009-05-13 06:29:30 -07:00
|
|
|
Entry *en;
|
|
|
|
#endif
|
2010-08-09 09:25:45 -07:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_seat_emit(ed, seat, "focus,out", "");
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2017-09-18 09:37:06 -07:00
|
|
|
rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
|
2009-05-13 06:29:30 -07:00
|
|
|
if (!rp) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2011-04-05 18:20:59 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
|
2009-05-13 06:29:30 -07:00
|
|
|
return;
|
|
|
|
|
2010-10-20 03:34:26 -07:00
|
|
|
if (!en->imf_context) return;
|
|
|
|
|
|
|
|
ecore_imf_context_reset(en->imf_context);
|
|
|
|
ecore_imf_context_focus_out(en->imf_context);
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
static void
|
|
|
|
_edje_focus_out_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Efl_Input_Focus *ev = event->info;
|
|
|
|
|
|
|
|
_edje_focus_out(data, efl_input_device_get(ev));
|
|
|
|
}
|
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
static Edje_Entry_Change_Info *
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
|
2013-03-29 03:42:54 -07:00
|
|
|
char *text,
|
|
|
|
const char *fmtpre, const char *fmtpost,
|
|
|
|
Eina_Bool clearsel, Eina_Bool changeinfo)
|
2012-02-07 00:49:56 -08:00
|
|
|
{
|
|
|
|
Edje_Markup_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
2015-08-04 07:32:47 -07:00
|
|
|
Eina_Bool have_sel = EINA_FALSE;
|
|
|
|
|
|
|
|
if ((clearsel) && (en->have_selection))
|
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, en->rp->object, en);
|
|
|
|
have_sel = EINA_TRUE;
|
|
|
|
}
|
2012-02-07 00:49:56 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
EINA_LIST_FOREACH(ed->markup_filter_callbacks, l, cb)
|
2012-02-07 00:49:56 -08:00
|
|
|
{
|
|
|
|
if (!strcmp(cb->part, en->rp->part->name))
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
cb->func(cb->data, ed->obj, cb->part, &text);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (!text) break;
|
|
|
|
}
|
|
|
|
}
|
2013-01-07 03:17:55 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
// For skipping useless commit
|
|
|
|
if (en->have_preedit && (!text || !strcmp(text, "")))
|
2013-04-28 20:46:22 -07:00
|
|
|
en->commit_cancel = EINA_TRUE;
|
|
|
|
else
|
|
|
|
en->commit_cancel = EINA_FALSE;
|
2013-01-07 03:17:55 -08:00
|
|
|
#endif
|
2012-02-07 00:49:56 -08:00
|
|
|
if (text)
|
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
Edje_Entry_Change_Info *info = NULL;
|
2013-04-10 20:30:04 -07:00
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
if (changeinfo)
|
|
|
|
{
|
|
|
|
info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
}
|
|
|
|
else
|
2013-03-29 03:42:54 -07:00
|
|
|
{
|
|
|
|
info->insert = EINA_TRUE;
|
|
|
|
info->change.insert.content = eina_stringshare_add(text);
|
2013-04-10 20:30:04 -07:00
|
|
|
info->change.insert.plain_length =
|
2013-03-29 03:42:54 -07:00
|
|
|
eina_unicode_utf8_get_len(info->change.insert.content);
|
|
|
|
}
|
|
|
|
}
|
2015-08-04 07:34:57 -07:00
|
|
|
if (info)
|
2013-03-29 03:42:54 -07:00
|
|
|
{
|
2015-08-04 07:34:57 -07:00
|
|
|
if (have_sel)
|
|
|
|
{
|
|
|
|
info->merge = EINA_TRUE;
|
|
|
|
}
|
|
|
|
info->change.insert.pos =
|
|
|
|
evas_textblock_cursor_pos_get(en->cursor);
|
2013-03-29 03:42:54 -07:00
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
if (fmtpre) _text_filter_format_prepend(ed, en, en->cursor, fmtpre);
|
2012-02-07 00:49:56 -08:00
|
|
|
evas_object_textblock_text_markup_prepend(c, text);
|
|
|
|
free(text);
|
2013-04-06 10:18:48 -07:00
|
|
|
if (fmtpost) _text_filter_format_prepend(ed, en, en->cursor, fmtpost);
|
2013-03-29 03:42:54 -07:00
|
|
|
return info;
|
2012-02-07 00:49:56 -08:00
|
|
|
}
|
2013-03-29 03:42:54 -07:00
|
|
|
return NULL;
|
2012-02-07 00:49:56 -08:00
|
|
|
}
|
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
static Edje_Entry_Change_Info *
|
2013-04-10 20:30:04 -07:00
|
|
|
_text_filter_text_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
|
2013-03-29 03:42:54 -07:00
|
|
|
const char *text,
|
|
|
|
const char *fmtpre, const char *fmtpost,
|
|
|
|
Eina_Bool clearsel, Eina_Bool changeinfo)
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
char *text2 = NULL;
|
2010-05-28 23:40:56 -07:00
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
|
2015-08-04 07:32:47 -07:00
|
|
|
|
|
|
|
if ((clearsel) && (en->have_selection))
|
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, en->rp->object, en);
|
|
|
|
}
|
|
|
|
|
2010-05-28 23:40:56 -07:00
|
|
|
text2 = strdup(text);
|
2013-04-06 10:18:48 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(cb->part, en->rp->part->name))
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
cb->func(cb->data, ed->obj, cb->part, EDJE_TEXT_FILTER_TEXT, &text2);
|
2010-05-28 23:40:56 -07:00
|
|
|
if (!text2) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (text2)
|
|
|
|
{
|
2012-02-07 00:49:56 -08:00
|
|
|
char *markup_text;
|
2013-03-29 03:42:54 -07:00
|
|
|
Edje_Entry_Change_Info *info = NULL;
|
2013-04-10 20:30:04 -07:00
|
|
|
|
2012-02-07 00:49:56 -08:00
|
|
|
markup_text = evas_textblock_text_utf8_to_markup(NULL, text2);
|
2010-05-28 23:40:56 -07:00
|
|
|
free(text2);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (markup_text)
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_markup_prepend_internal(ed, en, c, markup_text,
|
2015-06-08 11:43:00 -07:00
|
|
|
fmtpre, fmtpost,
|
|
|
|
clearsel, changeinfo);
|
2013-03-29 03:42:54 -07:00
|
|
|
return info;
|
2010-05-28 23:40:56 -07:00
|
|
|
}
|
2013-03-29 03:42:54 -07:00
|
|
|
return NULL;
|
2010-05-28 23:40:56 -07:00
|
|
|
}
|
|
|
|
|
2010-10-01 20:34:00 -07:00
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, const char *text)
|
2010-10-01 20:34:00 -07:00
|
|
|
{
|
|
|
|
char *text2;
|
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
|
|
|
|
2012-10-10 01:06:27 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(text);
|
2010-10-01 20:34:00 -07:00
|
|
|
text2 = strdup(text);
|
2013-04-06 10:18:48 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
|
2010-10-01 20:34:00 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(cb->part, en->rp->part->name))
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
cb->func(cb->data, ed->obj, cb->part, EDJE_TEXT_FILTER_FORMAT, &text2);
|
2010-10-01 20:34:00 -07:00
|
|
|
if (!text2) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (text2)
|
|
|
|
{
|
2012-02-07 00:49:56 -08:00
|
|
|
char *s, *markup_text;
|
2018-11-08 08:34:16 -08:00
|
|
|
size_t size;
|
2012-02-07 00:49:56 -08:00
|
|
|
|
|
|
|
s = text2;
|
|
|
|
if (*s == '+')
|
|
|
|
{
|
|
|
|
s++;
|
2015-06-08 11:43:00 -07:00
|
|
|
while (*s == ' ')
|
|
|
|
s++;
|
2014-08-14 03:32:45 -07:00
|
|
|
if (!*s)
|
2012-02-07 00:49:56 -08:00
|
|
|
{
|
|
|
|
free(text2);
|
|
|
|
return;
|
|
|
|
}
|
2018-11-08 08:34:16 -08:00
|
|
|
size = strlen(s);
|
|
|
|
markup_text = (char *)malloc(size + 3);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (markup_text)
|
|
|
|
{
|
|
|
|
*(markup_text) = '<';
|
2018-11-08 08:34:16 -08:00
|
|
|
memcpy((markup_text + 1), s, size);
|
|
|
|
*(markup_text + size + 1) = '>';
|
|
|
|
*(markup_text + size + 2) = '\0';
|
2012-02-07 00:49:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (s[0] == '-')
|
|
|
|
{
|
|
|
|
s++;
|
2015-06-08 11:43:00 -07:00
|
|
|
while (*s == ' ')
|
|
|
|
s++;
|
2014-08-14 03:32:45 -07:00
|
|
|
if (!*s)
|
2012-02-07 00:49:56 -08:00
|
|
|
{
|
|
|
|
free(text2);
|
|
|
|
return;
|
|
|
|
}
|
2018-11-08 08:34:16 -08:00
|
|
|
size = strlen(s);
|
|
|
|
markup_text = (char *)malloc(size + 4);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (markup_text)
|
|
|
|
{
|
|
|
|
*(markup_text) = '<';
|
|
|
|
*(markup_text + 1) = '/';
|
2018-11-08 08:34:16 -08:00
|
|
|
memcpy((markup_text + 2), s, size);
|
|
|
|
*(markup_text + size + 2) = '>';
|
|
|
|
*(markup_text + size + 3) = '\0';
|
2012-02-07 00:49:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-08 08:34:16 -08:00
|
|
|
size = strlen(s);
|
|
|
|
markup_text = (char *)malloc(size + 4);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (markup_text)
|
|
|
|
{
|
|
|
|
*(markup_text) = '<';
|
2018-11-08 08:34:16 -08:00
|
|
|
memcpy((markup_text + 1), s, size);
|
|
|
|
*(markup_text + size + 1) = '/';
|
|
|
|
*(markup_text + size + 2) = '>';
|
|
|
|
*(markup_text + size + 3) = '\0';
|
2012-02-07 00:49:56 -08:00
|
|
|
}
|
|
|
|
}
|
2010-10-01 20:34:00 -07:00
|
|
|
free(text2);
|
2012-02-07 00:49:56 -08:00
|
|
|
if (markup_text)
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_markup_prepend_internal(ed, en, c, markup_text,
|
2013-03-29 03:42:54 -07:00
|
|
|
NULL, NULL,
|
|
|
|
EINA_FALSE, EINA_FALSE);
|
2010-10-01 20:34:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
static Edje_Entry_Change_Info *
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_markup_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
|
2013-03-29 03:42:54 -07:00
|
|
|
const char *text,
|
|
|
|
const char *fmtpre, const char *fmtpost,
|
|
|
|
Eina_Bool clearsel, Eina_Bool changeinfo)
|
2010-10-01 20:34:00 -07:00
|
|
|
{
|
|
|
|
char *text2;
|
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
|
2015-08-04 07:32:47 -07:00
|
|
|
|
|
|
|
if ((clearsel) && (en->have_selection))
|
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, en->rp->object, en);
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:34:00 -07:00
|
|
|
text2 = strdup(text);
|
2013-04-06 10:18:48 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
|
2010-10-01 20:34:00 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(cb->part, en->rp->part->name))
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
cb->func(cb->data, ed->obj, cb->part, EDJE_TEXT_FILTER_MARKUP, &text2);
|
2010-10-01 20:34:00 -07:00
|
|
|
if (!text2) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (text2)
|
2013-03-29 03:42:54 -07:00
|
|
|
{
|
|
|
|
Edje_Entry_Change_Info *info;
|
2013-04-10 20:30:04 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_markup_prepend_internal(ed, en, c, text2,
|
2013-03-29 03:42:54 -07:00
|
|
|
fmtpre, fmtpost,
|
|
|
|
clearsel, changeinfo);
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
return NULL;
|
2010-10-01 20:34:00 -07:00
|
|
|
}
|
|
|
|
|
2008-10-15 08:15:06 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED, Entry *en, Evas_Coord *cx, Evas_Coord *cy)
|
2008-10-15 08:15:06 -07:00
|
|
|
{
|
2011-05-19 01:38:42 -07:00
|
|
|
Evas_Coord cw, ch;
|
2011-01-30 02:46:33 -08:00
|
|
|
Evas_Textblock_Cursor_Type cur_type;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (c != en->cursor) return;
|
2011-01-30 02:46:33 -08:00
|
|
|
switch (en->rp->part->cursor_mode)
|
|
|
|
{
|
|
|
|
case EDJE_ENTRY_CURSOR_MODE_BEFORE:
|
2015-06-08 11:43:00 -07:00
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
|
|
|
|
break;
|
|
|
|
|
2011-01-30 02:46:33 -08:00
|
|
|
case EDJE_ENTRY_CURSOR_MODE_UNDER:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* no break for a reason */
|
2011-01-30 02:46:33 -08:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
|
2011-01-30 02:46:33 -08:00
|
|
|
}
|
2011-05-19 01:38:42 -07:00
|
|
|
evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type);
|
|
|
|
*cx += (cw / 2);
|
|
|
|
*cy += (ch / 2);
|
2008-10-15 08:15:06 -07:00
|
|
|
}
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
static int
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_line_last_get(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en EINA_UNUSED)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cc;
|
|
|
|
int ln;
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
cc = evas_object_textblock_cursor_new(o);
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_paragraph_last(cc);
|
2008-10-15 02:58:25 -07:00
|
|
|
ln = evas_textblock_cursor_line_geometry_get(cc, NULL, NULL, NULL, NULL);
|
|
|
|
evas_textblock_cursor_free(cc);
|
|
|
|
return ln;
|
|
|
|
}
|
|
|
|
|
2010-04-17 08:50:27 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED,
|
|
|
|
Entry *en EINA_UNUSED)
|
2010-04-17 08:50:27 -07:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_line_char_first(c);
|
2010-04-17 08:50:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED,
|
|
|
|
Entry *en EINA_UNUSED)
|
2010-04-17 08:50:27 -07:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_line_char_last(c);
|
2010-04-17 08:50:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED,
|
|
|
|
Entry *en EINA_UNUSED)
|
2010-04-17 08:50:27 -07:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_paragraph_first(c);
|
2010-04-17 08:50:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_curs_end(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED, Entry *en EINA_UNUSED)
|
2010-04-17 08:50:27 -07:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_paragraph_last(c);
|
2010-04-17 08:50:27 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 21:48:19 -07:00
|
|
|
static Eina_Bool
|
2008-10-15 02:58:25 -07:00
|
|
|
_curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
|
|
|
|
{
|
2011-05-19 01:38:42 -07:00
|
|
|
Evas_Coord cx, cy;
|
2008-10-15 08:15:06 -07:00
|
|
|
Evas_Coord lx, ly, lw, lh;
|
2010-04-17 08:50:27 -07:00
|
|
|
int last = _curs_line_last_get(c, o, en);
|
2008-10-15 02:58:25 -07:00
|
|
|
|
2013-04-22 07:34:25 -07:00
|
|
|
if (ln < 0) return EINA_FALSE;
|
|
|
|
if (ln > last) return EINA_FALSE;
|
2011-05-19 01:38:42 -07:00
|
|
|
|
|
|
|
_curs_update_from_curs(c, o, en, &cx, &cy);
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
|
2013-04-09 21:48:19 -07:00
|
|
|
return EINA_FALSE;
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (evas_textblock_cursor_cluster_coord_set(c, cx, ly + (lh / 2)))
|
2013-04-22 07:34:25 -07:00
|
|
|
return EINA_TRUE;
|
2010-04-17 09:19:28 -07:00
|
|
|
evas_textblock_cursor_line_set(c, ln);
|
2011-05-19 01:38:42 -07:00
|
|
|
if (cx < (lx + (lw / 2)))
|
2010-04-17 08:50:27 -07:00
|
|
|
{
|
|
|
|
if (ln == last) _curs_end(c, o, en);
|
|
|
|
_curs_lin_start(c, o, en);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ln == last)
|
|
|
|
_curs_end(c, o, en);
|
|
|
|
else
|
|
|
|
_curs_lin_end(c, o, en);
|
|
|
|
}
|
2013-04-09 21:48:19 -07:00
|
|
|
return EINA_TRUE;
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 21:48:19 -07:00
|
|
|
static Eina_Bool
|
2008-10-15 02:58:25 -07:00
|
|
|
_curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
|
|
|
|
{
|
|
|
|
int ln;
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
|
2013-04-09 21:48:19 -07:00
|
|
|
return _curs_jump_line(c, o, en, ln);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 21:48:19 -07:00
|
|
|
static Eina_Bool
|
2008-10-15 02:58:25 -07:00
|
|
|
_curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
|
|
|
{
|
2013-04-09 21:48:19 -07:00
|
|
|
return _curs_jump_line_by(c, o, en, -1);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2013-04-09 21:48:19 -07:00
|
|
|
static Eina_Bool
|
2008-10-15 02:58:25 -07:00
|
|
|
_curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
|
|
|
{
|
2013-04-09 21:48:19 -07:00
|
|
|
return _curs_jump_line_by(c, o, en, 1);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_sel_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
|
|
|
{
|
|
|
|
if (en->sel_start) return;
|
|
|
|
en->sel_start = evas_object_textblock_cursor_new(o);
|
2008-10-16 02:17:44 -07:00
|
|
|
evas_textblock_cursor_copy(c, en->sel_start);
|
2008-10-15 02:58:25 -07:00
|
|
|
en->sel_end = evas_object_textblock_cursor_new(o);
|
2009-02-14 18:55:56 -08:00
|
|
|
evas_textblock_cursor_copy(c, en->sel_end);
|
2009-05-14 05:53:56 -07:00
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
en->have_selection = EINA_FALSE;
|
2008-11-18 18:14:50 -08:00
|
|
|
if (en->selection)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
2008-11-18 18:14:50 -08:00
|
|
|
}
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-10 20:30:04 -07:00
|
|
|
_sel_enable(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED,
|
|
|
|
Evas_Object *o EINA_UNUSED, Entry *en)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
|
|
|
if (en->have_selection) return;
|
2009-06-17 04:10:32 -07:00
|
|
|
en->have_selection = EINA_TRUE;
|
2008-11-18 18:14:50 -08:00
|
|
|
if (en->selection)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
2008-11-18 18:14:50 -08:00
|
|
|
}
|
2013-04-24 17:45:15 -07:00
|
|
|
|
|
|
|
_edje_entry_imf_context_reset(en->rp);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "selection,start", en->rp->part->name);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2015-12-03 00:12:11 -08:00
|
|
|
static void
|
|
|
|
_emit_sel_state(Edje *ed, Entry *en)
|
|
|
|
{
|
|
|
|
if (!evas_textblock_cursor_compare(en->sel_start, en->sel_end))
|
|
|
|
{
|
|
|
|
_edje_emit(ed, "selection,reset", en->rp->part->name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_edje_emit(ed, "selection,changed", en->rp->part->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
|
|
|
if (!en->sel_end) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_enable(ed, c, o, en);
|
2008-10-15 02:58:25 -07:00
|
|
|
if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
|
2013-05-13 03:11:51 -07:00
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
evas_textblock_cursor_copy(c, en->sel_end);
|
2013-02-27 22:08:00 -08:00
|
|
|
|
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
|
|
|
|
2008-11-18 18:14:50 -08:00
|
|
|
if (en->selection)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
2008-11-18 18:14:50 -08:00
|
|
|
}
|
2015-12-03 00:12:11 -08:00
|
|
|
_emit_sel_state(ed, en);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2009-03-22 06:50:53 -07:00
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_preextend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
|
|
|
if (!en->sel_end) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_enable(ed, c, o, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
|
2013-05-13 03:11:51 -07:00
|
|
|
|
2009-03-22 06:50:53 -07:00
|
|
|
evas_textblock_cursor_copy(c, en->sel_start);
|
2013-02-27 22:08:00 -08:00
|
|
|
|
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
|
|
|
|
2009-03-22 06:50:53 -07:00
|
|
|
if (en->selection)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
2015-12-03 00:12:11 -08:00
|
|
|
_emit_sel_state(ed, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Entry *en)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
2009-06-17 04:10:32 -07:00
|
|
|
en->had_sel = EINA_FALSE;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (en->sel_start)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
evas_textblock_cursor_free(en->sel_start);
|
|
|
|
evas_textblock_cursor_free(en->sel_end);
|
|
|
|
en->sel_start = NULL;
|
|
|
|
en->sel_end = NULL;
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
2008-10-16 02:17:44 -07:00
|
|
|
if (en->selection)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
2008-10-16 02:17:44 -07:00
|
|
|
}
|
2008-10-15 02:58:25 -07:00
|
|
|
while (en->sel)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
Sel *sel;
|
|
|
|
|
|
|
|
sel = en->sel->data;
|
|
|
|
if (sel->obj_bg) evas_object_del(sel->obj_bg);
|
|
|
|
if (sel->obj_fg) evas_object_del(sel->obj_fg);
|
|
|
|
free(sel);
|
|
|
|
en->sel = eina_list_remove_list(en->sel, en->sel);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
2008-10-16 02:17:44 -07:00
|
|
|
if (en->have_selection)
|
|
|
|
{
|
2009-06-17 04:10:32 -07:00
|
|
|
en->have_selection = EINA_FALSE;
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "selection,cleared", en->rp->part->name);
|
2008-10-16 02:17:44 -07:00
|
|
|
}
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
2014-11-26 03:29:08 -08:00
|
|
|
Evas_Coord x, y;
|
2008-10-15 02:58:25 -07:00
|
|
|
Evas_Object *smart, *clip;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
smart = evas_object_smart_parent_get(o);
|
|
|
|
clip = evas_object_clip_get(o);
|
2014-11-26 03:29:08 -08:00
|
|
|
if (!en->sel_start)
|
2015-06-08 11:43:00 -07:00
|
|
|
return;
|
2014-11-26 03:29:08 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(o, &x, &y, NULL, NULL);
|
|
|
|
if (en->have_selection)
|
2008-10-15 02:58:25 -07:00
|
|
|
{
|
2014-11-26 03:29:08 -08:00
|
|
|
Eina_Iterator *range = NULL;
|
|
|
|
Eina_List *l;
|
2016-07-27 18:59:15 -07:00
|
|
|
Sel *sel = NULL;
|
2014-11-26 03:29:08 -08:00
|
|
|
Evas_Textblock_Rectangle *r;
|
|
|
|
|
|
|
|
range = evas_textblock_cursor_range_simple_geometry_get(en->sel_start,
|
|
|
|
en->sel_end);
|
|
|
|
|
|
|
|
l = en->sel;
|
|
|
|
EINA_ITERATOR_FOREACH(range, r)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2014-11-26 03:29:08 -08:00
|
|
|
if (!l)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *ob;
|
|
|
|
|
|
|
|
sel = calloc(1, sizeof(Sel));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!sel)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
en->sel = eina_list_append(en->sel, sel);
|
2015-10-20 11:57:17 -07:00
|
|
|
if (en->rp->part->source)
|
|
|
|
{
|
2017-09-05 23:14:07 -07:00
|
|
|
ob = edje_object_add(ed->base.evas);
|
2015-10-20 11:57:17 -07:00
|
|
|
edje_object_file_set(ob, ed->path, en->rp->part->source);
|
|
|
|
evas_object_smart_member_add(ob, smart);
|
|
|
|
evas_object_stack_below(ob, o);
|
|
|
|
evas_object_clip_set(ob, clip);
|
|
|
|
evas_object_pass_events_set(ob, EINA_TRUE);
|
|
|
|
evas_object_show(ob);
|
|
|
|
sel->obj_bg = ob;
|
|
|
|
_edje_subobj_register(ed, sel->obj_bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (en->rp->part->source2)
|
|
|
|
{
|
2017-09-05 23:14:07 -07:00
|
|
|
ob = edje_object_add(ed->base.evas);
|
2015-10-20 11:57:17 -07:00
|
|
|
edje_object_file_set(ob, ed->path, en->rp->part->source2);
|
|
|
|
evas_object_smart_member_add(ob, smart);
|
|
|
|
evas_object_stack_above(ob, o);
|
|
|
|
evas_object_clip_set(ob, clip);
|
|
|
|
evas_object_pass_events_set(ob, EINA_TRUE);
|
|
|
|
evas_object_show(ob);
|
|
|
|
sel->obj_fg = ob;
|
|
|
|
_edje_subobj_register(ed, sel->obj_fg);
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2014-11-26 03:29:08 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sel = eina_list_data_get(l);
|
|
|
|
l = l->next;
|
|
|
|
}
|
|
|
|
*(&(sel->rect)) = *r;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
|
|
|
if (sel->obj_bg)
|
|
|
|
{
|
|
|
|
evas_object_move(sel->obj_bg, x + r->x, y + r->y);
|
|
|
|
evas_object_resize(sel->obj_bg, r->w, r->h);
|
|
|
|
}
|
|
|
|
if (sel->obj_fg)
|
|
|
|
{
|
|
|
|
evas_object_move(sel->obj_fg, x + r->x, y + r->y);
|
|
|
|
evas_object_resize(sel->obj_fg, r->w, r->h);
|
|
|
|
}
|
|
|
|
}
|
2014-11-26 03:29:08 -08:00
|
|
|
eina_iterator_free(range);
|
|
|
|
|
|
|
|
/* delete redundant selection rects */
|
|
|
|
while (l)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2014-11-26 03:29:08 -08:00
|
|
|
Eina_List *temp = l->next;
|
|
|
|
sel = eina_list_data_get(l);
|
|
|
|
if (sel)
|
|
|
|
{
|
|
|
|
if (sel->obj_bg) evas_object_del(sel->obj_bg);
|
|
|
|
if (sel->obj_fg) evas_object_del(sel->obj_fg);
|
|
|
|
free(sel);
|
|
|
|
}
|
|
|
|
en->sel = eina_list_remove_list(en->sel, l);
|
|
|
|
l = temp;
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-11 02:26:29 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_entry_style_tag_check(Edje_Real_Part *rp, const char *tag)
|
|
|
|
{
|
2019-12-19 22:13:36 -08:00
|
|
|
if (!tag) return EINA_FALSE;
|
2016-07-11 02:26:29 -07:00
|
|
|
const Evas_Textblock_Style *ts = NULL;
|
|
|
|
|
|
|
|
ts = evas_object_textblock_style_user_peek(rp->object);
|
2019-12-19 22:13:36 -08:00
|
|
|
if (!ts) ts = evas_object_textblock_style_get(rp->object);
|
2016-07-11 02:26:29 -07:00
|
|
|
if (ts)
|
|
|
|
{
|
2019-12-19 22:13:36 -08:00
|
|
|
const char *style_str = evas_textblock_style_get(ts);
|
|
|
|
if (!style_str) return EINA_FALSE;
|
|
|
|
if (strstr(style_str, tag)) return EINA_TRUE;
|
2016-07-11 02:26:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Anchor *an = data;
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Edje_Real_Part *rp = an->en->rp;
|
|
|
|
char *buf, *n;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len;
|
2008-10-16 23:40:46 -07:00
|
|
|
int ignored;
|
2009-03-22 06:50:53 -07:00
|
|
|
Entry *en;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = an->en->ed;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-03-22 06:50:53 -07:00
|
|
|
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
|
|
|
|
(en->select_allow))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2013-04-06 10:18:48 -07:00
|
|
|
|
2017-02-07 15:08:19 -08:00
|
|
|
ignored = rp->ignore_flags & ev->event_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
if ((!ev->event_flags) || (!ignored))
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
n = an->name;
|
|
|
|
if (!n) n = "";
|
|
|
|
len = 200 + strlen(n);
|
|
|
|
buf = alloca(len);
|
2008-10-16 23:40:46 -07:00
|
|
|
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
|
2011-04-05 18:20:59 -07:00
|
|
|
snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n);
|
2008-10-16 23:40:46 -07:00
|
|
|
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
2011-04-05 18:20:59 -07:00
|
|
|
snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n);
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2016-07-11 02:26:29 -07:00
|
|
|
|
|
|
|
/* Link Pressed effect */
|
|
|
|
if (_edje_entry_style_tag_check(rp, "link_pressed="))
|
|
|
|
{
|
|
|
|
an->en->have_link_pressed = EINA_TRUE;
|
|
|
|
evas_textblock_cursor_format_append(an->start, "<link_pressed>");
|
2020-01-24 06:49:03 -08:00
|
|
|
evas_textblock_cursor_format_prepend(an->end, "</link_pressed>");
|
2016-07-11 02:26:29 -07:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2017-02-07 15:08:19 -08:00
|
|
|
ev->event_flags |= rp->mask_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_anchor_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Anchor *an = data;
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
Edje_Real_Part *rp = an->en->rp;
|
|
|
|
char *buf, *n;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len;
|
2008-10-16 23:40:46 -07:00
|
|
|
int ignored;
|
2009-03-22 06:50:53 -07:00
|
|
|
Entry *en;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = an->en->ed;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
en = rp->typedata.text->entry_data;
|
2017-02-07 15:08:19 -08:00
|
|
|
ignored = rp->ignore_flags & ev->event_flags;
|
2011-03-10 02:12:32 -08:00
|
|
|
n = an->name;
|
|
|
|
if (!n) n = "";
|
|
|
|
len = 200 + strlen(n);
|
|
|
|
buf = alloca(len);
|
2013-02-17 06:18:46 -08:00
|
|
|
if ((rp->part->select_mode != EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
|
|
|
|
(!en->select_allow))
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
2013-02-17 06:18:46 -08:00
|
|
|
if ((!ev->event_flags) || (!ignored))
|
|
|
|
{
|
|
|
|
snprintf(buf, len, "anchor,mouse,up,%i,%s", ev->button, n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2016-07-11 02:26:29 -07:00
|
|
|
/* Link Pressed effect */
|
|
|
|
if (an->en->have_link_pressed)
|
|
|
|
{
|
|
|
|
const Evas_Object_Textblock_Node_Format *node;
|
|
|
|
node = evas_textblock_node_format_first_get(rp->object);
|
|
|
|
for (; node; node = evas_textblock_node_format_next_get(node))
|
|
|
|
{
|
|
|
|
const char *text = evas_textblock_node_format_text_get(node);
|
|
|
|
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
if (!strcmp(text, "+ link_pressed"))
|
|
|
|
{
|
|
|
|
evas_textblock_node_format_remove_pair(rp->object,
|
|
|
|
(Evas_Object_Textblock_Node_Format *)node);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-02-17 06:18:46 -08:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2016-07-11 02:26:29 -07:00
|
|
|
|
2011-03-10 02:12:32 -08:00
|
|
|
if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ignored))
|
|
|
|
{
|
|
|
|
snprintf(buf, len, "anchor,mouse,clicked,%i,%s", ev->button, n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2011-03-10 02:12:32 -08:00
|
|
|
}
|
2017-02-07 15:08:19 -08:00
|
|
|
ev->event_flags |= rp->mask_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_anchor_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Anchor *an = data;
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Edje_Real_Part *rp = an->en->rp;
|
|
|
|
char *buf, *n;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len;
|
2008-10-16 23:40:46 -07:00
|
|
|
int ignored;
|
2009-03-22 06:50:53 -07:00
|
|
|
Entry *en;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = an->en->ed;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-03-22 06:50:53 -07:00
|
|
|
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
|
|
|
|
(en->select_allow))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2013-04-06 10:18:48 -07:00
|
|
|
|
2017-02-07 15:08:19 -08:00
|
|
|
ignored = rp->ignore_flags & ev->event_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
if ((!ev->event_flags) || (!ignored))
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
n = an->name;
|
|
|
|
if (!n) n = "";
|
|
|
|
len = 200 + strlen(n);
|
|
|
|
buf = alloca(len);
|
|
|
|
snprintf(buf, len, "anchor,mouse,move,%s", n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2017-02-07 15:08:19 -08:00
|
|
|
ev->event_flags |= rp->mask_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_anchor_mouse_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Anchor *an = data;
|
|
|
|
Evas_Event_Mouse_In *ev = event_info;
|
|
|
|
Edje_Real_Part *rp = an->en->rp;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = an->en->ed;
|
2008-10-16 23:40:46 -07:00
|
|
|
char *buf, *n;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len;
|
2008-10-16 23:40:46 -07:00
|
|
|
int ignored;
|
|
|
|
|
2017-02-07 15:08:19 -08:00
|
|
|
ignored = rp->ignore_flags & ev->event_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
if ((!ev->event_flags) || (!ignored))
|
|
|
|
{
|
2014-02-17 04:18:19 -08:00
|
|
|
/* set to allow handling in elementary, in case we have
|
|
|
|
* an unwanted event propagation */
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
n = an->name;
|
|
|
|
if (!n) n = "";
|
|
|
|
len = 200 + strlen(n);
|
|
|
|
buf = alloca(len);
|
|
|
|
snprintf(buf, len, "anchor,mouse,in,%s", n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2017-02-07 15:08:19 -08:00
|
|
|
ev->event_flags |= rp->mask_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_anchor_mouse_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Anchor *an = data;
|
|
|
|
Evas_Event_Mouse_Out *ev = event_info;
|
|
|
|
Edje_Real_Part *rp = an->en->rp;
|
|
|
|
char *buf, *n;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t len;
|
2008-10-16 23:40:46 -07:00
|
|
|
int ignored;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = an->en->ed;
|
2008-10-16 23:40:46 -07:00
|
|
|
|
2017-02-07 15:08:19 -08:00
|
|
|
ignored = rp->ignore_flags & ev->event_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
if ((!ev->event_flags) || (!ignored))
|
|
|
|
{
|
2014-02-17 04:18:19 -08:00
|
|
|
/* set to allow handling in elementary, in case we have
|
|
|
|
* an unwanted event propagation */
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
n = an->name;
|
|
|
|
if (!n) n = "";
|
|
|
|
len = 200 + strlen(n);
|
|
|
|
buf = alloca(len);
|
|
|
|
snprintf(buf, len, "anchor,mouse,out,%s", n);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, buf, rp->part->name);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2017-02-07 15:08:19 -08:00
|
|
|
ev->event_flags |= rp->mask_flags;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
2016-01-12 05:20:19 -08:00
|
|
|
static void
|
|
|
|
_item_obj_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Item_Obj *io = data;
|
|
|
|
Anchor *an = io->an;
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if (!an)
|
|
|
|
{
|
|
|
|
ERR("Failed to free item object struct. Anchor is NULL!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
en = an->en;
|
|
|
|
en->item_objs = (Item_Obj *)eina_inlist_remove(EINA_INLIST_GET(en->item_objs),
|
|
|
|
EINA_INLIST_GET(io));
|
|
|
|
io->an = NULL;
|
|
|
|
free(io->name);
|
|
|
|
free(io);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_item_obj_get(Anchor *an, Evas_Object *o, Evas_Object *smart, Evas_Object *clip)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Item_Obj *io;
|
|
|
|
Entry *en = an->en;
|
|
|
|
Edje *ed = en->ed;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(en->item_objs, io)
|
|
|
|
{
|
2018-02-11 02:20:46 -08:00
|
|
|
if (!io->an && io->name && !strcmp(an->name ? an->name : "", io->name))
|
2016-01-12 05:20:19 -08:00
|
|
|
{
|
|
|
|
io->an = an;
|
|
|
|
return io->obj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
io = calloc(1, sizeof(Item_Obj));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!io)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
return NULL;
|
|
|
|
}
|
2016-01-12 05:20:19 -08:00
|
|
|
|
|
|
|
obj = ed->item_provider.func
|
|
|
|
(ed->item_provider.data, smart,
|
|
|
|
en->rp->part->name, an->name);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _item_obj_del_cb, io);
|
|
|
|
evas_object_smart_member_add(obj, smart);
|
|
|
|
evas_object_stack_above(obj, o);
|
|
|
|
evas_object_clip_set(obj, clip);
|
|
|
|
evas_object_pass_events_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
io->an = an;
|
2018-02-11 02:20:46 -08:00
|
|
|
io->name = strdup(an->name ? an->name : "");
|
2016-01-12 05:20:19 -08:00
|
|
|
io->obj = obj;
|
|
|
|
en->item_objs = (Item_Obj *)eina_inlist_append(EINA_INLIST_GET(en->item_objs),
|
|
|
|
EINA_INLIST_GET(io));
|
|
|
|
|
|
|
|
return io->obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_unused_item_objs_free(Entry *en)
|
|
|
|
{
|
|
|
|
Item_Obj *io;
|
|
|
|
Eina_Inlist *l;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH_SAFE(en->item_objs, l, io)
|
|
|
|
{
|
|
|
|
if (!io->an)
|
|
|
|
{
|
|
|
|
if (io->obj)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full(io->obj, EVAS_CALLBACK_DEL, _item_obj_del_cb, io);
|
|
|
|
evas_object_del(io->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
en->item_objs = (Item_Obj *)eina_inlist_remove(EINA_INLIST_GET(en->item_objs),
|
|
|
|
EINA_INLIST_GET(io));
|
|
|
|
free(io->name);
|
|
|
|
free(io);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-12 03:36:58 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_is_anchors_outside_viewport(Evas_Coord oxy, Evas_Coord axy, Evas_Coord awh,
|
|
|
|
Evas_Coord vxy, Evas_Coord vwh)
|
|
|
|
{
|
|
|
|
if (((oxy + axy + awh) < vxy) || ((oxy + axy) > vwh))
|
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
static void
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
_anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
2011-06-10 09:41:45 -07:00
|
|
|
Eina_List *l, *ll, *range = NULL;
|
2008-10-16 23:40:46 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
2016-07-12 03:36:58 -07:00
|
|
|
Evas_Coord vx, vy, vw, vh;
|
|
|
|
Evas_Coord tvh, tvw;
|
2008-10-16 23:40:46 -07:00
|
|
|
Evas_Object *smart, *clip;
|
2016-07-27 18:59:15 -07:00
|
|
|
Sel *sel = NULL;
|
2008-10-22 04:34:42 -07:00
|
|
|
Anchor *an;
|
2013-04-06 10:18:48 -07:00
|
|
|
Edje *ed = en->ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
/* Better not to update anchors outside the view port. */
|
|
|
|
if (en->anchors_updated) return;
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
smart = evas_object_smart_parent_get(o);
|
|
|
|
clip = evas_object_clip_get(o);
|
|
|
|
x = y = w = h = -1;
|
|
|
|
evas_object_geometry_get(o, &x, &y, &w, &h);
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_output_viewport_get(en->ed->base.evas, &vx, &vy, &vw, &vh);
|
2016-07-12 03:36:58 -07:00
|
|
|
tvw = vx + vw;
|
|
|
|
tvh = vy + vh;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
2010-04-25 06:06:58 -07:00
|
|
|
// for item anchors
|
|
|
|
if (an->item)
|
|
|
|
{
|
2016-07-12 03:36:58 -07:00
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
|
|
|
|
if (!evas_textblock_cursor_format_item_geometry_get
|
|
|
|
(an->start, &cx, &cy, &cw, &ch))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_is_anchors_outside_viewport(y, cy, ch, vy, tvh) ||
|
|
|
|
_is_anchors_outside_viewport(x, cx, cw, vx, tvw))
|
|
|
|
{
|
|
|
|
if (an->sel)
|
|
|
|
{
|
|
|
|
sel = an->sel->data;
|
|
|
|
evas_object_hide(sel->obj);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2008-10-22 04:34:42 -07:00
|
|
|
|
2010-09-13 05:08:19 -07:00
|
|
|
if (!an->sel)
|
2010-04-26 07:55:45 -07:00
|
|
|
{
|
2016-07-12 03:36:58 -07:00
|
|
|
Evas_Object *ob;
|
|
|
|
|
2010-09-13 05:08:19 -07:00
|
|
|
sel = calloc(1, sizeof(Sel));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!sel)
|
2010-09-13 05:08:19 -07:00
|
|
|
{
|
2016-07-27 18:59:15 -07:00
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
an->sel = eina_list_append(an->sel, sel);
|
2016-08-07 23:33:18 -07:00
|
|
|
if (!an->sel)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
2016-07-27 18:59:15 -07:00
|
|
|
if (ed->item_provider.func)
|
|
|
|
{
|
|
|
|
ob = _item_obj_get(an, o, smart, clip);
|
|
|
|
sel->obj = ob;
|
2010-09-13 05:08:19 -07:00
|
|
|
}
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
2016-07-27 18:59:15 -07:00
|
|
|
/* We have only one sel per item */
|
|
|
|
sel = an->sel->data;
|
|
|
|
evas_object_move(sel->obj, x + cx, y + cy);
|
|
|
|
evas_object_resize(sel->obj, cw, ch);
|
|
|
|
evas_object_show(sel->obj);
|
2010-04-25 06:06:58 -07:00
|
|
|
}
|
|
|
|
// for link anchors
|
|
|
|
else
|
|
|
|
{
|
2012-03-26 01:31:05 -07:00
|
|
|
range =
|
2011-06-10 09:41:45 -07:00
|
|
|
evas_textblock_cursor_range_geometry_get(an->start, an->end);
|
2010-04-25 06:06:58 -07:00
|
|
|
if (eina_list_count(range) != eina_list_count(an->sel))
|
|
|
|
{
|
|
|
|
while (an->sel)
|
|
|
|
{
|
|
|
|
sel = an->sel->data;
|
|
|
|
if (sel->obj_bg) evas_object_del(sel->obj_bg);
|
|
|
|
if (sel->obj_fg) evas_object_del(sel->obj_fg);
|
|
|
|
if (sel->obj) evas_object_del(sel->obj);
|
|
|
|
free(sel);
|
|
|
|
an->sel = eina_list_remove_list(an->sel, an->sel);
|
|
|
|
}
|
2020-08-05 17:46:24 -07:00
|
|
|
if (range)
|
2016-07-12 03:36:58 -07:00
|
|
|
{
|
2020-08-05 17:46:24 -07:00
|
|
|
Evas_Textblock_Rectangle *r, *r_last;
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2020-08-05 17:46:24 -07:00
|
|
|
r = range->data;
|
|
|
|
r_last = eina_list_last_data_get(range);
|
|
|
|
if (r->y != r_last->y)
|
2016-07-27 18:59:15 -07:00
|
|
|
{
|
2020-08-05 17:46:24 -07:00
|
|
|
/* For multiple range */
|
|
|
|
r->h = r->y + r_last->y + r_last->h;
|
2016-07-27 18:59:15 -07:00
|
|
|
}
|
2020-08-05 17:46:24 -07:00
|
|
|
/* For vertically layout entry */
|
|
|
|
if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
|
2015-10-20 11:57:17 -07:00
|
|
|
{
|
2020-08-05 17:46:24 -07:00
|
|
|
EINA_LIST_FREE(range, r)
|
|
|
|
free(r);
|
|
|
|
continue;
|
2015-10-20 11:57:17 -07:00
|
|
|
}
|
2020-08-05 17:46:24 -07:00
|
|
|
else
|
2015-10-20 11:57:17 -07:00
|
|
|
{
|
2020-08-05 17:46:24 -07:00
|
|
|
/* XXX: Should consider for horizontal entry but has
|
|
|
|
* very minimal usage. Probably we should get the min x
|
|
|
|
* and max w for range and then decide whether it is in
|
|
|
|
* the viewport or not. Unnecessary calculation for this
|
|
|
|
* minimal usage. Please test with large number of anchors
|
|
|
|
* after implementing it, if its needed to be.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
for (ll = range; ll; ll = eina_list_next(ll))
|
|
|
|
{
|
|
|
|
Evas_Object *ob;
|
|
|
|
|
|
|
|
sel = calloc(1, sizeof(Sel));
|
|
|
|
if (!sel)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
an->sel = eina_list_append(an->sel, sel);
|
|
|
|
if (en->rp->part->source5)
|
|
|
|
{
|
|
|
|
ob = edje_object_add(ed->base.evas);
|
|
|
|
edje_object_file_set(ob, ed->path, en->rp->part->source5);
|
|
|
|
evas_object_smart_member_add(ob, smart);
|
|
|
|
evas_object_stack_below(ob, o);
|
|
|
|
evas_object_clip_set(ob, clip);
|
|
|
|
evas_object_pass_events_set(ob, EINA_TRUE);
|
|
|
|
sel->obj_bg = ob;
|
|
|
|
_edje_subobj_register(ed, sel->obj_bg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (en->rp->part->source6)
|
|
|
|
{
|
|
|
|
ob = edje_object_add(ed->base.evas);
|
|
|
|
edje_object_file_set(ob, ed->path, en->rp->part->source6);
|
|
|
|
evas_object_smart_member_add(ob, smart);
|
|
|
|
evas_object_stack_above(ob, o);
|
|
|
|
evas_object_clip_set(ob, clip);
|
|
|
|
evas_object_pass_events_set(ob, EINA_TRUE);
|
|
|
|
sel->obj_fg = ob;
|
|
|
|
_edje_subobj_register(ed, sel->obj_fg);
|
|
|
|
}
|
|
|
|
|
|
|
|
ob = evas_object_rectangle_add(ed->base.evas);
|
|
|
|
evas_object_color_set(ob, 0, 0, 0, 0);
|
2015-10-20 11:57:17 -07:00
|
|
|
evas_object_smart_member_add(ob, smart);
|
|
|
|
evas_object_stack_above(ob, o);
|
|
|
|
evas_object_clip_set(ob, clip);
|
2020-08-05 17:46:24 -07:00
|
|
|
evas_object_repeat_events_set(ob, EINA_TRUE);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
|
|
|
|
sel->obj = ob;
|
2015-10-20 11:57:17 -07:00
|
|
|
}
|
2010-04-25 06:06:58 -07:00
|
|
|
}
|
|
|
|
}
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2016-07-12 03:36:58 -07:00
|
|
|
EINA_LIST_FOREACH(an->sel, ll, sel)
|
2010-04-25 06:06:58 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Rectangle *r;
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2021-02-03 18:00:14 -08:00
|
|
|
if (!range) break;
|
|
|
|
|
2010-04-25 06:06:58 -07:00
|
|
|
r = range->data;
|
|
|
|
*(&(sel->rect)) = *r;
|
2016-07-12 03:36:58 -07:00
|
|
|
if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh) ||
|
|
|
|
_is_anchors_outside_viewport(x, r->x, r->w, vx, tvw))
|
|
|
|
{
|
|
|
|
range = eina_list_remove_list(range, range);
|
|
|
|
free(r);
|
|
|
|
evas_object_hide(sel->obj_bg);
|
|
|
|
evas_object_hide(sel->obj_fg);
|
|
|
|
evas_object_hide(sel->obj);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-04-25 06:06:58 -07:00
|
|
|
if (sel->obj_bg)
|
|
|
|
{
|
|
|
|
evas_object_move(sel->obj_bg, x + r->x, y + r->y);
|
|
|
|
evas_object_resize(sel->obj_bg, r->w, r->h);
|
2016-07-12 03:36:58 -07:00
|
|
|
evas_object_show(sel->obj_bg);
|
2010-04-25 06:06:58 -07:00
|
|
|
}
|
|
|
|
if (sel->obj_fg)
|
|
|
|
{
|
|
|
|
evas_object_move(sel->obj_fg, x + r->x, y + r->y);
|
|
|
|
evas_object_resize(sel->obj_fg, r->w, r->h);
|
2016-07-12 03:36:58 -07:00
|
|
|
evas_object_show(sel->obj_fg);
|
2010-04-25 06:06:58 -07:00
|
|
|
}
|
|
|
|
if (sel->obj)
|
|
|
|
{
|
|
|
|
evas_object_move(sel->obj, x + r->x, y + r->y);
|
|
|
|
evas_object_resize(sel->obj, r->w, r->h);
|
2016-07-12 03:36:58 -07:00
|
|
|
evas_object_show(sel->obj);
|
2010-04-25 06:06:58 -07:00
|
|
|
}
|
|
|
|
range = eina_list_remove_list(range, range);
|
|
|
|
free(r);
|
|
|
|
}
|
2010-10-20 03:34:26 -07:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2016-01-12 05:20:19 -08:00
|
|
|
|
|
|
|
_unused_item_objs_free(en);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
static void
|
|
|
|
_anchors_update_check(Edje *ed, Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord vx, vy, vw, vh;
|
|
|
|
Eina_Bool anchors_updated = EINA_FALSE;
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
x = y = w = h = -1;
|
|
|
|
vx = vy = vw = vh = -1;
|
|
|
|
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_output_viewport_get(ed->base.evas, &vx, &vy, &vw, &vh);
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
if (((y + h) <= vy) || (y >= (vy + vh)))
|
|
|
|
anchors_updated = EINA_TRUE;
|
|
|
|
else if (((x + w) <= vx) || (x >= (vx + vw)))
|
|
|
|
anchors_updated = EINA_TRUE;
|
|
|
|
|
|
|
|
if (en->anchors_updated)
|
|
|
|
en->anchors_updated = anchors_updated;
|
|
|
|
_anchors_update(en->cursor, rp->object, en);
|
|
|
|
en->anchors_updated = anchors_updated;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_anchors_need_update(Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
Eina_Bool anchors_updated;
|
|
|
|
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
anchors_updated = en->anchors_updated;
|
|
|
|
en->anchors_updated = EINA_FALSE;
|
|
|
|
_anchors_update(en->cursor, rp->object, en);
|
|
|
|
en->anchors_updated = anchors_updated;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_anchors_clear(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Entry *en)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
2016-01-12 05:20:19 -08:00
|
|
|
Item_Obj *io;
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
while (en->anchorlist)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->anchorlist->data);
|
|
|
|
en->anchorlist = eina_list_remove_list(en->anchorlist, en->anchorlist);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2010-04-26 07:55:45 -07:00
|
|
|
while (en->itemlist)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
free(en->itemlist->data);
|
|
|
|
en->itemlist = eina_list_remove_list(en->itemlist, en->itemlist);
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
while (en->anchors)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
Anchor *an = en->anchors->data;
|
|
|
|
|
|
|
|
while (an->sel)
|
|
|
|
{
|
|
|
|
Sel *sel = an->sel->data;
|
|
|
|
if (sel->obj_bg) evas_object_del(sel->obj_bg);
|
|
|
|
if (sel->obj_fg) evas_object_del(sel->obj_fg);
|
2016-01-12 05:20:19 -08:00
|
|
|
if (!an->item && sel->obj) evas_object_del(sel->obj);
|
2010-09-19 01:08:17 -07:00
|
|
|
free(sel);
|
|
|
|
an->sel = eina_list_remove_list(an->sel, an->sel);
|
|
|
|
}
|
2015-09-25 01:49:18 -07:00
|
|
|
evas_textblock_cursor_free(an->start);
|
|
|
|
evas_textblock_cursor_free(an->end);
|
2010-09-19 01:08:17 -07:00
|
|
|
free(an->name);
|
|
|
|
free(an);
|
|
|
|
en->anchors = eina_list_remove_list(en->anchors, en->anchors);
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2016-01-12 05:20:19 -08:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(en->item_objs, io)
|
|
|
|
io->an = NULL;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
2014-01-27 07:14:32 -08:00
|
|
|
/* FIXME: This is horrible. It's just a copy&paste (with some adjustments)
|
|
|
|
* from textblock. I didn't want to introduce any non-API links between the
|
|
|
|
* libs so I just copied it. Should have been handled differently. */
|
|
|
|
static char *
|
|
|
|
_anchor_format_parse(const char *item)
|
|
|
|
{
|
|
|
|
const char *start, *end;
|
|
|
|
char *tmp;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
start = strchr(item, '=');
|
2014-03-19 16:44:56 -07:00
|
|
|
if (!start) return NULL;
|
|
|
|
|
2014-01-27 07:14:32 -08:00
|
|
|
start++; /* Advance after the '=' */
|
|
|
|
/* If we can find a quote as the first non-space char,
|
|
|
|
* our new delimiter is a quote, not a space. */
|
|
|
|
while (*start == ' ')
|
2015-06-08 11:43:00 -07:00
|
|
|
start++;
|
2014-01-27 07:14:32 -08:00
|
|
|
|
|
|
|
if (*start == '\'')
|
|
|
|
{
|
|
|
|
start++;
|
|
|
|
end = strchr(start, '\'');
|
|
|
|
while ((end) && (end > start) && (end[-1] == '\\'))
|
|
|
|
end = strchr(end + 1, '\'');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end = strchr(start, ' ');
|
|
|
|
while ((end) && (end > start) && (end[-1] == '\\'))
|
|
|
|
end = strchr(end + 1, ' ');
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Null terminate before the spaces */
|
|
|
|
if (end) len = end - start;
|
|
|
|
else len = strlen(start);
|
|
|
|
|
2014-01-28 02:10:05 -08:00
|
|
|
tmp = malloc(len + 1);
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
ERR("Running out of memory when allocating %lu byte string", (unsigned long)len + 1);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-01-27 07:14:32 -08:00
|
|
|
strncpy(tmp, start, len);
|
|
|
|
tmp[len] = '\0';
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
static void
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
2011-09-05 05:07:31 -07:00
|
|
|
const Eina_List *anchors_a, *anchors_item;
|
2008-10-16 23:40:46 -07:00
|
|
|
Anchor *an = NULL;
|
|
|
|
_anchors_clear(c, o, en);
|
2010-08-09 09:25:45 -07:00
|
|
|
|
2011-09-05 05:07:31 -07:00
|
|
|
anchors_a = evas_textblock_node_format_list_get(o, "a");
|
|
|
|
anchors_item = evas_textblock_node_format_list_get(o, "item");
|
2011-05-11 03:19:01 -07:00
|
|
|
|
2011-09-05 05:07:31 -07:00
|
|
|
if (anchors_a)
|
2011-05-11 03:19:01 -07:00
|
|
|
{
|
2011-09-05 05:07:31 -07:00
|
|
|
const Evas_Object_Textblock_Node_Format *node;
|
|
|
|
const Eina_List *itr;
|
|
|
|
EINA_LIST_FOREACH(anchors_a, itr, node)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2011-09-05 05:07:31 -07:00
|
|
|
const char *s = evas_textblock_node_format_text_get(node);
|
2011-05-11 03:19:01 -07:00
|
|
|
char *p;
|
|
|
|
an = calloc(1, sizeof(Anchor));
|
|
|
|
if (!an)
|
2016-07-27 18:59:15 -07:00
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
|
|
|
|
an->en = en;
|
|
|
|
p = strstr(s, "href=");
|
|
|
|
if (p)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2014-01-27 07:14:32 -08:00
|
|
|
an->name = _anchor_format_parse(p);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
en->anchors = eina_list_append(en->anchors, an);
|
|
|
|
an->start = evas_object_textblock_cursor_new(o);
|
|
|
|
an->end = evas_object_textblock_cursor_new(o);
|
|
|
|
evas_textblock_cursor_at_format_set(an->start, node);
|
|
|
|
evas_textblock_cursor_copy(an->start, an->end);
|
|
|
|
|
|
|
|
/* Close the anchor, if the anchor was without text,
|
|
|
|
* free it as well */
|
|
|
|
node = evas_textblock_node_format_next_get(node);
|
|
|
|
for (; node; node = evas_textblock_node_format_next_get(node))
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2011-05-11 03:19:01 -07:00
|
|
|
s = evas_textblock_node_format_text_get(node);
|
|
|
|
if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
|
2012-02-20 00:51:55 -08:00
|
|
|
break;
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
|
|
|
|
if (node)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2011-05-11 03:19:01 -07:00
|
|
|
evas_textblock_cursor_at_format_set(an->end, node);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
else if (!evas_textblock_cursor_compare(an->start, an->end))
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2018-02-11 02:20:46 -08:00
|
|
|
free(an->name);
|
2011-05-11 03:19:01 -07:00
|
|
|
evas_textblock_cursor_free(an->start);
|
|
|
|
evas_textblock_cursor_free(an->end);
|
|
|
|
en->anchors = eina_list_remove(en->anchors, an);
|
|
|
|
free(an);
|
|
|
|
}
|
|
|
|
an = NULL;
|
|
|
|
}
|
2011-09-05 05:07:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (anchors_item)
|
|
|
|
{
|
|
|
|
const Evas_Object_Textblock_Node_Format *node;
|
|
|
|
const Eina_List *itr;
|
|
|
|
EINA_LIST_FOREACH(anchors_item, itr, node)
|
2011-05-11 03:19:01 -07:00
|
|
|
{
|
2011-09-05 05:07:31 -07:00
|
|
|
const char *s = evas_textblock_node_format_text_get(node);
|
2011-05-11 03:19:01 -07:00
|
|
|
char *p;
|
|
|
|
an = calloc(1, sizeof(Anchor));
|
|
|
|
if (!an)
|
2016-07-27 18:59:15 -07:00
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
break;
|
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
|
|
|
|
an->en = en;
|
|
|
|
an->item = 1;
|
|
|
|
p = strstr(s, "href=");
|
|
|
|
if (p)
|
|
|
|
{
|
2014-01-27 07:14:32 -08:00
|
|
|
an->name = _anchor_format_parse(p);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2011-05-11 03:19:01 -07:00
|
|
|
en->anchors = eina_list_append(en->anchors, an);
|
|
|
|
an->start = evas_object_textblock_cursor_new(o);
|
|
|
|
an->end = evas_object_textblock_cursor_new(o);
|
|
|
|
evas_textblock_cursor_at_format_set(an->start, node);
|
|
|
|
evas_textblock_cursor_copy(an->start, an->end);
|
|
|
|
/* Although needed in textblock, don't bother with finding the end
|
|
|
|
* here cause it doesn't really matter. */
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2010-08-09 09:25:45 -07:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
|
2011-10-03 05:30:40 -07:00
|
|
|
static void
|
|
|
|
_free_entry_change_info(void *_info)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
Edje_Entry_Change_Info *info = (Edje_Entry_Change_Info *)_info;
|
2011-10-03 05:30:40 -07:00
|
|
|
if (info->insert)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(info->change.insert.content);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_stringshare_del(info->change.del.content);
|
|
|
|
}
|
|
|
|
free(info);
|
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
|
2008-10-16 17:07:43 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_range_del_emit(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Entry *en)
|
2008-10-16 17:07:43 -07:00
|
|
|
{
|
2011-10-03 05:30:40 -07:00
|
|
|
size_t start, end;
|
|
|
|
char *tmp;
|
2012-06-18 06:31:24 -07:00
|
|
|
Edje_Entry_Change_Info *info;
|
|
|
|
|
2011-10-03 05:30:40 -07:00
|
|
|
start = evas_textblock_cursor_pos_get(en->sel_start);
|
|
|
|
end = evas_textblock_cursor_pos_get(en->sel_end);
|
2012-06-18 06:31:24 -07:00
|
|
|
if (start == end)
|
2015-06-08 11:43:00 -07:00
|
|
|
goto noop;
|
2012-06-18 06:31:24 -07:00
|
|
|
|
|
|
|
info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
goto noop;
|
|
|
|
}
|
2012-06-18 06:31:24 -07:00
|
|
|
info->insert = EINA_FALSE;
|
2011-10-03 05:30:40 -07:00
|
|
|
info->change.del.start = start;
|
|
|
|
info->change.del.end = end;
|
|
|
|
|
|
|
|
tmp = evas_textblock_cursor_range_text_get(en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
|
|
|
|
info->change.del.content = eina_stringshare_add(tmp);
|
|
|
|
if (tmp) free(tmp);
|
2008-10-16 17:07:43 -07:00
|
|
|
evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
|
2011-10-03 05:30:40 -07:00
|
|
|
_edje_emit(ed, "entry,changed", en->rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
|
|
|
|
_free_entry_change_info);
|
2012-06-18 06:31:24 -07:00
|
|
|
noop:
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(ed, en->cursor, en->rp->object, en);
|
2008-10-16 17:07:43 -07:00
|
|
|
}
|
|
|
|
|
2013-03-29 03:42:54 -07:00
|
|
|
//static void
|
|
|
|
//_range_del(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Entry *en)
|
|
|
|
//{
|
|
|
|
// evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
|
2013-04-06 10:18:48 -07:00
|
|
|
// _sel_clear(ed, en->cursor, en->rp->object, en);
|
2013-03-29 03:42:54 -07:00
|
|
|
//}
|
2008-10-16 18:40:10 -07:00
|
|
|
|
2010-03-25 01:17:51 -07:00
|
|
|
static void
|
2011-10-03 05:30:40 -07:00
|
|
|
_delete_emit(Edje *ed, Evas_Textblock_Cursor *c, Entry *en, size_t pos,
|
|
|
|
Eina_Bool backspace)
|
2010-03-25 01:17:51 -07:00
|
|
|
{
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
|
|
|
|
if (backspace)
|
2011-10-03 05:30:40 -07:00
|
|
|
{
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
if (!evas_textblock_cursor_char_prev(c))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
evas_textblock_cursor_char_next(c);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!evas_textblock_cursor_char_next(c))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
evas_textblock_cursor_char_prev(c);
|
2011-10-03 05:30:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
return;
|
|
|
|
}
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
char *tmp = NULL;
|
2011-10-03 05:30:40 -07:00
|
|
|
|
|
|
|
info->insert = EINA_FALSE;
|
|
|
|
if (backspace)
|
|
|
|
{
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
|
|
|
|
Evas_Textblock_Cursor *cc = evas_object_textblock_cursor_new(en->rp->object);
|
|
|
|
evas_textblock_cursor_copy(c, cc);
|
|
|
|
Eina_Bool remove_cluster = evas_textblock_cursor_at_cluster_as_single_glyph(cc,EINA_FALSE);
|
|
|
|
if (remove_cluster)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_cluster_prev(cc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_char_prev(cc);
|
|
|
|
}
|
|
|
|
|
|
|
|
info->change.del.start = evas_textblock_cursor_pos_get(cc);
|
2011-10-03 05:30:40 -07:00
|
|
|
info->change.del.end = pos;
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
|
|
|
|
tmp = evas_textblock_cursor_range_text_get(c, cc, EVAS_TEXTBLOCK_TEXT_MARKUP);
|
|
|
|
evas_textblock_cursor_range_delete(c, cc);
|
|
|
|
evas_textblock_cursor_free(cc);
|
2011-10-03 05:30:40 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
Evas_Textblock_Cursor *cc = evas_object_textblock_cursor_new(en->rp->object);
|
|
|
|
evas_textblock_cursor_copy(c, cc);
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
|
|
|
|
Eina_Bool remove_cluster = evas_textblock_cursor_at_cluster_as_single_glyph(cc,EINA_TRUE);
|
|
|
|
if (remove_cluster)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_cluster_next(cc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_char_next(cc);
|
|
|
|
}
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
|
|
|
|
info->change.del.start = evas_textblock_cursor_pos_get(cc);
|
2011-10-03 05:30:40 -07:00
|
|
|
info->change.del.end = pos;
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
|
|
|
|
tmp = evas_textblock_cursor_range_text_get(c, cc, EVAS_TEXTBLOCK_TEXT_MARKUP);
|
|
|
|
evas_textblock_cursor_range_delete(c, cc);
|
|
|
|
evas_textblock_cursor_free(cc);
|
2011-10-03 05:30:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
info->change.del.content = eina_stringshare_add(tmp);
|
|
|
|
if (tmp) free(tmp);
|
|
|
|
|
|
|
|
_edje_emit(ed, "entry,changed", en->rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", en->rp->part->name,
|
|
|
|
info, _free_entry_change_info);
|
2010-03-25 01:17:51 -07:00
|
|
|
}
|
|
|
|
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
Eina_Bool
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_hide_visible_password(Edje *ed, Edje_Real_Part *rp)
|
2011-06-29 22:31:08 -07:00
|
|
|
{
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2011-06-29 22:31:08 -07:00
|
|
|
const Evas_Object_Textblock_Node_Format *node;
|
|
|
|
node = evas_textblock_node_format_first_get(rp->object);
|
|
|
|
for (; node; node = evas_textblock_node_format_next_get(node))
|
|
|
|
{
|
|
|
|
const char *text = evas_textblock_node_format_text_get(node);
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
if (!strcmp(text, "+ password=off"))
|
|
|
|
{
|
|
|
|
evas_textblock_node_format_remove_pair(rp->object,
|
2015-06-08 11:43:00 -07:00
|
|
|
(Evas_Object_Textblock_Node_Format *)node);
|
2014-03-06 21:42:49 -08:00
|
|
|
_edje_emit(ed, "entry,changed", rp->part->name);
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
int_ret = EINA_TRUE;
|
2011-06-29 22:31:08 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(ed, rp);
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
|
|
|
|
return int_ret;
|
2011-06-29 22:31:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_password_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
Entry *en = (Entry *)data;
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_hide_visible_password(en->ed, en->rp);
|
2011-06-29 22:31:08 -07:00
|
|
|
en->pw_timer = NULL;
|
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-08-17 18:31:49 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_is_modifier(const char *key)
|
|
|
|
{
|
|
|
|
if ((!strncmp(key, "Shift", 5)) ||
|
|
|
|
(!strncmp(key, "Control", 7)) ||
|
|
|
|
(!strncmp(key, "Alt", 3)) ||
|
|
|
|
(!strncmp(key, "Meta", 4)) ||
|
|
|
|
(!strncmp(key, "Super", 5)) ||
|
|
|
|
(!strncmp(key, "Hyper", 5)) ||
|
|
|
|
(!strcmp(key, "Scroll_Lock")) ||
|
|
|
|
(!strcmp(key, "Num_Lock")) ||
|
|
|
|
(!strcmp(key, "Caps_Lock")))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_compose_seq_reset(Entry *en)
|
|
|
|
{
|
|
|
|
char *str;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_LIST_FREE(en->seq, str)
|
|
|
|
eina_stringshare_del(str);
|
2012-08-17 18:31:49 -07:00
|
|
|
en->composing = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
|
|
|
Edje *ed = data;
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Efl_Input_Device *seat;
|
|
|
|
|
2008-10-13 04:57:32 -07:00
|
|
|
Entry *en;
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool control, alt, shift;
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
|
|
|
Eina_Bool super, altgr;
|
|
|
|
#endif
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool multiline;
|
|
|
|
Eina_Bool cursor_changed;
|
2011-02-20 21:53:23 -08:00
|
|
|
int old_cur_pos;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
|
|
|
|
seat = efl_input_device_seat_get(ev->dev);
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
|
2008-10-13 04:57:32 -07:00
|
|
|
if (!rp) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 04:57:32 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2008-10-13 02:19:04 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2013-07-30 23:13:40 -07:00
|
|
|
if (!ev->key) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2013-05-06 20:08:47 -07:00
|
|
|
_edje_emit(ed, "entry,keydown", rp->part->name);
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2009-05-13 06:29:30 -07:00
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Key_Down ecore_ev;
|
|
|
|
ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
|
2012-08-17 18:31:49 -07:00
|
|
|
if (!en->composing)
|
|
|
|
{
|
2014-03-05 18:17:34 -08:00
|
|
|
if (ecore_imf_context_filter_event(en->imf_context,
|
|
|
|
ECORE_IMF_EVENT_KEY_DOWN,
|
|
|
|
(Ecore_IMF_Event *)&ecore_ev))
|
2013-02-14 00:03:52 -08:00
|
|
|
{
|
2014-03-05 18:17:34 -08:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
return;
|
2013-02-14 00:03:52 -08:00
|
|
|
}
|
2012-08-17 18:31:49 -07:00
|
|
|
}
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
#endif
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2011-02-20 21:53:23 -08:00
|
|
|
old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
|
|
|
super = evas_key_modifier_is_set(ev->modifiers, "Super");
|
|
|
|
altgr = evas_key_modifier_is_set(ev->modifiers, "AltGr");
|
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
control = evas_key_modifier_is_set(ev->modifiers, "Control");
|
|
|
|
alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
|
|
|
|
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
2008-10-22 01:57:49 -07:00
|
|
|
multiline = rp->part->multiline;
|
2009-06-17 04:10:32 -07:00
|
|
|
cursor_changed = EINA_FALSE;
|
2013-07-30 23:13:40 -07:00
|
|
|
if (!strcmp(ev->key, "Escape"))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
// dead keys here. Escape for now (should emit these)
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,escape", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Up") ||
|
|
|
|
(!strcmp(ev->key, "KP_Up") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (multiline)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
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;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2015-08-19 19:31:27 -07:00
|
|
|
else if (en->have_selection)
|
2014-05-15 01:43:00 -07:00
|
|
|
{
|
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
|
|
|
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
|
|
|
else
|
|
|
|
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2013-04-09 21:48:19 -07:00
|
|
|
if (_curs_up(en->cursor, rp->object, en))
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,up", rp->part->name);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Down") ||
|
|
|
|
(!strcmp(ev->key, "KP_Down") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (multiline)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
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;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2015-08-19 19:31:27 -07:00
|
|
|
else if (en->have_selection)
|
2014-05-15 01:43:00 -07:00
|
|
|
{
|
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
|
|
|
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
|
|
|
else
|
|
|
|
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2013-04-09 21:48:19 -07:00
|
|
|
if (_curs_down(en->cursor, rp->object, en))
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,down", rp->part->name);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Left") ||
|
|
|
|
(!strcmp(ev->key, "KP_Left") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2013-04-22 07:34:25 -07:00
|
|
|
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;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2014-05-15 01:43:00 -07:00
|
|
|
else
|
|
|
|
{
|
2015-06-03 08:39:42 -07:00
|
|
|
if (en->have_selection)
|
|
|
|
{
|
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
|
|
|
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
|
|
|
else
|
|
|
|
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2014-05-15 01:43:00 -07:00
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (evas_textblock_cursor_cluster_prev(en->cursor))
|
2013-04-09 21:48:19 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
|
|
|
if (altgr) evas_textblock_cursor_word_start(en->cursor);
|
|
|
|
#else
|
2011-12-14 08:27:45 -08:00
|
|
|
/* If control is pressed, go to the start of the word */
|
|
|
|
if (control) evas_textblock_cursor_word_start(en->cursor);
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,left", rp->part->name);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Right") ||
|
|
|
|
(!strcmp(ev->key, "KP_Right") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2013-04-22 07:34:25 -07:00
|
|
|
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;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-22 07:34:25 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2014-05-15 01:43:00 -07:00
|
|
|
else
|
|
|
|
{
|
2015-06-03 08:39:42 -07:00
|
|
|
if (en->have_selection)
|
|
|
|
{
|
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
|
|
|
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
|
|
|
else
|
|
|
|
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2014-05-15 01:43:00 -07:00
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2012-07-19 01:26:02 -07:00
|
|
|
/* If control is pressed, go to the end of the word */
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
|
|
|
if (altgr) evas_textblock_cursor_word_end(en->cursor);
|
|
|
|
#else
|
2011-12-14 08:27:45 -08:00
|
|
|
if (control) evas_textblock_cursor_word_end(en->cursor);
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (evas_textblock_cursor_cluster_next(en->cursor))
|
2013-04-09 21:48:19 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,right", rp->part->name);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "BackSpace"))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2011-12-14 08:27:40 -08:00
|
|
|
if (control && !en->have_selection)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
|
|
|
// del to start of previous word
|
2011-12-14 08:27:40 -08:00
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
evas_textblock_cursor_cluster_prev(en->cursor);
|
2011-12-14 08:27:40 -08:00
|
|
|
evas_textblock_cursor_word_start(en->cursor);
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_preextend(ed, en->cursor, rp->object, en);
|
2011-12-14 08:27:40 -08:00
|
|
|
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
|
|
|
else if ((alt) && (shift))
|
|
|
|
{
|
|
|
|
// undo last action
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (en->have_selection)
|
2011-08-03 01:56:59 -07:00
|
|
|
{
|
2011-10-03 05:30:40 -07:00
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
2011-08-03 01:56:59 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-08-03 01:56:59 -07:00
|
|
|
{
|
elm_entry: handle cursor delete/backspace with clusters consist of one or multible glyphs
Summary:
Cluster consist of one glyph, expected to be removed on backspace or delete key.
Cluster consist of multible glyph, expectd to remove part of on backspace or delete key.
This is behaviour founded in Android. (our current way of handling similar to Qt)
**New Behaviour**
{F3750386}
**Old Behaviour**
{F3750387}
Test Plan:
Auto Testing is challenging because there are no easy way to emulate keyboard down on elm_entry
```
#include <Elementary.h>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win,*box,*entry;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("", "");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
entry = elm_entry_add(box);
evas_object_size_hint_weight_set(box,EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box,EVAS_HINT_FILL,EVAS_HINT_FILL);
elm_entry_entry_set(entry,"<font=NotoColorEmoji wrap=mixed >🇧🇬อั🇧🇬อั😀😀😀😀😀อั</font>");
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.9);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(entry);
evas_object_show(box);
elm_box_pack_end(box,entry);
elm_win_resize_object_add(win,box);
evas_object_resize(win,320,480);
evas_object_size_hint_weight_set(entry,EVAS_HINT_EXPAND,0.1);
evas_object_size_hint_align_set(entry,EVAS_HINT_FILL,EVAS_HINT_FILL);
evas_object_show(win);
elm_run();
return 0;
}
ELM_MAIN()
```
Reviewers: tasn, woohyun, bowonryu
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9628
2019-09-04 22:52:51 -07:00
|
|
|
//if (evas_textblock_cursor_char_prev(en->cursor))
|
2011-08-03 01:56:59 -07:00
|
|
|
{
|
2011-10-03 05:30:40 -07:00
|
|
|
_delete_emit(ed, en->cursor, en, old_cur_pos, EINA_TRUE);
|
2011-08-03 01:56:59 -07:00
|
|
|
}
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,backspace", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Delete") ||
|
|
|
|
(!strcmp(ev->key, "KP_Delete") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (control)
|
|
|
|
{
|
|
|
|
// del to end of next word
|
2011-12-15 00:28:40 -08:00
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
|
|
|
|
evas_textblock_cursor_word_end(en->cursor);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
evas_textblock_cursor_cluster_next(en->cursor);
|
2011-12-15 00:28:40 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(ed, en->cursor, rp->object, en);
|
2011-12-15 00:28:40 -08:00
|
|
|
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
|
|
|
else if (shift)
|
|
|
|
{
|
|
|
|
// cut
|
|
|
|
}
|
|
|
|
else
|
2011-02-20 17:48:41 -08:00
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
if (en->have_selection)
|
2011-10-03 05:30:40 -07:00
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-10-03 05:30:40 -07:00
|
|
|
{
|
|
|
|
_delete_emit(ed, en->cursor, en, old_cur_pos, EINA_FALSE);
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
_edje_emit(ed, "entry,key,delete", rp->part->name);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-03-27 00:30:11 -07:00
|
|
|
else if ((!alt) &&
|
2013-07-30 23:13:40 -07:00
|
|
|
(!strcmp(ev->key, "Home") ||
|
|
|
|
((!strcmp(ev->key, "KP_Home")) && !ev->string)))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
|
|
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
if ((control) && (multiline))
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_start(en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_lin_start(en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,home", rp->part->name);
|
2015-09-22 07:12:47 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-03-27 00:30:11 -07:00
|
|
|
else if ((!alt) &&
|
2013-07-30 23:13:40 -07:00
|
|
|
(!strcmp(ev->key, "End") ||
|
|
|
|
((!strcmp(ev->key, "KP_End")) && !ev->string)))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
|
|
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
if ((control) && (multiline))
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_end(en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_lin_end(en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,end", rp->part->name);
|
2015-09-22 07:12:47 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (!shift) && (!strcmp(ev->key, "v")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (!shift) && (!strcmp(ev->key, "v")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
_edje_emit(ed, "entry,paste,request", rp->part->name);
|
2011-07-24 00:47:17 -07:00
|
|
|
_edje_emit(ed, "entry,paste,request,3", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (!strcmp(ev->key, "a")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (!strcmp(ev->key, "a")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2011-07-24 00:59:47 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2012-02-14 00:32:23 -08:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_edje_emit(ed, "entry,selection,none,request", rp->part->name);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_edje_emit(ed, "entry,selection,all,request", rp->part->name);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2011-07-24 00:59:47 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (((!shift) && !strcmp(ev->key, "c")) || !strcmp(ev->key, "Insert")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (((!shift) && !strcmp(ev->key, "c")) || !strcmp(ev->key, "Insert")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
_edje_emit(ed, "entry,copy,notify", rp->part->name);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (!shift) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (!shift) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
_edje_emit(ed, "entry,cut,notify", rp->part->name);
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (!strcmp(ev->key, "z")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (!strcmp(ev->key, "z")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
// redo
|
2011-07-19 01:08:16 -07:00
|
|
|
_edje_emit(ed, "entry,redo,request", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// undo
|
2011-07-19 01:08:16 -07:00
|
|
|
_edje_emit(ed, "entry,undo,request", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2016-09-23 01:51:37 -07:00
|
|
|
#if defined(__APPLE__) && defined(__MACH__)
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((super) && (!shift) && (!strcmp(ev->key, "y")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#else
|
2020-08-04 19:32:11 -07:00
|
|
|
else if ((control) && (!shift) && (!strcmp(ev->key, "y")))
|
2016-09-23 01:51:37 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
// redo
|
2011-07-19 01:08:16 -07:00
|
|
|
_edje_emit(ed, "entry,redo,request", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2014-05-06 06:57:34 -07:00
|
|
|
//else if ((control) && (!shift) && (!strcmp(ev->key, "w")))
|
2015-06-08 11:43:00 -07:00
|
|
|
//{
|
|
|
|
//_compose_seq_reset(en);
|
|
|
|
//_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
//select current word?
|
|
|
|
//ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
//}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Tab"))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (multiline)
|
|
|
|
{
|
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
// remove a tab
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-03 05:30:40 -07:00
|
|
|
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
2011-10-03 05:30:40 -07:00
|
|
|
{
|
2016-07-27 18:59:15 -07:00
|
|
|
ERR("Running very low on memory");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->insert = EINA_TRUE;
|
|
|
|
info->change.insert.plain_length = 1;
|
|
|
|
|
|
|
|
if (en->have_selection)
|
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
|
|
|
info->merge = EINA_TRUE;
|
|
|
|
}
|
|
|
|
info->change.insert.pos =
|
|
|
|
evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
info->change.insert.content = eina_stringshare_add("<tab/>");
|
|
|
|
_text_filter_format_prepend(ed, en, en->cursor, "tab");
|
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
|
|
|
_edje_emit(ed, "entry,changed", rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", rp->part->name,
|
|
|
|
info, _free_entry_change_info);
|
2011-10-03 05:30:40 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,tab", rp->part->name);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if ((!strcmp(ev->key, "ISO_Left_Tab")) && (multiline))
|
2011-02-20 17:48:41 -08:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
// remove a tab
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Prior") ||
|
|
|
|
(!strcmp(ev->key, "KP_Prior") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
|
|
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2013-11-01 02:32:43 -07:00
|
|
|
if (!_curs_jump_line_by(en->cursor, rp->object, en, -10))
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_line_set(en->cursor, 0);
|
|
|
|
_curs_lin_start(en->cursor, rp->object, en);
|
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,pgup", rp->part->name);
|
2015-09-22 07:12:47 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if (!strcmp(ev->key, "Next") ||
|
|
|
|
(!strcmp(ev->key, "KP_Next") && !ev->string))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
|
|
|
if (shift) _sel_start(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2013-11-01 02:32:43 -07:00
|
|
|
if (!_curs_jump_line_by(en->cursor, rp->object, en, 10))
|
|
|
|
{
|
|
|
|
int last = _curs_line_last_get(en->cursor, rp->object, en);
|
|
|
|
evas_textblock_cursor_line_set(en->cursor, last);
|
|
|
|
_curs_lin_end(en->cursor, rp->object, en);
|
|
|
|
}
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->select_allow)
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
if (shift) _sel_extend(ed, en->cursor, rp->object, en);
|
|
|
|
else _sel_clear(ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,pgdn", rp->part->name);
|
2015-09-22 07:12:47 -07:00
|
|
|
_edje_emit(ed, "cursor,changed,manual", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2013-07-30 23:13:40 -07:00
|
|
|
else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
if (multiline)
|
|
|
|
{
|
2011-10-03 05:30:40 -07:00
|
|
|
Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
2010-08-09 09:25:45 -07:00
|
|
|
{
|
2016-07-27 18:59:15 -07:00
|
|
|
ERR("Running very low on memory");
|
2010-08-09 09:25:45 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-07-27 18:59:15 -07:00
|
|
|
info->insert = EINA_TRUE;
|
|
|
|
info->change.insert.plain_length = 1;
|
|
|
|
if (en->have_selection)
|
|
|
|
{
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
|
|
|
info->merge = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->change.insert.pos =
|
|
|
|
evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
if (shift ||
|
|
|
|
evas_object_textblock_legacy_newline_get(rp->object))
|
|
|
|
{
|
|
|
|
_text_filter_format_prepend(ed, en, en->cursor, "br");
|
|
|
|
info->change.insert.content = eina_stringshare_add("<br/>");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_text_filter_format_prepend(ed, en, en->cursor, "ps");
|
|
|
|
info->change.insert.content = eina_stringshare_add("<ps/>");
|
|
|
|
}
|
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
|
|
|
_edje_emit(ed, "entry,changed", rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", rp->part->name,
|
|
|
|
info, _free_entry_change_info);
|
|
|
|
_edje_emit(ed, "cursor,changed", rp->part->name);
|
|
|
|
cursor_changed = EINA_TRUE;
|
2010-08-09 09:25:45 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2008-10-22 01:57:49 -07:00
|
|
|
_edje_emit(ed, "entry,key,enter", rp->part->name);
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-17 18:31:49 -07:00
|
|
|
char *compres = NULL, *string = (char *)ev->string;
|
|
|
|
Eina_Bool free_string = EINA_FALSE;
|
|
|
|
Ecore_Compose_State state;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2017-01-25 06:10:47 -08:00
|
|
|
if (control) goto end;
|
2012-08-17 18:31:49 -07:00
|
|
|
if (!en->composing)
|
|
|
|
{
|
|
|
|
_compose_seq_reset(en);
|
|
|
|
en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->key));
|
|
|
|
state = ecore_compose_get(en->seq, &compres);
|
|
|
|
if (state == ECORE_COMPOSE_MIDDLE) en->composing = EINA_TRUE;
|
|
|
|
else en->composing = EINA_FALSE;
|
2014-05-06 06:52:37 -07:00
|
|
|
if (!en->composing)
|
|
|
|
{
|
2014-08-12 23:11:06 -07:00
|
|
|
free(compres);
|
|
|
|
compres = NULL;
|
2014-05-06 06:52:37 -07:00
|
|
|
_compose_seq_reset(en);
|
2015-06-12 01:39:51 -07:00
|
|
|
if (ev->string && (!ev->string[1]) &&
|
|
|
|
((ev->string[0] < 0x20) || (ev->string[0] == 0x7f)))
|
2014-08-12 23:11:06 -07:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free(compres);
|
|
|
|
compres = NULL;
|
|
|
|
goto end;
|
2014-05-06 06:52:37 -07:00
|
|
|
}
|
2012-08-17 18:31:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_is_modifier(ev->key)) goto end;
|
|
|
|
en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->key));
|
|
|
|
state = ecore_compose_get(en->seq, &compres);
|
2014-08-12 23:11:06 -07:00
|
|
|
if (state == ECORE_COMPOSE_NONE)
|
|
|
|
{
|
|
|
|
_compose_seq_reset(en);
|
|
|
|
free(compres);
|
|
|
|
compres = NULL;
|
|
|
|
}
|
2012-08-17 18:31:49 -07:00
|
|
|
else if (state == ECORE_COMPOSE_DONE)
|
|
|
|
{
|
|
|
|
_compose_seq_reset(en);
|
|
|
|
if (compres)
|
|
|
|
{
|
|
|
|
string = compres;
|
|
|
|
free_string = EINA_TRUE;
|
|
|
|
}
|
2014-08-12 23:11:06 -07:00
|
|
|
compres = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free(compres);
|
|
|
|
compres = NULL;
|
|
|
|
goto end;
|
2012-08-17 18:31:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (string)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
Edje_Entry_Change_Info *info = NULL;
|
|
|
|
// if PASSWORD_SHOW_LAST mode, appending text with password=off tag
|
2011-06-29 22:31:08 -07:00
|
|
|
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
|
|
|
|
_edje_password_show_last)
|
|
|
|
{
|
2013-04-10 20:30:04 -07:00
|
|
|
_edje_entry_hide_visible_password(ed, en->rp);
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_text_prepend(ed, en, en->cursor, string,
|
2013-03-29 03:42:54 -07:00
|
|
|
"+ password=off",
|
|
|
|
"- password",
|
|
|
|
EINA_TRUE, EINA_TRUE);
|
|
|
|
if (info)
|
2011-06-29 22:31:08 -07:00
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
if (en->pw_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(en->pw_timer);
|
|
|
|
en->pw_timer = NULL;
|
|
|
|
}
|
2014-03-03 04:29:34 -08:00
|
|
|
if (_edje_password_show_last_timeout >= 0)
|
|
|
|
en->pw_timer = ecore_timer_add
|
2015-06-08 11:43:00 -07:00
|
|
|
(_edje_password_show_last_timeout,
|
2013-03-29 03:42:54 -07:00
|
|
|
_password_timer_cb, en);
|
2011-06-29 22:31:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_text_prepend(ed, en, en->cursor, string,
|
2013-03-29 03:42:54 -07:00
|
|
|
NULL, NULL,
|
|
|
|
EINA_TRUE, EINA_TRUE);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2013-03-29 03:42:54 -07:00
|
|
|
if (info)
|
|
|
|
{
|
|
|
|
_edje_emit(ed, "entry,changed", rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", rp->part->name,
|
|
|
|
info, _free_entry_change_info);
|
|
|
|
_edje_emit(ed, "cursor,changed", rp->part->name);
|
|
|
|
cursor_changed = EINA_TRUE;
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
|
|
|
}
|
2014-08-12 23:11:06 -07:00
|
|
|
if (free_string) free(string);
|
2010-09-19 01:08:17 -07:00
|
|
|
}
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2012-08-17 18:31:49 -07:00
|
|
|
end:
|
2013-04-10 20:30:04 -07:00
|
|
|
if (!cursor_changed &&
|
2013-03-29 03:42:54 -07:00
|
|
|
(old_cur_pos != evas_textblock_cursor_pos_get(en->cursor)))
|
2011-04-05 18:20:59 -07:00
|
|
|
_edje_emit(ed, "cursor,changed", rp->part->name);
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(ed, rp);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Evas_Event_Key_Up *ev = event_info;
|
|
|
|
Efl_Input_Device *seat;
|
2008-10-13 02:19:04 -07:00
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2008-10-13 04:57:32 -07:00
|
|
|
Entry *en;
|
2011-11-20 06:15:37 -08:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
seat = efl_input_device_seat_get(ev->dev);
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_focused_part_get(ed, _edje_seat_name_get(ed, seat));
|
2008-10-13 04:57:32 -07:00
|
|
|
if (!rp) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 04:57:32 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2008-10-13 02:19:04 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2013-05-06 20:08:47 -07:00
|
|
|
_edje_emit(ed, "entry,keyup", rp->part->name);
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2009-05-13 06:29:30 -07:00
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Key_Up ecore_ev;
|
2011-11-20 06:15:37 -08:00
|
|
|
|
2010-09-05 00:20:47 -07:00
|
|
|
ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
|
2009-05-13 06:29:30 -07:00
|
|
|
if (ecore_imf_context_filter_event(en->imf_context,
|
|
|
|
ECORE_IMF_EVENT_KEY_UP,
|
|
|
|
(Ecore_IMF_Event *)&ecore_ev))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
2011-11-20 06:15:37 -08:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)event_info;
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
2015-12-21 06:27:43 -08:00
|
|
|
static Evas_Textblock_Cursor *
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
_edje_cursor_cluster_coord_set(Edje_Real_Part *rp, Evas_Coord canvasx, Evas_Coord canvasy, Evas_Coord *cx, Evas_Coord *cy)
|
2015-12-21 06:27:43 -08:00
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
Evas_Coord x, y, lh = 0, cly = 0;
|
|
|
|
Evas_Textblock_Cursor *line_cur;
|
|
|
|
Evas_Textblock_Cursor *tc;
|
|
|
|
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
evas_object_geometry_get(rp->object, &x, &y, NULL, NULL);
|
|
|
|
*cx = canvasx - x;
|
|
|
|
*cy = canvasy - y;
|
|
|
|
|
|
|
|
line_cur = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_paragraph_last(line_cur);
|
|
|
|
evas_textblock_cursor_line_geometry_get(line_cur, NULL, &cly, NULL, &lh);
|
|
|
|
/* Consider a threshold of half the line height */
|
|
|
|
if (*cy > (cly + lh) && *cy < (cly + lh + lh / 2))
|
|
|
|
{
|
|
|
|
*cy = cly + lh - 1; // Make it inside Textblock
|
|
|
|
}
|
|
|
|
evas_textblock_cursor_paragraph_first(line_cur);
|
|
|
|
evas_textblock_cursor_line_geometry_get(line_cur, NULL, &cly, NULL, NULL);
|
|
|
|
|
|
|
|
if (*cy < cly && *cy > (cly - lh / 2))
|
|
|
|
{
|
|
|
|
*cy = cly;
|
|
|
|
}
|
|
|
|
evas_textblock_cursor_free(line_cur);
|
|
|
|
/* No need to check return value if not able to set the char coord Textblock
|
|
|
|
* will take care */
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
evas_textblock_cursor_cluster_coord_set(en->cursor, *cx, *cy);
|
2015-12-21 06:27:43 -08:00
|
|
|
|
|
|
|
return tc;
|
|
|
|
}
|
|
|
|
|
2011-09-29 02:02:31 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2011-09-29 02:02:31 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
Entry *en;
|
|
|
|
if (!rp) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-09-29 02:02:31 -07:00
|
|
|
if (!en) return;
|
2012-12-21 03:39:36 -08:00
|
|
|
_edje_entry_imf_cursor_location_set(en);
|
2011-09-29 02:02:31 -07:00
|
|
|
}
|
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2011-05-19 01:38:42 -07:00
|
|
|
Evas_Coord cx, cy;
|
2008-10-13 02:19:04 -07:00
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2008-10-13 04:57:32 -07:00
|
|
|
Entry *en;
|
2010-09-19 01:08:17 -07:00
|
|
|
// Eina_Bool multiline;
|
2012-07-23 20:52:14 -07:00
|
|
|
Evas_Textblock_Cursor *tc = NULL;
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool dosel = EINA_FALSE;
|
2012-07-23 20:52:14 -07:00
|
|
|
Eina_Bool shift;
|
2015-12-21 06:27:43 -08:00
|
|
|
|
2012-12-19 21:07:23 -08:00
|
|
|
if ((!rp) || (!ev)) return;
|
2009-04-23 05:42:53 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 04:57:32 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2008-10-15 02:58:25 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2011-07-24 14:25:27 -07:00
|
|
|
if ((ev->button != 1) && (ev->button != 2)) return;
|
2010-11-09 05:36:52 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Mouse_Down ecore_ev;
|
|
|
|
ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev);
|
|
|
|
if (ecore_imf_context_filter_event(en->imf_context,
|
|
|
|
ECORE_IMF_EVENT_MOUSE_DOWN,
|
|
|
|
(Ecore_IMF_Event *)&ecore_ev))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-11-09 05:36:52 -08:00
|
|
|
}
|
|
|
|
#endif
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2012-12-17 23:13:58 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
|
|
|
|
2012-07-23 20:52:14 -07:00
|
|
|
shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
|
2009-06-17 04:10:32 -07:00
|
|
|
en->select_mod_start = EINA_FALSE;
|
|
|
|
en->select_mod_end = EINA_FALSE;
|
2013-06-02 23:47:05 -07:00
|
|
|
|
|
|
|
if (en->select_allow && ev->button != 2) dosel = EINA_TRUE;
|
2009-03-19 06:36:10 -07:00
|
|
|
if (dosel)
|
|
|
|
{
|
2012-03-06 11:59:51 -08:00
|
|
|
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
|
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
if (evas_textblock_cursor_compare(en->cursor, en->sel_start) < 0)
|
|
|
|
evas_textblock_cursor_line_char_first(en->cursor);
|
|
|
|
else
|
|
|
|
evas_textblock_cursor_line_char_last(en->cursor);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
en->have_selection = EINA_FALSE;
|
|
|
|
en->selecting = EINA_FALSE;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
evas_textblock_cursor_line_char_first(en->cursor);
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
evas_textblock_cursor_line_char_last(en->cursor);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
}
|
2012-03-06 11:59:51 -08:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
if (evas_textblock_cursor_compare(en->cursor, en->sel_start) < 0)
|
|
|
|
evas_textblock_cursor_word_start(en->cursor);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_word_end(en->cursor);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
evas_textblock_cursor_cluster_next(en->cursor);
|
2012-07-23 20:52:14 -07:00
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
en->have_selection = EINA_FALSE;
|
|
|
|
en->selecting = EINA_FALSE;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
evas_textblock_cursor_word_start(en->cursor);
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
evas_textblock_cursor_word_end(en->cursor);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
evas_textblock_cursor_cluster_next(en->cursor);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
}
|
2012-03-06 11:59:51 -08:00
|
|
|
goto end;
|
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
}
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
tc = _edje_cursor_cluster_coord_set(rp, ev->canvas.x, ev->canvas.y, &cx, &cy);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-03-19 06:36:10 -07:00
|
|
|
if (dosel)
|
|
|
|
{
|
2011-04-05 18:20:59 -07:00
|
|
|
if ((en->have_selection) &&
|
2013-11-08 00:30:44 -08:00
|
|
|
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
|
2009-03-19 06:36:10 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
if (shift)
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2012-07-23 20:52:14 -07:00
|
|
|
else
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
Eina_List *first, *last;
|
|
|
|
FLOAT_T sc;
|
|
|
|
|
|
|
|
first = en->sel;
|
|
|
|
last = eina_list_last(en->sel);
|
|
|
|
if (first && last)
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
Evas_Textblock_Rectangle *r1, *r2;
|
|
|
|
Evas_Coord d, d1, d2;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-07-23 20:52:14 -07:00
|
|
|
r1 = first->data;
|
|
|
|
r2 = last->data;
|
|
|
|
d = r1->x - cx;
|
|
|
|
d1 = d * d;
|
|
|
|
d = (r1->y + (r1->h / 2)) - cy;
|
|
|
|
d1 += d * d;
|
|
|
|
d = r2->x + r2->w - 1 - cx;
|
|
|
|
d2 = d * d;
|
|
|
|
d = (r2->y + (r2->h / 2)) - cy;
|
|
|
|
d2 += d * d;
|
edje: Add dpi feature.
Summary:
This dpi is used to get the scale for each collection.
If each collection has a described dpi, it calculates a proper scale
based on the dpi and dpi which is described in the collection.
@feature
Test Plan:
If add dpi to collection of edc, the edje will save the value as the dpi of the collection.
For example, if the dpi of your device is 100, you just set dpi: 100 in the collection of edc.
If the edj is loaded in another device(dpi is 200), it will scaled 2 times.
It is possible that the described dpi of application and theme are different.
In that case, application and theme have a different scale.
It makes the edj that made in different environment works in one device.
Reviewers: seoz, zmike, JackDanielZ, Hermet, woohyun, cedric, raster
Reviewed By: raster
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1190
2014-07-23 22:50:25 -07:00
|
|
|
sc = DIV(en->ed->scale, en->ed->file->base_scale);
|
2016-12-20 16:01:01 -08:00
|
|
|
if (EQ(sc, ZERO)) sc = DIV(_edje_scale, en->ed->file->base_scale);
|
2012-07-23 20:52:14 -07:00
|
|
|
d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number!
|
|
|
|
d = d * d;
|
|
|
|
if (d1 < d2)
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
if (d1 <= d)
|
|
|
|
{
|
|
|
|
en->select_mod_start = EINA_TRUE;
|
|
|
|
en->selecting = EINA_TRUE;
|
|
|
|
}
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
2012-07-23 20:52:14 -07:00
|
|
|
else
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
if (d2 <= d)
|
|
|
|
{
|
|
|
|
en->select_mod_end = EINA_TRUE;
|
|
|
|
en->selecting = EINA_TRUE;
|
|
|
|
}
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-09-05 04:25:19 -07:00
|
|
|
if (shift)
|
|
|
|
{
|
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2012-07-23 20:52:14 -07:00
|
|
|
else
|
2010-03-25 21:42:39 -07:00
|
|
|
{
|
2012-07-23 20:52:14 -07:00
|
|
|
en->selecting = EINA_TRUE;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2013-06-02 23:47:05 -07:00
|
|
|
_sel_start(en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
}
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
end:
|
2008-10-16 02:17:44 -07:00
|
|
|
if (evas_textblock_cursor_compare(tc, en->cursor))
|
2011-12-15 06:41:46 -08:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_emit(en->ed, "cursor,changed,manual", rp->part->name);
|
2011-12-15 06:41:46 -08:00
|
|
|
}
|
2010-11-09 05:36:52 -08:00
|
|
|
evas_textblock_cursor_free(tc);
|
2012-02-20 00:51:55 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2011-07-24 14:25:27 -07:00
|
|
|
if (ev->button == 2)
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "entry,paste,request", rp->part->name);
|
|
|
|
_edje_emit(en->ed, "entry,paste,request,1", rp->part->name);
|
2011-07-24 14:25:27 -07:00
|
|
|
}
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2011-05-19 01:38:42 -07:00
|
|
|
Evas_Coord cx, cy;
|
2008-10-13 02:19:04 -07:00
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
2008-10-13 04:57:32 -07:00
|
|
|
Entry *en;
|
2008-10-16 02:17:44 -07:00
|
|
|
Evas_Textblock_Cursor *tc;
|
2015-12-21 06:27:43 -08:00
|
|
|
|
2012-12-19 21:07:23 -08:00
|
|
|
if ((!ev) || (ev->button != 1)) return;
|
2008-10-13 04:57:32 -07:00
|
|
|
if (!rp) return;
|
2012-03-06 11:59:51 -08:00
|
|
|
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) return;
|
|
|
|
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 04:57:32 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2008-10-15 02:58:25 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-11-09 05:36:52 -08:00
|
|
|
|
2014-02-07 05:43:06 -08:00
|
|
|
/* We don't check for ON_HOLD because we'd like to end selection anyway when
|
|
|
|
* mouse is up, even if it's held. */
|
2013-01-24 21:15:46 -08:00
|
|
|
|
2010-11-09 05:36:52 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Mouse_Up ecore_ev;
|
|
|
|
ecore_imf_evas_event_mouse_up_wrap(ev, &ecore_ev);
|
|
|
|
if (ecore_imf_context_filter_event(en->imf_context,
|
|
|
|
ECORE_IMF_EVENT_MOUSE_UP,
|
|
|
|
(Ecore_IMF_Event *)&ecore_ev))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-11-09 05:36:52 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-12-21 06:27:43 -08:00
|
|
|
/* cx cy are unused but needed in mouse down, please bear with it */
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
tc = _edje_cursor_cluster_coord_set(rp, ev->canvas.x, ev->canvas.y, &cx, &cy);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2014-02-07 06:19:05 -08:00
|
|
|
if (en->select_allow)
|
2011-04-05 18:20:59 -07:00
|
|
|
{
|
2014-02-07 06:19:05 -08:00
|
|
|
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
|
|
|
if (en->had_sel)
|
|
|
|
{
|
|
|
|
if (en->select_mod_end)
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
else if (en->select_mod_start)
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_preextend(en->ed, en->cursor, rp->object, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2010-09-19 01:08:17 -07:00
|
|
|
//evas_textblock_cursor_copy(en->cursor, en->sel_end);
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
2014-02-07 06:19:05 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_copy(en->cursor, en->sel_end);
|
|
|
|
}
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
2009-03-22 06:50:53 -07:00
|
|
|
if (en->selecting)
|
|
|
|
{
|
|
|
|
if (en->have_selection)
|
2011-04-05 18:20:59 -07:00
|
|
|
en->had_sel = EINA_TRUE;
|
2009-06-17 04:10:32 -07:00
|
|
|
en->selecting = EINA_FALSE;
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
2008-10-16 02:17:44 -07:00
|
|
|
if (evas_textblock_cursor_compare(tc, en->cursor))
|
2011-12-15 06:41:46 -08:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_emit(en->ed, "cursor,changed,manual", rp->part->name);
|
2011-12-15 06:41:46 -08:00
|
|
|
}
|
2013-01-24 21:15:46 -08:00
|
|
|
|
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
evas_textblock_cursor_free(tc);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_part_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2011-05-19 01:38:42 -07:00
|
|
|
Evas_Coord cx, cy;
|
2008-10-13 02:19:04 -07:00
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
2008-10-13 04:57:32 -07:00
|
|
|
Entry *en;
|
2008-10-13 02:19:04 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
2008-10-16 02:17:44 -07:00
|
|
|
Evas_Textblock_Cursor *tc;
|
2013-04-06 10:18:48 -07:00
|
|
|
|
2012-12-19 21:07:23 -08:00
|
|
|
if ((!rp) || (!ev)) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 04:57:32 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
2008-10-15 02:58:25 -07:00
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-11-09 05:36:52 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Event_Mouse_Move ecore_ev;
|
|
|
|
ecore_imf_evas_event_mouse_move_wrap(ev, &ecore_ev);
|
|
|
|
if (ecore_imf_context_filter_event(en->imf_context,
|
|
|
|
ECORE_IMF_EVENT_MOUSE_MOVE,
|
|
|
|
(Ecore_IMF_Event *)&ecore_ev))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-11-09 05:36:52 -08:00
|
|
|
}
|
|
|
|
#endif
|
2011-04-05 18:20:59 -07:00
|
|
|
|
2009-03-19 06:36:10 -07:00
|
|
|
if (en->selecting)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2009-03-19 06:36:10 -07:00
|
|
|
tc = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_copy(en->cursor, tc);
|
|
|
|
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
2011-05-19 01:38:42 -07:00
|
|
|
cx = ev->cur.canvas.x - x;
|
|
|
|
cy = ev->cur.canvas.y - y;
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_coord_set(en->cursor, cx, cy))
|
2009-03-19 06:36:10 -07:00
|
|
|
{
|
|
|
|
Evas_Coord lx, ly, lw, lh;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2011-05-19 01:38:42 -07:00
|
|
|
if (evas_textblock_cursor_line_coord_set(en->cursor, cy) < 0)
|
2011-03-30 05:20:51 -07:00
|
|
|
{
|
|
|
|
if (rp->part->multiline)
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_end(en->cursor, rp->object, en);
|
2011-03-30 05:20:51 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_paragraph_first(en->cursor);
|
|
|
|
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_coord_set(en->cursor, cx, ly + (lh / 2)))
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_end(en->cursor, rp->object, en);
|
2011-03-30 05:20:51 -07:00
|
|
|
}
|
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
else
|
2011-03-30 05:20:51 -07:00
|
|
|
{
|
|
|
|
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
|
2011-05-19 01:38:42 -07:00
|
|
|
if (cx <= lx)
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_lin_start(en->cursor, rp->object, en);
|
2011-03-30 05:20:51 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
_curs_lin_end(en->cursor, rp->object, en);
|
2011-03-30 05:20:51 -07:00
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
}
|
2014-02-07 06:19:05 -08:00
|
|
|
if (en->select_allow)
|
2009-03-19 06:36:10 -07:00
|
|
|
{
|
2014-02-07 06:19:05 -08:00
|
|
|
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
|
2009-03-22 06:50:53 -07:00
|
|
|
{
|
|
|
|
if (en->had_sel)
|
|
|
|
{
|
|
|
|
if (en->select_mod_end)
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
else if (en->select_mod_start)
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_preextend(en->ed, en->cursor, rp->object, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
|
|
|
else
|
2015-06-08 11:43:00 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2009-03-22 06:50:53 -07:00
|
|
|
}
|
2014-02-07 06:19:05 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
|
|
|
}
|
|
|
|
|
2010-03-25 21:42:39 -07:00
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0)
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_enable(en->ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
if (en->have_selection)
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, en->cursor, rp->object, en);
|
2010-03-25 21:42:39 -07:00
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
if (evas_textblock_cursor_compare(tc, en->cursor))
|
2011-12-15 06:41:46 -08:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_emit(en->ed, "cursor,changed,manual", rp->part->name);
|
2011-12-15 06:41:46 -08:00
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
evas_textblock_cursor_free(tc);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-12 03:36:58 -07:00
|
|
|
static void
|
|
|
|
_canvas_viewport_resize_cb(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
Entry *en;
|
|
|
|
if ((!rp)) return;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
|
|
|
return;
|
|
|
|
|
|
|
|
_anchors_need_update(rp);
|
|
|
|
}
|
|
|
|
|
2010-02-10 07:12:35 -08:00
|
|
|
static void
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_in_cb(void *data, const Efl_Event *event)
|
2010-02-10 07:12:35 -08:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Efl_Input_Focus *ev = event->info;
|
|
|
|
Evas *e = event->object;
|
|
|
|
Efl_Input_Device *seat;
|
|
|
|
Edje *ed = data;
|
|
|
|
|
2012-12-19 21:07:23 -08:00
|
|
|
if (!ed) return;
|
2010-02-10 07:12:35 -08:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
seat = efl_input_device_get(ev);
|
|
|
|
if (evas_canvas_seat_focus_get(e, seat) == ed->obj)
|
2010-11-09 05:36:52 -08:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_focus_in(data, seat);
|
2010-11-09 05:36:52 -08:00
|
|
|
}
|
2010-02-10 07:12:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_out_cb(void *data, const Efl_Event *event)
|
2010-02-10 07:12:35 -08:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Efl_Input_Focus *ev = event->info;
|
|
|
|
Evas *e = event->object;
|
|
|
|
Efl_Input_Device *seat;
|
|
|
|
Edje *ed = data;
|
|
|
|
|
2012-12-19 21:07:23 -08:00
|
|
|
if (!ed) return;
|
2010-02-10 07:12:35 -08:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
seat = efl_input_device_get(ev);
|
|
|
|
if (evas_canvas_seat_focus_get(e, seat) == ed->obj)
|
2010-11-09 05:36:52 -08:00
|
|
|
{
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_edje_focus_out(data, seat);
|
2010-11-09 05:36:52 -08:00
|
|
|
}
|
2010-02-10 07:12:35 -08:00
|
|
|
}
|
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
/***************************************************************/
|
|
|
|
void
|
|
|
|
_edje_entry_init(Edje *ed)
|
|
|
|
{
|
2010-02-17 15:43:31 -08:00
|
|
|
if (!ed->has_entries)
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-02-17 15:43:31 -08:00
|
|
|
if (ed->entries_inited)
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-02-17 15:43:31 -08:00
|
|
|
ed->entries_inited = EINA_TRUE;
|
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
efl_event_callback_add(ed->obj, EFL_EVENT_FOCUS_IN, _edje_focus_in_cb, ed);
|
|
|
|
efl_event_callback_add(ed->obj, EFL_EVENT_FOCUS_OUT, _edje_focus_out_cb, ed);
|
|
|
|
evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN,
|
|
|
|
_edje_key_down_cb, ed);
|
|
|
|
evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP,
|
|
|
|
_edje_key_up_cb, ed);
|
efl_canvas_scene: rename event from focus,* to scene_focus,*
Summary:
This event can just be renamed, no need to handle legacy. The reason for
this, that this event is used to map to EVAS_CALLBACK_ enum fields,
which means, the legacy names of the event does not matter.
ref T7476
Reviewers: cedric, segfaultxavi, zmike, stefan_schmidt
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7476
Differential Revision: https://phab.enlightenment.org/D8242
2019-03-08 06:02:30 -08:00
|
|
|
efl_event_callback_add(ed->base.evas, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN,
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_in_cb, ed);
|
efl_canvas_scene: rename event from focus,* to scene_focus,*
Summary:
This event can just be renamed, no need to handle legacy. The reason for
this, that this event is used to map to EVAS_CALLBACK_ enum fields,
which means, the legacy names of the event does not matter.
ref T7476
Reviewers: cedric, segfaultxavi, zmike, stefan_schmidt
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7476
Differential Revision: https://phab.enlightenment.org/D8242
2019-03-08 06:02:30 -08:00
|
|
|
efl_event_callback_add(ed->base.evas, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT,
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_out_cb, ed);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_shutdown(Edje *ed)
|
|
|
|
{
|
2012-12-19 21:07:23 -08:00
|
|
|
if ((!ed) || (!ed->has_entries))
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-02-17 15:43:31 -08:00
|
|
|
if (!ed->entries_inited)
|
2011-04-05 18:20:59 -07:00
|
|
|
return;
|
2010-02-17 15:43:31 -08:00
|
|
|
ed->entries_inited = EINA_FALSE;
|
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
efl_event_callback_del(ed->obj, EFL_EVENT_FOCUS_IN, _edje_focus_in_cb, ed);
|
|
|
|
efl_event_callback_del(ed->obj, EFL_EVENT_FOCUS_OUT, _edje_focus_out_cb, ed);
|
|
|
|
evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN,
|
|
|
|
_edje_key_down_cb);
|
|
|
|
evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP,
|
|
|
|
_edje_key_up_cb);
|
efl_canvas_scene: rename event from focus,* to scene_focus,*
Summary:
This event can just be renamed, no need to handle legacy. The reason for
this, that this event is used to map to EVAS_CALLBACK_ enum fields,
which means, the legacy names of the event does not matter.
ref T7476
Reviewers: cedric, segfaultxavi, zmike, stefan_schmidt
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7476
Differential Revision: https://phab.enlightenment.org/D8242
2019-03-08 06:02:30 -08:00
|
|
|
efl_event_callback_del(ed->base.evas, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN,
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_in_cb, ed);
|
efl_canvas_scene: rename event from focus,* to scene_focus,*
Summary:
This event can just be renamed, no need to handle legacy. The reason for
this, that this event is used to map to EVAS_CALLBACK_ enum fields,
which means, the legacy names of the event does not matter.
ref T7476
Reviewers: cedric, segfaultxavi, zmike, stefan_schmidt
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7476
Differential Revision: https://phab.enlightenment.org/D8242
2019-03-08 06:02:30 -08:00
|
|
|
efl_event_callback_del(ed->base.evas, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT,
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
_evas_focus_out_cb, ed);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
2019-01-16 12:02:43 -08:00
|
|
|
int
|
|
|
|
_edje_entry_real_part_cursor_objs_get(Edje_Real_Part *rp, Evas_Object **cursor_objs)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text) || (!rp->typedata.text->entry_data)) return -1;
|
|
|
|
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
|
|
|
|
if (en->cursor_bg) cursor_objs[ret++] = en->cursor_bg;
|
|
|
|
if (en->cursor_fg) cursor_objs[ret++] = en->cursor_fg;
|
|
|
|
if (en->cursor_fg2) cursor_objs[ret++] = en->cursor_fg2;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
void
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2009-05-13 06:29:30 -07:00
|
|
|
const char *ctx_id;
|
|
|
|
const Ecore_IMF_Context_Info *ctx_info;
|
|
|
|
#endif
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
2008-10-13 02:19:04 -07:00
|
|
|
en = calloc(1, sizeof(Entry));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!en)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
return;
|
|
|
|
}
|
2012-09-11 06:14:51 -07:00
|
|
|
rp->typedata.text->entry_data = en;
|
2008-10-15 08:15:06 -07:00
|
|
|
en->rp = rp;
|
2013-04-06 10:18:48 -07:00
|
|
|
en->ed = ed;
|
2008-10-13 02:19:04 -07:00
|
|
|
|
2011-09-29 02:02:31 -07:00
|
|
|
evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOVE, _edje_part_move_cb, rp);
|
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_DOWN, _edje_part_mouse_down_cb, rp);
|
|
|
|
evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_UP, _edje_part_mouse_up_cb, rp);
|
|
|
|
evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_MOVE, _edje_part_mouse_move_cb, rp);
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE, _canvas_viewport_resize_cb, rp);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2010-04-29 12:56:59 -07:00
|
|
|
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
|
2011-04-05 18:20:59 -07:00
|
|
|
en->select_allow = EINA_TRUE;
|
2010-04-29 12:56:59 -07:00
|
|
|
|
2008-10-24 00:08:08 -07:00
|
|
|
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
|
2008-10-22 22:38:06 -07:00
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
Edje_Part_Description_Text *txt;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2011-04-05 18:20:59 -07:00
|
|
|
txt = (Edje_Part_Description_Text *)rp->chosen_description;
|
2010-07-29 05:02:36 -07:00
|
|
|
|
2010-11-09 05:36:52 -08:00
|
|
|
en->select_allow = EINA_FALSE;
|
2010-09-19 01:08:17 -07:00
|
|
|
if (txt && edje_string_get(&txt->text.repch))
|
2011-04-05 18:20:59 -07:00
|
|
|
evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch));
|
2010-09-19 01:08:17 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
evas_object_textblock_replace_char_set(rp->object, "*");
|
2008-10-22 22:38:06 -07:00
|
|
|
}
|
2008-10-13 02:19:04 -07:00
|
|
|
|
2015-10-20 11:57:17 -07:00
|
|
|
if (rp->part->source3)
|
|
|
|
{
|
2017-09-05 23:14:07 -07:00
|
|
|
en->cursor_bg = edje_object_add(ed->base.evas);
|
2015-10-20 11:57:17 -07:00
|
|
|
edje_object_file_set(en->cursor_bg, ed->path, rp->part->source3);
|
|
|
|
evas_object_smart_member_add(en->cursor_bg, ed->obj);
|
|
|
|
evas_object_stack_below(en->cursor_bg, rp->object);
|
|
|
|
evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object));
|
|
|
|
evas_object_pass_events_set(en->cursor_bg, EINA_TRUE);
|
|
|
|
_edje_subobj_register(ed, en->cursor_bg);
|
|
|
|
}
|
|
|
|
if (rp->part->source4)
|
|
|
|
{
|
2017-09-05 23:14:07 -07:00
|
|
|
en->cursor_fg = edje_object_add(ed->base.evas);
|
2015-10-20 11:57:17 -07:00
|
|
|
edje_object_file_set(en->cursor_fg, ed->path, rp->part->source4);
|
|
|
|
evas_object_smart_member_add(en->cursor_fg, ed->obj);
|
|
|
|
evas_object_stack_above(en->cursor_fg, rp->object);
|
|
|
|
evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object));
|
|
|
|
evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
|
|
|
|
_edje_subobj_register(ed, en->cursor_fg);
|
2017-07-12 02:37:50 -07:00
|
|
|
|
|
|
|
/* A proxy to the main cursor. */
|
|
|
|
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
|
|
|
{
|
2017-09-05 23:14:07 -07:00
|
|
|
en->cursor_fg2 = edje_object_add(ed->base.evas);
|
2017-07-12 02:37:50 -07:00
|
|
|
edje_object_file_set(en->cursor_fg2, ed->path, rp->part->source4);
|
|
|
|
evas_object_smart_member_add(en->cursor_fg2, ed->obj);
|
|
|
|
evas_object_stack_above(en->cursor_fg2, rp->object);
|
|
|
|
evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object));
|
|
|
|
evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE);
|
|
|
|
_edje_subobj_register(ed, en->cursor_fg2);
|
|
|
|
}
|
2013-01-14 08:18:07 -08:00
|
|
|
}
|
|
|
|
|
2012-01-17 00:38:37 -08:00
|
|
|
evas_object_textblock_legacy_newline_set(rp->object, EINA_TRUE);
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
|
2008-10-15 08:15:06 -07:00
|
|
|
{
|
2019-07-19 12:43:21 -07:00
|
|
|
if (en->cursor_bg) evas_object_show(en->cursor_bg);
|
|
|
|
if (en->cursor_fg) evas_object_show(en->cursor_fg);
|
|
|
|
if (en->cursor_fg2) evas_object_show(en->cursor_fg2);
|
2012-02-02 20:50:23 -08:00
|
|
|
en->input_panel_enable = EINA_TRUE;
|
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2013-01-05 08:17:53 -08:00
|
|
|
_edje_need_imf();
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-01-07 03:17:55 -08:00
|
|
|
en->commit_cancel = EINA_FALSE;
|
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
edje_object_signal_callback_add(ed->obj, "focus,part,in,*",
|
|
|
|
rp->part->name,
|
|
|
|
_edje_entry_focus_in_cb, rp);
|
|
|
|
edje_object_signal_callback_add(ed->obj, "focus,part,out,*",
|
|
|
|
rp->part->name,
|
|
|
|
_edje_entry_focus_out_cb, rp);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
ctx_id = ecore_imf_context_default_id_get();
|
|
|
|
if (ctx_id)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2009-05-14 05:53:56 -07:00
|
|
|
ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
|
|
|
|
if (!ctx_info->canvas_type ||
|
|
|
|
strcmp(ctx_info->canvas_type, "evas") == 0)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
|
|
|
en->imf_context = ecore_imf_context_add(ctx_id);
|
|
|
|
}
|
2009-05-14 05:53:56 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
|
|
|
|
if (ctx_id)
|
|
|
|
{
|
|
|
|
en->imf_context = ecore_imf_context_add(ctx_id);
|
|
|
|
}
|
|
|
|
}
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
2009-05-14 05:53:56 -07:00
|
|
|
else
|
2011-04-05 18:20:59 -07:00
|
|
|
en->imf_context = NULL;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
if (!en->imf_context) goto done;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
ecore_imf_context_client_window_set
|
2015-06-08 11:43:00 -07:00
|
|
|
(en->imf_context,
|
|
|
|
(void *)ecore_evas_window_get
|
2017-09-05 23:14:07 -07:00
|
|
|
(ecore_evas_ecore_evas_get(ed->base.evas)));
|
|
|
|
ecore_imf_context_client_canvas_set(en->imf_context, ed->base.evas);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2011-04-05 18:20:59 -07:00
|
|
|
ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context,
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_imf_retrieve_surrounding_cb, ed);
|
2014-01-22 18:26:52 -08:00
|
|
|
ecore_imf_context_retrieve_selection_callback_set(en->imf_context, _edje_entry_imf_retrieve_selection_cb, ed);
|
2013-04-06 10:18:48 -07:00
|
|
|
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb, ed);
|
|
|
|
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb, ed);
|
|
|
|
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb, ed);
|
2014-01-22 18:26:52 -08:00
|
|
|
ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_SELECTION_SET, _edje_entry_imf_event_selection_set_cb, ed);
|
2011-04-05 18:20:59 -07:00
|
|
|
ecore_imf_context_input_mode_set(en->imf_context,
|
|
|
|
rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ?
|
2009-05-14 05:53:56 -07:00
|
|
|
ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL);
|
2012-02-05 19:30:45 -08:00
|
|
|
|
2016-05-17 23:20:05 -07:00
|
|
|
if (rp->part->multiline)
|
|
|
|
ecore_imf_context_input_hint_set(en->imf_context,
|
|
|
|
ecore_imf_context_input_hint_get(en->imf_context) | ECORE_IMF_INPUT_HINT_MULTILINE);
|
|
|
|
|
2012-02-05 19:30:45 -08:00
|
|
|
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
|
|
|
|
ecore_imf_context_input_panel_language_set(en->imf_context, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
2009-05-14 05:53:56 -07:00
|
|
|
}
|
2011-11-20 06:39:34 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
done:
|
|
|
|
#endif
|
2009-12-01 03:02:46 -08:00
|
|
|
en->cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(rp->object);
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 02:19:04 -07:00
|
|
|
if (!en) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
rp->typedata.text->entry_data = NULL;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
2008-10-16 23:40:46 -07:00
|
|
|
_anchors_clear(en->cursor, rp->object, en);
|
2016-01-12 05:20:19 -08:00
|
|
|
_unused_item_objs_free(en);
|
2010-12-13 23:05:52 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2010-11-30 03:06:22 -08:00
|
|
|
_preedit_clear(en);
|
2010-12-13 23:05:52 -08:00
|
|
|
#endif
|
2008-10-15 08:15:06 -07:00
|
|
|
evas_object_del(en->cursor_bg);
|
|
|
|
evas_object_del(en->cursor_fg);
|
2013-01-14 08:18:07 -08:00
|
|
|
evas_object_del(en->cursor_fg2);
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2016-01-08 08:17:29 -08:00
|
|
|
if (en->cursor_user)
|
|
|
|
evas_textblock_cursor_free(en->cursor_user);
|
|
|
|
|
|
|
|
if (en->cursor_user_extra)
|
|
|
|
evas_textblock_cursor_free(en->cursor_user_extra);
|
|
|
|
|
2011-06-29 22:31:08 -07:00
|
|
|
if (en->pw_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(en->pw_timer);
|
|
|
|
en->pw_timer = NULL;
|
|
|
|
}
|
|
|
|
|
2017-09-05 23:14:07 -07:00
|
|
|
evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_VIEWPORT_RESIZE, _canvas_viewport_resize_cb, rp);
|
2016-07-12 03:36:58 -07:00
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2009-05-14 05:53:56 -07:00
|
|
|
if (en->imf_context)
|
|
|
|
{
|
2012-02-20 00:51:55 -08:00
|
|
|
ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb);
|
|
|
|
ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb);
|
|
|
|
ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb);
|
2014-01-22 18:26:52 -08:00
|
|
|
ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_SELECTION_SET, _edje_entry_imf_event_selection_set_cb);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
ecore_imf_context_del(en->imf_context);
|
|
|
|
en->imf_context = NULL;
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
edje_object_signal_callback_del(ed->obj, "focus,part,in,*",
|
|
|
|
rp->part->name,
|
|
|
|
_edje_entry_focus_in_cb);
|
|
|
|
edje_object_signal_callback_del(ed->obj, "focus,part,out,*",
|
|
|
|
rp->part->name,
|
|
|
|
_edje_entry_focus_out_cb);
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
#endif
|
2012-08-17 18:31:49 -07:00
|
|
|
_compose_seq_reset(en);
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2008-10-13 02:19:04 -07:00
|
|
|
free(en);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp)
|
2008-10-13 02:19:04 -07:00
|
|
|
{
|
2013-01-14 08:18:07 -08:00
|
|
|
Evas_Coord x, y, w, h, xx, yy, ww, hh, xx2, yy2;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2011-01-30 02:46:33 -08:00
|
|
|
Evas_Textblock_Cursor_Type cur_type;
|
2013-01-14 08:18:07 -08:00
|
|
|
Eina_Bool bidi_cursor = EINA_FALSE;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-13 02:19:04 -07:00
|
|
|
if (!en) return;
|
2008-10-15 02:58:25 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(ed, en->cursor, rp->object, en);
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
_anchors_update_check(ed, rp);
|
2016-01-05 06:30:20 -08:00
|
|
|
if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
|
2013-01-14 08:18:07 -08:00
|
|
|
{
|
2016-01-05 06:30:20 -08:00
|
|
|
switch (rp->part->cursor_mode)
|
|
|
|
{
|
|
|
|
case EDJE_ENTRY_CURSOR_MODE_BEFORE:
|
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_ENTRY_CURSOR_MODE_UNDER:
|
|
|
|
/* no break for a reason */
|
|
|
|
default:
|
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
|
|
|
|
}
|
|
|
|
x = y = w = h = -1;
|
|
|
|
xx = yy = ww = hh = -1;
|
|
|
|
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
|
|
|
bidi_cursor = evas_textblock_cursor_geometry_bidi_get(en->cursor, &xx, &yy, &ww, &hh, &xx2, &yy2, NULL, NULL, cur_type);
|
|
|
|
if (ww < 1) ww = 1;
|
|
|
|
if (hh < 1) hh = 1;
|
|
|
|
if (en->cursor_bg)
|
2013-01-14 08:18:07 -08:00
|
|
|
{
|
2017-07-12 02:37:50 -07:00
|
|
|
int bg_w = ww;
|
|
|
|
|
|
|
|
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
|
|
|
edje_object_size_min_restricted_calc(en->cursor_bg, &bg_w, NULL, ww, 0);
|
|
|
|
|
2016-01-05 06:30:20 -08:00
|
|
|
evas_object_move(en->cursor_bg, x + xx, y + yy);
|
2017-07-12 02:37:50 -07:00
|
|
|
evas_object_resize(en->cursor_bg, bg_w, hh);
|
2013-01-14 08:18:07 -08:00
|
|
|
}
|
2016-01-05 06:30:20 -08:00
|
|
|
if (en->cursor_fg)
|
2013-01-14 08:18:07 -08:00
|
|
|
{
|
2017-07-12 02:37:50 -07:00
|
|
|
int fg_w = ww;
|
|
|
|
|
|
|
|
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
|
|
|
edje_object_size_min_restricted_calc(en->cursor_fg, &fg_w, NULL, ww, 0);
|
|
|
|
|
2016-01-05 06:30:20 -08:00
|
|
|
evas_object_move(en->cursor_fg, x + xx, y + yy);
|
2017-07-12 02:37:50 -07:00
|
|
|
|
2016-01-05 06:30:20 -08:00
|
|
|
if (bidi_cursor)
|
|
|
|
{
|
2017-07-12 02:37:50 -07:00
|
|
|
if (en->cursor_fg2)
|
|
|
|
{
|
|
|
|
evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2));
|
|
|
|
evas_object_resize(en->cursor_fg, fg_w, hh / 2);
|
|
|
|
evas_object_resize(en->cursor_fg2, fg_w, hh / 2);
|
|
|
|
evas_object_show(en->cursor_fg2);
|
|
|
|
}
|
2016-01-05 06:30:20 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-07-12 02:37:50 -07:00
|
|
|
evas_object_resize(en->cursor_fg, fg_w, hh);
|
|
|
|
if (en->cursor_fg2)
|
|
|
|
evas_object_hide(en->cursor_fg2);
|
2016-01-05 06:30:20 -08:00
|
|
|
}
|
2013-01-14 08:18:07 -08:00
|
|
|
}
|
|
|
|
}
|
2008-10-13 02:19:04 -07:00
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
const char *
|
2008-10-15 02:58:25 -07:00
|
|
|
_edje_entry_selection_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-16 02:17:44 -07:00
|
|
|
if (!en) return NULL;
|
2008-10-15 02:58:25 -07:00
|
|
|
// get selection - convert to markup
|
2008-10-16 02:17:44 -07:00
|
|
|
if ((!en->selection) && (en->have_selection))
|
2011-04-05 18:20:59 -07:00
|
|
|
en->selection = evas_textblock_cursor_range_text_get
|
2015-06-08 11:43:00 -07:00
|
|
|
(en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
|
2008-10-16 02:17:44 -07:00
|
|
|
return en->selection;
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
_edje_entry_text_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-16 02:17:44 -07:00
|
|
|
if (!en) return NULL;
|
2008-10-15 02:58:25 -07:00
|
|
|
// get text - convert to markup
|
|
|
|
return evas_object_textblock_text_markup_get(rp->object);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2016-08-07 22:27:26 -07:00
|
|
|
const char *ptext;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (!en) return;
|
2016-08-07 22:27:26 -07:00
|
|
|
ptext = evas_object_textblock_text_markup_get(rp->object);
|
|
|
|
// some simple "do nothing if the text is the same" logic
|
|
|
|
if (ptext == text) return;
|
|
|
|
// if prev and cur is empty
|
|
|
|
if (!ptext) ptext = "";
|
|
|
|
if (!text) text = "";
|
|
|
|
if ((!ptext[0]) && (!text[0])) return;
|
|
|
|
// same content
|
|
|
|
if (!strcmp(ptext, text)) return;
|
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2008-10-15 02:58:25 -07:00
|
|
|
// set text as markup
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2011-02-20 17:48:41 -08:00
|
|
|
evas_object_textblock_text_markup_set(rp->object, text);
|
2011-05-19 05:08:29 -07:00
|
|
|
_edje_entry_set_cursor_start(rp);
|
2010-10-12 07:13:22 -07:00
|
|
|
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "entry,changed", rp->part->name);
|
2011-08-02 22:36:01 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2012-08-27 01:59:11 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2011-05-19 05:08:29 -07:00
|
|
|
#if 0
|
|
|
|
/* Don't emit cursor changed cause it didn't. It's just init to 0. */
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
2011-05-19 05:08:29 -07:00
|
|
|
#endif
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2011-05-15 08:57:38 -07:00
|
|
|
void
|
|
|
|
_edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-05-15 08:57:38 -07:00
|
|
|
Evas_Textblock_Cursor *end_cur;
|
|
|
|
if (!en) return;
|
|
|
|
end_cur = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
evas_textblock_cursor_paragraph_last(end_cur);
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_markup_prepend(en->ed, en, end_cur, text, NULL, NULL,
|
2013-03-29 03:42:54 -07:00
|
|
|
EINA_TRUE, EINA_FALSE);
|
2011-05-15 08:57:38 -07:00
|
|
|
evas_textblock_cursor_free(end_cur);
|
|
|
|
|
|
|
|
/* We are updating according to the real cursor on purpose */
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "entry,changed", rp->part->name);
|
2011-05-15 08:57:38 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2011-05-15 08:57:38 -07:00
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
void
|
|
|
|
_edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-16 02:17:44 -07:00
|
|
|
if (!en) return;
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_text_filter_markup_prepend(en->ed, en, en->cursor, text, NULL, NULL,
|
2013-03-29 03:42:54 -07:00
|
|
|
EINA_TRUE, EINA_FALSE);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "entry,changed", rp->part->name);
|
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2008-10-16 02:17:44 -07:00
|
|
|
}
|
|
|
|
|
2008-10-15 02:58:25 -07:00
|
|
|
void
|
|
|
|
_edje_entry_set_cursor_start(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (!en) return;
|
|
|
|
_curs_start(en->cursor, rp->object, en);
|
2011-04-24 22:36:58 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_set_cursor_end(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (!en) return;
|
|
|
|
_curs_end(en->cursor, rp->object, en);
|
2011-04-24 22:36:58 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
|
|
|
|
2008-11-18 00:45:27 -08:00
|
|
|
void
|
|
|
|
_edje_entry_select_none(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-11-18 00:45:27 -08:00
|
|
|
if (!en) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2008-11-18 00:45:27 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_select_all(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-11-18 00:45:27 -08:00
|
|
|
if (!en) return;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
2008-11-18 00:45:27 -08:00
|
|
|
_curs_start(en->cursor, rp->object, en);
|
2016-03-17 11:14:32 -07:00
|
|
|
_edje_entry_imf_context_reset(en->rp);
|
2008-11-18 00:45:27 -08:00
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
_curs_end(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2008-11-18 00:45:27 -08:00
|
|
|
}
|
|
|
|
|
2010-03-10 22:34:20 -08:00
|
|
|
void
|
|
|
|
_edje_entry_select_begin(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2010-03-10 22:34:20 -08:00
|
|
|
if (!en) return;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(en->ed, en->cursor, rp->object, en);
|
|
|
|
_sel_enable(en->ed, en->cursor, rp->object, en);
|
2010-03-10 22:34:20 -08:00
|
|
|
_sel_start(en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-03-10 22:34:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_select_extend(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2010-03-10 22:34:20 -08:00
|
|
|
if (!en) return;
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_extend(en->ed, en->cursor, rp->object, en);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-03-10 22:34:20 -08:00
|
|
|
}
|
|
|
|
|
2008-10-23 17:44:26 -07:00
|
|
|
const Eina_List *
|
|
|
|
_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2008-10-23 17:44:26 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Anchor *an;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-26 04:04:53 -07:00
|
|
|
if (!en) return NULL;
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
/* Update the anchors first in case entry is not inside the canvas
|
|
|
|
* viewport */
|
|
|
|
_anchors_need_update(rp);
|
2008-10-23 17:44:26 -07:00
|
|
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
|
|
|
{
|
2013-11-08 00:40:57 -08:00
|
|
|
const char *n = an->name;
|
2013-11-08 00:42:34 -08:00
|
|
|
if ((an->item) || (!n)) continue;
|
2013-11-08 00:40:57 -08:00
|
|
|
if (!strcmp(anchor, n))
|
2011-04-05 18:20:59 -07:00
|
|
|
return an->sel;
|
2008-10-23 17:44:26 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
const Eina_List *
|
2008-10-16 23:40:46 -07:00
|
|
|
_edje_entry_anchors_list(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l, *anchors = NULL;
|
|
|
|
Anchor *an;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-16 23:40:46 -07:00
|
|
|
if (!en) return NULL;
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
/* Update the anchors first in case entry is not inside the canvas
|
|
|
|
* viewport */
|
|
|
|
_anchors_need_update(rp);
|
2008-10-16 23:40:46 -07:00
|
|
|
if (!en->anchorlist)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
|
|
|
const char *n = an->name;
|
2013-11-08 00:42:34 -08:00
|
|
|
if ((an->item) || (!n)) continue;
|
2010-09-19 01:08:17 -07:00
|
|
|
anchors = eina_list_append(anchors, strdup(n));
|
|
|
|
}
|
|
|
|
en->anchorlist = anchors;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
|
|
|
return en->anchorlist;
|
|
|
|
}
|
|
|
|
|
2010-04-26 07:55:45 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2010-04-26 07:55:45 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Anchor *an;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!en) return EINA_FALSE;
|
2010-04-26 07:55:45 -07:00
|
|
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
|
|
|
{
|
2013-11-08 00:40:57 -08:00
|
|
|
const char *n = an->name;
|
2014-11-04 15:00:45 -08:00
|
|
|
if (!an->item) continue;
|
2013-11-08 00:40:57 -08:00
|
|
|
if (!n) n = "";
|
|
|
|
if (!strcmp(item, n))
|
2010-04-26 07:55:45 -07:00
|
|
|
{
|
|
|
|
evas_textblock_cursor_format_item_geometry_get(an->start, cx, cy, cw, ch);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const Eina_List *
|
|
|
|
_edje_entry_items_list(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2010-04-26 07:55:45 -07:00
|
|
|
Eina_List *l, *items = NULL;
|
|
|
|
Anchor *an;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2010-04-26 07:55:45 -07:00
|
|
|
if (!en) return NULL;
|
edje entry: Improves anchors handling
Summary:
When edje entry is not inside the canvas view port, anchors update is aborted to improve the scrolling performance
in case of large number of anchors.
@feature
Test Plan:
1. Should have many entries inside scroller.
2. Each entry should contain large number of anchors.
3. Scroll it, scrolling is not smooth.
Reviewers: seoz, cedric, thiepha, woohyun, tasn, raster, shilpasingh, herdsman, JackDanielZ
Reviewed By: shilpasingh
Subscribers: poornima.srinivasan, rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D2108
2015-05-14 22:18:08 -07:00
|
|
|
/* Update the anchors first in case entry is not inside the canvas
|
|
|
|
* viewport */
|
|
|
|
_anchors_need_update(rp);
|
2010-04-26 07:55:45 -07:00
|
|
|
if (!en->itemlist)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
2010-09-19 01:08:17 -07:00
|
|
|
{
|
|
|
|
const char *n = an->name;
|
2014-11-04 15:00:45 -08:00
|
|
|
if (!an->item) continue;
|
2010-09-19 01:08:17 -07:00
|
|
|
if (!n) n = "";
|
|
|
|
items = eina_list_append(items, strdup(n));
|
|
|
|
}
|
|
|
|
en->itemlist = items;
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
|
|
|
return en->itemlist;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
void
|
2014-09-22 18:18:35 -07:00
|
|
|
_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *cdir)
|
2008-10-16 23:40:46 -07:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h, xx, yy, ww, hh;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2011-01-30 02:46:33 -08:00
|
|
|
Evas_Textblock_Cursor_Type cur_type;
|
2014-09-22 18:18:35 -07:00
|
|
|
Evas_BiDi_Direction dir;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2008-10-16 23:40:46 -07:00
|
|
|
if (!en) return;
|
2011-01-30 02:46:33 -08:00
|
|
|
switch (rp->part->cursor_mode)
|
|
|
|
{
|
|
|
|
case EDJE_ENTRY_CURSOR_MODE_BEFORE:
|
2015-06-08 11:43:00 -07:00
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
|
|
|
|
break;
|
|
|
|
|
2011-01-30 02:46:33 -08:00
|
|
|
case EDJE_ENTRY_CURSOR_MODE_UNDER:
|
2015-06-08 11:43:00 -07:00
|
|
|
/* no break for a reason */
|
2011-01-30 02:46:33 -08:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
|
2011-01-30 02:46:33 -08:00
|
|
|
}
|
2008-10-16 23:40:46 -07:00
|
|
|
|
|
|
|
x = y = w = h = -1;
|
|
|
|
xx = yy = ww = hh = -1;
|
|
|
|
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
|
2014-09-22 18:18:35 -07:00
|
|
|
evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, &dir, cur_type);
|
2008-10-16 23:40:46 -07:00
|
|
|
if (ww < 1) ww = 1;
|
2011-10-04 04:40:52 -07:00
|
|
|
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
|
|
|
|
edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
|
2011-10-03 01:02:07 -07:00
|
|
|
if (hh < 1) hh = 1;
|
2008-10-16 23:40:46 -07:00
|
|
|
if (cx) *cx = x + xx;
|
|
|
|
if (cy) *cy = y + yy;
|
|
|
|
if (cw) *cw = ww;
|
|
|
|
if (ch) *ch = hh;
|
2014-09-22 18:18:35 -07:00
|
|
|
if (cdir) *cdir = dir;
|
2008-10-16 23:40:46 -07:00
|
|
|
}
|
2009-03-19 06:36:10 -07:00
|
|
|
|
2012-02-29 07:57:53 -08:00
|
|
|
void
|
|
|
|
_edje_entry_user_insert(Edje_Real_Part *rp, const char *text)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-10-02 05:53:54 -07:00
|
|
|
Edje_Entry_Change_Info *info;
|
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2014-01-19 22:59:50 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_markup_prepend(en->ed, en, en->cursor, text, NULL, NULL,
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_TRUE, EINA_TRUE);
|
2013-03-29 03:42:54 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
|
|
|
if (info)
|
2012-02-29 07:57:53 -08:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "entry,changed", rp->part->name);
|
|
|
|
_edje_emit_full(en->ed, "entry,changed,user", rp->part->name,
|
2013-03-29 03:42:54 -07:00
|
|
|
info, _free_entry_change_info);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
2012-02-29 07:57:53 -08:00
|
|
|
}
|
2012-10-28 06:29:01 -07:00
|
|
|
|
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2012-02-29 07:57:53 -08:00
|
|
|
}
|
|
|
|
|
2009-03-19 06:36:10 -07:00
|
|
|
void
|
2009-06-17 04:10:32 -07:00
|
|
|
_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
|
2009-03-19 06:36:10 -07:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2014-02-07 06:19:05 -08:00
|
|
|
|
2009-03-19 06:36:10 -07:00
|
|
|
en->select_allow = allow;
|
|
|
|
}
|
2009-03-20 08:07:39 -07:00
|
|
|
|
2010-03-26 18:26:10 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_select_allow_get(const Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EINA_FALSE;
|
2010-09-19 01:08:17 -07:00
|
|
|
return en->select_allow;
|
2010-03-26 18:26:10 -07:00
|
|
|
}
|
|
|
|
|
2009-03-20 08:07:39 -07:00
|
|
|
void
|
|
|
|
_edje_entry_select_abort(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-03-20 08:07:39 -07:00
|
|
|
if (en->selecting)
|
|
|
|
{
|
2009-06-17 04:10:32 -07:00
|
|
|
en->selecting = EINA_FALSE;
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-03-20 08:07:39 -07:00
|
|
|
}
|
|
|
|
}
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2012-02-23 22:51:04 -08:00
|
|
|
void *
|
|
|
|
_edje_entry_imf_context_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-23 22:51:04 -08:00
|
|
|
if (!en) return NULL;
|
|
|
|
|
|
|
|
return en->imf_context;
|
|
|
|
#else
|
|
|
|
return NULL;
|
2013-01-05 08:07:59 -08:00
|
|
|
(void)rp;
|
2012-02-23 22:51:04 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-10-26 22:42:41 -07:00
|
|
|
void
|
|
|
|
_edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-10-26 22:42:41 -07:00
|
|
|
if (!en) return;
|
|
|
|
|
|
|
|
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
|
|
|
|
autocapital_type = EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
ecore_imf_context_autocapital_type_set(en->imf_context, (Ecore_IMF_Autocapital_Type)autocapital_type);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
|
|
|
(void)autocapital_type;
|
2011-10-26 22:42:41 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Edje_Text_Autocapital_Type
|
|
|
|
_edje_entry_autocapital_type_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-10-26 22:42:41 -07:00
|
|
|
if (!en) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
return (Edje_Text_Autocapital_Type)ecore_imf_context_autocapital_type_get(en->imf_context);
|
2011-10-26 22:42:41 -07:00
|
|
|
return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
(void)rp;
|
|
|
|
#endif
|
2011-10-26 22:42:41 -07:00
|
|
|
}
|
|
|
|
|
2012-02-13 18:34:50 -08:00
|
|
|
void
|
|
|
|
_edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-13 18:34:50 -08:00
|
|
|
if (!en) return;
|
|
|
|
en->prediction_allow = prediction;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_prediction_allow_set(en->imf_context, prediction);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_prediction_allow_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-13 18:34:50 -08:00
|
|
|
if (!en) return EINA_FALSE;
|
|
|
|
return en->prediction_allow;
|
|
|
|
}
|
|
|
|
|
2014-09-01 03:01:54 -07:00
|
|
|
void
|
|
|
|
_edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
2014-09-13 23:22:03 -07:00
|
|
|
ecore_imf_context_input_hint_set(en->imf_context, (Ecore_IMF_Input_Hints)input_hints);
|
2014-09-01 03:01:54 -07:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)input_hints;
|
2014-09-01 03:01:54 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Edje_Input_Hints
|
|
|
|
_edje_entry_input_hint_get(const Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EDJE_INPUT_HINT_NONE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EDJE_INPUT_HINT_NONE;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
2014-09-13 23:22:03 -07:00
|
|
|
return (Edje_Input_Hints)ecore_imf_context_input_hint_get(en->imf_context);
|
2014-09-01 03:01:54 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return EDJE_INPUT_HINT_NONE;
|
|
|
|
}
|
|
|
|
|
2011-10-26 22:42:41 -07:00
|
|
|
void
|
|
|
|
_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-10-26 22:42:41 -07:00
|
|
|
if (!en) return;
|
2012-02-02 20:50:23 -08:00
|
|
|
en->input_panel_enable = enabled;
|
2011-10-26 22:42:41 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_input_panel_enabled_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-10-26 22:42:41 -07:00
|
|
|
if (!en) return EINA_FALSE;
|
2012-02-02 20:50:23 -08:00
|
|
|
return en->input_panel_enable;
|
2011-10-26 22:42:41 -07:00
|
|
|
}
|
|
|
|
|
2012-02-12 22:34:47 -08:00
|
|
|
void
|
|
|
|
_edje_entry_input_panel_show(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-12 22:34:47 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_show(en->imf_context);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
2012-02-12 22:34:47 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_input_panel_hide(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-12 22:34:47 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_hide(en->imf_context);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
2012-02-12 22:34:47 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-02-15 00:21:11 -08:00
|
|
|
void
|
|
|
|
_edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return;
|
|
|
|
en->input_panel_lang = lang;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
ecore_imf_context_input_panel_language_set(en->imf_context, (Ecore_IMF_Input_Panel_Lang)lang);
|
2012-02-15 00:21:11 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Edje_Input_Panel_Lang
|
|
|
|
_edje_entry_input_panel_language_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EDJE_INPUT_PANEL_LANG_AUTOMATIC;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC;
|
|
|
|
return en->input_panel_lang;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
|
|
|
(void)data;
|
|
|
|
(void)len;
|
2012-02-15 00:21:11 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
|
|
|
(void)data;
|
|
|
|
(void)len;
|
2012-02-15 00:21:11 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-03-26 01:31:05 -07:00
|
|
|
void
|
2012-02-15 00:21:11 -08:00
|
|
|
_edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
ecore_imf_context_input_panel_return_key_type_set(en->imf_context, (Ecore_IMF_Input_Panel_Return_Key_Type)return_key_type);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
|
|
|
(void)return_key_type;
|
2012-02-15 00:21:11 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-03-26 01:31:05 -07:00
|
|
|
Edje_Input_Panel_Return_Key_Type
|
2012-02-15 00:21:11 -08:00
|
|
|
_edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
return (Edje_Input_Panel_Return_Key_Type)ecore_imf_context_input_panel_return_key_type_get(en->imf_context);
|
2012-02-15 00:21:11 -08:00
|
|
|
return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
|
|
|
|
(void)rp;
|
|
|
|
#endif
|
2012-02-15 00:21:11 -08:00
|
|
|
}
|
|
|
|
|
2012-03-26 01:31:05 -07:00
|
|
|
void
|
2012-02-15 00:21:11 -08:00
|
|
|
_edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled);
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
|
|
|
(void)disabled;
|
2012-02-15 00:21:11 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-03-26 01:31:05 -07:00
|
|
|
Eina_Bool
|
2012-02-15 00:21:11 -08:00
|
|
|
_edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-15 00:21:11 -08:00
|
|
|
if (!en) return EINA_FALSE;
|
|
|
|
if (en->imf_context)
|
|
|
|
return ecore_imf_context_input_panel_return_key_disabled_get(en->imf_context);
|
|
|
|
return EINA_FALSE;
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
return EINA_FALSE;
|
|
|
|
(void)rp;
|
|
|
|
#endif
|
2012-02-15 00:21:11 -08:00
|
|
|
}
|
|
|
|
|
2013-12-26 20:24:54 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
void
|
|
|
|
_edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand)
|
|
|
|
#else
|
|
|
|
void
|
2014-01-17 01:51:36 -08:00
|
|
|
_edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand EINA_UNUSED)
|
2013-12-26 20:24:54 -08:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_show_on_demand_set(en->imf_context, ondemand);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_input_panel_show_on_demand_get(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;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
2015-06-08 11:43:00 -07:00
|
|
|
if (en->imf_context)
|
|
|
|
{
|
|
|
|
Eina_Bool ret = ecore_imf_context_input_panel_show_on_demand_get(en->imf_context);
|
|
|
|
return ret;
|
|
|
|
}
|
2013-12-26 20:24:54 -08:00
|
|
|
#endif
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
static Evas_Textblock_Cursor *
|
|
|
|
_cursor_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return NULL;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!en) return NULL;
|
|
|
|
switch (cur)
|
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_MAIN:
|
2015-06-08 11:43:00 -07:00
|
|
|
return en->cursor;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_SELECTION_BEGIN:
|
2015-06-08 11:43:00 -07:00
|
|
|
return en->sel_start;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_SELECTION_END:
|
2015-06-08 11:43:00 -07:00
|
|
|
return en->sel_end;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_PREEDIT_START:
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!en->preedit_start)
|
|
|
|
en->preedit_start = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
return en->preedit_start;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_PREEDIT_END:
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!en->preedit_end)
|
|
|
|
en->preedit_end = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
return en->preedit_end;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_USER:
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!en->cursor_user)
|
|
|
|
en->cursor_user = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
return en->cursor_user;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
case EDJE_CURSOR_USER_EXTRA:
|
2015-06-08 11:43:00 -07:00
|
|
|
if (!en->cursor_user_extra)
|
|
|
|
en->cursor_user_extra = evas_object_textblock_cursor_new(rp->object);
|
|
|
|
return en->cursor_user_extra;
|
|
|
|
|
2010-09-19 01:08:17 -07:00
|
|
|
default:
|
2015-06-08 11:43:00 -07:00
|
|
|
break;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_next(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EINA_FALSE;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_next(c))
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2010-08-09 09:25:45 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2017-06-09 07:55:40 -07:00
|
|
|
return _edje_text_cursor_next(rp, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Eina_Bool
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_prev(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EINA_FALSE;
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_prev(c))
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2010-09-19 01:08:17 -07:00
|
|
|
if (evas_textblock_cursor_paragraph_prev(c)) goto ok;
|
2010-06-05 06:07:08 -07:00
|
|
|
else return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
ok:
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2017-06-09 07:55:40 -07:00
|
|
|
return _edje_text_cursor_prev(rp, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_up(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2009-12-01 03:02:46 -08:00
|
|
|
Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
|
|
|
|
int ln;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EINA_FALSE;
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
|
|
|
|
ln--;
|
2010-06-05 06:07:08 -07:00
|
|
|
if (ln < 0) return EINA_FALSE;
|
2011-04-05 18:20:59 -07:00
|
|
|
if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
|
2009-12-01 03:02:46 -08:00
|
|
|
&lx, &ly, &lw, &lh))
|
2011-04-05 18:20:59 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_coord_set(c, cx, ly + (lh / 2)))
|
2015-02-02 02:12:42 -08:00
|
|
|
evas_textblock_cursor_line_char_last(c);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2017-06-09 07:55:40 -07:00
|
|
|
return _edje_text_cursor_up(rp, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_down(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2009-12-01 03:02:46 -08:00
|
|
|
Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
|
2009-12-21 08:24:39 -08:00
|
|
|
int ln;
|
2012-09-11 06:14:51 -07:00
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return EINA_FALSE;
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
|
|
|
|
ln++;
|
2011-04-05 18:20:59 -07:00
|
|
|
if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
|
2009-12-01 03:02:46 -08:00
|
|
|
&lx, &ly, &lw, &lh))
|
2011-04-05 18:20:59 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
if (!evas_textblock_cursor_cluster_coord_set(c, cx, ly + (lh / 2)))
|
2015-01-12 08:44:06 -08:00
|
|
|
evas_textblock_cursor_line_char_last(c);
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_TRUE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
return _edje_text_cursor_down(rp, c);
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_begin(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2016-07-11 01:09:31 -07:00
|
|
|
int old_cur_pos;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!c) return;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2016-07-11 01:09:31 -07:00
|
|
|
old_cur_pos = evas_textblock_cursor_pos_get(c);
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_paragraph_first(c);
|
2016-07-11 01:09:31 -07:00
|
|
|
|
|
|
|
if (old_cur_pos == evas_textblock_cursor_pos_get(c))
|
|
|
|
return;
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_text_cursor_begin(rp, c);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_end(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2016-07-11 01:09:31 -07:00
|
|
|
int old_cur_pos;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!c) return;
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2016-07-11 01:09:31 -07:00
|
|
|
old_cur_pos = evas_textblock_cursor_pos_get(c);
|
2012-09-11 06:14:51 -07:00
|
|
|
_curs_end(c, rp->object, rp->typedata.text->entry_data);
|
2016-07-11 01:09:31 -07:00
|
|
|
|
|
|
|
if (old_cur_pos == evas_textblock_cursor_pos_get(c))
|
|
|
|
return;
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
2017-06-09 07:55:40 -07:00
|
|
|
void
|
|
|
|
_edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
_edje_text_cursor_end(rp, c);
|
|
|
|
}
|
2009-12-01 03:02:46 -08:00
|
|
|
|
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_copy(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *d, Efl_Text_Cursor_Handle *c)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2010-12-13 21:42:25 -08:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-12-01 03:02:46 -08:00
|
|
|
evas_textblock_cursor_copy(c, d);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c;
|
|
|
|
Evas_Textblock_Cursor *d;
|
|
|
|
c = _cursor_get(rp, cur);
|
|
|
|
if (!c) return;
|
|
|
|
d = _cursor_get(rp, dst);
|
|
|
|
if (!d) return;
|
|
|
|
_edje_text_cursor_copy(rp, d, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_line_begin(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2016-07-11 01:09:31 -07:00
|
|
|
int old_cur_pos;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!c) return;
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2012-01-17 20:38:04 -08:00
|
|
|
|
2016-07-11 01:09:31 -07:00
|
|
|
old_cur_pos = evas_textblock_cursor_pos_get(c);
|
2010-08-11 02:40:21 -07:00
|
|
|
evas_textblock_cursor_line_char_first(c);
|
2016-07-11 01:09:31 -07:00
|
|
|
|
|
|
|
if (old_cur_pos == evas_textblock_cursor_pos_get(c))
|
|
|
|
return;
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2017-06-09 07:55:40 -07:00
|
|
|
_edje_text_cursor_line_begin(rp, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_line_end(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
Entry *en;
|
2016-07-11 01:09:31 -07:00
|
|
|
int old_cur_pos;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!c) return;
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2016-07-11 01:09:31 -07:00
|
|
|
|
|
|
|
old_cur_pos = evas_textblock_cursor_pos_get(c);
|
2010-08-09 09:25:45 -07:00
|
|
|
evas_textblock_cursor_line_char_last(c);
|
2016-07-11 01:09:31 -07:00
|
|
|
|
|
|
|
if (old_cur_pos == evas_textblock_cursor_pos_get(c))
|
|
|
|
return;
|
|
|
|
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2010-03-11 02:16:32 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
void
|
|
|
|
_edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
_edje_text_cursor_line_end(rp, c);
|
|
|
|
}
|
|
|
|
|
2010-09-06 23:56:16 -07:00
|
|
|
Eina_Bool
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_coord_set(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c,
|
2010-09-06 23:56:16 -07:00
|
|
|
Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
2019-12-13 15:23:15 -08:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
2013-11-08 00:30:44 -08:00
|
|
|
Entry *en = rp->typedata.text->entry_data;
|
2019-12-13 15:23:15 -08:00
|
|
|
if (!en) return EINA_FALSE;
|
2017-06-09 07:55:40 -07:00
|
|
|
if ((c == _cursor_get(rp, EDJE_CURSOR_SELECTION_BEGIN)) ||
|
|
|
|
(c == _cursor_get(rp, EDJE_CURSOR_SELECTION_END)))
|
2013-11-08 00:30:44 -08:00
|
|
|
{
|
|
|
|
if (en->have_selection)
|
edje entry: return correct selection
Summary:
In entry, when selection_get function is called, selection is not
always returned the current selection.
Scenario:
- In select mode, entry has selection (e.g, by double click).
- When selection handler is moved, set the cursor the current coordinate
with edje_object_part_text_cursor_pos_set() API.
- Edje emits "selection,changed" signal.
- Elementary gets current selection and stores it.
- Elementary does not get selection as visual selection (e.g, text is
highlighted with "entry test", but the selection returned
from edje is "entry").
- If we copy and then paste to the entry, the pasted text is not same as
selected text.
Reason:
- In _edje_entry_cursor_coord_set function, if entry has selection, we only
emit "selection,changed" signal without freeing en->selection.
- When _edje_entry_selection_get is called, we check the en->selection,
since it is existed, we just return it which is not updated one.
This patch clears en->selection, so that it is updated at _selection_get,
and the updated selection is returned to caller.
@fix
Test Plan:
In mobile profile, open entry
- Right click, choose select, double click -> selection handlers are shown.
- Drag selection handlers to change selection.
- Right click, do copy.
- Right click, do paste.
- See the pasted text is not same as selection.
Reviewers: raster, tasn, herdsman
Subscribers: seoz, JackDanielZ, cedric
Differential Revision: https://phab.enlightenment.org/D2746
2015-11-25 23:52:48 -08:00
|
|
|
{
|
|
|
|
if (en->selection)
|
|
|
|
{
|
|
|
|
free(en->selection);
|
|
|
|
en->selection = NULL;
|
|
|
|
}
|
|
|
|
_edje_emit(en->ed, "selection,changed", rp->part->name);
|
|
|
|
}
|
2013-11-08 00:30:44 -08:00
|
|
|
}
|
evas textblock: add/apply cursor cluster APIs based on grapheme cluster
Summary:
Add a feature for moving cursor over a grapheme cluster.
It is applied to edje_entry.c and elm_entry.c for improving
cursor handling just like other modern text editors. ex) gedit
The patch on Evas needs to update libunibreak library.
So, the patch will update libunibreak, too.
@feature
Test Plan:
1. Put "ഹലോ" in your entry.
2. Your cursor can reach at the end of text from the beginning
only in 2 right key event with this feature.
Reviewers: raster, cedric, jpeg, herdsman, zmike, devilhorns
Reviewed By: herdsman, zmike
Subscribers: #reviewers, #committers, zmike, bowonryu, woohyun
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5490
2018-08-20 04:21:53 -07:00
|
|
|
return evas_textblock_cursor_cluster_coord_set(c, x, y);
|
2010-09-06 23:56:16 -07:00
|
|
|
}
|
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur,
|
|
|
|
Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
if (!c) return EINA_FALSE;
|
|
|
|
return _edje_text_cursor_coord_set(rp, c, x, y);
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2010-08-09 09:25:45 -07:00
|
|
|
if (evas_textblock_cursor_is_format(c)) return EINA_TRUE;
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!c) return EINA_FALSE;
|
2010-08-09 09:25:45 -07:00
|
|
|
return evas_textblock_cursor_format_is_visible_get(c);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
char *
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_content_get(Edje_Real_Part *rp EINA_UNUSED, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
return evas_textblock_cursor_content_get(c);
|
|
|
|
}
|
|
|
|
|
2012-01-02 03:32:06 -08:00
|
|
|
char *
|
2009-12-01 03:02:46 -08:00
|
|
|
_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
2010-09-05 01:29:52 -07:00
|
|
|
|
2010-10-20 03:34:26 -07:00
|
|
|
if (!c) return NULL;
|
2010-09-05 01:29:52 -07:00
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
return _edje_text_cursor_content_get(rp, c);
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
2011-02-27 02:25:22 -08:00
|
|
|
void
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_pos_set(Edje_Real_Part *rp, Efl_Text_Cursor_Handle *c, int pos)
|
2011-02-27 02:25:22 -08:00
|
|
|
{
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
2017-06-09 07:55:40 -07:00
|
|
|
Entry *en = rp->typedata.text->entry_data;
|
2012-09-11 06:14:51 -07:00
|
|
|
if (!en) return;
|
2011-02-27 02:25:22 -08:00
|
|
|
if (!c) return;
|
2011-05-19 05:08:29 -07:00
|
|
|
/* Abort if cursor position didn't really change */
|
|
|
|
if (evas_textblock_cursor_pos_get(c) == pos)
|
2012-02-20 00:51:55 -08:00
|
|
|
return;
|
2011-05-19 05:08:29 -07:00
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
_edje_entry_imf_context_reset(rp);
|
2011-02-27 02:25:22 -08:00
|
|
|
evas_textblock_cursor_pos_set(c, pos);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_update(en->ed, c, rp->object, rp->typedata.text->entry_data);
|
2011-02-27 02:25:22 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(en->ed, "cursor,changed", rp->part->name);
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2011-02-27 02:25:22 -08:00
|
|
|
}
|
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
void
|
|
|
|
_edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
|
|
|
|
_edje_text_cursor_pos_set(rp, c, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
Efl.Text.Cursor
Summary:
Implementation of new cursor text object.
This Patch Contains :
1- Remove Efl.Text.Cursor & Efl.Text_Markup_Interactive interfaces and replace them with one Class Efl.Text.Cursor
=> there are some modifications on cursor methods
2- Update all related classes to use Efl.Text.Cursor object instead of the old interfaces
3- If class uses Efl.Text_Cursor_Cursor (handle), mainly annotation it will stay as it is until we update other annotations into attribute_factory
4- Add main cursor property into efl.text.interactive
5- Add cursor_new method in efl.ui.text (I think we may move it into efl.text.interactive interface)
There still some parts that need discussion: especially cursor movement functionality, I prefer to move function with Enum, instead of special function for each movement.
```
enum @beta Efl.Text.Cursor_Move_Type
{
[[Text cursor movement types]]
char_next, [[Advances to the next character]]
char_prev, [[Advances to the previous character]]
cluster_next, [[Advances to the next grapheme cluster]]
cluster_prev, [[Advances to the previous grapheme cluster]]
paragraph_start, [[Advances to the first character in this paragraph]]
paragraph_end, [[Advances to the last character in this paragraph]]
word_start, [[Advance to current word start]]
word_end, [[Advance to current word end]]
line_start, [[Advance to current line first character]]
line_end, [[Advance to current line last character]]
paragraph_first, [[Advance to current paragraph first character]]
paragraph_last, [[Advance to current paragraph last character]]
paragraph_next, [[Advances to the start of the next text node]]
paragraph_prev [[Advances to the end of the previous text node]]
}
move {
[[Move the cursor]]
params {
@in type: Efl.Text.Cursor_Move_Type; [[The type of movement]]
}
return: bool; [[True if actually moved]]
}
```
or old way:
```
char_next {
[[Advances to the next character]]
// FIXME: Make the number of characters we moved by? Useful for all the other functions
return: bool; [[True if actually moved]]
}
char_prev {
[[Advances to the previous character]]
return: bool; [[True if actually moved]]
}
char_delete {
[[Deletes a single character from position pointed by given cursor.]]
}
cluster_next {
[[Advances to the next grapheme cluster]]
return: bool; [[True if actually moved]]
}
cluster_prev {
[[Advances to the previous grapheme cluster]]
return: bool; [[True if actually moved]]
}
// FIXME: paragraph_end is inconsistent with word_end. The one goes to the last character and the other after the last character.
paragraph_start {
[[Advances to the first character in this paragraph]]
return: bool; [[True if actually moved]]
}
paragraph_end {
[[Advances to the last character in this paragraph]]
return: bool; [[True if actually moved]]
}
word_start {
[[Advance to current word start]]
return: bool; [[True if actually moved]]
}
word_end {
[[Advance to current word end]]
return: bool; [[True if actually moved]]
}
line_start {
[[Advance to current line first character]]
return: bool; [[True if actually moved]]
}
line_end {
[[Advance to current line last character]]
return: bool; [[True if actually moved]]
}
paragraph_first {
[[Advance to current paragraph first character]]
return: bool; [[True if actually moved]]
}
paragraph_last {
[[Advance to current paragraph last character]]
return: bool; [[True if actually moved]]
}
paragraph_next {
[[Advances to the start of the next text node]]
return: bool; [[True if actually moved]]
}
paragraph_prev {
[[Advances to the end of the previous text node]]
return: bool; [[True if actually moved]]
}
```
Reviewers: woohyun, tasn, segfaultxavi
Reviewed By: woohyun
Subscribers: a.srour, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10542
2019-11-22 00:35:54 -08:00
|
|
|
_edje_text_cursor_pos_get(Edje_Real_Part *rp EINA_UNUSED, Efl_Text_Cursor_Handle *c)
|
2017-06-09 07:55:40 -07:00
|
|
|
{
|
|
|
|
return evas_textblock_cursor_pos_get(c);
|
|
|
|
}
|
|
|
|
|
2011-02-27 02:25:22 -08:00
|
|
|
int
|
|
|
|
_edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
|
|
|
if (!c) return 0;
|
2017-06-09 07:55:40 -07:00
|
|
|
return _edje_text_cursor_pos_get(rp, c);
|
2011-02-27 02:25:22 -08:00
|
|
|
}
|
2011-08-25 00:25:37 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-08-25 00:25:37 -07:00
|
|
|
if (!en) return;
|
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
ecore_imf_context_input_panel_layout_set(en->imf_context, (Ecore_IMF_Input_Panel_Layout)layout);
|
2011-11-20 06:15:37 -08:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)rp;
|
|
|
|
(void)layout;
|
2011-08-25 00:25:37 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Edje_Input_Panel_Layout
|
|
|
|
_edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
|
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2011-11-17 06:07:39 -08:00
|
|
|
if (!en) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
2011-08-25 00:25:37 -07:00
|
|
|
if (en->imf_context)
|
2013-01-20 23:12:39 -08:00
|
|
|
return (Edje_Input_Panel_Layout)ecore_imf_context_input_panel_layout_get(en->imf_context);
|
2011-08-25 00:25:37 -07:00
|
|
|
return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
(void)rp;
|
|
|
|
#endif
|
2011-08-25 00:25:37 -07:00
|
|
|
}
|
2011-02-27 02:25:22 -08:00
|
|
|
|
2013-03-27 01:28:53 -07:00
|
|
|
void
|
|
|
|
_edje_entry_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_input_panel_layout_variation_set(en->imf_context, variation);
|
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)variation;
|
2013-03-27 01:28:53 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_edje_entry_input_panel_layout_variation_get(Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return 0;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return 0;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
return ecore_imf_context_input_panel_layout_variation_get(en->imf_context);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-13 03:40:55 -08:00
|
|
|
void
|
|
|
|
_edje_entry_imf_context_reset(Edje_Real_Part *rp)
|
2011-07-28 22:56:09 -07:00
|
|
|
{
|
2013-01-05 08:07:59 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en;
|
2012-11-02 01:15:58 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
2012-02-13 03:40:55 -08:00
|
|
|
if (!en) return;
|
2011-07-28 22:56:09 -07:00
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_reset(en->imf_context);
|
2013-01-07 03:17:55 -08:00
|
|
|
if (en->commit_cancel)
|
2015-06-08 11:43:00 -07:00
|
|
|
en->commit_cancel = EINA_FALSE;
|
2013-01-05 08:07:59 -08:00
|
|
|
#else
|
|
|
|
(void)rp;
|
2011-07-28 22:56:09 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-21 03:39:36 -08:00
|
|
|
_edje_entry_imf_cursor_location_set(Entry *en)
|
2011-07-28 22:56:09 -07:00
|
|
|
{
|
2011-11-17 06:07:39 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
edje entry: fix gcc warnings about possibly uninitialized variables
this fixes warnings from gcc specifically:
lib/edje/edje_entry.c: In function ‘_edje_entry_imf_cursor_info_set’:
lib/edje/edje_entry.c:4104:4: warning: ‘dir’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
ecore_imf_context_bidi_direction_set(en->imf_context,
(Ecore_IMF_BiDi_Direction)dir);
^
lib/edje/edje_entry.c:4099:24: note: ‘dir’ was declared here
Evas_BiDi_Direction dir;
^
lib/edje/edje_entry.c:4103:4: warning:
‘ch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:27: note: ‘ch’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4:
warning: ‘cw’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:23: note: ‘cw’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4: warning:
‘cy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:19: note: ‘cy’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4: warning:
‘cx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:15: note: ‘cx’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c: In function
‘_edje_part_move_cb’:
lib/edje/edje_entry.c:4104:4: warning: ‘dir’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
ecore_imf_context_bidi_direction_set(en->imf_context,
(Ecore_IMF_BiDi_Direction)dir);
^
lib/edje/edje_entry.c:4099:24: note: ‘dir’ was declared here
Evas_BiDi_Direction dir;
^
lib/edje/edje_entry.c:4103:4: warning:
‘ch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:27: note: ‘ch’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4:
warning: ‘cw’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:23: note: ‘cw’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4: warning:
‘cy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:19: note: ‘cy’ was declared here
Evas_Coord cx, cy, cw, ch;
^
lib/edje/edje_entry.c:4103:4: warning:
‘cx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw,
ch);
^
lib/edje/edje_entry.c:4098:15: note: ‘cx’ was declared here
Evas_Coord cx, cy, cw, ch;
^
and the likes...
2016-02-29 20:19:08 -08:00
|
|
|
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
|
|
|
|
Evas_BiDi_Direction dir = 0;
|
2011-07-28 22:56:09 -07:00
|
|
|
if (!en || !en->rp || !en->imf_context) return;
|
|
|
|
|
2014-09-22 18:18:35 -07:00
|
|
|
_edje_entry_cursor_geometry_get(en->rp, &cx, &cy, &cw, &ch, &dir);
|
2012-12-21 03:39:36 -08:00
|
|
|
ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
|
2014-09-22 18:18:35 -07:00
|
|
|
ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir);
|
2012-12-21 03:39:36 -08:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)en;
|
2012-12-21 03:39:36 -08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_entry_imf_cursor_info_set(Entry *en)
|
|
|
|
{
|
2013-02-27 22:08:00 -08:00
|
|
|
int cursor_pos;
|
|
|
|
|
2012-12-21 03:39:36 -08:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (!en || !en->rp || !en->imf_context) return;
|
2011-07-28 22:56:09 -07:00
|
|
|
|
2013-02-27 22:08:00 -08:00
|
|
|
if (en->have_selection)
|
|
|
|
{
|
|
|
|
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
|
|
|
cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
|
|
|
|
else
|
|
|
|
cursor_pos = evas_textblock_cursor_pos_get(en->sel_end);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
|
|
|
|
ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos);
|
|
|
|
|
2012-12-21 03:39:36 -08:00
|
|
|
_edje_entry_imf_cursor_location_set(en);
|
2011-11-20 06:15:37 -08:00
|
|
|
#else
|
2015-06-08 11:43:00 -07:00
|
|
|
(void)en;
|
2011-07-28 22:56:09 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-06-25 21:44:58 -07:00
|
|
|
void
|
|
|
|
_edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint)
|
|
|
|
{
|
|
|
|
Entry *en;
|
|
|
|
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if (!en) return;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
ecore_imf_context_prediction_hint_set(en->imf_context, prediction_hint);
|
|
|
|
#else
|
|
|
|
(void)prediction_hint;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-05-22 19:26:30 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_prediction_hint_hash_set(Edje_Real_Part *rp, const char *key, const char *value)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
return ecore_imf_context_prediction_hint_hash_set(en->imf_context, key, value);
|
|
|
|
#else
|
|
|
|
(void)key;
|
|
|
|
(void)value;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
_edje_entry_prediction_hint_hash_del(Edje_Real_Part *rp, const char *key)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
#ifdef HAVE_ECORE_IMF
|
|
|
|
if (en->imf_context)
|
|
|
|
return ecore_imf_context_prediction_hint_hash_del(en->imf_context, key);
|
|
|
|
#else
|
|
|
|
(void)key;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-05-14 05:53:56 -07:00
|
|
|
#ifdef HAVE_ECORE_IMF
|
2016-11-30 13:52:14 -08:00
|
|
|
|
|
|
|
static Edje_Real_Part *
|
|
|
|
_edje_entry_imf_default_focused_rp_get(Edje *ed)
|
|
|
|
{
|
|
|
|
Eina_Stringshare *seat_name;
|
|
|
|
Efl_Input_Device *seat;
|
|
|
|
Evas *e;
|
|
|
|
|
|
|
|
e = evas_object_evas_get(ed->obj);
|
2020-08-25 02:53:56 -07:00
|
|
|
seat = evas_default_device_get(e, EVAS_DEVICE_CLASS_SEAT);
|
2016-11-30 13:52:14 -08:00
|
|
|
seat_name = _edje_seat_name_get(ed, seat);
|
|
|
|
|
|
|
|
return _edje_focused_part_get(ed, seat_name);
|
|
|
|
}
|
|
|
|
|
2010-10-14 00:50:32 -07:00
|
|
|
static Eina_Bool
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text, int *cursor_pos)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2011-04-05 18:20:59 -07:00
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en = NULL;
|
2009-05-13 06:29:30 -07:00
|
|
|
const char *str;
|
2012-12-13 03:35:41 -08:00
|
|
|
char *plain_text;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
2010-09-27 17:25:54 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2011-04-05 18:20:59 -07:00
|
|
|
return EINA_FALSE;
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-05-13 06:29:30 -07:00
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
str = _edje_entry_text_get(rp);
|
2012-12-13 03:35:41 -08:00
|
|
|
if (str)
|
2013-05-13 17:33:19 -07:00
|
|
|
{
|
|
|
|
plain_text = evas_textblock_text_markup_to_utf8(NULL, str);
|
|
|
|
|
|
|
|
if (plain_text)
|
|
|
|
{
|
2016-08-17 18:40:24 -07:00
|
|
|
if (ecore_imf_context_input_hint_get(ctx) & ECORE_IMF_INPUT_HINT_SENSITIVE_DATA)
|
|
|
|
{
|
2019-12-04 00:09:33 -08:00
|
|
|
int idx = 0;
|
2016-08-17 18:40:24 -07:00
|
|
|
char *itr = NULL;
|
2019-12-04 00:09:33 -08:00
|
|
|
size_t len = eina_unicode_utf8_get_len(plain_text);
|
|
|
|
char *u_text = (char *)malloc(len * sizeof(char) + 1);
|
2020-02-27 01:16:00 -08:00
|
|
|
if (!u_text)
|
|
|
|
{
|
|
|
|
free(plain_text);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2019-12-04 00:09:33 -08:00
|
|
|
|
|
|
|
itr = u_text;
|
|
|
|
while (eina_unicode_utf8_next_get(plain_text, &idx))
|
|
|
|
{
|
|
|
|
*itr = '*';
|
|
|
|
itr++;
|
|
|
|
}
|
|
|
|
*itr = 0;
|
|
|
|
|
2019-12-10 22:49:44 -08:00
|
|
|
free(plain_text);
|
2019-12-04 00:09:33 -08:00
|
|
|
plain_text = strdup(u_text);
|
|
|
|
free(u_text);
|
|
|
|
u_text = NULL;
|
2016-08-17 18:40:24 -07:00
|
|
|
}
|
2013-05-13 17:33:19 -07:00
|
|
|
|
2017-06-08 01:02:35 -07:00
|
|
|
*text = strdup(plain_text);
|
2013-05-13 17:33:19 -07:00
|
|
|
free(plain_text);
|
|
|
|
plain_text = NULL;
|
|
|
|
}
|
|
|
|
else
|
Edje entry: Pass correct cursor position and text to imf in case of selection
Summary:
When selection is there we are passing the whole text and position to imf
which sees that next character like matras (eg .Hindi) should be inserted
(if pressed) and when matra comes the selected text is gone and only matra
remains in the entry.
eg: we have text in hindi like मानक, select all and hit matra in keyboard
selected text is gone, only matra is there.
@fix
Test Plan: Tested in Tizen device
Reviewers: jihoon, tasn, herdsman, thiepha
Subscribers: Hermet, shilpasingh, raster, subodh, jpeg, cedric
Differential Revision: https://phab.enlightenment.org/D2951
2016-08-29 01:23:07 -07:00
|
|
|
{
|
|
|
|
*text = strdup("");
|
|
|
|
}
|
2013-05-13 17:33:19 -07:00
|
|
|
}
|
2012-12-13 03:35:41 -08:00
|
|
|
else
|
Edje entry: Pass correct cursor position and text to imf in case of selection
Summary:
When selection is there we are passing the whole text and position to imf
which sees that next character like matras (eg .Hindi) should be inserted
(if pressed) and when matra comes the selected text is gone and only matra
remains in the entry.
eg: we have text in hindi like मानक, select all and hit matra in keyboard
selected text is gone, only matra is there.
@fix
Test Plan: Tested in Tizen device
Reviewers: jihoon, tasn, herdsman, thiepha
Subscribers: Hermet, shilpasingh, raster, subodh, jpeg, cedric
Differential Revision: https://phab.enlightenment.org/D2951
2016-08-29 01:23:07 -07:00
|
|
|
{
|
|
|
|
*text = strdup("");
|
|
|
|
}
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2009-05-13 06:29:30 -07:00
|
|
|
if (cursor_pos)
|
2013-05-13 17:33:19 -07:00
|
|
|
{
|
Edje entry: Pass correct cursor position and text to imf in case of selection
Summary:
When selection is there we are passing the whole text and position to imf
which sees that next character like matras (eg .Hindi) should be inserted
(if pressed) and when matra comes the selected text is gone and only matra
remains in the entry.
eg: we have text in hindi like मानक, select all and hit matra in keyboard
selected text is gone, only matra is there.
@fix
Test Plan: Tested in Tizen device
Reviewers: jihoon, tasn, herdsman, thiepha
Subscribers: Hermet, shilpasingh, raster, subodh, jpeg, cedric
Differential Revision: https://phab.enlightenment.org/D2951
2016-08-29 01:23:07 -07:00
|
|
|
if (en->have_selection && en->sel_start)
|
|
|
|
*cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
|
|
|
|
else if (en->cursor)
|
2013-05-13 17:33:19 -07:00
|
|
|
*cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
else
|
|
|
|
*cursor_pos = 0;
|
|
|
|
}
|
2010-09-19 01:08:17 -07:00
|
|
|
|
2010-09-27 17:25:54 -07:00
|
|
|
return EINA_TRUE;
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
|
2012-01-17 20:38:04 -08:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2011-04-05 18:20:59 -07:00
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en = NULL;
|
2012-01-17 20:38:04 -08:00
|
|
|
char *commit_str = event_info;
|
2013-03-29 03:42:54 -07:00
|
|
|
Edje_Entry_Change_Info *info = NULL;
|
2013-04-10 20:30:04 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
2012-01-17 20:38:04 -08:00
|
|
|
if ((!rp)) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2012-01-17 20:38:04 -08:00
|
|
|
return;
|
2009-05-14 05:53:56 -07:00
|
|
|
|
2010-09-05 00:20:47 -07:00
|
|
|
if (en->have_selection)
|
|
|
|
{
|
2012-01-17 20:38:04 -08:00
|
|
|
if (strcmp(commit_str, ""))
|
2010-11-30 03:06:22 -08:00
|
|
|
{
|
|
|
|
/* delete selected characters */
|
2012-01-03 01:55:59 -08:00
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
2010-11-30 03:06:22 -08:00
|
|
|
}
|
2010-09-05 00:20:47 -07:00
|
|
|
}
|
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
/* delete preedit characters */
|
|
|
|
_preedit_del(en);
|
|
|
|
_preedit_clear(en);
|
2013-01-07 03:17:55 -08:00
|
|
|
|
|
|
|
// Skipping commit process when it is useless
|
|
|
|
if (en->commit_cancel)
|
|
|
|
{
|
|
|
|
en->commit_cancel = EINA_FALSE;
|
|
|
|
return;
|
|
|
|
}
|
2010-11-30 03:06:22 -08:00
|
|
|
|
2011-06-29 22:31:08 -07:00
|
|
|
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
|
|
|
|
_edje_password_show_last)
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_hide_visible_password(ed, en->rp);
|
2011-06-29 22:31:08 -07:00
|
|
|
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
|
|
|
|
_edje_password_show_last && (!en->preedit_start))
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_text_prepend(ed, en, en->cursor, commit_str,
|
2013-03-29 03:42:54 -07:00
|
|
|
"+ password=off", "- password",
|
|
|
|
EINA_TRUE, EINA_TRUE);
|
|
|
|
if (info)
|
2011-06-29 22:31:08 -07:00
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
if (en->pw_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(en->pw_timer);
|
|
|
|
en->pw_timer = NULL;
|
|
|
|
}
|
2014-03-03 04:29:34 -08:00
|
|
|
if (_edje_password_show_last_timeout >= 0)
|
|
|
|
en->pw_timer = ecore_timer_add
|
2015-06-08 11:43:00 -07:00
|
|
|
(_edje_password_show_last_timeout,
|
2013-03-29 03:42:54 -07:00
|
|
|
_password_timer_cb, en);
|
2011-06-29 22:31:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2013-03-29 03:42:54 -07:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
info = _text_filter_text_prepend(ed, en, en->cursor, commit_str,
|
2013-04-10 20:30:04 -07:00
|
|
|
NULL, NULL,
|
2013-03-29 03:42:54 -07:00
|
|
|
EINA_TRUE, EINA_TRUE);
|
|
|
|
}
|
2010-11-30 03:06:22 -08:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
2013-03-29 03:42:54 -07:00
|
|
|
if (info)
|
2012-01-03 01:55:59 -08:00
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_emit(ed, "entry,changed", rp->part->name);
|
2012-01-03 01:55:59 -08:00
|
|
|
_edje_emit_full(ed, "entry,changed,user", rp->part->name,
|
|
|
|
info, _free_entry_change_info);
|
|
|
|
_edje_emit(ed, "cursor,changed", rp->part->name);
|
|
|
|
}
|
2012-10-28 06:29:01 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_real_part_configure(ed, rp);
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
|
2020-01-14 01:22:52 -08:00
|
|
|
static int
|
|
|
|
_sort_cb(const void *a1, const void *a2)
|
|
|
|
{
|
|
|
|
Ecore_IMF_Preedit_Attr *attr1 = (Ecore_IMF_Preedit_Attr *)a1;
|
|
|
|
Ecore_IMF_Preedit_Attr *attr2 = (Ecore_IMF_Preedit_Attr *)a2;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attr1, 0);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(attr2, 0);
|
|
|
|
|
|
|
|
if (attr1->start_index < attr2->start_index) return -1;
|
|
|
|
else if (attr1->start_index == attr2->start_index) return 0;
|
|
|
|
else return 1;
|
|
|
|
}
|
|
|
|
|
2012-01-17 20:38:04 -08:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
2011-04-05 18:20:59 -07:00
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en = NULL;
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
Edje_Entry_Change_Info *info = NULL;
|
2010-11-30 03:06:22 -08:00
|
|
|
int cursor_pos;
|
|
|
|
int preedit_start_pos, preedit_end_pos;
|
2009-05-13 06:29:30 -07:00
|
|
|
char *preedit_string;
|
2013-02-03 16:57:50 -08:00
|
|
|
char *markup_txt = NULL;
|
2015-06-08 11:43:00 -07:00
|
|
|
char *tagname[] = {
|
2016-01-12 23:48:10 -08:00
|
|
|
NULL, "preedit",
|
|
|
|
// XXX: FIXME: EFL2 - make these 2 preedit_sel's different for efl
|
|
|
|
// 2.0 and beyond. maybe use "preedit_sel", "preedit_hilight",
|
|
|
|
// See https://phab.enlightenment.org/D2980 for this issue
|
|
|
|
"preedit_sel", "preedit_sel",
|
2015-06-08 11:43:00 -07:00
|
|
|
"preedit_sub1", "preedit_sub2", "preedit_sub3", "preedit_sub4"
|
|
|
|
};
|
2010-11-30 03:06:22 -08:00
|
|
|
int i;
|
2013-02-03 16:57:50 -08:00
|
|
|
size_t preedit_type_size = sizeof(tagname) / sizeof(tagname[0]);
|
2010-11-30 03:06:22 -08:00
|
|
|
Eina_Bool preedit_end_state = EINA_FALSE;
|
2011-12-27 18:40:16 -08:00
|
|
|
Eina_List *attrs = NULL, *l = NULL;
|
|
|
|
Ecore_IMF_Preedit_Attr *attr;
|
|
|
|
Eina_Strbuf *buf;
|
2013-02-03 16:57:50 -08:00
|
|
|
Eina_Strbuf *preedit_attr_str;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
2012-01-17 20:38:04 -08:00
|
|
|
if ((!rp)) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2012-01-17 20:38:04 -08:00
|
|
|
return;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2012-01-17 20:38:04 -08:00
|
|
|
if (!en->imf_context) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2011-12-27 18:40:16 -08:00
|
|
|
ecore_imf_context_preedit_string_with_attributes_get(en->imf_context,
|
|
|
|
&preedit_string,
|
|
|
|
&attrs, &cursor_pos);
|
2012-01-17 20:38:04 -08:00
|
|
|
if (!preedit_string) return;
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
if (!strcmp(preedit_string, ""))
|
2011-04-05 18:20:59 -07:00
|
|
|
preedit_end_state = EINA_TRUE;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2015-08-05 03:02:53 -07:00
|
|
|
if (en->have_selection && !preedit_end_state)
|
|
|
|
_range_del_emit(ed, en->cursor, rp->object, en);
|
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
/* delete preedit characters */
|
|
|
|
_preedit_del(en);
|
2009-05-13 06:29:30 -07:00
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
|
2009-05-14 05:53:56 -07:00
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
/* insert preedit character(s) */
|
2011-12-27 18:40:16 -08:00
|
|
|
if (strlen(preedit_string) > 0)
|
2011-06-29 22:31:08 -07:00
|
|
|
{
|
2011-12-27 18:40:16 -08:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
if (attrs)
|
2011-06-29 22:31:08 -07:00
|
|
|
{
|
2020-01-14 01:22:52 -08:00
|
|
|
attrs = eina_list_sort(attrs, 0, EINA_COMPARE_CB(_sort_cb));
|
|
|
|
|
2011-12-27 18:40:16 -08:00
|
|
|
EINA_LIST_FOREACH(attrs, l, attr)
|
|
|
|
{
|
2020-01-14 01:22:52 -08:00
|
|
|
if (attr->preedit_type < preedit_type_size)
|
2011-12-27 18:40:16 -08:00
|
|
|
{
|
2013-02-03 16:57:50 -08:00
|
|
|
preedit_attr_str = eina_strbuf_new();
|
|
|
|
if (preedit_attr_str)
|
|
|
|
{
|
|
|
|
eina_strbuf_append_n(preedit_attr_str, preedit_string + attr->start_index, attr->end_index - attr->start_index);
|
|
|
|
markup_txt = evas_textblock_text_utf8_to_markup(NULL, eina_strbuf_string_get(preedit_attr_str));
|
2011-12-27 18:40:16 -08:00
|
|
|
|
2013-02-03 16:57:50 -08:00
|
|
|
if (markup_txt)
|
|
|
|
{
|
2020-01-14 01:22:52 -08:00
|
|
|
if (tagname[attr->preedit_type])
|
|
|
|
eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
|
|
|
|
else
|
|
|
|
eina_strbuf_append_printf(buf, "%s", markup_txt);
|
2013-02-03 16:57:50 -08:00
|
|
|
free(markup_txt);
|
|
|
|
}
|
|
|
|
eina_strbuf_free(preedit_attr_str);
|
|
|
|
}
|
2012-10-10 02:15:16 -07:00
|
|
|
}
|
2013-02-13 18:09:21 -08:00
|
|
|
else
|
|
|
|
eina_strbuf_append(buf, preedit_string);
|
2011-12-27 18:40:16 -08:00
|
|
|
}
|
2011-06-29 22:31:08 -07:00
|
|
|
}
|
2012-06-06 08:06:31 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_strbuf_append(buf, preedit_string);
|
|
|
|
}
|
2013-01-07 03:17:55 -08:00
|
|
|
|
|
|
|
// For skipping useless commit
|
|
|
|
if (!preedit_end_state)
|
2015-06-08 11:43:00 -07:00
|
|
|
en->have_preedit = EINA_TRUE;
|
2013-01-07 03:17:55 -08:00
|
|
|
|
2011-12-27 18:40:16 -08:00
|
|
|
if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
|
|
|
|
_edje_password_show_last)
|
|
|
|
{
|
2013-04-06 10:18:48 -07:00
|
|
|
_edje_entry_hide_visible_password(ed, en->rp);
|
2015-12-03 08:04:07 -08:00
|
|
|
info = _text_filter_markup_prepend(ed, en, en->cursor,
|
2013-03-29 03:42:54 -07:00
|
|
|
eina_strbuf_string_get(buf),
|
|
|
|
"+ password=off",
|
|
|
|
"- password",
|
|
|
|
EINA_TRUE, EINA_TRUE);
|
|
|
|
if (info)
|
2011-12-27 18:40:16 -08:00
|
|
|
{
|
2013-03-29 03:42:54 -07:00
|
|
|
if (en->pw_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(en->pw_timer);
|
|
|
|
en->pw_timer = NULL;
|
|
|
|
}
|
2014-03-03 04:29:34 -08:00
|
|
|
if (_edje_password_show_last_timeout >= 0)
|
|
|
|
en->pw_timer = ecore_timer_add
|
2015-06-08 11:43:00 -07:00
|
|
|
(_edje_password_show_last_timeout,
|
2013-03-29 03:42:54 -07:00
|
|
|
_password_timer_cb, en);
|
2011-12-27 18:40:16 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
info = _text_filter_markup_prepend(ed, en, en->cursor,
|
2013-03-29 03:42:54 -07:00
|
|
|
eina_strbuf_string_get(buf),
|
|
|
|
NULL, NULL,
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
EINA_TRUE, EINA_TRUE);
|
2011-12-27 18:40:16 -08:00
|
|
|
eina_strbuf_free(buf);
|
2011-06-29 22:31:08 -07:00
|
|
|
}
|
2011-07-28 22:56:09 -07:00
|
|
|
|
2010-11-30 03:06:22 -08:00
|
|
|
if (!preedit_end_state)
|
|
|
|
{
|
2011-02-20 17:48:41 -08:00
|
|
|
/* set preedit start cursor */
|
2010-11-30 03:06:22 -08:00
|
|
|
if (!en->preedit_start)
|
2011-04-05 18:20:59 -07:00
|
|
|
en->preedit_start = evas_object_textblock_cursor_new(rp->object);
|
2010-11-30 03:06:22 -08:00
|
|
|
evas_textblock_cursor_copy(en->cursor, en->preedit_start);
|
|
|
|
|
|
|
|
/* set preedit end cursor */
|
|
|
|
if (!en->preedit_end)
|
2011-04-05 18:20:59 -07:00
|
|
|
en->preedit_end = evas_object_textblock_cursor_new(rp->object);
|
2010-11-30 03:06:22 -08:00
|
|
|
evas_textblock_cursor_copy(en->cursor, en->preedit_end);
|
|
|
|
|
|
|
|
preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
|
|
|
|
for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_char_prev(en->preedit_start);
|
|
|
|
}
|
|
|
|
|
|
|
|
en->have_preedit = EINA_TRUE;
|
|
|
|
|
|
|
|
/* set cursor position */
|
|
|
|
evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
|
|
|
|
}
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2011-07-28 22:56:09 -07:00
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
2011-09-05 05:07:31 -07:00
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
_edje_emit_full(ed, "preedit,changed", rp->part->name, info,
|
|
|
|
_free_entry_change_info);
|
2009-05-13 06:29:30 -07:00
|
|
|
_edje_emit(ed, "cursor,changed", rp->part->name);
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2011-12-27 18:40:16 -08:00
|
|
|
/* delete attribute list */
|
|
|
|
if (attrs)
|
|
|
|
{
|
2015-06-08 11:43:00 -07:00
|
|
|
EINA_LIST_FREE(attrs, attr)
|
|
|
|
free(attr);
|
2011-12-27 18:40:16 -08:00
|
|
|
}
|
|
|
|
|
2010-10-14 00:50:32 -07:00
|
|
|
free(preedit_string);
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
|
|
|
|
2012-01-17 20:38:04 -08:00
|
|
|
static void
|
2013-01-03 18:08:14 -08:00
|
|
|
_edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
|
2009-05-13 06:29:30 -07:00
|
|
|
{
|
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2012-09-11 06:14:51 -07:00
|
|
|
Entry *en = NULL;
|
2012-01-17 20:38:04 -08:00
|
|
|
Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
|
2010-10-21 01:23:45 -07:00
|
|
|
Evas_Textblock_Cursor *del_start, *del_end;
|
2014-01-19 19:54:45 -08:00
|
|
|
Edje_Entry_Change_Info *info;
|
2010-10-21 01:23:45 -07:00
|
|
|
int cursor_pos;
|
2014-01-19 19:54:45 -08:00
|
|
|
int start, end;
|
2017-09-28 23:29:31 -07:00
|
|
|
char *tmp;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
if ((!rp)) return;
|
2012-01-17 20:38:04 -08:00
|
|
|
if ((!rp) || (!ev)) return;
|
2012-09-11 06:14:51 -07:00
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
2009-05-13 06:29:30 -07:00
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
2012-01-17 20:38:04 -08:00
|
|
|
return;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2010-10-21 01:23:45 -07:00
|
|
|
cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
|
|
|
|
|
|
|
|
del_start = evas_object_textblock_cursor_new(en->rp->object);
|
|
|
|
evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset);
|
|
|
|
|
|
|
|
del_end = evas_object_textblock_cursor_new(en->rp->object);
|
|
|
|
evas_textblock_cursor_pos_set(del_end, cursor_pos + ev->offset + ev->n_chars);
|
|
|
|
|
2014-01-19 19:54:45 -08:00
|
|
|
start = evas_textblock_cursor_pos_get(del_start);
|
|
|
|
end = evas_textblock_cursor_pos_get(del_end);
|
|
|
|
if (start == end) goto end;
|
|
|
|
|
|
|
|
info = calloc(1, sizeof(*info));
|
2016-07-27 18:59:15 -07:00
|
|
|
if (!info)
|
|
|
|
{
|
|
|
|
ERR("Running very low on memory");
|
|
|
|
return;
|
|
|
|
}
|
2014-01-19 19:54:45 -08:00
|
|
|
info->insert = EINA_FALSE;
|
|
|
|
info->change.del.start = start;
|
|
|
|
info->change.del.end = end;
|
2017-09-28 23:29:31 -07:00
|
|
|
|
|
|
|
tmp = evas_textblock_cursor_range_text_get(del_start, del_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
|
|
|
|
info->change.del.content = eina_stringshare_add(tmp);
|
|
|
|
if (tmp) free(tmp);
|
|
|
|
|
|
|
|
evas_textblock_cursor_range_delete(del_start, del_end);
|
|
|
|
_anchors_get(en->cursor, rp->object, en);
|
|
|
|
_anchors_update_check(ed, rp);
|
|
|
|
|
2014-01-19 19:54:45 -08:00
|
|
|
_edje_emit(ed, "entry,changed", en->rp->part->name);
|
|
|
|
_edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
|
|
|
|
_free_entry_change_info);
|
2016-03-30 19:34:01 -07:00
|
|
|
_edje_emit(ed, "cursor,changed", en->rp->part->name);
|
|
|
|
_edje_emit(ed, "cursor,changed,manual", en->rp->part->name);
|
|
|
|
|
|
|
|
_edje_entry_imf_cursor_info_set(en);
|
|
|
|
_edje_entry_real_part_configure(ed, rp);
|
|
|
|
|
2014-01-19 19:54:45 -08:00
|
|
|
end:
|
2010-10-21 01:23:45 -07:00
|
|
|
evas_textblock_cursor_free(del_start);
|
|
|
|
evas_textblock_cursor_free(del_end);
|
2009-05-13 06:29:30 -07:00
|
|
|
}
|
2014-01-22 18:26:52 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
|
|
|
|
{
|
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2014-01-22 18:26:52 -08:00
|
|
|
Entry *en = NULL;
|
|
|
|
Ecore_IMF_Event_Selection *ev = event_info;
|
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
2014-01-22 18:26:52 -08:00
|
|
|
if ((!rp) || (!ev)) return;
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
|
|
|
return;
|
|
|
|
|
2014-11-12 22:36:46 -08:00
|
|
|
if (ev->start == ev->end)
|
|
|
|
{
|
|
|
|
_edje_entry_cursor_pos_set(rp, EDJE_CURSOR_MAIN, ev->start);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_sel_clear(ed, en->cursor, rp->object, en);
|
|
|
|
evas_textblock_cursor_pos_set(en->cursor, ev->start);
|
|
|
|
_sel_enable(ed, en->cursor, rp->object, en);
|
|
|
|
_sel_start(en->cursor, rp->object, en);
|
|
|
|
evas_textblock_cursor_pos_set(en->cursor, ev->end);
|
|
|
|
_sel_extend(ed, en->cursor, rp->object, en);
|
|
|
|
}
|
2014-01-31 17:32:53 -08:00
|
|
|
|
|
|
|
_edje_entry_real_part_configure(en->ed, rp);
|
2014-01-22 18:26:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, char **text)
|
|
|
|
{
|
|
|
|
Edje *ed = data;
|
edje: support seat on focus action and signals
Seat goes as an optional parameter for FOCUS_SET (if not
provided, act over default seat), and emit signals
with seat suffix:
* focus,in,$SEAT
* focus,out,$SEAT
* focus,part,in,$SEAT
* focus,part,out,$SEAT
2016-11-17 09:21:02 -08:00
|
|
|
Edje_Real_Part *rp;
|
2014-01-22 18:26:52 -08:00
|
|
|
Entry *en = NULL;
|
2016-04-27 05:30:23 -07:00
|
|
|
const char *selection_text = NULL;
|
2014-01-22 18:26:52 -08:00
|
|
|
|
2016-11-30 13:52:14 -08:00
|
|
|
rp = _edje_entry_imf_default_focused_rp_get(ed);
|
2014-01-22 18:26:52 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
|
|
|
(!rp->typedata.text)) return EINA_FALSE;
|
|
|
|
else
|
|
|
|
en = rp->typedata.text->entry_data;
|
|
|
|
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
|
|
|
|
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (en->have_selection)
|
|
|
|
{
|
2016-04-27 05:30:23 -07:00
|
|
|
selection_text = _edje_entry_selection_get(rp);
|
|
|
|
|
2014-01-22 18:26:52 -08:00
|
|
|
if (text)
|
2016-04-27 05:30:23 -07:00
|
|
|
*text = selection_text ? strdup(selection_text) : NULL;
|
|
|
|
|
|
|
|
return selection_text ? EINA_TRUE : EINA_FALSE;
|
2014-01-22 18:26:52 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2015-06-08 11:43:00 -07:00
|
|
|
|
2009-05-13 06:29:30 -07:00
|
|
|
#endif
|
2010-09-06 23:56:16 -07:00
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
Evas_Textblock_Cursor *
|
|
|
|
_edje_text_cursor_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
return _cursor_get(rp, cur);
|
|
|
|
}
|
|
|
|
|
2010-09-06 23:56:16 -07:00
|
|
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|