Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        etox.c 


Log Message:
Hide the clip box when no text is present. Added a note in the README for
where future optimizing should be concentrated.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- etox.c      28 Jul 2003 22:04:31 -0000      1.47
+++ etox.c      29 Jul 2003 04:41:04 -0000      1.48
@@ -159,7 +159,8 @@
        /*
         * Display and position the clip box with the correct size.
         */
-       evas_object_show(et->clip);
+       if (et->lines)
+               evas_object_show(et->clip);
        evas_object_move(et->clip, (double) (et->x), (double) (et->y));
        evas_object_resize(et->clip, (double) (et->w), (double) (et->h));
 }
@@ -248,11 +249,8 @@
         * Layout the lines on the etox starting at the newly added text.
         */
        etox_layout(et);
-
-       /*
-        * Destroy the temporary list of lines now that it is empty.
-        */
-       evas_list_free(lines);
+       if (et->lines && et->visible)
+               evas_object_show(et->clip);
 }
 
 /**
@@ -327,11 +325,8 @@
         * Layout the lines on the etox.
         */
        etox_layout(et);
-
-       /*
-        * Destroy the temporary list of lines now that it is empty.
-        */
-       evas_list_free(lines);
+       if (et->lines && et->visible)
+               evas_object_show(et->clip);
 }
 
 /**
@@ -347,6 +342,8 @@
 {
        CHECK_PARAM_POINTER("et", et);
        CHECK_PARAM_POINTER("text", text);
+       if (et->lines && et->visible)
+               evas_object_show(et->clip);
 }
 
 /**
@@ -363,19 +360,17 @@
 
        CHECK_PARAM_POINTER("et", et);
 
-       if (!text)
-               text = strdup("");
-       else
-               text = strdup(text);
-
        etox_clear(et);
 
        /*
-        * Layout the text and add to the display
+        * Layout the text and add to the display. Duplicate text to avoid
+        * read-only memory segv's when parsing.
         */
-       et->lines = _etox_break_text(et, text);
-
-       etox_layout(et);
+       if (text && *text) {
+               text = strdup(text);
+               et->lines = _etox_break_text(et, text);
+               FREE(text);
+       }
 
        /*
         * Sum up the length and height of the text in the etox.
@@ -394,7 +389,9 @@
                et->length += line->length;
        }
 
-       FREE(text);
+       etox_layout(et);
+       if (et->lines && et->visible)
+               evas_object_show(et->clip);
 }
 
 /**
@@ -459,6 +456,7 @@
        }
 
        et->lines = NULL;
+       evas_object_hide(et->clip);
 }
 
 /**




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to