25 } |
25 } |
26 public ProductionTimeLine() |
26 public ProductionTimeLine() |
27 { |
27 { |
28 // Required to initialize variables |
28 // Required to initialize variables |
29 InitializeComponent(); |
29 InitializeComponent(); |
|
30 Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed); |
30 Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed); |
31 Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed); |
31 Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed); |
32 Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed); |
32 |
33 |
33 } |
34 } |
34 |
35 |
|
36 void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
37 { |
|
38 UpdateElements(); |
|
39 } |
|
40 |
35 void VideoRecordUpdated_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
41 void VideoRecordUpdated_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
36 { |
42 { |
37 UpdateElements(); |
43 UpdateElements(); |
38 } |
44 } |
39 |
45 |
40 |
46 |
41 void Action_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
47 void Action_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
42 { |
48 { |
43 AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X; |
49 AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X; |
44 } |
50 } |
|
51 private double _sumOfLengh=0; |
45 public void UpdateElements() |
52 public void UpdateElements() |
46 { |
53 { |
47 if (DataContext != null) |
54 if (DataContext != null) |
48 { |
55 { |
49 VideoTimeStrip.Children.Clear(); |
56 if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1) |
50 int intChapter = 0; |
57 { |
51 foreach(ObservableCollection<VideoSequence> Ocvs in ((ProductionTimeLineVM)this.DataContext).ListVideoSequences) |
58 if (!((ProductionTimeLineVM)DataContext).IsIndexing) |
52 { |
|
53 foreach (VideoSequence Vs in Ocvs) |
|
54 { |
59 { |
55 CustomableVideoElement _temp = new CustomableVideoElement() |
60 VideoTimeStrip.Children.Clear(); |
|
61 int intChapter = 0; |
|
62 _sumOfLengh = 0; |
|
63 foreach (ObservableCollection<VideoSequence> Ocvs in ((ProductionTimeLineVM)this.DataContext).ListVideoSequences) |
56 { |
64 { |
57 DataContext = new CustomableVideoElementVM(Vs) |
65 |
|
66 foreach (VideoSequence Vs in Ocvs) |
58 { |
67 { |
59 Chapter = (VideoChapterType)intChapter |
68 CustomableVideoElement _temp = new CustomableVideoElement() |
60 }, |
69 { |
61 }; |
70 DataContext = new CustomableVideoElementVM(Vs) |
62 _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove); |
71 { |
63 _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown); |
72 Chapter = (VideoChapterType)intChapter |
64 _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp); |
73 }, |
65 |
74 }; |
66 VideoTimeStrip.Children.Add(_temp);// TODO: Add event handler implementation here. |
75 _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown); |
67 |
76 if ((VideoChapterType)intChapter == ((ProductionTimeLineVM)this.DataContext).SelectedBookChapter.Type) |
|
77 { |
|
78 _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove); |
|
79 |
|
80 _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp); |
|
81 } |
|
82 VideoTimeStrip.Children.Add(_temp);// TODO: Add event handler implementation here. |
|
83 _sumOfLengh += _temp.Width; |
|
84 } |
|
85 intChapter++; |
|
86 } |
68 } |
87 } |
69 intChapter++; |
88 else |
70 } |
89 { |
71 |
90 AnnotationTimeStrip.Children.Clear(); |
72 } |
91 |
|
92 foreach (ObservableCollection<SegmentIndex> Ocsi in ((ProductionTimeLineVM)this.DataContext).ListIndex) |
|
93 { |
|
94 foreach (SegmentIndex Si in Ocsi) |
|
95 { |
|
96 |
|
97 // PolemicElementControl an = new PolemicElementControl() { IsEnabled = false }; |
|
98 CustomableIndexElement an = new CustomableIndexElement() |
|
99 { |
|
100 DataContext = new CustomableIndexElementVM(Si) |
|
101 }; |
|
102 |
|
103 //an.DataContext = new PolemicElementVM(Si); |
|
104 |
|
105 an.MouseLeftButtonDown += new MouseButtonEventHandler(an_MouseLeftButtonDown); |
|
106 an.MouseMove += new MouseEventHandler(an_MouseMove); |
|
107 an.MouseLeftButtonUp += new MouseButtonEventHandler(an_MouseLeftButtonUp); |
|
108 //((ProductionTimeLineVM)DataContext).SelectedBookChapter); |
|
109 AnnotationTimeStrip.Children.Add(an); |
|
110 |
|
111 } |
|
112 |
|
113 } |
|
114 |
|
115 } |
|
116 |
|
117 |
|
118 } |
|
119 |
|
120 |
|
121 } |
|
122 } |
|
123 |
|
124 void an_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
|
125 { |
|
126 _isTrimRightCapturated = false; |
|
127 _isTrimLeftCapturated = false; |
|
128 } |
|
129 |
|
130 void an_MouseMove(object sender, MouseEventArgs e) |
|
131 { |
|
132 if (((ProductionTimeLineVM)DataContext).IsIndexing) |
|
133 { |
|
134 if (e.GetPosition(AnnotationTimeStrip).X <= _sumOfLengh && _isTrimRightCapturated && ((CustomableIndexElement)sender).CaptureMouse()) |
|
135 { |
|
136 ((CustomableIndexElement)sender).TrimRight = _comePoint.X - e.GetPosition(((CustomableIndexElement)sender)).X; |
|
137 _comePoint = e.GetPosition(((CustomableIndexElement)sender)); |
|
138 } |
|
139 |
|
140 } |
|
141 } |
|
142 private CustomableIndexElement _selectedIndex; |
|
143 void an_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
144 { |
|
145 _selectedIndex = ((CustomableIndexElement)sender); |
|
146 if (e.GetPosition(((CustomableIndexElement)sender)).X >= ((CustomableIndexElement)sender).Width - 5) |
|
147 { |
|
148 _comePoint = e.GetPosition(((CustomableIndexElement)sender)); |
|
149 _isTrimRightCapturated = true; |
|
150 } |
|
151 |
73 } |
152 } |
74 private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e) |
153 private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e) |
75 { |
154 { |
76 Random rndNumbers = new Random(); |
155 Random rndNumbers = new Random(); |
77 if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1) |
156 if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1) |
99 VideoTimeStrip.Children.Add(_temp );// TODO: Add event handler implementation here. |
178 VideoTimeStrip.Children.Add(_temp );// TODO: Add event handler implementation here. |
100 } |
179 } |
101 else |
180 else |
102 { |
181 { |
103 VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter; |
182 VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter; |
104 PolemicElementControl an = new PolemicElementControl(); |
183 PolemicElementControl an = new PolemicElementControl() { IsEnabled = false }; |
105 an.DataContext = new PolemicElementVM(new SegmentIndex(vc) |
184 an.DataContext = new PolemicElementVM(new SegmentIndex(vc) |
106 { |
185 { |
107 TimerIn = TimeSpan.Zero, |
186 TimerIn = TimeSpan.Zero, |
108 Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0), |
187 Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0), |
109 Chapter = vc, |
188 Chapter = vc, |
|
189 |
110 |
190 |
111 }); |
191 }); |
112 |
192 |
113 //((ProductionTimeLineVM)DataContext).SelectedBookChapter); |
193 //((ProductionTimeLineVM)DataContext).SelectedBookChapter); |
114 AnnotationTimeStrip.Children.Add(an); |
194 AnnotationTimeStrip.Children.Add(an); |
115 } |
195 } |
116 } |
196 } |
117 } |
197 } |
132 |
212 |
133 private CustomableVideoElement _selected; |
213 private CustomableVideoElement _selected; |
134 void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e) |
214 void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e) |
135 { |
215 { |
136 |
216 |
137 |
217 if (!((ProductionTimeLineVM)DataContext).IsIndexing) |
138 if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse()) |
218 { |
139 { |
219 if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse()) |
140 ((CustomableVideoElement)sender).TrimRight = _comePoint.X - e.GetPosition(((CustomableVideoElement)sender)).X; |
220 { |
141 _comePoint = e.GetPosition(((CustomableVideoElement)sender)); |
221 ((CustomableVideoElement)sender).TrimRight = _comePoint.X - e.GetPosition(((CustomableVideoElement)sender)).X; |
142 } |
222 _comePoint = e.GetPosition(((CustomableVideoElement)sender)); |
143 else if (_isTrimLeftCapturated && ((CustomableVideoElement)sender).CaptureMouse()) |
223 } |
144 { |
224 else if (_isTrimLeftCapturated && ((CustomableVideoElement)sender).CaptureMouse()) |
145 ((CustomableVideoElement)sender).TrimLeft = e.GetPosition(((CustomableVideoElement)sender)).X - _comePoint.X; |
225 { |
146 _comePoint = e.GetPosition(((CustomableVideoElement)sender)); |
226 ((CustomableVideoElement)sender).TrimLeft = e.GetPosition(((CustomableVideoElement)sender)).X - _comePoint.X; |
|
227 _comePoint = e.GetPosition(((CustomableVideoElement)sender)); |
|
228 } |
147 } |
229 } |
148 |
230 |
149 } |
231 } |
150 void CustomableVideoElement_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
232 void CustomableVideoElement_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
151 { |
233 { |