Fix for edje_cc that didn't like insertion of element before the first element

Signed-off-by: Daniel Zaoui <daniel.zaoui@samsung.com>

SVN revision: 81252
This commit is contained in:
Daniel Zaoui 2012-12-18 13:54:02 +00:00 committed by Daniel Zaoui
parent ba8b15bcff
commit f8450a7224
1 changed files with 6 additions and 4 deletions

View File

@ -1679,7 +1679,9 @@ reorder_parts(void)
if (ep2->reorder.linked_prev) if (ep2->reorder.linked_prev)
ERR("Unable to insert two or more parts in same part \"%s\".", ERR("Unable to insert two or more parts in same part \"%s\".",
pc->parts[j]->name); pc->parts[j]->name);
k = j - 1; /* Need it to be able to insert an element before the first */
if (j == 0) k = 0;
else k = j - 1;
found = EINA_TRUE; found = EINA_TRUE;
ep2->reorder.linked_prev += ep->reorder.linked_prev + 1; ep2->reorder.linked_prev += ep->reorder.linked_prev + 1;
ep->reorder.before = (Edje_Part_Parser *)pc->parts[j]; ep->reorder.before = (Edje_Part_Parser *)pc->parts[j];
@ -1728,10 +1730,10 @@ reorder_parts(void)
} }
if (i > k) if (i > k)
{ {
for (j = i - ep->reorder.linked_prev - 1 ; j >= k ; j--) for (j = i - ep->reorder.linked_prev ; j > k; j--)
{ {
pc->parts[j + amount] = pc->parts[j]; pc->parts[j + amount - 1] = pc->parts[j - 1];
pc->parts[j + amount]->id = j + amount; pc->parts[j + amount - 1]->id = j + amount - 1;
} }
for (j = 0 ; j < amount ; j++) for (j = 0 ; j < amount ; j++)
{ {