struct _Entry
{
Edje_Real_Part *rp;
- Evas_Coord cx, cy;
Evas_Object *cursor_bg;
Evas_Object *cursor_fg;
Evas_Textblock_Cursor *cursor;
}
static void
-_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en)
+_curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en, Evas_Coord *cx, Evas_Coord *cy)
{
- Evas_Coord cx, cy, cw, ch;
+ Evas_Coord cw, ch;
Evas_Textblock_Cursor_Type cur_type;
if (c != en->cursor) return;
switch (en->rp->part->cursor_mode)
default:
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
}
- evas_textblock_cursor_geometry_get(c, &cx, &cy, &cw, &ch, NULL, cur_type);
- en->cx = cx + (cw / 2);
- en->cy = cy + (ch / 2);
+ evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type);
+ *cx += (cw / 2);
+ *cy += (ch / 2);
}
static void
_curs_back(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
evas_textblock_cursor_char_prev(c);
- _curs_update_from_curs(c, o, en);
}
static void
_curs_next(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
evas_textblock_cursor_char_next(c);
- _curs_update_from_curs(c, o, en);
}
static int
_curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
evas_textblock_cursor_line_char_first(c);
- _curs_update_from_curs(c, o, en);
}
static void
_curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
evas_textblock_cursor_line_char_last(c);
- _curs_update_from_curs(c, o, en);
}
static void
_curs_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
{
evas_textblock_cursor_paragraph_first(c);
- _curs_update_from_curs(c, o, en);
}
static void
{
evas_textblock_cursor_paragraph_last(c);
_curs_lin_end(c, o, en);
- _curs_update_from_curs(c, o, en);
}
static void
_curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
{
+ Evas_Coord cx, cy;
Evas_Coord lx, ly, lw, lh;
int last = _curs_line_last_get(c, o, en);
{
if (ln > last) ln = last;
}
+
+ _curs_update_from_curs(c, o, en, &cx, &cy);
+
if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
return;
- if (evas_textblock_cursor_char_coord_set(c, en->cx, ly + (lh / 2)))
+ if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
return;
evas_textblock_cursor_line_set(c, ln);
- if (en->cx < (lx + (lw / 2)))
+ if (cx < (lx + (lw / 2)))
{
if (ln == last) _curs_end(c, o, en);
// evas_textblock_cursor_line_char_last(c);
_backspace(en->cursor, rp->object, en);
}
_sel_clear(en->cursor, rp->object, en);
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
_edje_emit(ed, "entry,key,backspace", rp->part->name);
_delete(en->cursor, rp->object, en);
}
_sel_clear(en->cursor, rp->object, en);
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
_edje_emit(ed, "entry,key,delete", rp->part->name);
else if ((control) && ((!strcmp(ev->key, "x") || (!strcmp(ev->key, "m")))))
{
// FIXME: cut - save selection, delete seletion
- _curs_update_from_curs(en->cursor, rp->object, en);
_edje_emit(ed, "entry,cut,notify", rp->part->name);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
}
//yy
// evas_textblock_cursor_format_prepend(en->cursor, "\t");
_text_filter_format_prepend(en, en->cursor, "\t");
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
}
// evas_textblock_cursor_format_prepend(en->cursor, "ps");
_text_filter_format_prepend(en, en->cursor, "ps");
}
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
//zz
// evas_textblock_cursor_text_prepend(en->cursor, ev->string);
_text_filter_text_prepend(en, en->cursor, ev->string);
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(ed, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
static void
_edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
+ Evas_Coord cx, cy;
Edje_Real_Part *rp = data;
Evas_Event_Mouse_Down *ev = event_info;
Entry *en;
evas_textblock_cursor_copy(en->cursor, tc);
// multiline = rp->part->multiline;
evas_object_geometry_get(rp->object, &x, &y, &w, &h);
- en->cx = ev->canvas.x - x;
- en->cy = ev->canvas.y - y;
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
+ cx = ev->canvas.x - x;
+ cy = ev->canvas.y - y;
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
{
Evas_Coord lx, ly, lw, lh;
int line;
- line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
+ line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
if (line == -1)
{
if (rp->part->multiline)
{
evas_textblock_cursor_paragraph_first(en->cursor);
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, ly + (lh / 2)))
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
_curs_end(en->cursor, rp->object, en);
}
}
}
else
{
- if (en->cx <= lx)
+ if (cx <= lx)
_curs_lin_start(en->cursor, rp->object, en);
else
_curs_lin_end(en->cursor, rp->object, en);
r1 = first->data;
r2 = last->data;
- d = r1->x - en->cx;
+ d = r1->x - cx;
d1 = d * d;
- d = (r1->y + (r1->h / 2)) - en->cy;
+ d = (r1->y + (r1->h / 2)) - cy;
d1 += d * d;
- d = r2->x + r2->w - 1 - en->cx;
+ d = r2->x + r2->w - 1 - cx;
d2 = d * d;
- d = (r2->y + (r2->h / 2)) - en->cy;
+ d = (r2->y + (r2->h / 2)) - cy;
d2 += d * d;
sc = rp->edje->scale;
if (sc == ZERO) sc = _edje_scale;
static void
_edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
+ Evas_Coord cx, cy;
Edje_Real_Part *rp = data;
Evas_Event_Mouse_Up *ev = event_info;
Entry *en;
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);
- en->cx = ev->canvas.x - x;
- en->cy = ev->canvas.y - y;
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
+ cx = ev->canvas.x - x;
+ cy = ev->canvas.y - y;
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
{
Evas_Coord lx, ly, lw, lh;
int line;
- line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
+ line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
if (line == -1)
{
if (rp->part->multiline)
{
evas_textblock_cursor_paragraph_first(en->cursor);
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, ly + (lh / 2)))
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
_curs_end(en->cursor, rp->object, en);
}
}
}
else
{
- if (en->cx <= lx)
+ if (cx <= lx)
_curs_lin_start(en->cursor, rp->object, en);
else
_curs_lin_end(en->cursor, rp->object, en);
static void
_edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
+ Evas_Coord cx, cy;
Edje_Real_Part *rp = data;
Evas_Event_Mouse_Move *ev = event_info;
Entry *en;
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);
- en->cx = ev->cur.canvas.x - x;
- en->cy = ev->cur.canvas.y - y;
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
+ cx = ev->cur.canvas.x - x;
+ cy = ev->cur.canvas.y - y;
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
{
Evas_Coord lx, ly, lw, lh;
- if (evas_textblock_cursor_line_coord_set(en->cursor, en->cy) < 0)
+ if (evas_textblock_cursor_line_coord_set(en->cursor, cy) < 0)
{
if (rp->part->multiline)
_curs_end(en->cursor, rp->object, en);
{
evas_textblock_cursor_paragraph_first(en->cursor);
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, ly + (lh / 2)))
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
_curs_end(en->cursor, rp->object, en);
}
}
else
{
evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (en->cx <= lx)
+ if (cx <= lx)
_curs_lin_start(en->cursor, rp->object, en);
else
_curs_lin_end(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
#if 0
/* Cursor didn't really change, don't say it did. */
- _curs_update_from_curs(en->cursor, rp->object, en);
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
#endif
//xx
// evas_object_textblock_text_markup_prepend(en->cursor, text);
_text_filter_markup_prepend(en, en->cursor, text);
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
{
return EINA_FALSE;
}
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
else return EINA_FALSE;
}
ok:
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
else
evas_textblock_cursor_line_char_last(c);
}
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
else
evas_textblock_cursor_line_char_last(c);
}
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
evas_textblock_cursor_paragraph_first(c);
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
d = _cursor_get(rp, dst);
if (!d) return;
evas_textblock_cursor_copy(c, d);
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
evas_textblock_cursor_line_char_first(c);
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
evas_textblock_cursor_line_char_last(c);
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return;
evas_textblock_cursor_pos_set(c, pos);
- _curs_update_from_curs(c, rp->object, rp->entry_data);
_sel_update(c, rp->object, rp->entry_data);
#ifdef HAVE_ECORE_IMF
evas_textblock_cursor_free(tc);
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);
evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
}
- _curs_update_from_curs(en->cursor, rp->object, en);
_anchors_get(en->cursor, rp->object, en);
_edje_emit(rp->edje, "entry,changed", rp->part->name);
_edje_emit(ed, "cursor,changed", rp->part->name);