Example #1
0
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var results = new List <DrawingInstruction>();

            var previousFrame = PreviousFrame(currentInstructions);

            var text     = string.Concat(previousFrame.Text, '\n');
            var newFrame = new DrawingInstruction
            {
                Cursor = projectInstructions.DrawCursor,
                Delay  = 1,
                Text   = text
            };

            results.Add(newFrame);

            var lastFrame = new DrawingInstruction
            {
                Cursor = false,
                Delay  = 1,
                Text   = text
            };

            results.Add(lastFrame);

            return(results);
        }
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var results = new List <DrawingInstruction>();

            if (Change == 0 || Start == End)
            {
                return(results);
            }

            var realChange = GetRealChange();

            var previousFrame = PreviousFrame(currentInstructions);

            for (var current = Start; End > Start && current <= End || Start > End && current >= End; current += realChange)
            {
                var newFrame = new DrawingInstruction
                {
                    Cursor = false,
                    Delay  = Delay,
                    Text   = string.Concat(previousFrame.Text, current.ToString())
                };

                results.Add(newFrame);
            }

            if (!LeaveTextWhenFinished)
            {
                results.Add(previousFrame.Copy());
            }

            return(results);
        }
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var frameCount = Length / Delay;

            frameCount = frameCount % 2 == 0 ? frameCount + 1 : frameCount;

            var previousFrame = PreviousFrame(currentInstructions).Copy();

            var newFrameTemplate = new DrawingInstruction
            {
                Cursor = false,
                Delay  = Delay,
                Text   = string.Concat(previousFrame.Text, Text)
            };

            var results = new List <DrawingInstruction>();

            for (int frameIndex = 0; frameIndex < frameCount; frameIndex++)
            {
                var on = frameIndex % 2 == 0;

                var newFrame = on ? newFrameTemplate.Copy() : previousFrame;
                results.Add(newFrame);
            }

            return(results);
        }
Example #4
0
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var results       = new List <DrawingInstruction>();
            var previousFrame = PreviousFrame(currentInstructions);

            if (!FlashCursor)
            {
                var newFrame = new DrawingInstruction
                {
                    Cursor = DrawCursor,
                    Delay  = Length,
                    Text   = previousFrame.Text
                };

                results.Add(newFrame);

                if (DrawCursor)
                {
                    var newFrame2 = new DrawingInstruction
                    {
                        Cursor = false,
                        Delay  = Length,
                        Text   = previousFrame.Text
                    };

                    results.Add(newFrame2);
                }
            }
            else
            {
                var frameCount = Length / Delay;
                frameCount = frameCount % 2 == 0 ? frameCount : frameCount + 1;

                var newFrameTemplate = new DrawingInstruction
                {
                    Cursor = true,
                    Delay  = Delay,
                    Text   = previousFrame.Text
                };

                for (int frameIndex = 0; frameIndex < frameCount; frameIndex++)
                {
                    var on = frameIndex % 2 == 0;

                    var newFrame = on ? newFrameTemplate.Copy() : previousFrame.Copy();
                    results.Add(newFrame);
                }

                var lastFrame = new DrawingInstruction
                {
                    Cursor = false,
                    Delay  = Delay,
                    Text   = previousFrame.Text
                };

                results.Add(lastFrame);
            }

            return(results);
        }
        internal override Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script)
        {
            var font = RenderingHelper.CreateFont(g, projectInstructions.FontFamily, projectInstructions.FontStyle,
                                                  projectInstructions.FontSize);

            // TODO : Can reduce size if only using typed text with draw cursor
            var text = string.Concat(Text, projectInstructions.DrawCursor ? "_" : string.Empty);

            var size = g.MeasureString(text, font).ToSize();

            return(new Measure(size));
        }
        internal override Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script)
        {
            var startText = (Start + Change).ToString();
            var endText   = (End + Change).ToString();
            var text      = startText.Length > endText.Length ? startText : endText;

            var font = RenderingHelper.CreateFont(g, projectInstructions.FontFamily, projectInstructions.FontStyle,
                                                  projectInstructions.FontSize);

            var size = g.MeasureString(text, font).ToSize();

            return(new Measure(size));
        }
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var results  = new List <DrawingInstruction>();
            var newFrame = new DrawingInstruction
            {
                Cursor = false,
                Delay  = 1,
                Text   = string.Empty
            };

            results.Add(newFrame);

            return(results);
        }
Example #8
0
        internal override Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script)
        {
            if (!DrawCursor)
            {
                return(new Measure());
            }

            var font = RenderingHelper.CreateFont(g, projectInstructions.FontFamily, projectInstructions.FontStyle,
                                                  projectInstructions.FontSize);

            var size = g.MeasureString("_", font).ToSize();

            return(new Measure(size));
        }
Example #9
0
        internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
        {
            var results = new List <DrawingInstruction>();

            for (var textIndex = 0; textIndex < Text.Length; textIndex++)
            {
                var previousFrame = results.Count == 0
                                        ? PreviousFrame(currentInstructions)
                                        : results[results.Count - 1];

                var current = string.Concat(previousFrame.Text, Text[textIndex]);

                var newFrame = new DrawingInstruction
                {
                    Cursor = projectInstructions.DrawCursor,
                    Delay  = Delay,
                    Text   = current
                };

                results.Add(newFrame);
            }

            if (projectInstructions.DrawCursor)
            {
                var previousFrame = results[results.Count - 1];
                var lastFrame     = new DrawingInstruction
                {
                    Cursor = false,
                    Delay  = Delay,
                    Text   = previousFrame.Text
                };

                results.Add(lastFrame);
            }

            return(results);
        }
 internal override IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions)
 {
     throw new NotSupportedException();
 }
 internal override Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script)
 {
     throw new InvalidOperationException();
 }
Example #12
0
 internal override Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script)
 {
     return(new Measure(OriginInstruction.NewRow));
 }
Example #13
0
 internal abstract IList <DrawingInstruction> CreateInstructions(ProjectInstructions projectInstructions, IList <ScriptedInstruction> script, IList <DrawingInstruction> currentInstructions);
Example #14
0
 internal abstract Measure Measure(Graphics g, ProjectInstructions projectInstructions, ScriptedInstruction[] script);