39 private List<Annotation> AnnotList = new List<Annotation>(); |
39 private List<Annotation> AnnotList = new List<Annotation>(); |
40 private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item |
40 private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item |
41 private CuttingViewModel CuttingVM; |
41 private CuttingViewModel CuttingVM; |
42 private Boolean AnnotWaiting = false; |
42 private Boolean AnnotWaiting = false; |
43 private float AnnotTcBegin; |
43 private float AnnotTcBegin; |
|
44 private UInt32 IntColor; |
44 |
45 |
45 private AnnotationViewModel canceledAnnotationVM; |
46 private AnnotationViewModel canceledAnnotationVM; |
46 |
47 |
47 #region Properties |
48 #region Properties |
48 |
49 |
113 // When the timeline is resized, we catch the resize event to define TimelineView's good scale |
114 // When the timeline is resized, we catch the resize event to define TimelineView's good scale |
114 this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); |
115 this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); |
115 |
116 |
116 // TEMP FOR DATA BINDING |
117 // TEMP FOR DATA BINDING |
117 AnnotList = new List<Annotation>(); |
118 AnnotList = new List<Annotation>(); |
118 AnnotList.Add(new Annotation(0, 10, "Axe Cam 1")); |
119 AnnotList.Add(new Annotation(0, 10, "Axe Cam 1", IntColor)); |
119 //AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2")); |
120 //AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2")); |
120 //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3")); |
121 //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3")); |
121 //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4")); |
122 //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4")); |
122 //AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5")); |
123 //AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5")); |
123 Cutting cut = new Cutting("titre de cutting", AnnotList); |
124 Cutting cut = new Cutting("titre de cutting", AnnotList); |
143 //Console.WriteLine("futurScale = " + futurScale); |
144 //Console.WriteLine("futurScale = " + futurScale); |
144 |
145 |
145 } |
146 } |
146 |
147 |
147 #region Timer |
148 #region Timer |
148 public void initTimer() |
149 public void initTimer(UInt32 intColorPar) |
149 { |
150 { |
150 timer = new DispatcherTimer(); |
151 timer = new DispatcherTimer(); |
151 timer.Interval = new TimeSpan(0, 0, 0, 0, 100); |
152 timer.Interval = new TimeSpan(0, 0, 0, 0, 100); |
152 timer.Tick += new EventHandler(timer_Tick); |
153 timer.Tick += new EventHandler(timer_Tick); |
|
154 |
|
155 IntColor = intColorPar; |
153 } |
156 } |
154 |
157 |
155 public void timerStart() |
158 public void timerStart() |
156 { |
159 { |
157 if (timer != null) |
160 if (timer != null) |
265 } |
268 } |
266 } |
269 } |
267 // If everything's fine, we create the new one |
270 // If everything's fine, we create the new one |
268 if (annotOk == true) |
271 if (annotOk == true) |
269 { |
272 { |
270 AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType)); |
273 AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType, avm.Color)); |
271 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
274 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
272 tv.DataContext = null; |
275 tv.DataContext = null; |
273 tv.DataContext = CuttingVM; |
276 tv.DataContext = CuttingVM; |
274 AnnotWaiting = false; |
277 AnnotWaiting = false; |
275 } |
278 } |
296 } |
299 } |
297 } |
300 } |
298 // if not, we mark the beginning |
301 // if not, we mark the beginning |
299 if (annotOk == true) |
302 if (annotOk == true) |
300 { |
303 { |
301 AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString())); |
304 AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString(), IntColor)); |
302 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
305 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
303 //Console.WriteLine("BEGIN currentTimecode = " + AnnotTcBegin + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
306 //Console.WriteLine("BEGIN currentTimecode = " + AnnotTcBegin + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
304 tv.DataContext = null; |
307 tv.DataContext = null; |
305 tv.DataContext = CuttingVM; |
308 tv.DataContext = CuttingVM; |
306 AnnotWaiting = true; |
309 AnnotWaiting = true; |
324 } |
327 } |
325 |
328 |
326 if (annotOk == true) |
329 if (annotOk == true) |
327 { |
330 { |
328 AnnotList.RemoveAt(AnnotList.Count - 1); |
331 AnnotList.RemoveAt(AnnotList.Count - 1); |
329 AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString())); |
332 AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString(), IntColor)); |
330 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
333 CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
331 //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
334 //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
332 tv.DataContext = null; |
335 tv.DataContext = null; |
333 tv.DataContext = CuttingVM; |
336 tv.DataContext = CuttingVM; |
334 AnnotWaiting = false; |
337 AnnotWaiting = false; |