using System.Text.Json.Serialization; namespace QuikDawEditor.EditingClasses; public class GainPoint : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } [JsonConstructor] public GainPoint() { } public double sourcePointms60BPM = 0; internal double _sourcePointms { get; set; } public double sourcePointms { get { return _sourcePointms; } set { _sourcePointms = Math.Truncate(value); sourcePointms60BPM = TranslateMsTo60BPM(_sourcePointms); NotifyPropertyChanged(nameof(GainPointLeft)); } } private float _GainValue = 1; public float GainValue { get { return _GainValue; } set { _GainValue = value; NotifyPropertyChanged(nameof(GainValue)); NotifyPropertyChanged(nameof(GainPointTop)); } } private bool _IsLeftEdgeGainPoint = false; public bool IsLeftEdgeGainPoint { get { return _IsLeftEdgeGainPoint; } set { _IsLeftEdgeGainPoint = value; NotifyPropertyChanged(nameof(IsLeftOrRightEdgeGainPoint)); } } private bool _IsRightEdgeGainPoint = false; public bool IsRightEdgeGainPoint { get { return _IsRightEdgeGainPoint; } set { _IsRightEdgeGainPoint = value; NotifyPropertyChanged(nameof(IsLeftOrRightEdgeGainPoint)); } } public bool IsLeftOrRightEdgeGainPoint { get { return IsRightEdgeGainPoint | IsLeftEdgeGainPoint; } } public void UpdateGainPointLeft() { NotifyPropertyChanged(nameof(GainPointLeft)); } public void UpdateGainPointTop(double clipAreaHeight) { ClipAreaHeight = clipAreaHeight; NotifyPropertyChanged(nameof(GainPointTop)); } public double ClipAreaHeight = 60; private Visibility _GainPointValVisibility = Visibility.Hidden; [JsonIgnore(Condition = JsonIgnoreCondition.Always)] public Visibility GainPointValVisibility { get { return _GainPointValVisibility; } set { _GainPointValVisibility = value; NotifyPropertyChanged(nameof(GainPointValVisibility)); } } public double GPZIndex { get { return IsLeftOrRightEdgeGainPoint ? 100000 : 1; } } double ellipseRadius = 5; public double GainPointLeft { get { return MsecToPixels(sourcePointms) - ellipseRadius / editingProject.ViewXZoomFac; } } public double GainPointTop { get { return (2D - (double)GainValue) * ClipAreaHeight / 2 - ellipseRadius; } } }