src/FingersDance.ViewModel/AnnotationViewModel.cs
author cavaliet
Thu, 22 Oct 2009 14:48:43 +0200
changeset 167 206f07a8d887
parent 160 e940ca798fe3
child 182 25b49d4f1635
permissions -rw-r--r--
Annotation's scale is now still visually at one, whatever the timeline's scale.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

using FingersDance.Data;

namespace FingersDance.ViewModels
{
    public class AnnotationViewModel : ViewModelBase
    {
        private float _tcBegin;
        private float _dur;
        private String _gestureType;
        private Color _color;

        private float _marginLeft;
        private Double _scaleX = 1;

        public AnnotationViewModel(Annotation a, float marginLeft, Double scaleX)
        {
            this._tcBegin = a.TcBegin;
            this._dur = a.Dur;
            this._gestureType = a.GestureType;
            this._color = a.Color;
            this._marginLeft = marginLeft;
            this._marginLeft = marginLeft;
            this._scaleX = scaleX;
        }
        public AnnotationViewModel(Annotation a, float marginLeft)
        {
            this._tcBegin = a.TcBegin;
            this._dur = a.Dur;
            this._gestureType = a.GestureType;
            this._color = a.Color;
            this._marginLeft = marginLeft;
        }

        public float TcBegin
        {
            get { return _tcBegin; }
            set
            {
                if (value == _tcBegin || float.IsNaN(value))
                    return;
                _tcBegin = value;
                base.OnPropertyChanged("TcBegin");
            }
        }
        public float Dur
        {
            get { return _dur; }
            set
            {
                if (value == _dur || float.IsNaN(value))
                    return;
                _dur = value;
                base.OnPropertyChanged("Dur");
            }
        }
        public String GestureType
        {
            get { return _gestureType; }
            set
            {
                if (value == _gestureType || String.IsNullOrEmpty(value))
                    return;
                _gestureType = value;
                base.OnPropertyChanged("GestureType");
            }
        }
        public Color Color
        {
            get { return _color; }
            set
            {
                if (value == _color)
                    return;
                _color = value;
            }
        }
        public float MarginLeft
        {
            get { return _marginLeft; }
            set
            {
                if (value == _marginLeft || float.IsNaN(value))
                    return;
                _marginLeft = value;
                base.OnPropertyChanged("MarginLeft");
            }
        }
        public Double ScaleX
        {
            get { return _scaleX; }
            set
            {
                if (value == _scaleX || Double.IsNaN(value))
                    return;
                _scaleX = value;
                base.OnPropertyChanged("ScaleX");
            }
        }

    }
}