* edje: count each type of description.
authorcedric <cedric>
Thu, 15 Jul 2010 13:38:07 +0000 (13:38 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 15 Jul 2010 13:38:07 +0000 (13:38 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@50267 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_convert.c
src/lib/edje_private.h

index a17ec86..b3efb54 100644 (file)
@@ -242,6 +242,8 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc)
 {
    Edje_Part_Collection_Directory_Entry *ce;
    Edje_Part_Collection *edc;
+   Edje_Part *part;
+   Eina_List *l;
 
    edc = oedc;
 
@@ -249,6 +251,37 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc)
 
    ce->ref = edc;
 
-   /* FIXME : Count type part and change their structure */
+   /* Count each type part and their respective state */
+   EINA_LIST_FOREACH(oedc->parts, l, part)
+     {
+       int *count;
+       int dummy = 0;
+
+
+       switch (part->type)
+         {
+#define CSP(Tp, Ce)                                            \
+            case EDJE_PART_TYPE_##Tp :                         \
+               count = &Ce->count.Tp;                          \
+               break;
+
+            CSP(RECTANGLE, ce);
+            CSP(TEXT, ce);
+            CSP(IMAGE, ce);
+            CSP(SWALLOW, ce);
+            CSP(TEXTBLOCK, ce);
+            CSP(GROUP, ce);
+            CSP(BOX, ce);
+            CSP(TABLE, ce);
+            CSP(EXTERNAL, ce);
+          default:
+             count = &dummy;
+             break;
+         }
+
+       *count += eina_list_count(part->other_desc) + 1;
+     }
+
+   /* FIXME : change structure layout */
    return edc;
 }
index 22fec11..08d8ee8 100644 (file)
@@ -506,6 +506,19 @@ struct _Edje_Part_Collection_Directory_Entry
    const char *entry; /* the nominal name of the part collection */
    int         id; /* the id of this named part collection */
 
+   struct
+   {
+      int      RECTANGLE;
+      int      TEXT;
+      int      IMAGE;
+      int      SWALLOW;
+      int      TEXTBLOCK;
+      int      GROUP;
+      int      BOX;
+      int      TABLE;
+      int      EXTERNAL;
+   } count;
+
    Edje_Part_Collection *ref;
 };