using System;
using System.Collections.Generic;
using System.Linq;
namespace JD.Serialization
{
partial class TapeTrack
{
#region Variables
private Tape _tape;
#endregion
#region Constructor
public TapeTrack()
{
Height = 25;
}
#endregion
#region Properties
public Tape Tape
{
get { return _tape; }
set
{
if (_tape != value)
{
_tape = value;
OnPropertyChanged();
}
}
}
public int Index
{
get { return Tape?.Tracks.IndexOf(this) ?? -1; }
}
///
/// Non serialized value of the current height of the track.
///
[UAFSerializable(SerializationFlags.UndoRedo)]
public int Height { get; set; }
#endregion
#region Methods
public override string ToString()
{
if (Name == "")
{
return $"Track {Index}";
}
return Name;
}
public IEnumerable Clips()
{
return _tape.Clips.Where(clip => clip.TrackId == Id);
}
public virtual IEnumerable ClipTypes()
{
return Enumerable.Empty();
}
public bool IsClipAllowed(System.Type type)
{
return !ClipTypes().Any() || ClipTypes().Contains(type);
}
#endregion methods
}
}