Exemple #1
0
        private void SetupMarks()
        {
            if (MarkCollections == null || !MarkCollections.Any())
            {
                LipSyncMode = LipSyncMode.Phoneme;
                return;
            }

            if (string.IsNullOrEmpty(MarkCollectionId))
            {
                var dmc = MarkCollections.FirstOrDefault(x => x.CollectionType == MarkCollectionType.Phoneme);
                if (dmc != null && string.IsNullOrEmpty(MarkCollectionId))
                {
                    MarkCollectionId = dmc.Name;
                }
            }


            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            if (mc != null)
            {
                _marks = mc.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            }
            else
            {
                _marks = new List <IMark>();
            }
        }
Exemple #2
0
 protected void RemoveMarkCollectionListeners(IMarkCollection mc)
 {
     if (mc == null)
     {
         return;
     }
     ((INotifyCollectionChanged)mc.Marks).CollectionChanged -= MarkCollectionPropertyChanged;
     RemoveMarkListeners(mc.Marks);
 }
Exemple #3
0
 /// <summary>
 /// Initialize the listeners on a specific collection
 /// </summary>
 /// <param name="markCollection"></param>
 protected void InitializeMarkCollectionListeners(IMarkCollection markCollection)
 {
     if (markCollection != null)
     {
         //Ensure we don't have any already attached listeners.
         RemoveMarkListeners(markCollection.Marks);
         AddMarkCollectionListeners(markCollection);
     }
 }
Exemple #4
0
 public void AddMarkCollectionListeners(IMarkCollection mc)
 {
     if (mc == null)
     {
         return;
     }
     ((INotifyCollectionChanged)mc.Marks).CollectionChanged += MarkCollectionPropertyChanged;
     AddMarkListeners(mc.Marks);
 }
Exemple #5
0
 public MarkRow(IMarkCollection markCollection)
 {
     MarkCollection = markCollection;
     MarkCollection.EnsureOrder();
     MarkCollection.PropertyChanged           += MarkCollection_PropertyChanged;
     MarkCollection.Decorator.PropertyChanged += Decorator_PropertyChanged;
     Height     = _baseRowHeight;
     StackCount = 1;
 }
Exemple #6
0
        private void ReloadMarkListeners(IMarkCollection collection)
        {
            var marks = collection?.Marks;

            if (marks != null)
            {
                RemoveMarkListeners(marks);
                AddMarkListeners(marks);
            }
        }
Exemple #7
0
        /// <summary>
        /// Gets the mark collection with the specified Guid.
        /// </summary>
        private IMarkCollection GetMarkCollection(Guid markCollectionGuid)
        {
            IMarkCollection markCollection = null;

            // If the mark collection contains the specified Guid then...
            if (MarkCollections.Any(item => item.Id == markCollectionGuid))
            {
                // Find the specified mark collection
                markCollection = MarkCollections.First(item => item.Id == markCollectionGuid);
            }

            return(markCollection);
        }
Exemple #8
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            if (mc != null)
            {
                _marks = mc.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            }
            else
            {
                _marks = new List <IMark>();
            }
        }
Exemple #9
0
        private bool MarkCollectionAt(Point p, out IMarkCollection markCollection)
        {
            bool success = false;

            markCollection = null;
            var row = RowAt(p);

            if (row != null)
            {
                markCollection = row.MarkCollection;
                success        = true;
            }

            return(success);
        }
Exemple #10
0
 public void DeleteCollection(IMarkCollection markCollection)
 {
     MarkCollections.Remove(markCollection);
     if (markCollection.IsDefault && MarkCollections.Any())
     {
         //we need to find a new default
         var mc = MarkCollections.FirstOrDefault(x => x.IsVisible);
         if (mc != null)
         {
             mc.IsDefault = true;
         }
         else
         {
             MarkCollections.First().IsDefault = true;
         }
     }
 }
Exemple #11
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
            if (_marks == null)
            {
                return;
            }

            bool        firstMark = true;
            StrobeClass t;

            foreach (var mark in _marks)
            {
                if (firstMark && mark.StartTime > StartTime)
                {
                    t = new StrobeClass {
                        StartTime = TimeSpan.Zero, CycleTime = (int)(StrobeSource == StrobeSource.MarkCollectionLabelDuration ? mark.Duration.TotalMilliseconds : GetMarkLabelValue(mark.Text))
                    };
                    _strobeClass.Add(t);
                    firstMark = false;
                }

                if (mark.StartTime < StartTime)
                {
                    continue;
                }
                t = new StrobeClass {
                    CycleTime = (int)(StrobeSource == StrobeSource.MarkCollectionLabelDuration ? mark.Duration.TotalMilliseconds : GetMarkLabelValue(mark.Text)), StartTime = mark.StartTime - StartTime
                };
                _strobeClass.Add(t);
                firstMark = false;
            }

            if (_strobeClass.Count > 0)
            {
                t = new StrobeClass {
                    CycleTime = _strobeClass.Last().CycleTime, StartTime = TimeSpan
                };
                _strobeClass.Add(t);
            }
        }
 public MarksRemovedUndoAction(TimedSequenceEditorForm form, IMark mark, IMarkCollection mc)
     : base(form, new Dictionary <IMark, IMarkCollection>() { { mark, mc } })
 {
 }
