Example #1
0
 /// <summary>
 /// Creates a new TextPositionInfo instance, copying values from another instance.
 /// </summary>
 public TextPositionInfo(ITextPosition other)
 {
     if (other != null)
     {
         this._filename = other.Filename;
         this._lineNumber = other.LineNumber;
         this._linePosition = other.LinePosition;
     }
 }
Example #2
0
        public Caret(IUIStyle style, TView textInformation) : base(style)
        {
            if (textInformation == null)
            {
                throw new ArgumentNullException(nameof(textInformation));
            }

            styleDefinition = StyleSystem.StylesFor <TextStyleDefinition>();

            TextInformation = textInformation;
            TextInformation.Document.DocumentModified += UpdatePositions;
            startPosition = null;
            endPosition   = TextInformation.Document.CreatePosition(0, Bias.Backward);

            selectionHighlight = new Highlight <TDocument>(startPosition, endPosition, Style);
            textInformation.Highlighter.AddHighlight(selectionHighlight);

            blinkAnimation = new StepValue(0, 1)
            {
                Duration = 1, Loop = AnimationLoop.Loop
            };

            Style.ValueChanged += OnStyleChanged;
        }
Example #3
0
 public TextChunkView(ITextProcessingRules rules, ITextNode node, IStyle style, ITextPosition offset, ITextPosition endOffset) : base(node, style)
 {
     this.rules        = rules;
     OffsetPosition    = offset;
     EndOffsetPosition = endOffset;
 }
 private SeparatedPosition(SeparatedTextProvider provider, int currentProvider, ITextPosition currentPosition)
 {
     _provider           = provider;
     _currentSubProvider = currentProvider;
     _currentPosition    = currentPosition;
 }
Example #5
0
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 public InvalidBooleanException(ITextPosition position)
     : base(position, GetMessage(position))
 {
 }
Example #6
0
 public CPLineDataImpl(ITextPosition _pos, ICPFileData _fileData) : base(_pos, _fileData)
 {
 }
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 /// <param name="unused">The unused characters.</param>
 public UnusedException(ITextPosition position, string unused)
     : base(position, GetMessage(position, unused))
 {
 }
Example #8
0
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 /// <param name="builder">The invalid number string.</param>
 public InvalidNumberException(ITextPosition position, StringBuilder builder)
     : base(position, GetMessage(position, builder.ToString()))
 {
 }
Example #9
0
 public WrappedTextPosition(WrappedTextProvider container)
 {
     _container = container;
     _position  = container._provider.GetStartPosition();
 }
Example #10
0
 public OptionalPosition(ITextPosition position)
 {
     Position = position;
 }
 public CPLineData(ITextPosition _pos, ICPFileData _fileData)
 {
     pos      = _pos;
     fileData = _fileData;
 }
Example #12
0
 ExposingTestChunk(ITextProcessingRules rules, ITextNode node, IStyle style, ITextPosition offset, ITextPosition endOffset) : base(rules, node, style, offset, endOffset)
 {
 }
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 /// <param name="command">The unknown command.</param>
 public UnknownCommandException(ITextPosition position, string command)
     : base(position, GetMessage(position, command))
 {
 }
 public RelativeTextPosition(ITextPosition basePos, int offset)
 {
     this.basePos = basePos;
     this.offset  = offset;
 }
Example #15
0
 public override ICPLineData CreateLineCPsData(ITextPosition _pos, ICPFileData _fileData)
 {
     return(new CPLineDataImpl(_pos, _fileData));
 }
 public GluedPosition(ITextPosition left, ITextPosition right)
 {
     _left  = left;
     _right = right;
 }
Example #17
0
 private WrappedTextPosition(WrappedTextProvider container, ITextPosition position)
 {
     _container = container;
     _position  = position;
 }
 ///<summary>
 /// Creates a new instance of <see cref="ConfigXmlAttribute"/>, storing a copy of the passed
 /// <paramref name="currentTextPositionPositionInfo"/>.
 ///</summary>
 public ConfigXmlAttribute(ITextPosition currentTextPositionPositionInfo, string prefix, string localName, string namespaceURI, XmlDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     // TODO: for NET 2.0 may check for "System.Configuration.Internal.IConfigErrorInfo"
     _textPositionInfo = new TextPositionInfo(currentTextPositionPositionInfo);
 }
Example #19
0
 public static ITextPosition NextColumn(this ITextPosition value)
 {
     return(new TextPosition(value.LineNumber, value.ColumnNumber + 1));
 }
Example #20
0
 public PasswordChunkView(ITextProcessingRules rules, ITextNode node, IStyle style, ITextPosition offset, ITextPosition endOffset, string passwordCharacter)
     : base(rules, node, style, offset, endOffset)
 {
     PasswordCharacter = passwordCharacter;
 }
Example #21
0
 public static ITextPosition NextLine(this ITextPosition value)
 {
     return(new TextPosition(value.LineNumber + 1, 1));
 }
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 public CommaException(ITextPosition position)
     : base(position, GetMessage(position))
 {
 }
Example #23
0
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 public CloseParenthesisException(ITextPosition position)
     : base(position, GetMessage(position))
 {
 }
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 /// <param name="op">The invalid operator.</param>
 public UnknownOpException(ITextPosition position, string op)
     : base(position, GetMessage(position, op))
 {
 }
 ///<summary>
 /// Creates a new instance of <see cref="ConfigXmlElement"/>, storing a copy of the passed
 /// <paramref name="currentTextPositionPositionInfo"/>.
 ///</summary>
 public ConfigXmlElement(ITextPosition currentTextPositionPositionInfo, string prefix, string localName, string namespaceURI, XmlDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     _textPositionInfo = new TextPositionInfo(currentTextPositionPositionInfo);
 }
 public ImmutableLeafTextNode(ITextDocument document, ITextPosition offset, ITextPosition endOffset)
 {
     Document       = document;
     this.offset    = offset;
     this.endOffset = endOffset;
 }
Example #27
0
 public abstract ICPLineData CreateLineCPsData(ITextPosition _pos, ICPFileData _fileData);
 ///<summary>
 /// Creates a new instance of <see cref="ConfigXmlAttribute"/>, storing a copy of the passed 
 /// <paramref name="currentTextPositionPositionInfo"/>.
 ///</summary>
 public ConfigXmlAttribute(ITextPosition currentTextPositionPositionInfo, string prefix, string localName, string namespaceURI, XmlDocument doc) 
     : base(prefix, localName, namespaceURI, doc)
 {
     // TODO: for NET 2.0 may check for "System.Configuration.Internal.IConfigErrorInfo"
     _textPositionInfo = new TextPositionInfo(currentTextPositionPositionInfo);
 }
Example #29
0
 /// <summary>
 /// Creates a new exception.
 /// </summary>
 /// <param name="position">Where the exception occured.</param>
 /// <param name="str">The message.</param>
 public ParseException(ITextPosition position, string str)
     : base(position, GetMessage(position, str))
 {
 }
Example #30
0
 public ITextPosition Move(int offset)
 {
     if (offset == 0)
     {
         return(Clone());
     }
     if (offset > 0)
     {
         ITextItem nextitem   = item;
         int       nextline   = line;
         int       nextcolumn = column;
         string    rightpart  = RightPart;
         if (offset <= rightpart.Length)
         {
             rightpart = rightpart.Substring(0, offset);
             RefNextLineColumn(rightpart, ref nextline, ref nextcolumn);
             return(new TextPosition()
             {
                 Item = nextitem, ItemIndex = this.itemindex + offset, Line = nextline, Column = nextcolumn
             });
         }
         RefNextLineColumn(rightpart, ref nextline, ref nextcolumn);
         offset -= rightpart.Length;
         while (nextitem?.Parent != null)
         {
             ITextZone     zone   = nextitem.Parent;
             ITextPosition result = GetNextOffset(zone, nextitem.ID + 1, ref offset, ref nextline, ref nextcolumn);
             if (result != null)
             {
                 return(result);
             }
             nextitem = zone;
         }
     }
     else
     {
         offset = -offset;
         ITextItem previtem   = item;
         int       prevline   = line;
         int       prevcolumn = column;
         string    leftpart   = LeftPart;
         if (offset <= leftpart.Length)
         {
             leftpart = leftpart.Substring(leftpart.Length - offset);
             RefPrevLineColumn(leftpart, ref prevline, ref prevcolumn);
             return(new TextPosition()
             {
                 Item = previtem, ItemIndex = this.itemindex - offset, Line = prevline, Column = prevcolumn
             });
         }
         RefPrevLineColumn(leftpart, ref prevline, ref prevcolumn);
         offset -= leftpart.Length;
         while (previtem?.Parent != null)
         {
             ITextZone     zone   = previtem.Parent;
             ITextPosition result = GetPrevOffset(zone, previtem.ID - 1, ref offset, ref prevline, ref prevcolumn);
             if (result != null)
             {
                 return(result);
             }
             previtem = zone;
         }
     }
     return(null);
 }
Example #31
0
        public ITextPosition MoveLine(int lineoffset)
        {
            if (lineoffset == 0)
            {
                return(Clone());
            }
            if (lineoffset > 0)
            {
                ITextItem nextitem   = item;
                int       nextline   = line;
                int       nextcolumn = column;
                string    rightpart  = RightPart;
                int       nextindex  = RefNextLine(rightpart, ref lineoffset, ref nextline, ref nextcolumn);
                if (nextindex >= 0)
                {
                    return new TextPosition()
                           {
                               Item = nextitem, ItemIndex = itemindex + nextindex + 1, Line = nextline, Column = nextcolumn
                           }
                }
                ;
                while (nextitem?.Parent != null)
                {
                    ITextZone zone = nextitem.Parent;

                    ITextPosition result = MoveNextLine(zone, nextitem.ID + 1, ref lineoffset, ref nextline, ref nextcolumn);
                    if (result != null)
                    {
                        return(result);
                    }
                    nextitem = zone;
                }
            }
            else
            {
                lineoffset = -lineoffset;
                ITextItem previtem   = item;
                int       prevline   = line;
                int       prevcolumn = column;
                string    leftpart   = LeftPart;
                int       previndex  = RefPrevLine(leftpart, ref lineoffset, ref prevline, ref prevcolumn);
                if (previndex >= 0)
                {
                    return new TextPosition()
                           {
                               Item = previtem, ItemIndex = previndex, Line = prevline, Column = prevcolumn
                           }
                }
                ;
                while (previtem?.Parent != null)
                {
                    ITextZone zone = previtem.Parent;

                    ITextPosition result = MovePrevLine(zone, previtem.ID - 1, ref lineoffset, ref prevline, ref prevcolumn);
                    if (result == null)
                    {
                        return(result);
                    }
                    previtem = zone;
                }
            }
            return(null);
        }
Example #32
0
 ///<summary>
 /// Creates a new instance of <see cref="ConfigXmlElement"/>, storing a copy of the passed 
 /// <paramref name="currentTextPositionPositionInfo"/>.
 ///</summary>
 public ConfigXmlElement(ITextPosition currentTextPositionPositionInfo, string prefix, string localName, string namespaceURI, XmlDocument doc) 
     : base(prefix, localName, namespaceURI, doc)
 {
     _textPositionInfo = new TextPositionInfo(currentTextPositionPositionInfo);
 }
Example #33
0
            public CPTraceVar CalcInjectionPoints(CPClassLayout cpClassLayout, string className, string _fname, ITextPosition pos, out bool needDeclare)
            {
                CPTraceVar traceVar = null;

                if (!cpClassLayout.traceVarPos.TryGetValue(name, out traceVar))
                {
                    needDeclare = true;
                    // add trace pos data
                    traceVar = new CPTraceVar()
                    {
                        name       = name,
                        uniqueName = uniqueName,
                        type       = type,
                        className  = className
                    };
                    cpClassLayout.traceVarPos.Add(traceVar.name, traceVar);
                    // define trace var definition placement
                    traceVar.defPos.fileName    = ent.ProjectItem.Name;
                    traceVar.defPos.pos.lineNum = ent.EndPoint.Line;           // - 1;
                    traceVar.defPos.pos.linePos = ent.EndPoint.LineCharOffset; // - 1;
                }
                else
                {
                    needDeclare = false;
                }
                // add trace pos
                traceVar.traceVarTracePos.Add(new FilePosPnt()
                {
                    fileName = _fname,
                    pos      = { lineNum = pos.lineNum, linePos = pos.linePos }
                });
                // check and add if need file containing original variable declaration
                TextPos traceInclPos = null;

                if (!cpClassLayout.traceInclPos.TryGetValue(ent.ProjectItem.Name, out traceInclPos))
                {
                    cpClassLayout.traceInclPos.Add(ent.ProjectItem.Name, new TextPos()
                    {
                        lineNum = 0, linePos = 0
                    });
                }

                return(traceVar);
            }