author | cavaliet |
Fri, 09 Oct 2009 11:33:35 +0200 | |
changeset 136 | 8b513df1b446 |
parent 135 | 84b3bf5ee3d2 |
child 140 | fc7c12f9da30 |
permissions | -rw-r--r-- |
10 | 1 |
using System; |
69 | 2 |
using System.Collections.Generic; |
10 | 3 |
using System.IO; |
4 |
using System.Net; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
8 |
using System.Windows.Input; |
10 | 9 |
using System.Windows.Media; |
10 |
using System.Windows.Media.Animation; |
|
11 |
using System.Windows.Navigation; |
|
34 | 12 |
using System.Windows.Controls.Primitives; |
13 |
using Microsoft.Surface.Presentation.Controls; |
|
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
14 |
using Microsoft.Surface.Presentation; |
34 | 15 |
using System.Windows.Threading; |
10 | 16 |
|
69 | 17 |
using FingersDance.Data; |
18 |
using FingersDance.ViewModels; |
|
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
19 |
using FingersDance.Views; |
69 | 20 |
|
10 | 21 |
namespace FingersDance.Control.TimeLine |
22 |
{ |
|
23 |
public partial class UserControlTimeLine |
|
34 | 24 |
{ |
25 |
||
26 |
#region Variables |
|
27 |
private DispatcherTimer timer; |
|
28 |
private bool isDragging = false; |
|
29 |
private bool finishedDragging = false; |
|
30 |
#endregion |
|
31 |
||
32 |
public event EventHandler DragStarted; |
|
33 |
public event EventHandler DragCompleted; |
|
34 |
public event EventHandler TimerTick; |
|
35 |
||
124 | 36 |
private double totalmilliseconds; |
37 |
||
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
38 |
private List<Annotation> AnnotList = new List<Annotation>(); |
128
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
39 |
private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
40 |
private CuttingViewModel CuttingVM; |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
41 |
private Boolean AnnotWaiting = false; |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
42 |
private float AnnotTcBegin; |
74
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
43 |
|
34 | 44 |
#region Properties |
45 |
||
46 |
public SurfaceSlider Slider |
|
10 | 47 |
{ |
34 | 48 |
get |
49 |
{ |
|
50 |
return slider; |
|
10 | 51 |
} |
34 | 52 |
set |
53 |
{ |
|
54 |
slider = value; |
|
10 | 55 |
} |
56 |
} |
|
57 |
|
|
34 | 58 |
public bool IsDragging |
59 |
{ |
|
60 |
get |
|
61 |
{ |
|
62 |
return isDragging; |
|
63 |
} |
|
64 |
set |
|
65 |
{ |
|
66 |
isDragging = value; |
|
67 |
} |
|
68 |
} |
|
69 |
||
70 |
public bool FinishedDragging |
|
71 |
{ |
|
72 |
get |
|
73 |
{ |
|
74 |
return finishedDragging; |
|
75 |
} |
|
76 |
set |
|
77 |
{ |
|
78 |
finishedDragging = value; |
|
79 |
} |
|
80 |
} |
|
81 |
||
82 |
public DispatcherTimer Timer |
|
83 |
{ |
|
84 |
get |
|
85 |
{ |
|
86 |
return timer; |
|
87 |
} |
|
88 |
set |
|
89 |
{ |
|
90 |
timer = value; |
|
91 |
} |
|
92 |
} |
|
93 |
#endregion |
|
94 |
|
|
95 |
||
96 |
||
97 |
|
|
10 | 98 |
public UserControlTimeLine() |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
99 |
{ |
10 | 100 |
this.InitializeComponent(); |
101 |
||
102 |
// Insert code required on object creation below this point. |
|
69 | 103 |
|
10 | 104 |
} |
105 |
||
124 | 106 |
public void initslider(double totalmillisecondsPar) |
34 | 107 |
{ |
124 | 108 |
totalmilliseconds = totalmillisecondsPar; |
34 | 109 |
slider.Maximum = totalmilliseconds; |
124 | 110 |
// When the timeline is resized, we catch the resize event to define TimelineView's good scale |
111 |
this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged); |
|
69 | 112 |
|
113 |
// TEMP FOR DATA BINDING |
|
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
114 |
AnnotList = new List<Annotation>(); |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
115 |
AnnotList.Add(new Annotation(0, 10, "Axe Cam 1")); |
128
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
116 |
//AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2")); |
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
117 |
//AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3")); |
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
118 |
//AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4")); |
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
119 |
//AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5")); |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
120 |
Cutting cut = new Cutting("titre de cutting", AnnotList); |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
121 |
CuttingVM = new CuttingViewModel(cut, AnnotWidth); |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
122 |
tv.DataContext = CuttingVM; |
69 | 123 |
|
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
124 |
tv.listview.PreviewContactDown += listview_PreviewContactDown; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
125 |
SurfaceDragDrop.AddDragCanceledHandler(tv.listview, onDragCanceled); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
126 |
|
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
127 |
UserControlTimeLine_SizeChanged(null, null); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
128 |
|
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
129 |
slider_ContactTapGesture(this, null); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
130 |
|
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
131 |
|
34 | 132 |
} |
133 |
||
124 | 134 |
void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e) |
135 |
{ |
|
136 |
// When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account. |
|
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
137 |
Double futurScale = (this.ActualWidth-30) / (totalmilliseconds / 1000); |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
138 |
//Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP FOR SHORT CONTENTS |
124 | 139 |
tv.RenderTransform = new ScaleTransform(futurScale,1); |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
140 |
//Console.WriteLine("futurScale = " + futurScale); |
124 | 141 |
|
142 |
} |
|
143 |
||
34 | 144 |
#region Timer |
145 |
public void initTimer() |
|
146 |
{ |
|
147 |
timer = new DispatcherTimer(); |
|
148 |
timer.Interval = new TimeSpan(0, 0, 0, 0, 100); |
|
149 |
timer.Tick += new EventHandler(timer_Tick); |
|
150 |
} |
|
151 |
||
152 |
public void timerStart() |
|
153 |
{ |
|
154 |
if (timer != null) |
|
155 |
timer.Start(); |
|
156 |
} |
|
157 |
void timer_Tick(object sender, EventArgs e) |
|
10 | 158 |
{ |
34 | 159 |
OnTimerTick(); |
160 |
if (!isDragging) |
|
161 |
{ |
|
162 |
//slider.Value = media.Position.TotalMilliseconds; |
|
163 |
} |
|
164 |
if (finishedDragging) |
|
165 |
{ |
|
166 |
//int SliderValue = (int)slider.Value; |
|
167 |
//TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); |
|
168 |
// media.Position = ts; |
|
169 |
// media.Play(); |
|
170 |
// isDragging = false; |
|
171 |
//finishedDragging = false; |
|
172 |
} |
|
173 |
} |
|
174 |
protected virtual void OnTimerTick() |
|
175 |
{ |
|
176 |
if (TimerTick != null) |
|
177 |
TimerTick(this, new EventArgs()); |
|
10 | 178 |
} |
34 | 179 |
|
180 |
#endregion |
|
181 |
||
128
90c29e979ef4
Drag and drop of annotations from timeline, first step
cavaliet
parents:
125
diff
changeset
|
182 |
private void sliderPosition_DragStarted(object sender, DragStartedEventArgs e) |
34 | 183 |
{ |
184 |
isDragging = true; |
|
185 |
OnDragStarted(); |
|
186 |
// media.Pause(); |
|
187 |
} |
|
188 |
protected virtual void OnDragStarted() |
|
189 |
{ |
|
190 |
if (DragStarted != null) |
|
191 |
DragStarted(this, new EventArgs()); |
|
192 |
} |
|
193 |
||
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
194 |
private void sliderPosition_DragCompleted(object sender, DragCompletedEventArgs e) |
34 | 195 |
{ |
196 |
finishedDragging = true; |
|
197 |
OnDragCompleted(); |
|
198 |
} |
|
199 |
protected virtual void OnDragCompleted() |
|
200 |
{ |
|
201 |
if (DragCompleted != null) |
|
202 |
DragCompleted(this, new EventArgs()); |
|
203 |
} |
|
204 |
||
74
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
205 |
private void slider_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
206 |
{ |
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
207 |
//startOrEndAnnotation(); |
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
74
diff
changeset
|
208 |
} |
74
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
209 |
|
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
210 |
public Boolean isAnnotationAccepted(AnnotationViewModel avm) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
211 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
212 |
Boolean annotOk = true; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
213 |
// We check if the annotation's begin and end timecodes allow a new annotation creation |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
214 |
if (CuttingVM != null && AnnotWaiting == false) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
215 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
216 |
foreach (Annotation a in AnnotList) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
217 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
218 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur)); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
219 |
// Check begin TC |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
220 |
if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur)) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
221 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
222 |
annotOk = false; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
223 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
224 |
// Check end tc and if the new annotation will not cover any other |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
225 |
float endTC = avm.TcBegin + avm.Dur; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
226 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
227 |
if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC)) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
228 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
229 |
annotOk = false; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
230 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
231 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
232 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
233 |
else |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
234 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
235 |
annotOk = false; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
236 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
237 |
return annotOk; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
238 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
239 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
240 |
|
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
241 |
public void addAnnotation(AnnotationViewModel avm) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
242 |
{ |
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
243 |
//Console.WriteLine("addAnnotation = " + avm.TcBegin + ", " + avm.Dur + ", " + avm.GestureType); |
135
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
244 |
Boolean annotOk = true; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
245 |
// We check if the annotation's begin and end timecodes allow a new annotation creation |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
246 |
if (CuttingVM != null && AnnotWaiting == false) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
247 |
{ |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
248 |
foreach (Annotation a in AnnotList) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
249 |
{ |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
250 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur)); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
251 |
// Check begin TC |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
252 |
if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur)) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
253 |
{ |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
254 |
annotOk = false; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
255 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
256 |
// Check end tc and if the new annotation will not cover any other |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
257 |
float endTC = avm.TcBegin + avm.Dur; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
258 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
259 |
if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC)) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
260 |
{ |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
261 |
annotOk = false; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
262 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
263 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
264 |
// If everything's fine, we create the new one |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
265 |
if (annotOk == true) |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
266 |
{ |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
267 |
AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType)); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
268 |
CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
269 |
tv.DataContext = null; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
270 |
tv.DataContext = CuttingVM; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
271 |
AnnotWaiting = false; |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
272 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
273 |
|
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
274 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
275 |
|
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
276 |
} |
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
277 |
|
84b3bf5ee3d2
First step of drag and drop annotation from a timeline to an other player
cavaliet
parents:
130
diff
changeset
|
278 |
public void startOrEndAnnotation() |
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
74
diff
changeset
|
279 |
{ |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
280 |
Boolean annotOk = true; |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
281 |
// We open a new annotation |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
282 |
if (CuttingVM != null && AnnotWaiting == false) |
124 | 283 |
{ |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
284 |
AnnotTcBegin = (float)slider.Value / 1000; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
285 |
|
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
286 |
// First we check if the new annotation will not cover any |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
287 |
foreach (Annotation a in AnnotList) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
288 |
{ |
130
192da585bee5
debug for adding annotations on timeline. Data AnnotationViewModel and TimelineAnnotationView changed to keep annotation TcBegin from visual margin.
cavaliet
parents:
129
diff
changeset
|
289 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", AnnotTcBegin = " + AnnotTcBegin + ", tcOut = " + (a.TcBegin + a.Dur)); |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
290 |
if (a.TcBegin <= AnnotTcBegin && AnnotTcBegin <= (a.TcBegin + a.Dur)) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
291 |
{ |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
292 |
annotOk = false; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
293 |
} |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
294 |
} |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
295 |
// if not, we mark the beginning |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
296 |
if (annotOk == true) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
297 |
{ |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
298 |
AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString())); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
299 |
CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
300 |
//Console.WriteLine("BEGIN currentTimecode = " + AnnotTcBegin + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
301 |
tv.DataContext = null; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
302 |
tv.DataContext = CuttingVM; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
303 |
AnnotWaiting = true; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
304 |
} |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
305 |
} |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
306 |
// We close the current opened annotation... |
130
192da585bee5
debug for adding annotations on timeline. Data AnnotationViewModel and TimelineAnnotationView changed to keep annotation TcBegin from visual margin.
cavaliet
parents:
129
diff
changeset
|
307 |
else if (CuttingVM != null && AnnotWaiting == true && (((float)slider.Value/1000)>AnnotTcBegin)) |
125
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
308 |
{ |
fab494cd9da7
Now to define an annotation we define its begin then its end.
cavaliet
parents:
124
diff
changeset
|
309 |
// ... by setting setting the good beginning and the good duration |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
310 |
float currentTC = (float)slider.Value / 1000; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
311 |
float currentDuration = currentTC - AnnotTcBegin; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
312 |
|
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
313 |
// First we check if the new annotation will not cover any (AnnotTcBegin was already checked) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
314 |
foreach (Annotation a in AnnotList) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
315 |
{ |
130
192da585bee5
debug for adding annotations on timeline. Data AnnotationViewModel and TimelineAnnotationView changed to keep annotation TcBegin from visual margin.
cavaliet
parents:
129
diff
changeset
|
316 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC); |
129
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
317 |
if (a.TcBegin <= currentTC && currentTC <= (a.TcBegin + a.Dur) || (AnnotTcBegin < a.TcBegin && (a.TcBegin + a.Dur) < currentTC)) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
318 |
{ |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
319 |
annotOk = false; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
320 |
} |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
321 |
} |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
322 |
|
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
323 |
if (annotOk == true) |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
324 |
{ |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
325 |
AnnotList.RemoveAt(AnnotList.Count - 1); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
326 |
AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString())); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
327 |
CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
328 |
//Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth))); |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
329 |
tv.DataContext = null; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
330 |
tv.DataContext = CuttingVM; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
331 |
AnnotWaiting = false; |
1f37ef03ebee
scale change improved and now annotations can not recover any of them.
cavaliet
parents:
128
diff
changeset
|
332 |
} |
124 | 333 |
} |
74
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
334 |
} |
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
69
diff
changeset
|
335 |
|
136
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
336 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
337 |
private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
338 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
339 |
FrameworkElement findSource = e.OriginalSource as FrameworkElement; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
340 |
SurfaceListBoxItem draggedElement = null; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
341 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
342 |
// Find the touched SurfaceListBoxItem object. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
343 |
while (draggedElement == null && findSource != null) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
344 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
345 |
if ((draggedElement = findSource as SurfaceListBoxItem) == null) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
346 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
347 |
findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
348 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
349 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
350 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
351 |
if (draggedElement == null) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
352 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
353 |
return; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
354 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
355 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
356 |
// Create the cursor visual. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
357 |
ContentControl cursorVisual = new ContentControl() |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
358 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
359 |
Content = new TimelineAnnotationView() |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
360 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
361 |
DataContext = findSource.DataContext |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
362 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
363 |
}; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
364 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
365 |
// We apply the current scale to the dragged annotation |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
366 |
((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
367 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
368 |
// Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
369 |
//SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
370 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
371 |
// Create a list of input devices. Add the contacts that |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
372 |
// are currently captured within the dragged element and |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
373 |
// the current contact (if it isn't already in the list). |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
374 |
List<InputDevice> devices = new List<InputDevice>(); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
375 |
devices.Add(e.Contact); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
376 |
foreach (Contact contact in draggedElement.ContactsCapturedWithin) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
377 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
378 |
if (contact != e.Contact) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
379 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
380 |
devices.Add(contact); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
381 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
382 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
383 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
384 |
// Get the drag source object |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
385 |
ItemsControl dragSource = ItemsControl.ItemsControlFromItemContainer(draggedElement); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
386 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
387 |
bool startDragOkay = |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
388 |
SurfaceDragDrop.BeginDragDrop( |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
389 |
dragSource, // The SurfaceListBox object that the cursor is dragged out from. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
390 |
draggedElement, // The SurfaceListBoxItem object that is dragged from the drag source. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
391 |
cursorVisual, // The visual element of the cursor. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
392 |
draggedElement.DataContext, // The data associated with the cursor. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
393 |
devices, // The input devices that start dragging the cursor. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
394 |
DragDropEffects.Move); // The allowed drag-and-drop effects of the operation. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
395 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
396 |
// If the drag began successfully, set e.Handled to true. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
397 |
// Otherwise SurfaceListBoxItem captures the contact |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
398 |
// and causes the drag operation to fail. |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
399 |
e.Handled = startDragOkay; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
400 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
401 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
402 |
private void onDragCanceled(Object sender, SurfaceDragDropEventArgs e) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
403 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
404 |
Console.WriteLine("onDragCanceled = " + sender + ", ((ContentControl)e.Cursor.Visual).Content = " + ((ContentControl)e.Cursor.Visual).Content); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
405 |
// e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
406 |
AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
407 |
// We check if the annotation is well one of the current annotations |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
408 |
if (CuttingVM != null) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
409 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
410 |
foreach (Annotation a in AnnotList) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
411 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
412 |
//Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur)); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
413 |
// Check begin TC |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
414 |
if (a.TcBegin == annotationDataVM.TcBegin && a.Dur == annotationDataVM.Dur && a.GestureType==annotationDataVM.GestureType) |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
415 |
{ |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
416 |
// We found the good annotation so we can delete it |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
417 |
AnnotList.Remove(a); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
418 |
// We redisplay the timeline |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
419 |
CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth); |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
420 |
tv.DataContext = null; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
421 |
tv.DataContext = CuttingVM; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
422 |
return; |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
423 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
424 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
425 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
426 |
} |
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
427 |
|
8b513df1b446
First step of deleting annotations from timeline by drag and drop
cavaliet
parents:
135
diff
changeset
|
428 |
|
10 | 429 |
} |
430 |
} |