Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_calc.c edje_load.c edje_private.h edje_smart.c 
        edje_text.c edje_util.c 


Log Message:
Remove part list, using table everywhere instead

===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -3 -r1.100 -r1.101
--- edje_calc.c 24 May 2007 04:34:40 -0000      1.100
+++ edje_calc.c 26 May 2007 23:57:21 -0000      1.101
@@ -137,7 +137,7 @@
 void
 _edje_recalc(Edje *ed)
 {
-   Evas_List *l;
+   int i;
    
    if (!ed->dirty) return;
    if (ed->freeze)
@@ -145,19 +145,19 @@
        ed->recalc = 1;
        if (!ed->calc_only) return;
      }
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *ep;
        
-       ep = l->data;
+       ep = ed->table_parts[i];
        ep->calculated = FLAG_NONE;
        ep->calculating = FLAG_NONE;
      }
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *ep;
        
-       ep = l->data;
+       ep = ed->table_parts[i];
        if (ep->calculated != FLAG_XY)
          _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY);
      }
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -3 -r1.103 -r1.104
--- edje_load.c 24 May 2007 04:34:41 -0000      1.103
+++ edje_load.c 26 May 2007 23:57:21 -0000      1.104
@@ -32,6 +32,7 @@
 {
    Edje *ed;
    int n;
+   Evas_List *parts = NULL;
    Evas_List *old_swallows;
    
    ed = _edje_fetch(obj);
@@ -60,6 +61,7 @@
    if (ed->collection)
      {
        Evas_List *l;
+       int i;
        int errors = 0;
 
        /* colorclass stuff */
@@ -94,7 +96,7 @@
                  return 0;
               }
             rp->part = ep;
-            ed->parts = evas_list_append(ed->parts, rp);
+            parts = evas_list_append(parts, rp);
             rp->param1.description = ep->default_desc;
             rp->chosen_description = rp->param1.description;
             if (!rp->param1.description)
@@ -149,30 +151,33 @@
          }
        if (n > 0)
          {
-            /* FIXME: keeping a table AND a list is just bad - nuke list */
+            Edje_Real_Part *rp;
             ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
             ed->table_parts_size = n;
             /* FIXME: check malloc return */
             n = 0;
-            for (l = ed->parts; l; l = l->next)
+            for (l = parts; l; l = l->next)
               {
-                 Edje_Real_Part *rp;
-                 
                  rp = l->data;
                  ed->table_parts[n] = rp;
                  n++;
+              }
+            evas_list_free(parts);
+            for (i = 0; i < ed->table_parts_size; i++)
+              {
+                 rp = ed->table_parts[i];
                  if (rp->param1.description->rel1.id_x >= 0)
-                   rp->param1.rel1_to_x = evas_list_nth(ed->parts, 
rp->param1.description->rel1.id_x);
+                   rp->param1.rel1_to_x = 
ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
                  if (rp->param1.description->rel1.id_y >= 0)
-                   rp->param1.rel1_to_y = evas_list_nth(ed->parts, 
rp->param1.description->rel1.id_y);
+                   rp->param1.rel1_to_y = 
ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
                  if (rp->param1.description->rel2.id_x >= 0)
-                   rp->param1.rel2_to_x = evas_list_nth(ed->parts, 
rp->param1.description->rel2.id_x);
+                   rp->param1.rel2_to_x = 
ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
                  if (rp->param1.description->rel2.id_y >= 0)
-                   rp->param1.rel2_to_y = evas_list_nth(ed->parts, 
rp->param1.description->rel2.id_y);
+                   rp->param1.rel2_to_y = 
ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
                  _edje_text_part_on_add_clippers(ed, rp);
                  if (rp->part->clip_to_id >= 0)
                    {
-                      rp->clip_to = evas_list_nth(ed->parts, 
rp->part->clip_to_id);
+                      rp->clip_to = ed->table_parts[rp->part->clip_to_id % 
ed->table_parts_size];
                       if (rp->clip_to)
                         {
                            evas_object_pass_events_set(rp->clip_to->object, 1);
@@ -180,14 +185,13 @@
                         }
                    }
                  if (rp->part->dragable.confine_id >= 0)
-                   rp->confine_to = evas_list_nth(ed->parts, 
rp->part->dragable.confine_id);
+                   rp->confine_to = 
ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
                  
                  /* replay events for dragable */
                  if (rp->part->dragable.events_id >= 0)
                    {
                       rp->events_to = 
-                         evas_list_nth(ed->parts,
-                               rp->part->dragable.events_id);
+                         ed->table_parts[rp->part->dragable.events_id % 
ed->table_parts_size];
                       /* events_to may be used only with dragable */
                       if (!rp->events_to->part->dragable.x &&
                           !rp->events_to->part->dragable.y)
@@ -205,9 +209,9 @@
                       rp->param1.description->text.id_text_source = -1;
                    }
                  if (rp->param1.description->text.id_source >= 0)
-                   rp->text.source = evas_list_nth(ed->parts, 
rp->param1.description->text.id_source);
+                   rp->text.source = 
ed->table_parts[rp->param1.description->text.id_source % ed->table_parts_size];
                  if (rp->param1.description->text.id_text_source >= 0)
-                   rp->text.text_source = evas_list_nth(ed->parts, 
rp->param1.description->text.id_text_source);
+                   rp->text.text_source = 
ed->table_parts[rp->param1.description->text.id_text_source % 
ed->table_parts_size];
               }
          }
        n = evas_list_count(ed->collection->programs);
@@ -232,11 +236,11 @@
        _edje_freeze(ed);
        if (ed->collection->script) _edje_embryo_script_init(ed);
        _edje_var_init(ed);
