예제 #1
0
		public NormalizedSpan(String text, String classification, Int32 startCharacterIndex, TextFormattingRunProperties properties)
		{
			_text = text;
			_length = text.Length;
			_classification = classification;
			_startCharacterIndex = startCharacterIndex;
			_properties = properties;
			_next = (NormalizedSpan)(_previous = null);
			_canSplitOrMerge = true;
		}
		static XmlWordClassificationLookup()
		{
			Typeface typeface = new Typeface(CodeEditor.FontName);
			double fontSize = CodeEditor.FontSize;
			map[0] = new TextFormattingRunProperties(typeface, fontSize, Colors.Blue);
			map[1] = new TextFormattingRunProperties(typeface, fontSize, Colors.DarkRed);
			map[2] = new TextFormattingRunProperties(typeface, fontSize, Colors.Green);
			map[3] = new TextFormattingRunProperties(typeface, fontSize, Colors.Red);
			map[4] = new TextFormattingRunProperties(typeface, fontSize, Colors.Black);
			map[5] = new TextFormattingRunProperties(typeface, fontSize, Colors.DarkGoldenrod);
			map[6] = new TextFormattingRunProperties(typeface, fontSize, Colors.White);
		}
예제 #3
0
        public NormalizedSpan TryMergeNextSpan()
        {
            if ((!_canSplitOrMerge || (this.Next == null)) || !this.Next._canSplitOrMerge)
            {
                return(this.Next);
            }
            Boolean flag = false;

            if ((_classification == this.Next._classification) || (_properties == this.Next._properties))
            {
                flag = true;
            }
            else if (_properties.SameSize(this.Next._properties))
            {
                if (_classification == "whitespace")
                {
                    flag            = true;
                    _classification = this.Next._classification;
                    _properties     = this.Next._properties;
                }
                else if (this.Next._classification == "whitespace")
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                return(this.Next);
            }
            _text     = _text + this.Next._text;
            _length  += this.Next._length;
            this.Next = this.Next.Next;
            if (this.Next != null)
            {
                this.Next.Previous = this;
            }
            return(this);
        }
		/// <summary>
		/// </summary>
		public Boolean SameSize(TextFormattingRunProperties other)
		{
			if (!_altered)
			{
				return (_size == other._size);
			}
			return false;
		}
		/// <summary>
		/// </summary>
		public Boolean IsEquivalent(TextFormattingRunProperties other)
		{
			if ((!_altered && !other._altered) && (_typeface.Equals(other._typeface) && (_size == other._size)))
			{
				return (_foreground == other._foreground);
			}
			return false;
		}
예제 #6
0
		public NormalizedSpan TryMergeNextSpan()
		{
			if ((!_canSplitOrMerge || (this.Next == null)) || !this.Next._canSplitOrMerge)
			{
				return this.Next;
			}
			Boolean flag = false;
			if ((_classification == this.Next._classification) || (_properties == this.Next._properties))
			{
				flag = true;
			}
			else if (_properties.SameSize(this.Next._properties))
			{
				if (_classification == "whitespace")
				{
					flag = true;
					_classification = this.Next._classification;
					_properties = this.Next._properties;
				}
				else if (this.Next._classification == "whitespace")
				{
					flag = true;
				}
			}
			if (!flag)
			{
				return this.Next;
			}
			_text = _text + this.Next._text;
			_length += this.Next._length;
			this.Next = this.Next.Next;
			if (this.Next != null)
			{
				this.Next.Previous = this;
			}
			return this;
		}
예제 #7
0
 public NormalizedSpan(String text, String classification, Int32 startCharacterIndex, TextFormattingRunProperties properties)
 {
     _text                = text;
     _length              = text.Length;
     _classification      = classification;
     _startCharacterIndex = startCharacterIndex;
     _properties          = properties;
     _next                = (NormalizedSpan)(_previous = null);
     _canSplitOrMerge     = true;
 }