private void ToggleLiveMode() { if (AnnoTierStatic.Selected != null && AnnoTierStatic.Selected.IsContinuous) { if (control.annoLiveModeCheckBox.IsChecked == true) { AnnoTierStatic.Selected.LiveAnnoMode(true); control.annoLiveModeCheckBox.IsChecked = false; } else { control.annoLiveModeCheckBox.IsChecked = true; AnnoTierStatic.Selected.LiveAnnoMode(false); } } else if (AnnoTierStatic.Selected != null && AnnoTierStatic.Selected.IsDiscreteOrFree) { AnnoTierStatic.UnselectLabel(); double pos = Time.PixelFromTime(timeline.CurrentPlayPosition); MainHandler.Time.CurrentSelectPosition = pos; annoCursor.X = pos; } isKeyDown = true; }
private void ChangeTier(bool down = true) { if (down) { for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i + 1 < annoTiers.Count) { AnnoTierStatic.Select(annoTiers[i + 1]); AnnoTierStatic.SelectLabel(null); break; } } } else { for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i > 0) { AnnoTierStatic.Select(annoTiers[i - 1]); AnnoTier.SelectLabel(null); break; } } } }
private void signalAndAnnoGrid_Move(double mouseX) { if (AnnoTierStatic.Label != null && Mouse.DirectlyOver.GetType() != AnnoTierStatic.Label.GetType() || AnnoTierStatic.Label == null) { AnnoTierStatic.UnselectLabel(); signalCursor.X = mouseX; double time = Time.TimeFromPixel(mouseX); Move(time); if (AnnoTierStatic.Selected != null) { if (AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.POINT || AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.POLYGON || AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.GRAPH || AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.SEGMENTATION) { if (control.annoListControl.annoDataGrid.Items.Count > 0) { int position = (int)(Time.CurrentPlayPosition * AnnoTierStatic.Selected.AnnoList.Scheme.SampleRate); if (position < control.annoListControl.annoDataGrid.Items.Count) { jumpToGeometric(position); } } } } } }
public void addAnnoTier(AnnoList anno) { setAnnoList(anno); AnnoTier tier = control.annoTrackControl.addAnnoTier(anno); tier.AnnoList.HasChanged = false; control.timeLineControl.rangeSlider.OnTimeRangeChanged += tier.TimeRangeChanged; annoTiers.Add(tier); annoLists.Add(anno); if (tier.AnnoList.Scheme.Type == AnnoScheme.TYPE.CONTINUOUS) { tier.Background = new LinearGradientBrush(tier.AnnoList.Scheme.MaxOrForeColor, tier.AnnoList.Scheme.MinOrBackColor, 90.0); tier.ContinuousBrush = new LinearGradientBrush(tier.AnnoList.Scheme.MaxOrForeColor, tier.AnnoList.Scheme.MinOrBackColor, 90.0); } else { tier.Background = new SolidColorBrush(tier.AnnoList.Scheme.MinOrBackColor); tier.BackgroundBrush = new SolidColorBrush(tier.AnnoList.Scheme.MinOrBackColor); } AnnoTierStatic.SelectTier(tier); tier.TimeRangeChanged(Time); }
private void CutSegment(object sender, KeyEventArgs e) { if (AnnoTierStatic.Label != null && AnnoTierStatic.Selected.IsDiscreteOrFree) { temp_segment = AnnoTierStatic.Label; AnnoTierStatic.RemoveSegmentPressed(sender, e); } }
private void navigatorFollowAnno_Unchecked(object sender, RoutedEventArgs e) { AnnoTierStatic.UnselectLabel(); bool is_playing = IsPlaying(); Stop(); if (is_playing) { Play(); } }
private void CopyLabelToTier(bool down = true) { if (down) { if (AnnoTierStatic.Label != null) { AnnoListItem temp = AnnoTierStatic.Label.Item; for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i + 1 < annoTiers.Count) { AnnoTierStatic.Select(annoTiers[i + 1]); if (AnnoTierStatic.Selected.IsDiscreteOrFree) { AnnoTier.SelectLabel(null); if (!AnnoTierStatic.Selected.AnnoList.Contains(temp)) { AnnoTierStatic.Selected.NewAnnoCopy(temp.Start, temp.Stop, temp.Label, temp.Color); break; } } } } } } else { if (AnnoTierStatic.Label != null) { AnnoListItem temp = AnnoTierStatic.Label.Item; for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i > 0) { AnnoTierStatic.Select(annoTiers[i - 1]); if (AnnoTierStatic.Selected.IsDiscreteOrFree) { AnnoTierStatic.SelectLabel(null); if (!AnnoTierStatic.Selected.AnnoList.Contains(temp)) { AnnoTierStatic.Selected.NewAnnoCopy(temp.Start, temp.Stop, temp.Label, temp.Color); break; } } } } } } }
public void addAnnoTier(AnnoList anno) { setAnnoList(anno); AnnoTier tier = new AnnoTier(anno); control.annoTierControl.Add(tier); control.timeLineControl.rangeSlider.OnTimeRangeChanged += tier.TimeRangeChanged; annoTiers.Add(tier); annoLists.Add(anno); AnnoTierStatic.Select(tier); tier.TimeRangeChanged(Time); updateNavigator(); }
private void annoList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListView grid = (ListView)sender; if (grid.SelectedIndex >= 0 && grid.SelectedIndex < grid.Items.Count) { AnnoListItem item = (AnnoListItem)grid.SelectedItem; control.annoListControl.editComboBox.SelectedItem = item.Label; double samplerate = MainHandler.getMaxVideoSampleRate(); double offset = (1.0f / samplerate); Time.CurrentPlayPosition = item.Start; mediaList.Move(item.Start + offset); moveSignalCursor(item.Start); if (item.Start >= timeline.SelectionStop) { float factor = (float)(((item.Start - Time.SelectionStart) / (Time.SelectionStop - Time.SelectionStart))); control.timeLineControl.rangeSlider.MoveAndUpdate(true, factor); } else if (item.Stop <= timeline.SelectionStart) { float factor = (float)(((Time.SelectionStart - item.Start)) / (Time.SelectionStop - Time.SelectionStart)); control.timeLineControl.rangeSlider.MoveAndUpdate(false, factor); } foreach (AnnoListItem a in AnnoTierStatic.Selected.AnnoList) { if (a.Start == item.Start && a.Stop == item.Stop && item.Label == a.Label) { AnnoTierStatic.SelectLabel(AnnoTierStatic.Selected.GetSegment(a)); control.annoListControl.editComboBox.SelectedItem = item.Label; break; } } if (item.isGeometric) { int position = (int)(Time.CurrentPlayPosition * AnnoTierStatic.Selected.AnnoList.Scheme.SampleRate); geometricSelectItem(item, position); } } }
private void RemoveSegment(object sender, KeyEventArgs e) { if (AnnoTier.Selected != null && AnnoTier.Selected.IsDiscreteOrFree) { if (AnnoTierStatic.Label != null) { AnnoTierStatic.RemoveSegmentPressed(sender, e); } } else if (AnnoTier.Selected != null && AnnoTier.Selected.IsContinuous) { AnnoListItem[] selected = new AnnoListItem[control.annoListControl.annoDataGrid.SelectedItems.Count]; control.annoListControl.annoDataGrid.SelectedItems.CopyTo(selected, 0); control.annoListControl.annoDataGrid.SelectedIndex = -1; foreach (AnnoListItem s in selected) { s.Score = double.NaN; } AnnoTier.Selected.TimeRangeChanged(MainHandler.Time); } }
private void removeAnnoTier(AnnoTier tier) { if (tier != null) { MessageBoxResult mb = MessageBoxResult.No; if (tier.AnnoList.HasChanged) { mb = MessageBox.Show("Save annotations on tier #" + tier.Name + " first?", "Confirm", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (mb == MessageBoxResult.Yes) { tier.AnnoList.Save(); } } if (mb != MessageBoxResult.Cancel) { control.annoTierControl.Remove(tier); AnnoTierStatic.Unselect(); tier.Children.Clear(); tier.AnnoList.Clear(); annoTiers.Remove(tier); if (annoTiers.Count > 0) { AnnoTierStatic.Select(annoTiers[0]); } else { clearAnnoInfo(); updateNavigator(); } } } }
private void SplitSegment(object sender, KeyEventArgs e) { AnnoTierStatic.SplitPressed(sender, e); }