81 lines
1.6 KiB
C#
81 lines
1.6 KiB
C#
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; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Non serialized value of the current height of the track.
|
|
/// </summary>
|
|
[UAFSerializable(SerializationFlags.UndoRedo)]
|
|
public int Height { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Name == "")
|
|
{
|
|
return $"Track {Index}";
|
|
}
|
|
|
|
return Name;
|
|
}
|
|
|
|
public IEnumerable<Clip> Clips()
|
|
{
|
|
return _tape.Clips.Where(clip => clip.TrackId == Id);
|
|
}
|
|
|
|
public virtual IEnumerable<System.Type> ClipTypes()
|
|
{
|
|
return Enumerable.Empty<System.Type>();
|
|
}
|
|
|
|
public bool IsClipAllowed(System.Type type)
|
|
{
|
|
return !ClipTypes().Any() || ClipTypes().Contains(type);
|
|
}
|
|
|
|
#endregion methods
|
|
}
|
|
}
|