diff options
-rw-r--r-- | generic/Group.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/generic/Group.c b/generic/Group.c index 9346f31..ce581a8 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -738,13 +738,12 @@ ComputeCoordinates(ZnItem item, current_item = current_item->next) { /* * Skip the clip item, it has been already updated. - * Do not skip as well items with a dependency, it is - * useful to update them early (connection between tracks - * or wp) they will be updated again later. + * Skip as well items with a dependency, they will + * be updated later. */ //printf("Trying to update: %d\n", current_item->id); - if ((current_item == group->clip) /*|| - (current_item->connected_item != ZN_NO_ITEM)*/) { + if ((current_item == group->clip) || + (current_item->connected_item != ZN_NO_ITEM)) { continue; } if (force || @@ -1509,9 +1508,11 @@ ZnGroupRemoveClip(ZnItem group, ********************************************************************************** */ void -ZnInsertDependentItem(ZnItem item) +ZnInsertDependentItem(ZnItem item) { - GroupItem group = (GroupItem) item->parent; + GroupItem group = (GroupItem) item->parent; + ZnItem *dep_list; + unsigned int i, num_deps; if (!group) { return; @@ -1519,7 +1520,20 @@ ZnInsertDependentItem(ZnItem item) if (!group->dependents) { group->dependents = ZnListNew(2, sizeof(ZnItem)); } - ZnListAdd(group->dependents, &item, ZnListTail); + dep_list = (ZnItem *) ZnListArray(group->dependents); + num_deps = ZnListSize(group->dependents); + // + // Insert the farther possible but not past an item + // dependent on this item. + for (i = 0; i < num_deps; i++) { + if (dep_list[i]->connected_item == item) { + //printf("item %d depends on %d inserting before\n", + // dep_list[i]->id, item->id); + break; + } + } + //printf("adding %d at position %d\n", item->id, i); + ZnListAdd(group->dependents, &item, i); } |