Пример #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>();
            }
        }
Пример #2
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (StrobeSource != StrobeSource.TimeInterval)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Пример #3
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (TextSource != TextSource.None)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Пример #4
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (FireworksSource == FireworksSource.MarkCollection)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Пример #5
0
		public override IModuleDataModel Clone()
		{
			TimedSequenceData result = new TimedSequenceData();
			// Cloning each MarkCollection so that the cloned data objects don't share references
			// and step on each other.
			result.MarkCollections = new List<MarkCollection>(MarkCollections.Select(x => new MarkCollection(x)));
			return result;
		}
Пример #6
0
 /// <inheritdoc />
 protected override void MarkCollectionsChanged()
 {
     if (LipSyncMode == LipSyncMode.MarkCollection)
     {
         var markCollection = MarkCollections.FirstOrDefault(x => x.Name.Equals(MarkCollectionId));
         InitializeMarkCollectionListeners(markCollection);
     }
 }
Пример #7
0
        /// <summary>
        /// Method to invoke when the AddCollection command is executed.
        /// </summary>
        private void AddCollection()
        {
            var mc = new MarkCollection();

            if (!MarkCollections.Any())
            {
                mc.IsDefault = true;
            }
            MarkCollections.Add(mc);
        }
Пример #8
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);
        }
Пример #9
0
        /// <summary>
        /// Updates the selected mark collection drop down.
        /// This method allows for the associated mark collection to be renamed.
        /// </summary>
        public void UpdateSelectedMarkCollectionName()
        {
            // If the selected mark collection no longer exists then...
            if (MarkCollections != null &&
                !MarkCollections.Any(mc => mc.Id == _markCollectionId))
            {
                // Make the mark collection drop down blank
                MarkCollectionId = new Guid();
            }

            OnPropertyChanged("MarkCollections");
            OnPropertyChanged("MarkCollectionName");
        }
Пример #10
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>();
            }
        }
Пример #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);
            }
        }
Пример #12
0
 /// <summary>
 /// Method to check whether the ToggleMarkBarState command can be executed.
 /// </summary>
 /// <returns><c>true</c> if the command can be executed; otherwise <c>false</c></returns>
 private bool CanToggleMarkBarState()
 {
     return(MarkCollections.Any());
 }
Пример #13
0
 /// <summary>
 /// Method to invoke when the ToggleMarkBarState command is executed.
 /// </summary>
 private void ToggleMarkBarState()
 {
     MarkCollections.ForEach(x => x.ShowMarkBar = _markBarToggleState);
     _markBarToggleState = !_markBarToggleState;
 }
Пример #14
0
 /// <summary>
 /// Method to invoke when the EnableAllLines command is executed.
 /// </summary>
 private void ToggleLineState()
 {
     MarkCollections.ForEach(x => x.ShowGridLines = _lineToggleState);
     _lineToggleState = !_lineToggleState;
 }
Пример #15
0
 /// <summary>
 /// Method to check whether the ExportCollection command can be executed.
 /// </summary>
 /// <returns><c>true</c> if the command can be executed; otherwise <c>false</c></returns>
 private bool CanExportCollection()
 {
     return(MarkCollections.Any());
 }
Пример #16
0
        private void SetupMarks()
        {
            IMarkCollection mc = MarkCollections.FirstOrDefault(x => x.Id == _data.MarkCollectionId);

            _marks = mc?.MarksInclusiveOfTime(StartTime, StartTime + TimeSpan);
        }
Пример #17
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;
                }
            }
        }