* edje: the most simple and usefull case of alias convertion

wasn't implemented at all. Should be working now, please test
	all your code that relly on "part1:part2[index]:sig" behaviour.


SVN revision: 55086
This commit is contained in:
Cedric BAIL 2010-11-30 13:09:03 +00:00
parent d3b5301bbd
commit d3e3b86e29
1 changed files with 33 additions and 55 deletions

View File

@ -1001,83 +1001,61 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
if (ed->delete_me) return; if (ed->delete_me) return;
sep = strchr(sig, EDJE_PART_PATH_SEPARATOR); sep = strrchr(sig, EDJE_PART_PATH_SEPARATOR);
/* If we are not sending the signal to a part of the child, the /* If we are not sending the signal to a part of the child, the
* signal if for ourself * signal if for ourself
*/ */
if (sep) if (sep)
{ {
char *idx, *newsig; Edje_Real_Part *rp;
char *newsig;
size_t length; size_t length;
char *part; char *part;
unsigned int i;
/* the signal contains a colon, split the signal into "part:signal", /* the signal contains a colon, split the signal into "parts:signal",
* and deliver it to "part" (if there is a GROUP or EXTERNAL part named "part") * use _edje_real_part_recursive_get_helper to find the real part.
*/ */
length = strlen(sig) + 1; length = strlen(sig) + 1;
part = alloca(length); part = alloca(length);
memcpy(part, sig, length); memcpy(part, sig, length);
/* The part contain a [index], retrieve it */ newsig = part + (sep - sig);
idx = strchr(sig, EDJE_PART_PATH_SEPARATOR_INDEXL);
if (!idx || sep < idx) newsig = part + (sep - sig);
else newsig = part + (idx - sig);
*newsig = '\0'; *newsig = '\0';
newsig++; newsig++;
for (i = 0; i < ed->table_parts_size; i++) rp = _edje_real_part_recursive_get(ed, part);
if (rp && rp->part)
{ {
Edje_Real_Part *rp = ed->table_parts[i]; switch (rp->part->type)
if ((((rp->part->type == EDJE_PART_TYPE_GROUP
|| rp->part->type == EDJE_PART_TYPE_EXTERNAL)
&& (rp->swallowed_object))
|| rp->part->type == EDJE_PART_TYPE_BOX || rp->part->type == EDJE_PART_TYPE_TABLE) &&
(rp->part) && (rp->part->name) &&
(strcmp(rp->part->name, part) == 0))
{ {
if (rp->part->type == EDJE_PART_TYPE_GROUP) case EDJE_PART_TYPE_GROUP:
{ {
Edje *ed2 = _edje_fetch(rp->swallowed_object); Edje *ed2;
if (ed2) _edje_emit(ed2, newsig, src);
return; /* stop processing.
* XXX maybe let signal be processed anyway?
* XXX in this case, just comment this line
*/
}
else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
{
_edje_external_signal_emit(rp->swallowed_object, newsig, src);
return;
}
else if (rp->part->type == EDJE_PART_TYPE_BOX
|| rp->part->type == EDJE_PART_TYPE_TABLE)
{
const char *partid;
Evas_Object *child;
Edje *ed2 = NULL;
idx = strchr(newsig, EDJE_PART_PATH_SEPARATOR_INDEXR); if (!rp->swallowed_object) break ;
if (!idx) return ; ed2 = _edje_fetch(rp->swallowed_object);
if (idx[1] != ':') return ; if (ed2) _edje_emit(ed2, newsig, src);
if (!rp->object) return; return; /* stop processing.
* XXX maybe let signal be processed anyway?
* XXX in this case, just comment this line
*/
}
case EDJE_PART_TYPE_EXTERNAL:
{
if (!rp->swallowed_object) break ;
partid = newsig; _edje_external_signal_emit(rp->swallowed_object, newsig, src);
newsig = idx; return;
}
*newsig = '\0'; case EDJE_PART_TYPE_BOX:
newsig += 2; /* we jump over ']' and ':' */ case EDJE_PART_TYPE_TABLE:
{
child = _edje_children_get(rp, partid); _edje_emit(rp->edje, newsig, src);
return;
if (child) ed2 = _edje_fetch(child); }
if (ed2) _edje_emit(ed2, newsig, src);
return;
}
} }
} }
} }
@ -1088,7 +1066,7 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
EINA_LIST_FOREACH(ed->subobjs, l, obj) EINA_LIST_FOREACH(ed->subobjs, l, obj)
{ {
Edje *ed2; Edje *ed2;
ed2 = _edje_fetch(obj); ed2 = _edje_fetch(obj);
if (!ed2) continue; if (!ed2) continue;
if (ed2->delete_me) continue; if (ed2->delete_me) continue;