typedef struct _Sel Sel;
typedef struct _Anchor Anchor;
-static Eina_Bool keypad_show = EINA_FALSE;
static Ecore_Timer *hide_timer = NULL;
static Entry *focused_entry = NULL;
tc = evas_object_textblock_cursor_new(en->rp->object);
evas_textblock_cursor_copy(en->cursor, tc);
- if (!evas_textblock_cursor_char_prev(tc))
+ if (!evas_textblock_cursor_char_prev(tc))
{
ret = EINA_TRUE;
goto done;
}
else
{
- if (evas_textblock_cursor_char_prev(tc))
+ if (evas_textblock_cursor_char_prev(tc))
{
str = evas_textblock_cursor_range_text_get(tc, en->cursor, EVAS_TEXTBLOCK_TEXT_MARKUP);
if (!str) goto done;
Entry *en = (Entry *)data;
if (!en || !en->imf_context) goto done;
- if (!keypad_show)
- _input_panel_hide(en->imf_context);
+ _input_panel_hide(en->imf_context);
done:
hide_timer = NULL;
return ECORE_CALLBACK_CANCEL;
}
-static void
-_input_panel_hide_timer_start(void *data)
+static void
+_input_panel_hide_timer_start(Entry *en)
{
+ if (!en || !en->input_panel_enable) return;
+
if (hide_timer)
{
ecore_timer_del(hide_timer);
}
- hide_timer = ecore_timer_add(0.2, _hide_timer_handler, data);
- focused_entry = (Entry *)data;
+ hide_timer = ecore_timer_add(0.2, _hide_timer_handler, en);
+ focused_entry = en;
+}
+
+static void
+_input_panel_show(Entry *en)
+{
+ if (!en->input_panel_enable) return;
+
+ if (hide_timer)
+ {
+ ecore_timer_del(hide_timer);
+ hide_timer = NULL;
+ }
+
+ if(!en->imf_context) return;
+ ecore_imf_context_input_panel_show(en->imf_context);
}
static void
evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
}
-static void
+static void
_edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Edje_Real_Part *rp;
ecore_imf_context_reset(en->imf_context);
ecore_imf_context_focus_in(en->imf_context);
- if (en->input_panel_enable)
- {
- keypad_show = EINA_TRUE;
- ecore_imf_context_input_panel_show(en->imf_context);
- }
+ _input_panel_show(en);
_caps_mode_check(en);
}
ecore_imf_context_cursor_position_set(en->imf_context, evas_textblock_cursor_pos_get(en->cursor));
ecore_imf_context_focus_out(en->imf_context);
- if (en->input_panel_enable)
- {
- keypad_show = EINA_FALSE;
- _input_panel_hide_timer_start(en);
- }
+ _input_panel_hide_timer_start(en);
}
#endif /* HAVE_ECORE_IMF */
ecore_imf_context_reset(en->imf_context);
ecore_imf_context_focus_in(en->imf_context);
- if (en->input_panel_enable)
- {
- keypad_show = EINA_TRUE;
- ecore_imf_context_input_panel_show(en->imf_context);
- }
+ _input_panel_show(en);
#endif /* HAVE_ECORE_IMF */
}
ecore_imf_context_cursor_position_set(en->imf_context, evas_textblock_cursor_pos_get(en->cursor));
ecore_imf_context_focus_out(en->imf_context);
- if (en->input_panel_enable)
- {
- keypad_show = EINA_FALSE;
- _input_panel_hide_timer_start(en);
- }
+ _input_panel_hide_timer_start(en);
#endif /* HAVE_ECORE_IMF */
}
_curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
{
int ln;
-
+
ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
_curs_jump_line(c, o, en, ln);
}
if (!en->sel_end) return;
_sel_enable(c, o, en);
if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
-
+
if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
if (evas_textblock_cursor_compare(en->sel_start, c) > 0)
en->selection = NULL;
}
_edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
-
+
#ifdef HAVE_ECORE_IMF
if (!en->imf_context) return;
ecore_imf_context_reset(en->imf_context);
list_cnt = eina_list_count(en->sel);
list_idx = 0;
-
+
evas_object_hide(en->cursor_fg);
evas_object_hide(en->cursor_bg);
evas_object_move(en->block_handler_btm, x + r->x + r->w, y + r->y + r->h);
evas_object_show(en->block_handler_btm);
}
- }
+ }
*(&(sel->rect)) = *r;
range = eina_list_remove_list(range, range);
free(r);
free(sel);
an->sel = eina_list_remove_list(an->sel, an->sel);
}
-
+
sel = calloc(1, sizeof(Sel));
an->sel = eina_list_append(an->sel, sel);
-
+
if (en->rp->edje->item_provider.func)
{
ob = en->rp->edje->item_provider.func
for (ll = range; ll; ll = eina_list_next(ll))
{
Evas_Object *ob;
-
+
sel = calloc(1, sizeof(Sel));
an->sel = eina_list_append(an->sel, sel);
ob = edje_object_add(en->rp->edje->evas);
evas_object_show(ob);
sel->obj_bg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg);
-
+
ob = edje_object_add(en->rp->edje->evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6);
evas_object_smart_member_add(ob, smart);
evas_object_show(ob);
sel->obj_fg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_fg);
-
+
ob = evas_object_rectangle_add(en->rp->edje->evas);
evas_object_color_set(ob, 0, 0, 0, 0);
evas_object_smart_member_add(ob, smart);
if (an->item)
{
Evas_Coord cx, cy, cw, ch;
-
+
if (!evas_textblock_cursor_format_item_geometry_get
(an->start, &cx, &cy, &cw, &ch))
continue;
else
{
Evas_Textblock_Rectangle *r;
-
+
r = range->data;
*(&(sel->rect)) = *r;
if (sel->obj_bg)
}
static void
-_autoperiod_insert(Edje_Real_Part *rp)
+_autoperiod_insert(Entry *en, Evas_Textblock_Cursor *cursor)
{
- Entry *en;
- Evas_Textblock_Cursor *tc;
+ Evas_Textblock_Cursor *tc = NULL;
char *str;
unsigned int len = 0;
- if (!rp || !rp->entry_data || !rp->object) return;
-
+ if (!en || !en->autoperiod) return;
if (!edje_autoperiod_allow_get()) return;
- en = rp->entry_data;
- if (!en->autoperiod) return;
-
if ((ecore_time_get() - en->space_key_time) > EDJE_ENTRY_DOUBLE_SPACE_TIME)
- {
- goto done;
- }
-
- tc = evas_object_textblock_cursor_new(rp->object);
- evas_textblock_cursor_copy(en->cursor, tc);
+ goto done;
- if (evas_textblock_cursor_char_prev(tc))
- {
- if (evas_textblock_cursor_char_prev(tc))
- {
- str = evas_textblock_cursor_range_text_get(tc, en->cursor, EVAS_TEXTBLOCK_TEXT_MARKUP);
+ tc = evas_object_textblock_cursor_new(en->rp->object);
+ evas_textblock_cursor_copy(cursor, tc);
- if (str)
- {
- len = strlen(str);
+ if (!evas_textblock_cursor_char_prev(tc)) goto done;
+ if (!evas_textblock_cursor_char_prev(tc)) goto done;
+
+ str = evas_textblock_cursor_range_text_get(tc, cursor,
+ EVAS_TEXTBLOCK_TEXT_MARKUP);
- if ((len >= 2) &&
- ((str[len-2] != ':') && (str[len-2] != ';') &&
- (str[len-2] != '.') && (str[len-2] != ',') &&
- (str[0] != '?') && (str[len-2] != '!') &&
- (str[len-2] != ' ')) && (str[len-1] == ' '))
- {
- _backspace(en->cursor, rp->object, en);
- evas_textblock_cursor_text_prepend(en->cursor, ".");
- }
+ if (!str) goto done;
+
+ len = strlen(str);
- free(str);
- }
- }
+ if ((len >= 2) &&
+ ((str[len-2] != ':') && (str[len-2] != ';') &&
+ (str[len-2] != '.') && (str[len-2] != ',') &&
+ (str[0] != '?') && (str[len-2] != '!') &&
+ (str[len-2] != ' ')) && (str[len-1] == ' '))
+ {
+ _backspace(cursor, en->rp->object, en);
+ evas_textblock_cursor_text_prepend(cursor, ".");
}
- evas_textblock_cursor_free(tc);
+
+ free(str);
done:
+ if (tc) evas_textblock_cursor_free(tc);
en->space_key_time = ecore_time_get();
}
}
}
}
- _edje_entry_real_part_configure(rp);
+ _edje_entry_real_part_configure(rp);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
}
-static Eina_Bool
+static Eina_Bool
_password_timer_cb(void *data)
{
Entry *en = (Entry *)data;
// cut
}
else
- {
+ {
if (en->have_selection)
_range_del(en->cursor, rp->object, en);
else
{
_delete(en->cursor, rp->object, en);
- /*count characters*/
+ /*count characters*/
if (en->func)
en->func(en->data, NULL);
}
_caps_mode_check(en);
}
else if ((!strcmp(ev->key, "ISO_Left_Tab")) && (multiline))
- {
+ {
// remove a tab
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
}
_caps_mode_check(en);
}
_edje_emit(ed, "entry,key,enter", rp->part->name);
- /*count characters*/
+ /*count characters*/
if (en->func)
en->func(en->data, NULL);
}
else if ((!strcmp(ev->key, "space")) && edje_autoperiod_allow_get() && en->autoperiod)
{
- _autoperiod_insert(rp);
+ _autoperiod_insert(en, en->cursor);
}
else
{
_range_del(en->cursor, rp->object, en);
_sel_clear(en->cursor, rp->object, en);
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD_SHOW_LAST_CHARACTER)
- {
- _edje_entry_hide_visible_password(en->rp);
+ {
+ _edje_entry_hide_visible_password(en->rp);
/*if inputtin text is not allowed, dont allow text input*/
if (en->func)
if (en->func(en->data, (void *)ev->string))
ecore_timer_del(en->pw_timer);
en->pw_timer = NULL;
}
- en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
+ en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
}
else
{
_text_filter_text_prepend(en, en->cursor, ev->string);
/*count characters*/
- if (en->func) en->func(en->data, NULL);
+ if (en->func) en->func(en->data, NULL);
#if 0
// evas_textblock_cursor_text_prepend(en->cursor, ev->string);
_text_filter_text_prepend(en, en->cursor, ev->string);
do /* move cursor to the end point of the words */
{
ct = _edje_entry_cursor_content_get(rp, EDJE_CURSOR_MAIN);
- if (block_type != _get_char_type(ct))
+ if (block_type != _get_char_type(ct))
{
//_edje_entry_cursor_prev(rp, EDJE_CURSOR_MAIN);
break;
en->select_allow = EINA_TRUE;
en->had_sel = EINA_TRUE;
en->selecting = EINA_FALSE;
-
+
//printf("string : %s \n", eina_strbuf_string_get(str));
eina_strbuf_free(str);
}
{
Edje_Real_Part *rp = data;
Entry *en;
- if (!rp) return;
+ if (!rp) return ECORE_CALLBACK_CANCEL;
en = rp->entry_data;
if (en->longpress_timer)
{
ecore_timer_del(en->longpress_timer);
en->longpress_timer = NULL;
- }
-
+ }
+
en->long_pressed = EINA_TRUE;
en->longpress_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
}
static void
en = rp->entry_data;
en->double_clicked = EINA_FALSE;
en->long_pressed = EINA_FALSE;
-
+
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
return;
return;
}
#endif
-
+
en->select_mod_start = EINA_FALSE;
en->select_mod_end = EINA_FALSE;
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
en->cx = ev->canvas.x - x;
en->cy = ev->canvas.y - y;
-
+
if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy);
{
Evas_Coord lx, ly, lw, lh;
int line;
-
+
line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
if (line == -1)
_curs_end(en->cursor, rp->object, en);
else
{
int lnum;
-
+
lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
if (lnum < 0)
{
{
Eina_List *first, *last;
FLOAT_T sc;
-
+
first = en->sel;
last = eina_list_last(en->sel);
if (first && last)
{
Evas_Textblock_Rectangle *r1, *r2;
Evas_Coord d, d1, d2;
-
+
r1 = first->data;
r2 = last->data;
d = r1->x - en->cx;
if (sc == ZERO) sc = _edje_scale;
d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number!
d = d * d;
-
+
if (d1 < d2)
{
if (d1 <= d)
if (rp->part->select_mode != EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
- {
+ {
if (en->select_allow)
{
if (en->had_sel)
}
else
evas_textblock_cursor_copy(en->cursor, en->sel_end);
-
+
if (en->selecting)
{
if (en->have_selection)
ecore_imf_context_cursor_position_set(en->imf_context,
evas_textblock_cursor_pos_get(en->cursor));
- if (en->input_panel_enable)
- {
- keypad_show = EINA_TRUE;
- ecore_imf_context_input_panel_show(en->imf_context);
- }
+ _input_panel_show(en);
}
#endif
_caps_mode_check(en);
-
+
_edje_entry_real_part_configure(rp);
}
return;
}
#endif
-
+
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
_edje_entry_real_part_configure(rp);
else
_curs_lin_end(en->cursor, rp->object, en);
}
-
+
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
{
}
_edje_entry_real_part_configure(rp);
-
+
_edje_emit(en->rp->edje, "handler,moving", en->rp->part->name);
}
{
Edje *ed = (Edje *)data;
- if (evas_focus_get(e) == ed->obj)
+ if (evas_focus_get(e) == ed->obj)
{
_edje_focus_in_cb(data, NULL, NULL, NULL);
}
{
Edje *ed = (Edje *)data;
- if (evas_focus_get(e) == ed->obj)
+ if (evas_focus_get(e) == ed->obj)
{
_edje_focus_out_cb(data, NULL, NULL, NULL);
}
}
done:
en->cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(rp->object);
-
+
edje_object_signal_callback_add(rp->edje->obj, "mouse,down,1,double", rp->part->name, _edje_entry_mouse_double_clicked, rp);
}
en->imf_ee_handler_delete = NULL;
}
- if (en->imf_ee_handler_changed)
+ if (en->imf_ee_handler_changed)
{
ecore_event_handler_del(en->imf_ee_handler_changed);
en->imf_ee_handler_changed = NULL;
if (!en) return;
// set text as markup
_sel_clear(en->cursor, rp->object, en);
- evas_object_textblock_text_markup_set(rp->object, text);
+ evas_object_textblock_text_markup_set(rp->object, text);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
#endif
_edje_entry_real_part_configure(rp);
-
+
en->select_allow = EINA_TRUE;
en->had_sel = EINA_TRUE;
}
return;
en->select_allow = allow;
-
+
if ((allow) && (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
{
_edje_entry_select_word(rp);
{
Entry *en = rp->entry_data;
if (!en) return;
-
+
en->func = func;
en->data = data;
}
_edje_entry_autoperiod_set(Edje_Real_Part *rp, Eina_Bool autoperiod)
{
Entry *en = rp->entry_data;
- if (!en) return;
+ if (!en) return;
en->autoperiod = autoperiod;
}
if (en->have_selection)
{
- if (strcmp(ev->str, ""))
+ if (strcmp(ev->str, ""))
{
/* delete selected characters */
_range_del(en->cursor, rp->object, en);
if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD_SHOW_LAST_CHARACTER)
{
- _edje_entry_hide_visible_password(en->rp);
+ _edje_entry_hide_visible_password(en->rp);
/* if inputtin text is not allowed, dont allow text input */
if (en->func)
{
ecore_timer_del(en->pw_timer);
en->pw_timer = NULL;
}
- en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
+ en->pw_timer = ecore_timer_add(2.0, _password_timer_cb, en);
}
else
{
- if (!strcmp(ev->str, " ")) _autoperiod_insert(rp);
+ if (!strcmp(ev->str, " ")) _autoperiod_insert(en, tc);
/* if inputtin text is not allowed, dont allow text input */
if (en->func)
Eina_List *attrs = NULL;
Ecore_IMF_Preedit_Attr *attr;
Eina_List *l;
- Eina_Strbuf *buf;
+ Eina_Strbuf *buf;
if (!rp) return ECORE_CALLBACK_PASS_ON;
/* insert preedit character(s) */
//xx
- if (strlen(preedit_string) > 0)
+ if (strlen(preedit_string) > 0)
{
buf = eina_strbuf_new();
if (attrs)
{
- EINA_LIST_FOREACH(attrs, l, attr)
+ EINA_LIST_FOREACH(attrs, l, attr)
{
if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1)
{
if (!preedit_end_state)
{
- /* set preedit start cursor */
+ /* set preedit start cursor */
if (!en->preedit_start)
en->preedit_start = evas_object_textblock_cursor_new(rp->object);
evas_textblock_cursor_copy(en->cursor, en->preedit_start);
evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
}
- /* count characters*/
+ /* count characters*/
if (en->func)
en->func(en->data, NULL);