Exemple #13
0
        private void CreateMarkRow(IMarkCollection markCollection)
        {
            MarkRow row = new MarkRow(markCollection);

            _rows.Add(row);
        }
Exemple #14
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
        }
Exemple #15
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);

            // Populate TextClass with start frame, mark frame and endframe
            if ((_text.Count > 0 || TextSource == TextSource.MarkCollectionLabels) && _marks != null)
            {
                var i           = 0;
                var currentMark = 0;
                foreach (var mark in _marks)
                {
                    TextClass t = new TextClass();
                    if (TextSource == TextSource.MarkCollectionLabels)
                    {
                        t.Text.Add(mark.Text);
                    }
                    else
                    {
                        foreach (string t1 in _text)
                        {
                            if (t1.Split(' ').Length > i)
                            {
                                t.Text.Add(t1.Split(' ')[i]);
                            }
                        }
                    }

                    double markTime = mark.StartTime.TotalMilliseconds - StartTime.TotalMilliseconds;
                    t.Frame = (int)markTime / 50;

                    t.EndFrame = (int)(mark.EndTime.TotalMilliseconds - StartTime.TotalMilliseconds) / 50;
                    if (_textClass.Count == 0)
                    {
                        t.StartFrame = 0;
                    }
                    else
                    {
                        t.StartFrame = ((t.Frame - _textClass[_textClass.Count - 1].Frame) / 2) + _textClass[_textClass.Count - 1].Frame;
                        if (TextDuration != TextDuration.MarkDuration)
                        {
                            _textClass[_textClass.Count - 1].EndFrame = t.StartFrame;
                        }
                    }

                    if (_marks.Count() == currentMark + 1 && TextDuration != TextDuration.MarkDuration)
                    {
                        t.EndFrame = GetNumberFrames();
                    }

                    i++;
                    if (t.Text.Count == 0 && RepeatText)
                    {
                        t.Text = _textClass[0].Text;
                        i      = 1;
                    }
                    _textClass.Add(t);
                    currentMark++;
                }
            }

            // Adjusts start and end frames for each mark depending on fade settings.
            for (var i = 0; i < _textClass.Count; i++)
            {
                TextClass text = _textClass[i];
                if (text.Text.Count == 0)
                {
                    text.Text.Add(" ");
                }
                else if (text.Text[0] == "")
                {
                    text.Text[0] = " ";
                }
                switch (TextFade)
                {
                case TextFade.In:
                    switch (TextDuration)
                    {
                    case TextDuration.AutoFit:
                        if (i != 0)
                        {
                            text.StartFrame = _textClass[i - 1].Frame;
                        }
                        text.EndFrame = text.Frame;
                        break;

                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int minFrameOffset = i != 0
                                                                        ? text.Frame - _textClass[i - 1].Frame
                                                                        : text.Frame;
                        text.EndFrame   = text.Frame;
                        text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 50, minFrameOffset));
                        break;
                    }
                    break;

                case TextFade.None:
                case TextFade.Out:
                    switch (TextDuration)
                    {
                    case TextDuration.AutoFit:
                        if (i != _textClass.Count - 1)
                        {
                            text.EndFrame = _textClass[i + 1].Frame;
                        }
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int maxFrameOffset = i != _textClass.Count - 1
                                                                        ? _textClass[i + 1].Frame - text.Frame
                                                                        : GetNumberFrames() - text.Frame;
                        text.StartFrame = text.Frame;
                        text.EndFrame   = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 50, maxFrameOffset));
                        break;
                    }
                    break;

                case TextFade.InOut:
                    switch (TextDuration)
                    {
                    case TextDuration.MarkDuration:
                        text.StartFrame = text.Frame;
                        break;

                    case TextDuration.UserDefined:
                        //Gets max and min frame to compare with users Visual time setting and pick the smallest.
                        int maxFrameOffset = i != _textClass.Count - 1
                                                                        ? _textClass[i + 1].Frame - text.Frame
                                                                        : GetNumberFrames() - text.Frame;
                        int minFrameOffset = i != 0
                                                                        ? text.Frame - _textClass[i - 1].Frame
                                                                        : text.Frame;
                        text.EndFrame   = (int)(text.Frame + Math.Min((double)TimeVisibleLength / 100, maxFrameOffset));
                        text.StartFrame = (int)(text.Frame - Math.Min((double)TimeVisibleLength / 100, minFrameOffset));
                        break;
                    }
                    break;
                }
            }
        }