From 9685d5d36965fe61742736987f0721dd8cad4166 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 15 Jul 2010 13:38:07 +0000 Subject: [PATCH] * edje: count each type of description. SVN revision: 50267 --- legacy/edje/src/lib/edje_convert.c | 35 +++++++++++++++++++++++++++++- legacy/edje/src/lib/edje_private.h | 13 +++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/legacy/edje/src/lib/edje_convert.c b/legacy/edje/src/lib/edje_convert.c index a17ec86314..b3efb544a6 100644 --- a/legacy/edje/src/lib/edje_convert.c +++ b/legacy/edje/src/lib/edje_convert.c @@ -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; } diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 22fec11ab5..08d8ee8784 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -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; };