private static HighlightingColor AsFrozen(HighlightingColor color)
 {
     if (!color.IsFrozen)
     {
         color.Freeze();
     }
     return(color);
 }
Exemplo n.º 2
0
 public static HighlightingColor AsFrozen(this HighlightingColor color)
 {
     if (!color.IsFrozen)
     {
         color.Freeze();
     }
     return(color);
 }
Exemplo n.º 3
0
 public void BeginSpan(HighlightingColor highlightingColor)
 {
     WriteIndent();
     if (currentColorBegin > -1)
     {
         HighlightingModel.SetHighlighting(currentColorBegin, b.Length - currentColorBegin, currentColor);
     }
     colorStack.Push(currentColor);
     currentColor      = currentColor.Clone();
     currentColorBegin = b.Length;
     currentColor.MergeWith(highlightingColor);
     currentColor.Freeze();
 }
Exemplo n.º 4
0
        private void BeginSpan(HighlightingColor highlightingColor)
        {
            if (textOutput != null)
            {
                textOutput.BeginSpan(highlightingColor);
                return;
            }

            if (currentColorBegin > -1)
            {
                HighlightingModel.SetHighlighting(currentColorBegin, locatable.Length - currentColorBegin, currentColor);
            }
            colorStack.Push(currentColor);
            currentColor      = currentColor.Clone();
            currentColorBegin = locatable.Length;
            currentColor.MergeWith(highlightingColor);
            currentColor.Freeze();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Converts <paramref name="self"/> to a <see cref="HighlightingColor"/> instance or null
        /// if input is null
        /// </summary>
        /// <param name="self">This</param>
        /// <returns></returns>
        public static HighlightingColor ToHighlightingColor(this IThemeColor self)
        {
            if (self == null)
            {
                return(null);
            }
            var hl = new HighlightingColor {
                Name       = self.Name,
                FontWeight = self.FontWeight,
                FontStyle  = self.FontStyle,
                Underline  = null,
                Foreground = MyHighlightingBrush.Create(self.Foreground),
                Background = MyHighlightingBrush.Create(self.Background),
            };

            hl.Freeze();
            return(hl);
        }