public virtual void ShiftTracks(int delta, GuiLabs.Undo.ActionManager am = null) { var oldIndices = Tracks.Select(t => t.GetIndex()).ToList(); var newIndices = oldIndices.Select(i => i + delta).ToList(); if (newIndices.Any(i => i < 0 || i >= timeline.Tracks.Count)) { throw new ArgumentException("shifting tracks would move them out of range", "delta"); } // runtime complexity is horrendeous, but we don't have that many tracks ... foreach (int i in newIndices) { if (!oldIndices.Contains(i)) { am.RecordAdd(Tracks, timeline.Tracks[i]); } } foreach (int i in oldIndices) { if (!newIndices.Contains(i)) { am.RecordRemove(Tracks, timeline.Tracks[i]); } } }
public override void ExtendToTrack(Track fromTrack, Track toTrack, GuiLabs.Undo.ActionManager am = null) { foreach (var child in _children.Where(b => b.Tracks.Contains(fromTrack))) { am.RecordAdd(child.Tracks, toTrack); } RecalcTracks(); }
public virtual void ExtendToTrack(Track fromTrack, Track toTrack, GuiLabs.Undo.ActionManager am = null) { if (Tracks.Contains(toTrack)) { throw new InvalidOperationException("block is already part of track"); } //Tracks.Add(toTrack); am.RecordAdd(Tracks, toTrack); }