-       for (l = ed->parts; l; l = l->next)
+       for (i = 0; i < ed->table_parts_size; i++)
          {
             Edje_Real_Part *rp;
             
-            rp = l->data;
+            rp = ed->table_parts[i];
             evas_object_show(rp->object);
             if (_edje_block_break(ed)) break;
             if (rp->part->dragable.x < 0) rp->drag.val.x = 1.0;
@@ -479,14 +483,14 @@
 _edje_swallows_collect(Edje *ed)
 {
    Evas_List *swallows = NULL;
-   Evas_List *l;
-   if (!ed->file || !ed->parts) return NULL;
+   int i;
+   if (!ed->file || !ed->table_parts) return NULL;
 
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *rp;
 
-       rp = l->data;
+       rp = ed->table_parts[i];
        if (!rp->swallowed_object) continue;
        swallows = evas_list_append(swallows, 
evas_stringshare_add(rp->part->name));
        swallows = evas_list_append(swallows, rp->swallowed_object);
@@ -522,14 +526,14 @@
        _edje_cache_file_unref(ed->file);
        ed->file = NULL;
      }
-   if (ed->parts)
+   if (ed->table_parts)
      {
-       while (ed->parts)
+       int i;
+       for (i = 0; i < ed->table_parts_size; i++)
          {
             Edje_Real_Part *rp;
 
-            rp = ed->parts->data;
-            ed->parts = evas_list_remove(ed->parts, rp);
+            rp = ed->table_parts[i];
             if (rp->object)
               {
                  _edje_text_real_part_on_del(ed, rp);
@@ -562,7 +566,6 @@
 
             free(rp);
          }
-       ed->parts = NULL;
      }
    if (ed->actions)
      {
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -3 -r1.123 -r1.124
--- edje_private.h      24 May 2007 04:34:41 -0000      1.123
+++ edje_private.h      26 May 2007 23:57:21 -0000      1.124
@@ -585,7 +585,6 @@
    Evas_Object          *clipper; /* a big rect to clip this Edje to */
    Edje_File            *file; /* the file the data comes form */
    Edje_Part_Collection *collection; /* the description being used */
-   Evas_List            *parts; /* private list of parts */
    Evas_List            *actions; /* currently running actions */   
    Evas_List            *callbacks;
    Evas_List            *pending_actions;
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_smart.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- edje_smart.c        21 Feb 2007 21:30:29 -0000      1.29
+++ edje_smart.c        26 May 2007 23:57:21 -0000      1.30
@@ -91,7 +91,7 @@
 _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
 {
    Edje *ed;
-   Evas_List *l;
+   int i;
    
    ed = evas_object_smart_data_get(obj);
    if (!ed) return;
@@ -100,12 +100,12 @@
    ed->y = y;
 //   evas_object_move(ed->clipper, ed->x, ed->y);
    
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *ep;
        Evas_Coord ox, oy;
        
-       ep = l->data;
+       ep = ed->table_parts[i];
        evas_object_geometry_get(ep->object, &ox, &oy, NULL, NULL);
        evas_object_move(ep->object, ed->x + ep->x + ep->offset.x, ed->y + 
ep->y +ep->offset.y);
        if (ep->swallowed_object)
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_text.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- edje_text.c 3 May 2007 23:15:09 -0000       1.60
+++ edje_text.c 26 May 2007 23:57:21 -0000      1.61
@@ -75,7 +75,7 @@
        o = l->data;
        if (ep->part->clip_to_id >= 0)
          {
-            ep->clip_to = evas_list_nth(ed->parts, ep->part->clip_to_id);
+            ep->clip_to = ed->table_parts[ep->part->clip_to_id % 
ed->table_parts_size];
             if (ep->clip_to)
               {
                  evas_object_pass_events_set(ep->clip_to->object, 1);
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -3 -r1.93 -r1.94
--- edje_util.c 3 May 2007 23:15:09 -0000       1.93
+++ edje_util.c 26 May 2007 23:57:21 -0000      1.94
@@ -1022,15 +1022,15 @@
 edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
 {
    Edje *ed;
-   Evas_List *l;
+   int i;
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!obj_swallow)) return;
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *rp;
        
-       rp = l->data;
+       rp = ed->table_parts[i];
        if (rp->swallowed_object == obj_swallow)
          {
             evas_object_smart_member_del(rp->swallowed_object);
@@ -1195,7 +1195,7 @@
    ok = 1;
    while (ok)
      {
-       Evas_List *l;
+       int i;
        
        ok = 0;
        ed->dirty = 1;
@@ -1206,13 +1206,13 @@
             maxh = 0;
          }
        pep = NULL;
-       for (l = ed->parts; l; l = l->next)
+       for (i = 0; i < ed->table_parts_size; i++)
          {
             Edje_Real_Part *ep;
             int w, h;
             int didw;
        
-            ep = l->data;
+            ep = ed->table_parts[i];
             w = ep->w - ep->req.w;
             h = ep->h - ep->req.h;
             didw = 0;
@@ -1710,13 +1710,13 @@
 Edje_Real_Part *
 _edje_real_part_get(Edje *ed, const char *part)
 {
-   Evas_List *l;
+   int i;
 
-   for (l = ed->parts; l; l = l->next)
+   for (i = 0; i < ed->table_parts_size; i++)
      {
        Edje_Real_Part *rp;
        
-       rp = l->data;
+       rp = ed->table_parts[i];
        if ((rp->part->name) && (!strcmp(rp->part->name, part))) return rp;
      }
    return NULL;



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to