31 public event EventHandler TimerTick; |
31 public event EventHandler TimerTick; |
32 |
32 |
33 private double totalmilliseconds; |
33 private double totalmilliseconds; |
34 |
34 |
35 private List<Annotation> AnnotList = new List<Annotation>(); |
35 private List<Annotation> AnnotList = new List<Annotation>(); |
36 private float AnnotWidth = 40+1; |
36 private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item |
37 private CuttingViewModel CuttingVM; |
37 private CuttingViewModel CuttingVM; |
38 private Boolean AnnotWaiting = false; |
38 private Boolean AnnotWaiting = false; |
39 private float AnnotTcBegin; |
39 private float AnnotTcBegin; |
40 private AnnotationViewModel lastAnnotVM; |
40 private AnnotationViewModel lastAnnotVM; |
41 |
41 |
109 this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); |
109 this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); |
110 |
110 |
111 // TEMP FOR DATA BINDING |
111 // TEMP FOR DATA BINDING |
112 AnnotList = new List<Annotation>(); |
112 AnnotList = new List<Annotation>(); |
113 AnnotList.Add(new Annotation(0, 10, "Axe Cam 1")); |
113 AnnotList.Add(new Annotation(0, 10, "Axe Cam 1")); |
114 //annotList.Add(new Annotation(20 - (1 * annotWidth), 30, "Mvt Cam 2")); |
114 //AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2")); |
115 //annotList.Add(new Annotation(50 - (2 * annotWidth), 60, "Saut 3")); |
115 //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3")); |
116 //annotList.Add(new Annotation(100 - (3 * annotWidth), 20, "Saut 4")); |
116 //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4")); |
117 //annotList.Add(new Annotation(120 - (4 * annotWidth), 50, "Saut 5")); |
117 //AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5")); |
118 Cutting cut = new Cutting("titre de cutting", AnnotList); |
118 Cutting cut = new Cutting("titre de cutting", AnnotList); |
119 CuttingVM = new CuttingViewModel(cut); |
119 CuttingVM = new CuttingViewModel(cut); |
120 tv.DataContext = CuttingVM; |
120 tv.DataContext = CuttingVM; |
121 |
121 |
122 slider_ContactTapGesture(this,null); |
122 slider_ContactTapGesture(this,null); |
206 // We open a new annotation |
205 // We open a new annotation |
207 if (CuttingVM != null && AnnotWaiting == false) |
206 if (CuttingVM != null && AnnotWaiting == false) |
208 { |
207 { |
209 AnnotTcBegin = (float)slider.Value; |
208 AnnotTcBegin = (float)slider.Value; |
210 lastAnnotVM = new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth), 0, CuttingVM.AnnotList.Count.ToString())); |
209 lastAnnotVM = new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth), 0, CuttingVM.AnnotList.Count.ToString())); |
|
210 //lastAnnotVM = new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000), 0, CuttingVM.AnnotList.Count.ToString())); |
|
211 //lastAnnotVM = new AnnotationViewModel(new Annotation(0, 0, CuttingVM.AnnotList.Count.ToString())); |
211 CuttingVM.AnnotList.Add(lastAnnotVM); |
212 CuttingVM.AnnotList.Add(lastAnnotVM); |
212 Console.WriteLine("BEGIN currentTimecode = " + (AnnotTcBegin / 1000) + ", nb = " + CuttingVM.AnnotList.Count + ", res = " + ((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth))); |
213 Console.WriteLine("BEGIN currentTimecode = " + (AnnotTcBegin / 1000) + ", nb = " + CuttingVM.AnnotList.Count + ", res = " + ((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth))); |
213 tv.DataContext = null; |
214 tv.DataContext = null; |
214 tv.DataContext = CuttingVM; |
215 tv.DataContext = CuttingVM; |
215 AnnotWaiting = true; |
216 AnnotWaiting = true; |
219 { |
220 { |
220 // ... by setting setting the good beginning and the good duration |
221 // ... by setting setting the good beginning and the good duration |
221 float currentDuration = ((float)slider.Value - AnnotTcBegin) / 1000; |
222 float currentDuration = ((float)slider.Value - AnnotTcBegin) / 1000; |
222 CuttingVM.AnnotList.RemoveAt(CuttingVM.AnnotList.Count - 1); |
223 CuttingVM.AnnotList.RemoveAt(CuttingVM.AnnotList.Count - 1); |
223 CuttingVM.AnnotList.Add(new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth), currentDuration, CuttingVM.AnnotList.Count.ToString()))); |
224 CuttingVM.AnnotList.Add(new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth), currentDuration, CuttingVM.AnnotList.Count.ToString()))); |
|
225 //CuttingVM.AnnotList.Add(new AnnotationViewModel(new Annotation((AnnotTcBegin / 1000), currentDuration, CuttingVM.AnnotList.Count.ToString()))); |
|
226 //CuttingVM.AnnotList.Add(new AnnotationViewModel(new Annotation(0, currentDuration, CuttingVM.AnnotList.Count.ToString()))); |
224 Console.WriteLine("currentTimecode = " + (AnnotTcBegin / 1000) + ", curDur = " + currentDuration + ", nb = " + CuttingVM.AnnotList.Count + ", res = " + ((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth))); |
227 Console.WriteLine("currentTimecode = " + (AnnotTcBegin / 1000) + ", curDur = " + currentDuration + ", nb = " + CuttingVM.AnnotList.Count + ", res = " + ((AnnotTcBegin / 1000) - (CuttingVM.AnnotList.Count * AnnotWidth))); |
225 tv.DataContext = null; |
228 tv.DataContext = null; |
226 tv.DataContext = CuttingVM; |
229 tv.DataContext = CuttingVM; |
227 AnnotWaiting = false; |
230 AnnotWaiting = false; |
228 } |
231 } |