Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas Modified Files: evas_object_textblock.c Log Message: next.prev char works.. a lot works. now i have to test text insertion at any point, text deletion at any point... most querying seems good. also text format insertion at any pont... but need to do format deletion and format querying stuff... but then its back to the todo list (this wraps up current incomplete api)... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/canvas/evas_object_textblock.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- evas_object_textblock.c 10 Feb 2005 01:07:36 -0000 1.27 +++ evas_object_textblock.c 10 Feb 2005 09:48:45 -0000 1.28 @@ -1051,7 +1051,10 @@ evas_object_textblock_layout_clean(obj); o->len = 0; o->pos = 0; + o->lines = 0; o->changed = 1; + o->native.dirty = 1; + o->format.dirty = 1; evas_object_change(obj); } @@ -1076,7 +1079,9 @@ evas_object_textblock_cursor_pos_next(Evas_Object *obj) { Evas_Object_Textblock *o; - + Node *node; + int ps = 0; + MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); @@ -1084,13 +1089,31 @@ MAGIC_CHECK(o, Evas_Object_Textblock, MAGIC_OBJ_TEXTBLOCK); return; MAGIC_CHECK_END(); - /* FIXME: DO */ + node = evas_object_textblock_node_pos_get(obj, o->pos, &ps); + if (node) + { + int chr; + int npos; + + npos = o->pos - ps; + chr = evas_common_font_utf8_get_next(node->text, &npos); + if ((!chr) || (npos >= node->text_len)) + { + npos = ps + node->text_len; + if (node) + o->pos = npos; + } + else + o->pos = npos + ps; + } } void evas_object_textblock_cursor_pos_prev(Evas_Object *obj) { Evas_Object_Textblock *o; + Node *node; + int ps = 0; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return; @@ -1099,7 +1122,47 @@ MAGIC_CHECK(o, Evas_Object_Textblock, MAGIC_OBJ_TEXTBLOCK); return; MAGIC_CHECK_END(); - /* FIXME: DO */ + if (o->pos == o->len) + { + if (o->nodes) + { + node = (Node *)(((Evas_Object_List *)o->nodes)->last); + while ((node) && (!node->text)) + node = (Node *)(((Evas_Object_List *)node)->prev); + if (node) + { + int npos; + + npos = evas_common_font_utf8_get_last(node->text, node->text_len); + o->pos = o->pos - node->text_len + npos; + } + } + return; + } + node = evas_object_textblock_node_pos_get(obj, o->pos, &ps); + if (node) + { + int chr; + int npos; + + npos = o->pos - ps; + if (o->pos > ps) + { + chr = evas_common_font_utf8_get_prev(node->text, &npos); + o->pos = npos + ps; + } + else + { + node = (Node *)(((Evas_Object_List *)node)->prev); + while ((node) && (!node->text)) + node = (Node *)(((Evas_Object_List *)node)->prev); + if (node) + { + npos = evas_common_font_utf8_get_last(node->text, node->text_len); + o->pos = o->pos - node->text_len + npos; + } + } + } } int @@ -1315,17 +1378,20 @@ { int ret, x = 0, y = 0, w = 0, h = 0; - ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, - lnode->text, - pos - lnode->text_pos, - &x, &y, &w, &h); - y = lnode->layout.line.y; - x += lnode->layout.line.x; - h = lnode->layout.line.mascent + lnode->layout.line.mdescent; - if (cx) *cx = x; - if (cy) *cy = y; - if (cw) *cw = w; - if (ch) *ch = h; + if (lnode->layout.font.font) + { + ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, + lnode->text, + pos - lnode->text_pos, + &x, &y, &w, &h); + y = lnode->layout.line.y; + x += lnode->layout.line.x; + h = lnode->layout.line.mascent + lnode->layout.line.mdescent; + if (cx) *cx = x; + if (cy) *cy = y; + if (cw) *cw = w; + if (ch) *ch = h; + } } } @@ -1361,42 +1427,46 @@ { int ret, rx = 0, ry = 0, rw = 0, rh = 0; - ret = ENFN->font_char_at_coords_get(ENDT, lnode->layout.font.font, - lnode->text, - x - lnode->layout.line.x, - 0, - &rx, &ry, &rw, &rh); - if (ret < 0) + if (lnode->layout.font.font) { - if ((x - lnode->layout.line.x) < - (lnode->layout.line.advance / 2)) - { - ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, - lnode->text, - 0, - &rx, &ry, &rw, &rh); - ret = 0; - } - else + ret = ENFN->font_char_at_coords_get(ENDT, lnode->layout.font.font, + lnode->text, + x - lnode->layout.line.x, + 0, + &rx, &ry, &rw, &rh); + if (ret < 0) { - int pos; - - pos = evas_common_font_utf8_get_last(lnode->text, lnode->text_len); - ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, - lnode->text, - pos, - &rx, &ry, &rw, &rh); - ret = pos; + if ((x - lnode->layout.line.x) < + (lnode->layout.line.advance / 2)) + { + ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, + lnode->text, + 0, + &rx, &ry, &rw, &rh); + ret = 0; + } + else + { + int pos; + + pos = evas_common_font_utf8_get_last(lnode->text, lnode->text_len); + ret = ENFN->font_char_coords_get(ENDT, lnode->layout.font.font, + lnode->text, + pos, + &rx, &ry, &rw, &rh); + ret = pos; + } } + ry = lnode->layout.line.y; + rx += lnode->layout.line.x; + rh = lnode->layout.line.mascent + lnode->layout.line.mdescent; + if (cx) *cx = rx; + if (cy) *cy = ry; + if (cw) *cw = rw; + if (ch) *ch = rh; + return ret + lnode->text_pos; } - ry = lnode->layout.line.y; - rx += lnode->layout.line.x; - rh = lnode->layout.line.mascent + lnode->layout.line.mdescent; - if (cx) *cx = rx; - if (cy) *cy = ry; - if (cw) *cw = rw; - if (ch) *ch = rh; - return ret + lnode->text_pos; + return -1; } } return -1; @@ -1815,7 +1885,7 @@ return; MAGIC_CHECK_END(); if (o->format_dir == dir) return; - /* FIXME: DO */ + /* FIXME: DOES NOTHING YET - FUTURE FEATRUE */ o->native.dirty = 1; o->format.dirty = 1; o->changed = 1; ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs