Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_entry.c Log Message: Some workarounds for ewl/textblock interactions. Still not great, but it's a little closer to usable than what's currently in CVS. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ewl_entry.c 10 Apr 2005 05:05:17 -0000 1.12 +++ ewl_entry.c 4 May 2005 05:40:05 -0000 1.13 @@ -695,6 +695,8 @@ int ewl_entry_coord_index_map(Ewl_Entry *e, int x, int y) { int index; + int cursor; + DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("e", e, 0); @@ -704,6 +706,20 @@ index = evas_object_textblock_char_coords_get(e->textobj, (Evas_Coord)(x - CURRENT_X(e)), (Evas_Coord)(y - CURRENT_Y(e)), NULL, NULL, NULL, NULL); + if (index < 0) + index = 0; + + /* + * FIXME: Correct for the textblock not considering newlines as + * character data. This only works for non-wrapped text. + */ + cursor = evas_object_textblock_cursor_pos_get(e->textobj); + evas_object_textblock_cursor_pos_set(e->textobj, index); + index += evas_object_textblock_cursor_line_get(e->textobj); + printf("Index %d Cursor on line %d\n", index, + evas_object_textblock_cursor_line_get(e->textobj)); + evas_object_textblock_cursor_pos_set(e->textobj, cursor); + DRETURN_INT(index, DLEVEL_STABLE); } @@ -725,6 +741,7 @@ void ewl_entry_index_geometry_map(Ewl_Entry *e, int index, int *x, int *y, int *w, int *h) { + int cursor; Evas_Coord tx, ty, tw, th; DENTER_FUNCTION(DLEVEL_STABLE); @@ -733,6 +750,15 @@ if (!e->textobj) DRETURN(DLEVEL_STABLE); + /* + * FIXME: Account for the newlines stripped out of the text. Only + * works on non-wrapped entry. + */ + cursor = evas_object_textblock_cursor_pos_get(e->textobj); + evas_object_textblock_cursor_pos_set(e->textobj, index); + index -= evas_object_textblock_cursor_line_get(e->textobj); + evas_object_textblock_cursor_pos_set(e->textobj, cursor); + evas_object_textblock_char_pos_get(e->textobj, index, &tx, &ty, &tw, &th); if (x) ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs