Example #1
0
 public void OnText(TextBlockInfo info)
 {
     string text = FixBoxChars(info.Text);
     if (string.IsNullOrEmpty(text))
         return;
     if (info.ChangeType == ChangeType.None)
     {
         Run r = BuildRun(text);
         r.Foreground = Brushes.Black;
         AddItem(info.RTL, r);
         ApplyHighlight(ChangeType.None, info.Highlight || info.InComment, r);
     }
     else
     {
         m_currentHighlight = GetHighlight(info.ChangeType);
         Inline r = BuildRun(BuildTaggedString(text));
         r = BuildDecoratedVersion(r);
         r.Tag = ChangeTag;
         r.FontFamily = GetFont(info.Font);
         AddItem(info.RTL, r);
         r.Foreground = m_currentHighlight.ForegroundBrush;
         r.Background = m_currentHighlight.BackgroundBrush;
         ApplyHighlight(info.ChangeType, info.Highlight, r);
     }
 }
Example #2
0
        private HighlightStyle LoadStyleChangeLabel()
        {
            HighlightStyle result = new HighlightStyle();
            ColorPair cp = new ColorPair();
            cp.Foreground = ColorTranslator.FromOle(GetInt("StyleChangedLabelColour"));
            cp.Background = Colors.White;
            cp.EnsureTextIsDarkOnLightNotLightOnDark();
            result.SetBrushes(cp);

            return result;
        }
Example #3
0
        private HighlightStyle LoadStyle(string name, string colorName, bool loadFormat, bool loadStartEndChars)
        {
            HighlightStyle result = new HighlightStyle();
            if (loadFormat)
                result.FontFormat = (WSFontFormat)GetInt(name + "Format");

            ColorPair cp = new ColorPair();
            cp.Foreground = ColorTranslator.FromOle(GetInt(colorName + "Colour"));
            cp.Background = ColorTranslator.FromOle(GetInt(colorName + "BackgroundColour"));
            cp.EnsureTextIsDarkOnLightNotLightOnDark();

            result.SetBrushes(cp);

            if (loadStartEndChars)
            {
                result.StartChar = (char)(short)GetInt(name + "SurroundStart");
                result.EndChar = (char)(short)GetInt(name + "SurroundEnd");
            }
            return result;
        }
Example #4
0
 public void BuildBrushes()
 {
     InsertStyle = LoadStyle("InsertedText", true);
     DeleteStyle = LoadStyle("DeletedText", true);
     MoveSourceStyle = LoadMoveStyle("From");
     MoveDestStyle = LoadMoveStyle("To");
     FormatChangeStyle = LoadStyle("FontChange", "FontChangeText", false, true);
     StyleChangeLabelStlye = LoadStyleChangeLabel();
     StyleChangeTextStyle = LoadStyle("StyleChanged", "StyleChanged", true, false);
     MovedDeletionStyle = new HighlightStyle() { ForegroundBrush = new SolidColorBrush(Colors.DeepPink) };
     InsertedCommentStyle = LoadStyle("InsertedText", true);
     DeletedCommentStyle = LoadStyle("DeletedText", true);
     CommentStyle = new HighlightStyle();
     InsertedCommentStyle.BackgroundBrush = DeletedCommentStyle.BackgroundBrush = CommentStyle.BackgroundBrush = Brushes.Yellow;
 }