using JD.Audio.Sound; using System.Linq; using JD.Sequencers.Times; using JD.Sequencers.Windowlesses; namespace JD.Application.View.Tracks { public enum OverlapMode { AllTracks, WaveOnly }; /// /// TrackView control works only with non overlapping tracks, those tracks are paint behind or in front of other tracks. /// public class OverlappingTrack : WindowlessControl { private readonly global::JD.Sequencers.Times.Timeline _timeline; private Wave _wave; private static OverlapMode _overlapMode = OverlapMode.AllTracks; public static OverlapMode OverlapMode { get { return _overlapMode; } set { _overlapMode = value; } } /// /// Constructor. /// public OverlappingTrack(global::JD.Sequencers.Times.Timeline timeline) { _timeline = timeline; } protected global::JD.Sequencers.Times.Timeline Timeline { get { return _timeline; } } public Wave Wave { get { return _wave; } set { _wave = value; } } /// /// Docks to match the background of the tracks in the track view. /// public void UpdateBounds(TrackView parent) { var bounds = parent.Bounds; switch (_overlapMode) { case OverlapMode.AllTracks: { var bottomTrack = parent.GetTracks().LastOrDefault(); if (bottomTrack != null) { bounds.Height = bottomTrack.Bounds.Bottom - bounds.Y; } } break; case OverlapMode.WaveOnly: { var waveTrack = parent.GetTracks().OfType().FirstOrDefault(); if (waveTrack != null) { bounds.Height = waveTrack.Bounds.Height; } } break; } Bounds = bounds; } } }