Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
etox.c etox_line.c
Log Message:
Changes for calculating line length and mapping coordinates.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- etox.c 26 Aug 2004 19:37:11 -0000 1.90
+++ etox.c 1 Oct 2004 19:42:20 -0000 1.91
@@ -319,7 +319,7 @@
et->h -= end->h;
etox_line_merge_prepend(start, end);
etox_line_free(start);
- et->length += end->length;
+ et->length += end->length + 1;
et->h += end->h;
if (end->w > et->tw)
et->tw = end->w;
@@ -526,7 +526,7 @@
* etox_get_length() includes the \n's at the end of each line
* whereas et->length does not.
*/
- ret = (char *) calloc(etox_get_length(obj), sizeof(char));
+ ret = (char *) calloc(et->length, sizeof(char));
temp = ret;
@@ -708,7 +708,7 @@
CHECK_PARAM_POINTER_RETURN("obj", obj, 0);
et = evas_object_smart_data_get(obj);
- return et->length + evas_list_count(et->lines) - 1;
+ return et->length;
}
@@ -900,8 +900,8 @@
{
Etox *et;
int sum;
- Evas_Object *bit;
Etox_Line *line = NULL;
+ Evas_Object *bit = NULL;
Evas_Coord tx, ty, tw, th;
Evas_List *l;
@@ -934,17 +934,15 @@
break;
}
- if (!line || !line->bits)
- return sum;
+ if (!line)
+ line = et->lines->last->data;
/*
* Bring the coordinate into the line if it falls outside, this may
* happen with centered or right alignment.
*/
- bit = line->bits->data;
- evas_object_geometry_get(bit, &tx, &ty, &tw, &th);
- if (xc < tx)
- xc = tx;
+ if (xc < line->x)
+ xc = line->x;
/*
* Find the bit that contains the character, be sure to check that
@@ -964,7 +962,6 @@
* character's index.
*/
if (!l) {
- bit = line->bits->data;
/*
* Estimate the average width and height of the line.
@@ -980,10 +977,11 @@
*/
evas_object_geometry_get(bit, &tx, &ty, &tw, &th);
if (x)
- *x = tx + line->w;
+ *x = tx + tw;
if (y)
*y = line->y;
- } else {
+ }
+ else {
/*
* Now get the actual geometry from the bit
@@ -1248,9 +1246,10 @@
bit = etox_style_new(et->evas, text, et->context->style);
evas_object_smart_member_add(bit, et->smart_obj);
evas_object_color_set(bit, et->context->r, et->context->g,
- et->context->b, et->context->a);
+ et->context->b, et->context->a);
evas_object_clip_set(bit, et->clip);
- etox_style_set_font(bit, et->context->font, et->context->font_size);
+ etox_style_set_font(bit, et->context->font,
+ et->context->font_size);
etox_line_append(line, bit);
evas_object_show(bit);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- etox_line.c 24 Aug 2004 14:44:55 -0000 1.40
+++ etox_line.c 1 Oct 2004 19:42:33 -0000 1.41
@@ -630,41 +630,43 @@
etox_line_index_to_geometry(Etox_Line *line, int index, Evas_Coord *x,
Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
- Evas_Object *bit = NULL;
- Evas_List *l;
- int sum = 0;
-
- /* find the bit containing the character */
- for (l = line->bits; l; l = l->next)
- {
- int length;
+ Evas_Object *bit = NULL;
+ Evas_List *l;
+ int sum = 0;
+
+ /* find the bit containing the character */
+ for (l = line->bits; l; l = l->next) {
+ int length;
- bit = l->data;
- length = etox_style_length(bit);
-
- if (sum + length > index)
- break;
+ bit = l->data;
+ length = etox_style_length(bit);
- sum += length;
+ if (sum + length > index)
+ break;
- if (!l->next)
- bit = NULL;
- }
-
- /* No bit intersects, so set the geometry to the end of the
- * line, with the average character width on the line
- */
- if (!bit)
- {
- if (h) *h = line->h;
- if (w) *w = line->w / line->length;
- if (y) *y = line->y;
- if (x) *x = line->x + line->w;
- return;
- }
+ sum += length;
- /* get the geometry from the bit */
- etox_style_text_at(bit, index - sum, x, y, w, h);
+ if (!l->next)
+ bit = NULL;
+ }
+
+ /*
+ * No bit intersects, so set the geometry to the end of the
+ * line, with the average character width on the line
+ */
+ if (!bit) {
+ if (h)
+ *h = line->h;
+ if (w)
+ *w = line->w / line->length;
+ if (y)
+ *y = line->y;
+ if (x)
+ *x = line->x + line->w;
+ }
+ else
+ /* get the geometry from the bit */
+ etox_style_text_at(bit, index - sum, x, y, w, h);
}
void
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs