src/FingersDance.ViewModel/CuttingViewModel.cs
author cavaliet
Thu, 22 Oct 2009 14:48:43 +0200
changeset 167 206f07a8d887
parent 146 dd8ed4d3beb6
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 FingersDance.Data;

namespace FingersDance.ViewModels
{
    public class CuttingViewModel : ViewModelBase
    {
        private string _title;
        private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();

        public CuttingViewModel(Cutting c, float annotWidth) {

            this._title = c.Title;
            this._annotList = new List<AnnotationViewModel>();
            int i = 0;
            foreach (Annotation annot in c.AnnotList)
            {
                this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
                i++;
            }

        }

        public String Title  
        {
            get { return _title; }
            set
            {
                if (value == _title || String.IsNullOrEmpty(value))
                    return;
                _title = value;
                base.OnPropertyChanged("Title");
            }
        }
        public List<AnnotationViewModel> AnnotList
        {
            get { return _annotList; }
            set
            {
                _annotList = value;
                base.OnPropertyChanged("AnnotList");
            }
        }

        public void setListFromAnnotations(List<Annotation> annotList, float annotWidth, Double scaleX)
        {

            this._annotList = new List<AnnotationViewModel>();
            int i = 0;
            foreach (Annotation annot in annotList)
            {
                this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth), 1/scaleX));
                i++;
            }

        }
    }
}