private void updatePositionLabels(double time) { control.signalPositionLabel.Text = FileTools.FormatSeconds(time) + "/" + FileTools.FormatSeconds(timeline.TotalDuration); if (SignalTrackStatic.Selected != null && SignalTrackStatic.Selected.Signal != null) { Signal signal = SignalTrackStatic.Selected.Signal; control.signalStatusValueLabel.Text = signal.Value(time).ToString(); control.signalStatusValueMinLabel.Text = "min " + signal.min[signal.ShowDim].ToString(); control.signalStatusValueMaxLabel.Text = "max " + signal.max[signal.ShowDim].ToString(); } if (MediaBoxStatic.Selected != null && MediaBoxStatic.Selected.Media != null) { control.mediaPositionLabel.Text = "#" + FileTools.FormatFrames(time, MediaBoxStatic.Selected.Media.GetSampleRate()) + "/" + FileTools.FormatFrames(timeline.TotalDuration, MediaBoxStatic.Selected.Media.GetSampleRate()); } }
private void ExportFrameWiseAnnotations(int sr, string seperator, string restclass) { bool found = false; int chunksize = sr; int currenttime = 0; string headline = ""; foreach (AnnoTier s in annoTiers) { headline += s.AnnoList.Meta.Role + "_" + s.AnnoList.Scheme.Name + seperator; } string firstmediadir = ""; if (mediaList.Count > 0) { firstmediadir = mediaList[0].GetDirectory(); } else if (signals.Count > 0) { firstmediadir = signals[0].Directory; } string filepath = FileTools.SaveFileDialog("SampledAnnotations_Export", "txt", "Plain Text(*.txt)|*.txt", firstmediadir); try { using (System.IO.StreamWriter file = new System.IO.StreamWriter(filepath, false)) { headline = headline.Remove(headline.Length - 1); file.WriteLine(headline); headline = ""; int maxdur = (int)(((Time.TotalDuration - 0.5) * 1000)); Mouse.SetCursor(System.Windows.Input.Cursors.Wait); while (currenttime < maxdur) { foreach (AnnoTier tier in annoTiers) { if (tier.AnnoList.Count > 0) { foreach (AnnoListItem ali in tier.AnnoList) { if ((ali.Start * 1000) - (ali.Duration * 1000) < currenttime && ali.Stop * 1000 > currenttime) { found = true; headline += ali.Label + seperator; break; } else { found = false; } } } else { found = false; } if (!found) { headline += restclass + seperator; } } headline = headline.Remove(headline.Length - 1); file.WriteLine(headline); headline = ""; currenttime += chunksize; } } Mouse.SetCursor(System.Windows.Input.Cursors.Arrow); MessageBox.Show("Sampled Annotations Data File successfully created!", "Sucess", MessageBoxButton.OK, MessageBoxImage.Information); } catch { MessageBox.Show("Could not create Sampled Annotations Data File!", "Warning", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void OnPreviewKeyDown(object sender, KeyEventArgs e) { if (!this.control.annoListControl.editTextBox.IsFocused) { if (e.KeyboardDevice.IsKeyDown(Key.Space)) { handlePlay(); e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && e.KeyboardDevice.IsKeyDown(Key.L)) { if (AnnoTierStatic.Selected != null && Properties.Settings.Default.CMLDefaultStream != null) { DatabaseHandler.StoreToDatabase(AnnoTierStatic.Selected.AnnoList, loadedDBmedia, false); CompleteTier(Properties.Settings.Default.CMLContext, AnnoTierStatic.Selected, Properties.Settings.Default.CMLDefaultStream, Properties.Settings.Default.CMLDefaultConf, Properties.Settings.Default.CMLDefaultGap, Properties.Settings.Default.CMLDefaultMinDur); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.D0) || e.KeyboardDevice.IsKeyDown(Key.NumPad0)) { if (AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.DISCRETE || AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.FREE) { string label = "GARBAGE"; if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.Item.Label = label; AnnoTierStatic.Label.Item.Color = Colors.Black; AnnoTierStatic.Label.Item.Confidence = 1.0; } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.D1) || e.KeyboardDevice.IsKeyDown(Key.D2) || e.KeyboardDevice.IsKeyDown(Key.D3) || e.KeyboardDevice.IsKeyDown(Key.D4) || e.KeyboardDevice.IsKeyDown(Key.D5) || e.KeyboardDevice.IsKeyDown(Key.D6) || e.KeyboardDevice.IsKeyDown(Key.D7) || e.KeyboardDevice.IsKeyDown(Key.D8) || e.KeyboardDevice.IsKeyDown(Key.D9) || e.KeyboardDevice.IsKeyDown(Key.NumPad1) || e.KeyboardDevice.IsKeyDown(Key.NumPad2) || e.KeyboardDevice.IsKeyDown(Key.NumPad3) || e.KeyboardDevice.IsKeyDown(Key.NumPad4) || e.KeyboardDevice.IsKeyDown(Key.NumPad5) || e.KeyboardDevice.IsKeyDown(Key.NumPad6) || e.KeyboardDevice.IsKeyDown(Key.NumPad7) || e.KeyboardDevice.IsKeyDown(Key.NumPad8) || e.KeyboardDevice.IsKeyDown(Key.NumPad9)) { int index = 0; if (e.Key - Key.D1 < 10 && AnnoTierStatic.Selected.AnnoList.Scheme.Labels != null && AnnoTierStatic.Selected.AnnoList.Scheme.Labels.Count > 0) { index = Math.Min(AnnoTierStatic.Selected.AnnoList.Scheme.Labels.Count - 1, e.Key - Key.D1); } else if (AnnoTierStatic.Selected.AnnoList.Scheme.Labels != null) { index = Math.Min(AnnoTierStatic.Selected.AnnoList.Scheme.Labels.Count - 1, e.Key - Key.NumPad1); } if (index >= 0 && AnnoTierStatic.Selected.AnnoList.Scheme.Type == AnnoScheme.TYPE.DISCRETE) { string label = AnnoTierStatic.Selected.AnnoList.Scheme.Labels.ElementAt(index).Name; if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.Item.Label = label; AnnoTierStatic.Selected.DefaultLabel = label; foreach (AnnoScheme.Label lp in AnnoTierStatic.Selected.AnnoList.Scheme.Labels) { if (label == lp.Name) { AnnoTierStatic.Label.Item.Color = lp.Color; AnnoTierStatic.Label.Item.Confidence = 1.0; AnnoTierStatic.Selected.DefaultColor = lp.Color; break; } } } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.Right) && e.KeyboardDevice.IsKeyDown(Key.LeftCtrl)) { if (AnnoTierStatic.Label != null && AnnoTierStatic.Selected.isDiscreteOrFree && isKeyDown == false /*&& AnnoTierStatic.Label == null*/) { UIElement container = VisualTreeHelper.GetParent(AnnoTierStatic.Label) as UIElement; Point relativeLocation = AnnoTierStatic.Label.TranslatePoint(new Point(0, 0), container); mediaList.move(MainHandler.Time.TimeFromPixel(relativeLocation.X + AnnoTierStatic.Label.Width)); if (e.KeyboardDevice.IsKeyDown(Key.LeftShift)) { annoCursor.X = relativeLocation.X + AnnoTierStatic.Label.Width; } else { signalCursor.X = relativeLocation.X + AnnoTierStatic.Label.Width; } timeline.CurrentSelectPosition = annoCursor.X; timeline.CurrentPlayPosition = MainHandler.Time.TimeFromPixel(signalCursor.X); timeline.CurrentPlayPositionPrecise = MainHandler.Time.TimeFromPixel(signalCursor.X); AnnoTierStatic.Label.select(true); isKeyDown = true; } e.Handled = true; } else if (e.KeyboardDevice.IsKeyDown(Key.Right) && !e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && !e.KeyboardDevice.IsKeyDown(Key.LeftAlt) && !isKeyDown) { isKeyDown = true; if (AnnoTier.Selected != null) { AnnoTier.Selected.Focus(); } int i = 0; double fps = 1.0 / 25.0; foreach (IMedia im in mediaList.Medias) { if (im.IsVideo()) { break; } i++; } if (i < mediaList.Medias.Count) { fps = 1.0 / mediaList.Medias[i].GetSampleRate(); } mediaList.move(MainHandler.Time.TimeFromPixel(signalCursor.X) + fps); timeline.CurrentPlayPosition = MainHandler.Time.TimeFromPixel(signalCursor.X) + fps; timeline.CurrentPlayPositionPrecise = MainHandler.Time.TimeFromPixel(signalCursor.X) + fps; double pos = MainHandler.Time.PixelFromTime(timeline.CurrentPlayPosition); signalCursor.X = pos; if (Time.CurrentPlayPosition >= Time.SelectionStop && control.navigator.followplaybox.IsChecked == true) { double factor = (((timeline.CurrentPlayPosition - timeline.SelectionStart) / (timeline.SelectionStop - timeline.SelectionStart))); control.timeLineControl.rangeSlider.followmedia = true; control.timeLineControl.rangeSlider.MoveAndUpdate(true, factor); if (timeline.SelectionStop - timeline.SelectionStart < 1) { timeline.SelectionStart = timeline.SelectionStop - 1; } signalCursor.X = 1; } else if (control.navigator.followplaybox.IsChecked == false) { control.timeLineControl.rangeSlider.followmedia = false; } double time = Time.TimeFromPixel(pos); control.signalPositionLabel.Text = FileTools.FormatSeconds(time); control.annoTrackControl.currenttime = Time.TimeFromPixel(pos); e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.Left) && e.KeyboardDevice.IsKeyDown(Key.LeftCtrl)) { if (AnnoTierStatic.Label != null && AnnoTierStatic.Selected.isDiscreteOrFree && isKeyDown == false /*&& AnnoTierStatic.Label == null*/) { UIElement container = VisualTreeHelper.GetParent(AnnoTierStatic.Label) as UIElement; Point relativeLocation = AnnoTierStatic.Label.TranslatePoint(new Point(0, 0), container); mediaList.move(MainHandler.Time.TimeFromPixel(relativeLocation.X)); if (e.KeyboardDevice.IsKeyDown(Key.LeftShift)) { annoCursor.X = relativeLocation.X; } else { signalCursor.X = relativeLocation.X; } timeline.CurrentSelectPosition = annoCursor.X; timeline.CurrentPlayPosition = MainHandler.Time.TimeFromPixel(signalCursor.X); timeline.CurrentPlayPositionPrecise = MainHandler.Time.TimeFromPixel(signalCursor.X); AnnoTierStatic.Label.select(true); isKeyDown = true; } e.Handled = true; } else if (e.KeyboardDevice.IsKeyDown(Key.Left) && !e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && !e.KeyboardDevice.IsKeyDown(Key.LeftAlt) && !isKeyDown) { isKeyDown = true; if (AnnoTier.Selected != null) { AnnoTier.Selected.Focus(); } int i = 0; double fps = 1.0 / 25.0; foreach (IMedia im in mediaList.Medias) { if (im.IsVideo()) { break; } i++; } if (i < mediaList.Medias.Count) { fps = 1.0 / mediaList.Medias[i].GetSampleRate(); } mediaList.move(MainHandler.Time.TimeFromPixel(signalCursor.X) - fps); timeline.CurrentPlayPosition = MainHandler.Time.TimeFromPixel(signalCursor.X) - fps; timeline.CurrentPlayPositionPrecise = timeline.CurrentPlayPosition; double pos = MainHandler.Time.PixelFromTime(timeline.CurrentPlayPosition); signalCursor.X = pos; if (Time.CurrentPlayPosition < Time.SelectionStart && Time.SelectionStart > 0 && control.navigator.followplaybox.IsChecked == true) { double factor = (((timeline.SelectionStop - timeline.CurrentPlayPosition) / (timeline.SelectionStop - timeline.SelectionStart))); control.timeLineControl.rangeSlider.followmedia = true; control.timeLineControl.rangeSlider.MoveAndUpdate(false, factor); if (timeline.SelectionStop - timeline.SelectionStart < 1) { timeline.SelectionStart = timeline.SelectionStop - 1; } signalCursor.X = MainHandler.Time.PixelFromTime(MainHandler.Time.SelectionStop); } else if (control.navigator.followplaybox.IsChecked == false) { control.timeLineControl.rangeSlider.followmedia = false; } double time = Time.TimeFromPixel(pos); if (time != 0) { control.signalPositionLabel.Text = FileTools.FormatSeconds(time); control.annoTrackControl.currenttime = Time.TimeFromPixel(pos); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && !isKeyDown) { if (AnnoTierStatic.Selected != null && !AnnoTierStatic.Selected.isDiscreteOrFree) { AnnoTierStatic.Selected.ContinuousAnnoMode(); } isKeyDown = true; e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.T) && e.KeyboardDevice.IsKeyDown(Key.Down)) { for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i + 1 < annoTiers.Count) { AnnoTier.SelectTier(annoTiers[i + 1]); AnnoTier.SelectLabel(null); break; } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.T) && e.KeyboardDevice.IsKeyDown(Key.Up)) { for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i > 0) { AnnoTier.SelectTier(annoTiers[i - 1]); AnnoTier.SelectLabel(null); break; } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.C) && e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && AnnoTierStatic.Selected != null && AnnoTierStatic.Selected.isDiscreteOrFree) { if (AnnoTierStatic.Label != null) { temp_segment = AnnoTierStatic.Label; AnnoTierStatic.Label.select(false); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.X) && e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && AnnoTierStatic.Selected != null && AnnoTierStatic.Selected.isDiscreteOrFree) { if (AnnoTierStatic.Label != null) { temp_segment = AnnoTierStatic.Label; AnnoTier.OnKeyDownHandler(sender, e); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.V) && e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && AnnoTierStatic.Selected != null && AnnoTierStatic.Selected.isDiscreteOrFree) { if (AnnoTierStatic.Selected != null) { double start = Time.TimeFromPixel(annoCursor.X); if (temp_segment != null) { AnnoTierStatic.Selected.NewAnnoCopy(start, start + temp_segment.Item.Duration, temp_segment.Item.Label, temp_segment.Item.Color, temp_segment.Item.Confidence); } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && e.KeyboardDevice.IsKeyDown(Key.Z)) { if (AnnoTierStatic.Selected != null) { AnnoTierStatic.Selected.UnDoObject.Undo(1); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) && e.KeyboardDevice.IsKeyDown(Key.Y)) { if (AnnoTierStatic.Selected != null) { AnnoTierStatic.Selected.UnDoObject.Redo(1); } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftAlt) && e.KeyboardDevice.IsKeyDown(Key.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) { AnnoTier.SelectTier(annoTiers[i + 1]); AnnoTier.SelectLabel(null); if (!AnnoTierStatic.Selected.AnnoList.Contains(temp)) { AnnoTierStatic.Selected.NewAnnoCopy(temp.Start, temp.Stop, temp.Label, temp.Color); } break; } } } e.Handled = true; } if (e.KeyboardDevice.IsKeyDown(Key.LeftAlt) && e.KeyboardDevice.IsKeyDown(Key.Up)) { if (AnnoTierStatic.Label != null) { AnnoListItem temp = AnnoTierStatic.Label.Item; for (int i = 0; i < annoTiers.Count; i++) { if (annoTiers[i] == AnnoTierStatic.Selected && i > 0) { AnnoTier.SelectTier(annoTiers[i - 1]); AnnoTier.SelectLabel(null); if (!AnnoTierStatic.Selected.AnnoList.Contains(temp)) { AnnoTierStatic.Selected.NewAnnoCopy(temp.Start, temp.Stop, temp.Label, temp.Color); } break; } } } e.Handled = true; } } }
private void saveProjectFile(List <AnnoTier> annoTiers, List <MediaBox> mediaBoxes, List <SignalTrack> signalTracks, string filepath) { string workdir = Path.GetDirectoryName(filepath); StreamWriter sw = new StreamWriter(filepath, false, System.Text.Encoding.Default); sw.WriteLine("<nova version=\"1\">"); sw.WriteLine("\t<medias>"); if (mediaList != null) { foreach (MediaBox box in mediaBoxes) { if (box.Media.GetFilepath() != null) { sw.WriteLine("\t\t<media>" + FileTools.GetRelativePath(box.Media.GetFilepath(), workdir) + "</media>"); } } } sw.WriteLine("\t</medias>"); sw.WriteLine("\t<signals>"); if (signalTracks != null) { foreach (SignalTrack st in signalTracks) { if (st.Signal.FilePath != null) { sw.WriteLine("\t\t<signal bg=\"" + st.Background + "\" fg=\"" + st.SignalColor + "\">" + FileTools.GetRelativePath(st.Signal.FilePath, workdir) + "</signal>"); } } } sw.WriteLine("\t</signals>"); if (DatabaseHandler.IsConnected && DatabaseHandler.IsDatabase && DatabaseHandler.IsSession) { sw.WriteLine("\t<tiers database=\"" + DatabaseHandler.DatabaseName + "\">"); } else { sw.WriteLine("\t<tiers>"); } foreach (AnnoTier t in annoTiers) { if (t.AnnoList.Source.HasFile) { sw.WriteLine("\t\t<tier>" + FileTools.GetRelativePath(t.AnnoList.Path, workdir) + "</tier>"); } else if (t.AnnoList.Source.HasDatabase) { sw.WriteLine("\t\t<tier>" + t.AnnoList.Path + "</tier>"); } } sw.WriteLine("\t</tiers>"); sw.WriteLine("</nova>"); sw.Close(); }
public void loadProjectFile(string filepath) { clearWorkspace(); string workdir = Path.GetDirectoryName(filepath); XmlDocument doc = new XmlDocument(); try { doc.Load(filepath); foreach (XmlNode node in doc.SelectNodes("//media")) { string path = FileTools.GetAbsolutePath(node.InnerText, workdir); loadFile(path); } foreach (XmlNode node in doc.SelectNodes("//signal")) { Color background = Defaults.Colors.Background; Color foreground = Defaults.Colors.Foreground; if (node.Attributes["bg"] != null) { background = (Color)ColorConverter.ConvertFromString(node.Attributes["bg"].LastChild.Value); } if (node.Attributes["fg"] != null) { foreground = (Color)ColorConverter.ConvertFromString(node.Attributes["fg"].LastChild.Value); } string path = FileTools.GetAbsolutePath(node.InnerText, workdir); loadFile(path, foreground, background); } if (DatabaseHandler.IsConnected) { XmlNode node = doc.SelectSingleNode("//tiers"); if (node != null && node.Attributes["database"] != null) { DatabaseHandler.ChangeDatabase(node.Attributes["database"].LastChild.Value); } } foreach (XmlNode node in (doc.SelectNodes("//tier"))) { string path = node.InnerText; if (!Path.HasExtension(path)) { AnnoList annoList = DatabaseHandler.LoadAnnoList(path); if (annoList != null) { addAnnoTier(annoList); } else { MessageTools.Warning("Could not load annotation from database with id '" + node.InnerText + "'"); } } else { if (path == "") { path = node.Attributes["filepath"].LastChild.Value; } path = FileTools.GetAbsolutePath(path, workdir); loadFile(path); } } } catch (Exception e) { MessageTools.Error(e.ToString()); } }
private void annoTrackGrid_MouseDown(object sender, MouseButtonEventArgs e) { if (control.navigator.askforlabels.IsChecked == true) { AnnoTier.askForLabel = true; } else { AnnoTier.askForLabel = false; } if (e.LeftButton == MouseButtonState.Pressed) { if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.isMoveable = true; AnnoTierStatic.Selected.LeftMouseButtonDown(e); } } if (e.RightButton == MouseButtonState.Pressed) { if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.select(false); } if (AnnoTierStatic.Selected != null && (AnnoTierStatic.Selected.AnnoList.Scheme.Type != AnnoScheme.TYPE.CONTINUOUS || isMouseButtonDown == false)) { foreach (AnnoTier a in annoTiers) { if (a.IsMouseOver) { AnnoTier.SelectLabel(null); AnnoTier.SelectTier(a); break; } } } if (AnnoTierStatic.Selected != null) { AnnoTierStatic.Selected.RightMouseButtonDown(e); } isMouseButtonDown = true; } if (AnnoTierStatic.Selected != null) { if (AnnoTierStatic.Selected.isDiscreteOrFree || (!AnnoTierStatic.Selected.isDiscreteOrFree && Keyboard.IsKeyDown(Key.LeftShift))) { double pos = e.GetPosition(control.trackGrid).X; annoCursor.X = pos; Time.CurrentSelectPosition = pos; annoCursor.Visibility = Visibility.Visible; double time = Time.TimeFromPixel(pos); control.annoPositionLabel.Text = FileTools.FormatSeconds(time); } else { annoCursor.X = 0; double time = Time.TimeFromPixel(0); annoCursor.Visibility = Visibility.Hidden; control.annoPositionLabel.Text = FileTools.FormatSeconds(time); } } }
private void saveProject(List <AnnoTier> annoTiers, MediaList mediaList, List <ISignalTrack> signalTracks, string filepath) { string workdir = Path.GetDirectoryName(filepath); StreamWriter sw = new StreamWriter(filepath, false, System.Text.Encoding.Default); sw.WriteLine("<nova version=\"1\">"); sw.WriteLine("\t<medias>"); if (mediaList != null) { foreach (IMedia t in mediaList.Medias) { if (t.GetFilepath() != null) { sw.WriteLine("\t\t<media>" + FileTools.GetRelativePath(t.GetFilepath(), workdir) + "</media>"); } } } sw.WriteLine("\t</medias>"); sw.WriteLine("\t<signals>"); if (signalTracks != null) { foreach (SignalTrack st in signalTracks) { if (st.Signal.FilePath != null) { sw.WriteLine("\t\t<signal bg=\"" + st.Background + "\" fg=\"" + st.SignalColor + "\">" + FileTools.GetRelativePath(st.Signal.FilePath, workdir) + "</signal>"); } } } sw.WriteLine("\t</signals>"); sw.WriteLine("\t<tiers>"); foreach (AnnoTier t in annoTiers) { if (t.AnnoList.Source.File.Path != "") { sw.WriteLine("\t\t<tier name=\"" + t.AnnoList.Scheme.Name + "\">" + FileTools.GetRelativePath(t.AnnoList.Source.File.Path, workdir) + "</tier>"); } } sw.WriteLine("\t</tiers>"); sw.WriteLine("</nova>"); sw.Close(); }
private void annoTierControl_MouseDown(object sender, MouseButtonEventArgs e) { if (control.navigator.askforlabels.IsChecked == true) { AnnoTier.askForLabel = true; } else { AnnoTier.askForLabel = false; } if (e.LeftButton == MouseButtonState.Pressed && !Keyboard.IsKeyDown(Key.LeftShift)) { if (AnnoTierStatic.Selected != null) { AnnoTierStatic.Selected.LeftMouseButtonDown(e); } if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.isMoveable = true; } geometricCompare.Clear(); } else if (e.RightButton == MouseButtonState.Pressed && !Keyboard.IsKeyDown(Key.LeftCtrl)) { if (AnnoTierStatic.Label != null) { AnnoTierStatic.Label.select(false); } if (AnnoTierStatic.Selected != null && (AnnoTierStatic.Selected.AnnoList.Scheme.Type != AnnoScheme.TYPE.CONTINUOUS || isMouseButtonDown == false)) { foreach (AnnoTier a in annoTiers) { if (a.IsMouseOver) { AnnoTier.SelectLabel(null); AnnoTier.Select(a); break; } } } if (AnnoTierStatic.Selected != null) { AnnoTierStatic.Selected.RightMouseButtonDown(e); } isMouseButtonDown = true; } else if (e.RightButton == MouseButtonState.Pressed && Keyboard.IsKeyDown(Key.LeftCtrl)) { try { AnnoList al = ((AnnoTier)Mouse.DirectlyOver).AnnoList; if (al.ID != AnnoTierStatic.Selected.AnnoList.ID) { geometricCompare.Add(al); } } catch { } } if (AnnoTierStatic.Selected != null) { if (AnnoTierStatic.Selected.IsDiscreteOrFree || (!AnnoTierStatic.Selected.IsDiscreteOrFree && Keyboard.IsKeyDown(Key.LeftShift))) { double pos = e.GetPosition(control.signalAndAnnoGrid).X; annoCursor.X = pos; Time.CurrentSelectPosition = pos; annoCursor.Visibility = Visibility.Visible; double time = Time.TimeFromPixel(pos); control.annoPositionLabel.Text = FileTools.FormatSeconds(time); } else { double pos = e.GetPosition(control.signalAndAnnoGrid).X; annoCursor.X = 0; double time = Time.TimeFromPixel(pos); annoCursor.Visibility = Visibility.Hidden; control.annoPositionLabel.Text = FileTools.FormatSeconds(time); } } else { double pos = e.GetPosition(control.signalAndAnnoGrid).X; annoCursor.X = 0; double time = Time.TimeFromPixel(pos); annoCursor.Visibility = Visibility.Hidden; control.annoPositionLabel.Text = FileTools.FormatSeconds(time); } }