74 lines
No EOL
2 KiB
C#
74 lines
No EOL
2 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using JD.Audio.Annotations;
|
|
using JD.Audio.Sound;
|
|
|
|
namespace JD.Application.View.PropertyGrid
|
|
{
|
|
/// <summary>
|
|
/// Property grid representation of the Annotation
|
|
/// </summary>
|
|
public class AnnotationGridView : INotifyPropertyChanged
|
|
{
|
|
private readonly EditableAnnotation _annotation;
|
|
private readonly Wave _wave;
|
|
|
|
public AnnotationGridView(EditableAnnotation annotation, Wave wave)
|
|
{
|
|
_annotation = annotation;
|
|
_wave = wave;
|
|
}
|
|
|
|
[Browsable(true)]
|
|
[Description("Time in seconds from the begin of the song")]
|
|
public TimeSpan Time
|
|
{
|
|
get { return _wave.UnitConverter.TimeFromBeat(_annotation.Time); }
|
|
}
|
|
|
|
[Browsable(true)]
|
|
[DisplayName("Beat")]
|
|
[Description("Time in beats from the begin of the song")]
|
|
public float _Beat
|
|
{
|
|
get { return _annotation.Time.Value; }
|
|
}
|
|
|
|
[Browsable(true)]
|
|
[Description("Measure number")]
|
|
public int Measure
|
|
{
|
|
get { return Beat.MeasurePosition; }
|
|
set { _annotation.Time = _wave.UnitConverter.BeatFromMeasure(value); }
|
|
}
|
|
|
|
[Browsable(true)]
|
|
[Description("Debug information associated")]
|
|
public string Comment
|
|
{
|
|
get { return _annotation.Comment; }
|
|
set { _annotation.Comment = value; }
|
|
}
|
|
|
|
protected Beat Beat
|
|
{
|
|
get { return _wave.Annotations.Markers[_annotation.Time]; }
|
|
}
|
|
|
|
protected EditableAnnotation Annotation
|
|
{
|
|
get { return _annotation; }
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _annotation.ToString();
|
|
}
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged
|
|
{
|
|
add { Annotation.PropertyChanged += value; }
|
|
remove { Annotation.PropertyChanged -= value; }
|
|
}
|
|
}
|
|
} |