Exemplo n.º 1
0
 public ChangeAction(ChangeType changeType, TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex)
 {
     _changeType = changeType;
     _changedElement = changedElement;
     _changeTranscriptionIndex = changeIndex;
     _changeAbsoluteIndex = changeAbsoluteIndex;
 }
Exemplo n.º 2
0
 public ReplaceAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex)
     : base(ChangeType.Replace, changedElement, changeIndex, changeAbsoluteIndex)
 {
 }
Exemplo n.º 3
0
 public abstract void Insert(TranscriptionIndex index, TranscriptionElement value);
Exemplo n.º 4
0
 public override bool Remove(TranscriptionElement value)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 5
0
 public override void Insert(int index, TranscriptionElement data)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 6
0
 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");
     }
 }
Exemplo n.º 7
0
 void _transcription_ContentChanged(object sender, TranscriptionElement.TranscriptionElementChangedEventArgs e)
 {
     if (e.ActionsTaken.Any(a => !(a.ChangedElement is TranscriptionPhrase)))
         waveform1.InvalidateSpeakers();
 }
Exemplo n.º 8
0
 public MyTranscriptionElementEventArgs(TranscriptionElement value)
 {
     Value = value;
 }
Exemplo n.º 9
0
 public Element GetVisualForTransctiption(TranscriptionElement el)
 {
     return listbox.ItemContainerGenerator.ContainerFromItem(el).VisualFindChild<Element>();
 }
Exemplo n.º 10
0
 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;
         }
     }
 }
Exemplo n.º 11
0
        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;
        }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
 public virtual bool Remove(TranscriptionElement value)
 {
     RemoveAt(_children.IndexOf(value));
     return true;
 }
Exemplo n.º 14
0
        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));
        }
Exemplo n.º 15
0
 public TextAction(TranscriptionElement changedelement, TranscriptionIndex changeIndex, int changeAbsoluteIndex, string oldtstring)
     : base(ChangeType.Modify, changedelement, changeIndex, changeAbsoluteIndex)
 {
     _oldtstring = oldtstring;
 }
Exemplo n.º 16
0
 private void FixPosSetFor(TranscriptionElement elm)
 {
     _FixPosElm = elm;
     var prevc = listbox.ItemContainerGenerator.ContainerFromItem(elm) as ListBoxItem;
     _FixPosElmPos = prevc.TransformToAncestor(_scrollViewer).Transform(new Point(0, 0));
 }
Exemplo n.º 17
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);
            }
        }
Exemplo n.º 18
0
        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();
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
 public int NormalizePhonetics(TranscriptionElement aElement, int aIndexNormalizace)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 21
0
        public override void Insert(TranscriptionIndex index, TranscriptionElement value)
        {
            ValidateIndexOrThrow(index);
            if (!index.IsPhraseIndex)
                throw new IndexOutOfRangeException("index");

            Phrases.Insert(index.PhraseIndex,(TranscriptionPhrase)value);
        }
Exemplo n.º 22
0
 public override void Add(TranscriptionElement data)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 23
0
 public InsertAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex)
     : base(ChangeType.Add, changedElement, changeIndex, changeAbsoluteIndex)
 {
 }
Exemplo n.º 24
0
 public override void Insert(TranscriptionIndex index, TranscriptionElement value)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 25
0
 public BeginAction(TranscriptionElement changedElement, TranscriptionIndex changeIndex, int changeAbsoluteIndex, TimeSpan oldtime)
     : base(ChangeType.Modify, changedElement, changeIndex,changeAbsoluteIndex)
 {
     _oldtime = oldtime;
 }
Exemplo n.º 26
0
 public override bool Replace(TranscriptionElement oldelement, TranscriptionElement newelement)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 27
0
 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));
 }