Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        Etox.h etox.c etox_line.c etox_selection.c 


Log Message:
Patch from dan sinclair to alter the geometry API.
Fix for line rewrapping bug.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- Etox.h      6 Oct 2004 04:48:45 -0000       1.53
+++ Etox.h      30 Dec 2004 20:58:45 -0000      1.54
@@ -175,6 +175,9 @@
 void etox_clear(Evas_Object * et);
 
 int etox_get_length(Evas_Object *obj);
+
+void etox_text_geometry_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+
 /*
  * Geometry retrieval functions
  */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -3 -r1.108 -r1.109
--- etox.c      15 Dec 2004 05:21:33 -0000      1.108
+++ etox.c      30 Dec 2004 20:58:45 -0000      1.109
@@ -366,9 +366,9 @@
        /*
         * Sum up the length and height of the text in the etox.
         */
-       et->h = 0;
-       et->length = strlen(text);
+       et->th = 0;
        et->tw = 0;
+       et->length = strlen(text);
 
        et->lines = _etox_break_text(et, text);
        FREE(text);
@@ -381,7 +381,7 @@
                if (line->w > et->tw)
                        et->tw = line->w;
 
-               et->h += line->h;
+               et->th += line->h;
        }
 
        etox_layout(et);
@@ -689,7 +689,7 @@
         */
        evas_object_move(et->clip, (et->x), (et->y));
        evas_object_resize(et->clip, (et->w), (et->h));
-       evas_object_resize(obj, et->w, et->h);
+       /* evas_object_resize(obj, et->w, et->h); */
 }
 
 /**
@@ -1260,22 +1260,7 @@
                l = l->next;
                y += line->h;
        }
-
-       /*
-        * Adjust the height of the etox to the height of all lines
-        */
-       et->h = y - et->y;
-       et->th = et->h;
-       
-
-       if (et->flags & ETOX_SOFT_WRAP) {
-               evas_object_resize(et->clip, et->w, et->h);
-               evas_object_resize(et->smart_obj, et->w, et->h);
-       }
-       else {
-               evas_object_resize(et->clip, et->tw, et->th);
-               evas_object_resize(et->smart_obj, et->tw, et->th);
-       }
+       et->th = y - et->y;
 }
 
 Etox_Line *
@@ -1333,3 +1318,24 @@
        }
 }
 
+/**
+ * etox_text_geometry_get - get the desired text geometry
+ * @obj: the etox to get the geometry from
+ * @w: variable to set the width into, or NULL if not needed
+ * @h: variable to set the height into, or NULL if not needed
+ *
+ * Returns the desired width and height of the etox
+ */
+void etox_text_geometry_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
+{
+    Etox *et;
+
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+
+    if (w) *w = et->tw;
+    if (h) *h = et->th;
+}
+
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- etox_line.c 26 Nov 2004 21:51:47 -0000      1.47
+++ etox_line.c 30 Dec 2004 20:58:45 -0000      1.48
@@ -427,7 +427,7 @@
                                NULL, NULL, NULL, NULL);
 
        /* Adjust the index to find the actual character we want to wrap. */
-       if (index > 0) {
+       if (index > 0 || (index == 0 && bit != line->bits->data)) {
                char *tmp;
 
                tmp = etox_style_get_text(bit);
@@ -445,7 +445,7 @@
        }
 
        /* Wrap if we've found a reasonable position */
-       if (index > 0) {
+       if (index > 0 || (index == 0 && bit != line->bits->data)) {
                etox_line_split(line, bit, index);
 
                ll = evas_list_find_list(et->lines, line);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_selection.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- etox_selection.c    13 May 2004 04:47:35 -0000      1.16
+++ etox_selection.c    30 Dec 2004 20:58:45 -0000      1.17
@@ -376,16 +376,11 @@
   Etox_Rect *rects = NULL, *cur = NULL;
   Evas_List *l = NULL, *midlines = NULL;
   Evas_Coord x, y, w, h;
-  int count = 1;
-
-  if (selected->start.line == selected->end.line)
-  {
-    return NULL;
-  }
+  int count = 0;
 
   l = evas_list_find_list(selected->etox->lines, selected->start.line);
 
-  for (l = l->next; l; l = l->next)
+  while (l)
   {
     Etox_Line *line = l->data;
 
@@ -394,6 +389,7 @@
     if (line == selected->end.line) break;
 
     midlines = evas_list_append(midlines, line);
+    l = l->next;
   }
 
   printf("count: %d\n", count);
@@ -410,7 +406,6 @@
   rects->w = x + w - rects->x;
   rects->h = y + h - rects->y;
 
-  printf("(%d, %d) %d x %d\n", rects->x, rects->y, rects->w, rects->h);
   cur = rects;
   /* printf("cur1: %d\n", cur); */
   for (l = midlines; l; l = l->next)
@@ -427,10 +422,14 @@
     cur->h = h;
   }
 
-  cur ++;
-  etox_line_get_geometry(selected->end.line, &x, &y, &w, &h);
-  cur->x = x;
-  cur->y = y;
+  if (selected->end.line != selected->start.line)
+  {
+    etox_line_get_geometry(selected->end.line, &x, &y, &w, &h);
+    cur++;
+    cur->x = x;
+    cur->y = y;
+  }
+
   //etox_line_index_to_geometry(selected->end.line, selected->end.index,
   //                            &x, &y, &w, &h);
   evas_object_geometry_get(selected->end.bit, &x, &y, &w, &h);




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to