protected void ElementChangedRowsHandler(object sender, ElementRowChangeEventArgs e) { ElementNode oldElement = e.OldRow.Tag as ElementNode; ElementNode newElement = e.NewRow.Tag as ElementNode; TimedSequenceElement movedElement = e.Element as TimedSequenceElement; movedElement.TargetNodes = new[]{newElement}; // now that the effect that this element has been updated to accurately reflect the change, // move the actual element around. It's a single element in the grid, belonging to multiple rows: // so find all rows that represent the old element, remove the element from them, and also find // all rows that represent the new element and add it to them. foreach (Row row in TimelineControl) { ElementNode rowElement = row.Tag as ElementNode; if (rowElement == oldElement && row != e.OldRow) row.RemoveElement(movedElement); if (rowElement == newElement && row != e.NewRow) row.AddElement(movedElement); } sequenceModified(); }
protected void ElementChangedRowsHandler(object sender, ElementRowChangeEventArgs e) { ChannelNode oldChannel = e.OldRow.Tag as ChannelNode; ChannelNode newChannel = e.NewRow.Tag as ChannelNode; TimedSequenceElement movedElement = e.Element as TimedSequenceElement; //List<TimelineElement> targetElements = _effectNodeToElement[movedElement.EffectNode]; // retarget the selected element from the old channel it was in to the new channel it was dragged to // TODO: there's *got* to be a better way of adding/removing a single item from an array... List<ChannelNode> nodeList = new List<ChannelNode>(movedElement.EffectNode.Effect.TargetNodes); if(nodeList.Contains(oldChannel)) { nodeList.Remove(oldChannel); } else { VixenSystem.Logging.Debug("TimedSequenceEditor: moving an element from " + e.OldRow.Name + " to " + e.NewRow.Name + "and the effect element wasn't in the old row channel!"); } nodeList.Add(newChannel); movedElement.EffectNode.Effect.TargetNodes = nodeList.ToArray(); // now that the effect that this element has been updated to accurately reflect the change, // move the actual element around. It's a single element in the grid, belonging to multiple rows: // so find all rows that represent the old channel, remove the element from them, and also find // all rows that represent the new channel and add it to them. foreach(Row row in timelineControl) { ChannelNode rowChannel = row.Tag as ChannelNode; if(rowChannel == oldChannel && row != e.OldRow) row.RemoveElement(movedElement); if(rowChannel == newChannel && row != e.NewRow) row.AddElement(movedElement); } sequenceModified(); }