Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        Etox_private.h etox.c etox_line.c etox_obstacle.c 
        etox_obstacle.h 


Log Message:
Move obstacle code progress, and an update to the todo items in the readme.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox_private.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- Etox_private.h      6 Aug 2003 02:45:35 -0000       1.19
+++ Etox_private.h      16 Aug 2003 06:09:32 -0000      1.20
@@ -148,8 +148,7 @@
 {
        Etox *et;
        Evas_Object *bit;
-       int start_line;
-       int end_line;
+       Evas_List *lines;
 };
 
 /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- etox.c      15 Aug 2003 06:38:58 -0000      1.55
+++ etox.c      16 Aug 2003 06:09:32 -0000      1.56
@@ -930,10 +930,8 @@
 
        obst = etox_obstacle_new(et, x, y, w, h);
 
-       if (obst) {
+       if (obst)
                et->obstacles = evas_list_append(et->obstacles, obst);
-               etox_obstacle_place(obst);
-       }
 
        etox_layout(et);
 
@@ -1197,8 +1195,14 @@
                 */
                ll = et->obstacles;
                while (ll) {
+                       double ox, oy, ow, oh;
+
                        Etox_Obstacle *obst = ll->data;
-                       etox_obstacle_place(obst);
+                       evas_object_geometry_get(obst->bit, &ox, &oy, &ow, &oh);
+                       if (etox_rect_intersect(ox, oy, ow, oh,
+                                               line->x, line->y,
+                                               line->w, line->h))
+                               etox_obstacle_line_insert(line, obst);
                        ll = ll->next;
                }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- etox_line.c 15 Aug 2003 06:38:58 -0000      1.21
+++ etox_line.c 16 Aug 2003 06:09:32 -0000      1.22
@@ -497,14 +497,24 @@
 
        l = prevline->next;
        while (l) {
+               Evas_List *ll;
+
                line = l->data;
                if (!(line->flags & ETOX_LINE_WRAPPED))
                        break;
 
                /* remove the wrap marker bit */
-               marker = line->bits->data;
-               line->bits = evas_list_remove(line->bits, marker);
-               evas_object_del(marker);
+               ll = line->bits;
+               while (ll) {
+                       marker = ll->data;
+                       if (!estyle_fixed(marker)) {
+                               line->bits = evas_list_remove(line->bits,
+                                               marker);
+                               evas_object_del(marker);
+                               break;
+                       }
+                       ll = ll->next;
+               }
 
                /* remove the line from the list */
                et->lines = evas_list_remove(et->lines, line);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_obstacle.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- etox_obstacle.c     15 Aug 2003 06:38:58 -0000      1.15
+++ etox_obstacle.c     16 Aug 2003 06:09:32 -0000      1.16
@@ -1,8 +1,5 @@
 #include "Etox_private.h"
 
-static void _etox_obstacle_line_insert(Etox_Line * line,
-                                      Etox_Obstacle * obst);
-
 /*
  * etox_obstacle_new - create a new obstacle with given dimensions
  * @et: the etox to add an obstacle
@@ -80,9 +77,6 @@
        if (y + h < obst->et->y)
                return;
 
-       obst->start_line = 0;
-       obst->end_line = 0;
-
        /*
         * Run through to determine the lines to determine which intersect the
         * obstacle
@@ -93,22 +87,14 @@
                if (line->y > y + h)
                        break;
 
-               if (line->y + line->h >= y) {
-                       /*
-                        * Check if the obstacle starts at this line
-                        */
-                       if (!obst->start_line)
-                               obst->start_line = i;
-                       _etox_obstacle_line_insert(line, obst);
-               }
+               if (line->y + line->h >= y)
+                       etox_obstacle_line_insert(line, obst);
 
                /*
                 * Check if the obstacle starts at this line
                 */
                i++;
        }
-
-       obst->end_line = i;
 }
 
 /*
@@ -116,35 +102,25 @@
  */
 void etox_obstacle_unplace(Etox_Obstacle * obst)
 {
-       int i, j;
        Etox_Line *line;
-       Evas_List *l;
 
        CHECK_PARAM_POINTER("obst", obst);
 
        /*
-        * Only adjust the lines that intersect the obstacle.
-        */
-       i = obst->start_line;
-
-       /*
         * On each line within the obstacle bounds, remove the obstacle from
         * the list of bits.
         */
-       for (j = 0, l = obst->et->lines; j <= obst->end_line && l;
-            l = l->next, j++) {
-               if (j >= i) {
-                       line = l->data;
-                       etox_line_remove(line, obst->bit);
-               }
+       while (obst->lines) {
+               line = obst->lines->data;
+               etox_line_remove(line, obst->bit);
+               obst->lines = evas_list_remove(obst->lines, line);
        }
 }
 
 /*
  * etox_obstacle_line_insert - place an obstacle within a line
  */
-static void _etox_obstacle_line_insert(Etox_Line * line,
-                                      Etox_Obstacle * obst)
+void etox_obstacle_line_insert(Etox_Line * line, Etox_Obstacle * obst)
 {
        int i;
        Evas_Object *bit;
@@ -185,13 +161,15 @@
                line->bits = evas_list_prepend_relative(line->bits, obst->bit,
                                bit);
        }
+
+       obst->lines = evas_list_append(obst->lines, line);
 }
 
 /*
  * etox_rect_intersect - check for intersection on two rectangles
  */
-inline int etox_rect_intersect(int x1, int y1, int w1, int h1,
-                              int x2, int y2, int w2, int h2)
+inline int etox_rect_intersect(double x1, double y1, double w1, double h1,
+                              double x2, double y2, double w2, double h2)
 {
        if (x1 > x2 + w2)
                return FALSE;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_obstacle.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etox_obstacle.h     26 Jul 2003 06:35:21 -0000      1.3
+++ etox_obstacle.h     16 Aug 2003 06:09:32 -0000      1.4
@@ -3,9 +3,10 @@
 
 Etox_Obstacle *etox_obstacle_new(Etox * line, int x, int y, int w, int h);
 void etox_obstacle_free(Etox * et, Etox_Obstacle * obstacle);
+void etox_obstacle_line_insert(Etox_Line * line, Etox_Obstacle * obst);
 void etox_obstacle_place(Etox_Obstacle * obst);
 void etox_obstacle_unplace(Etox_Obstacle * obst);
-inline int etox_rect_intersect(int x1, int y1, int w1, int h1,
-                              int x2, int y2, int w2, int h2);
+inline int etox_rect_intersect(double x1, double y1, double w1, double h1,
+                              double x2, double y2, double w2, double h2);
 
 #endif




-------------------------------------------------------
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