Ejemplo n.º 1
0
 private void HighlightVisibleRange()
 {
     //expand visible range (+- margin)
     var startLine = Math.Max(0, fctb.VisibleRange.Start.iLine - margin);
     var endLine = Math.Min(fctb.LinesCount - 1, fctb.VisibleRange.End.iLine + margin);
     var range = new Range(fctb, 0, startLine, 0, endLine);
     //clear folding markers
     range.ClearFoldingMarkers();
     //set markers for folding
     range.SetFoldingMarkers(@"N\d\d00", @"N\d\d99");
     //
     range.ClearStyle(StyleIndex.All);
     range.SetStyle(fctb.SyntaxHighlighter.BlueStyle, @"N\d+");
     range.SetStyle(fctb.SyntaxHighlighter.RedStyle, @"[+\-]?[\d\.]+\d+");
 }
Ejemplo n.º 2
0
        public void highlight(Range r)
        {
            ClearStyles(r);

            if (TabMode == _4Hud.TabMode.res)
            {
                r.SetStyle(CommentStyle, @"//.*$", RegexOptions.Multiline);

                r.SetStyle(ColorStyle1, @"""?\d+\s+\d+\s+\d+(\s+\d+)?""?");
                r.SetStyle(ColorNameStyle, @"(?<range>""?[\w]+""?)\s+""?\d+\s+\d+\s+\d+(\s+\d+)?""?");
                //r.SetStyle(ColorStyle2, @"\d+\s+\d+\s+\d+", RegexOptions.Singleline);
                //r.SetStyle(ColorNameStyle, @"(?<range>""?[\w]+""?)\d+\s+\d+\s+\d+", RegexOptions.Singleline);

                r.SetStyle(MinModeStyle, @"\s*""\w+(?<range>_minmode)""");

                r.SetStyle(PosStyle1, @"(""xpos(_minmode)?""|""ypos(_minmode)?"")\s+""(l|r|c|t|b)?-?\d+""");
                r.SetStyle(PosStyle2, @"(""wide(_minmode)?""|""tall(_minmode)?"")\s+""(\d+|f0)""");
                r.SetStyle(PosStyle1, @"""zpos(_minmode)?""\s+""(-?\d+)""");

                r.SetStyle(EnabledStyle, @"(?<range>(""visible(_minmode)?""|""enabled(_minmode)?""))\s+""1""");
                r.SetStyle(DisabledStyle, @"(?<range>(""visible(_minmode)?""|""enabled(_minmode)?""))\s+""0""");
                r.SetStyle(EnabledStyle, @"(""visible(_minmode)?""|""enabled(_minmode)?"")\s+(?<range>""1"")");
                r.SetStyle(DisabledStyle, @"(""visible(_minmode)?""|""enabled(_minmode)?"")\s+(?<range>""0"")");

                r.ClearFoldingMarkers();
                r.SetFoldingMarkers("{", "}");
                //r.SetFoldingMarkers(@"#region\b", @"#endregion\b");
            }
            else if (TabMode == _4Hud.TabMode.none)
            {
                r.SetStyle(CommentStyle, @"//.*$", RegexOptions.Multiline);
            }
            else if (TabMode == _4Hud.TabMode.info)
            {
                r.ClearStyle(NameStyle);

                r.SetStyle(CommentStyle, @"^//.*$", RegexOptions.Multiline);

                r.SetStyle(PosStyle1, "(?<range>^(" + InfoKeywords + "))(=|$)", RegexOptions.Multiline);
                r.SetStyle(PosStyle2, "(?<range>^[^\n=]+)(=|$)", RegexOptions.Multiline);

                //r.SetStyle(EnabledStyle, @"^url=(?<range>((http://teamfortress\.tv/|http://etf2l\.org/|http://steamcommunity\.com/groups/)).*)", RegexOptions.Multiline);
                //r.SetStyle(UnderlinedStyle, @"^url=(?<range>(?!http://).+)", RegexOptions.Multiline);
            }
        }