public ChangeAction(ChangeType changeType, TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex) { _changeType = changeType; _changedElement = changedElement; _changeTranscriptionIndex = changeIndex; _changeAbsoluteIndex = changeAbsoluteIndex; }
public ReplaceAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex) : base(ChangeType.Replace, changedElement, changeIndex, changeAbsoluteIndex) { }
public abstract void Insert(TranscriptionIndex index, TranscriptionElement value);
public override bool Remove(TranscriptionElement value) { throw new NotSupportedException(); }
public override void Insert(int index, TranscriptionElement data) { throw new NotSupportedException(); }
public override void Insert(TranscriptionIndex index, TranscriptionElement value) { ValidateIndexOrThrow(index); if (index.IsSectionIndex) { if (index.IsParagraphIndex) Sections[index.Sectionindex].Insert(index, value); else Sections.Insert(index.Sectionindex,(TranscriptionSection)value); } else { throw new IndexOutOfRangeException("index"); } }
void _transcription_ContentChanged(object sender, TranscriptionElement.TranscriptionElementChangedEventArgs e) { if (e.ActionsTaken.Any(a => !(a.ChangedElement is TranscriptionPhrase))) waveform1.InvalidateSpeakers(); }
public MyTranscriptionElementEventArgs(TranscriptionElement value) { Value = value; }
public Element GetVisualForTransctiption(TranscriptionElement el) { return listbox.ItemContainerGenerator.ContainerFromItem(el).VisualFindChild<Element>(); }
private void ColorizeBackground(TranscriptionElement focused) { var all = listbox.VisualFindChildren<Element>(); foreach (var elem in all) { if (elem.ValueElement == focused) { elem.Background = Settings.Default.ActiveParagraphBackground; } else { if (elem.ValueElement is TranscriptionSection) elem.Background = Settings.Default.SectionBackground; else if (elem.ValueElement is TranscriptionChapter) elem.Background = Settings.Default.ChapterBackground; else elem.Background = null; } } }
public Element SetActiveTranscription(TranscriptionElement el) { ActivatingTranscription = true; if (el == null) return null; if (el == _activeTranscription) return listbox.ItemContainerGenerator.ContainerFromItem(el).VisualFindChild<Element>(); _activeTranscription = el; _activetransctiptionSelectionLength = -1; _activetransctiptionSelectionStart = -1; foreach (Element ee in listbox.VisualFindChildren<Element>()) { if (ee.ValueElement != el) { ee.editor.Select(0, 0); } } listbox.ScrollIntoView(el); ListBoxItem cont = listbox.ItemContainerGenerator.ContainerFromItem(el) as ListBoxItem; if (cont == null) { listbox.UpdateLayout(); listbox.ScrollIntoView(el); cont = listbox.ItemContainerGenerator.ContainerFromItem(el) as ListBoxItem; } if (cont != null) { var elm = cont.VisualFindChild<Element>(); listbox.SelectedItem = el; //events may not be active yet if (elm.Background != Settings.Default.ActiveParagraphBackground) { elm.editor.Focus(); ColorizeBackground(el); } ActivatingTranscription = false; return elm; } ActivatingTranscription = false; return null; }
public virtual bool Replace(TranscriptionElement oldelement, TranscriptionElement newelement) { int index = _children.IndexOf(oldelement); if (index >= 0) { var oi = oldelement.TranscriptionIndex; var oa = oldelement.AbsoluteIndex; newelement._Parent = this; newelement._ParentIndex = oldelement._ParentIndex; oldelement._Parent = null; oldelement._ParentIndex = -1; _children[index] = newelement; OnContentChanged(new ReplaceAction(oldelement, oi, oa)); return true; } return false; }
public virtual bool Remove(TranscriptionElement value) { RemoveAt(_children.IndexOf(value)); return true; }
public virtual void Insert(int index, TranscriptionElement data) { if (index < 0 || index > Children.Count) throw new IndexOutOfRangeException(); _children.Insert(index, data); data._Parent = this; for (int i = index; i < _children.Count; i++) { _children[i]._ParentIndex = i; } OnContentChanged(new InsertAction(data, data.TranscriptionIndex, data.AbsoluteIndex)); }
public TextAction(TranscriptionElement changedelement, TranscriptionIndex changeIndex, int changeAbsoluteIndex, string oldtstring) : base(ChangeType.Modify, changedelement, changeIndex, changeAbsoluteIndex) { _oldtstring = oldtstring; }
private void FixPosSetFor(TranscriptionElement elm) { _FixPosElm = elm; var prevc = listbox.ItemContainerGenerator.ContainerFromItem(elm) as ListBoxItem; _FixPosElmPos = prevc.TransformToAncestor(_scrollViewer).Transform(new Point(0, 0)); }
private void ScrollToItem(TranscriptionElement elm) { if (_scrollViewer == null) return; listbox.SelectedItem = elm; listbox.ScrollIntoView(listbox.Items[listbox.SelectedIndex]); if (elm == Transcription.Last()) { _scrollViewer.ScrollToBottom(); } else { var all = listbox.VisualFindChildren<Element>(); var visible = all.Where(itm => listbox.VisualIsVisibleChild(itm)); Action scroll = new Action(() => { all = listbox.VisualFindChildren<Element>(); visible = all.Where(itm => listbox.VisualIsVisibleChild(itm)); var element = all.First(itm => itm.ValueElement == elm); var position = element.TransformToAncestor(_scrollViewer).Transform(new Point(0, element.ActualHeight)); _scrollViewer.ScrollToVerticalOffset(position.Y); _scrollViewer.UpdateLayout(); }); if (visible.Any(itm => itm.ValueElement == elm)) _scrollViewer.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, scroll); } }
void val_ContentChanged(object sender, TranscriptionElement.TranscriptionElementChangedEventArgs e) { Element el = this; //phrase changes if (el.ValueElement is TranscriptionParagraph && e.ActionsTaken.Any(a => a.ChangedElement.Parent != null && a.ChangedElement.Parent == el.ValueElement)) el.TextualContentChanged(); if (el == null || el.ValueElement == null || !e.ActionsTaken.Any(a => a.ChangedElement == el.ValueElement)) return; if (e.ActionsTaken.Any(a => a is NanoTrans.Core.TextAction)) el.TextualContentChanged(); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.BeginAction)) el.BeginChanged(el, new EventArgs()); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.BeginAction)) el.BeginChanged(el, new EventArgs()); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.EndAction)) el.EndChanged(el, new EventArgs()); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.ParagraphSpeakerAction)) el.RefreshSpeakerInfos(); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.ParagraphLanguageAction)) el.textBlockLanguage.GetBindingExpression(TextBlock.TextProperty).UpdateTarget(); if (e.ActionsTaken.Any(a => a is NanoTrans.Core.ParagraphAttibutesAction)) el.RepaintAttributes(); }
private void SetCaretIn(TranscriptionElement elm, int position) { if (ActiveTransctiption != elm) ActiveTransctiption = elm; listbox.ScrollIntoView(elm); var n = listbox.ItemContainerGenerator.ContainerFromItem(elm).VisualFindChild<Element>(); if (!n.IsFocused) n.Focus(); n.SetCaretOffset(position); }
public int NormalizePhonetics(TranscriptionElement aElement, int aIndexNormalizace) { throw new NotImplementedException(); }
public override void Insert(TranscriptionIndex index, TranscriptionElement value) { ValidateIndexOrThrow(index); if (!index.IsPhraseIndex) throw new IndexOutOfRangeException("index"); Phrases.Insert(index.PhraseIndex,(TranscriptionPhrase)value); }
public override void Add(TranscriptionElement data) { throw new NotSupportedException(); }
public InsertAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex) : base(ChangeType.Add, changedElement, changeIndex, changeAbsoluteIndex) { }
public override void Insert(TranscriptionIndex index, TranscriptionElement value) { throw new NotImplementedException(); }
public BeginAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex, TimeSpan oldtime) : base(ChangeType.Modify, changedElement, changeIndex,changeAbsoluteIndex) { _oldtime = oldtime; }
public override bool Replace(TranscriptionElement oldelement, TranscriptionElement newelement) { throw new NotSupportedException(); }
public virtual void Add(TranscriptionElement data) { _children.Add(data); data._Parent = this; data._ParentIndex = _children.Count - 1; OnContentChanged(new InsertAction(data, data.TranscriptionIndex, data.AbsoluteIndex)); }