Style of chars
This is base class for all text and design renderers
Inheritance: IDisposable
 /// <summary>
 /// Default Constructor
 /// </summary>
 public InputWindow()
 {
     InitializeComponent();
     tbInput.KeyDown += tbInput_KeyDown;
     LabelStyle=new TextStyle(Brushes.Blue,null,FontStyle.Regular);
     ReadOnlyStyle = new ReadOnlyStyle();
     tbInput.WideCaret = true;
 }
Beispiel #2
0
 public override void ReApplyStyles()
 {
     this.VocabStyle = new TextStyle(DataManager.settings.VocabStyle.ForeBrush, DataManager.settings.VocabStyle.BackgroundBrush, DataManager.settings.VocabStyle.FontStyle);
     this.CommandStyle = new TextStyle(DataManager.settings.CommandStyle.ForeBrush, DataManager.settings.CommandStyle.BackgroundBrush, DataManager.settings.CommandStyle.FontStyle);
     this.ResponseStyle = new TextStyle(DataManager.settings.ResponseStyle.ForeBrush, DataManager.settings.ResponseStyle.BackgroundBrush, DataManager.settings.ResponseStyle.FontStyle);
     this.ParanthesisStyle = new TextStyle(DataManager.settings.ParanthesisStyle.ForeBrush, DataManager.settings.ParanthesisStyle.BackgroundBrush, DataManager.settings.ParanthesisStyle.FontStyle);
     this.GotoStyle = new TextStyle(DataManager.settings.GotoStyle.ForeBrush, DataManager.settings.GotoStyle.BackgroundBrush, DataManager.settings.GotoStyle.FontStyle);
     this.CheckFlagStyle = new TextStyle(DataManager.settings.CheckFlagStyle.ForeBrush, DataManager.settings.CheckFlagStyle.BackgroundBrush, DataManager.settings.CheckFlagStyle.FontStyle);
     this.FragmentStyle = new TextStyle(DataManager.settings.FragmentStyle.ForeBrush, DataManager.settings.FragmentStyle.BackgroundBrush, DataManager.settings.FragmentStyle.FontStyle);
     this.Redraw();
 }
 private void Log(string text, Style style)
 {
     //some stuffs for best performance
     fctb.BeginUpdate();
     fctb.Selection.BeginUpdate();
     //remember user selection
     var userSelection = fctb.Selection.Clone();
     //add text with predefined style
     fctb.AppendText(text, style);
     //restore user selection
     if (!userSelection.IsEmpty || userSelection.Start.iLine < fctb.LinesCount - 2)
     {
         fctb.Selection.Start = userSelection.Start;
         fctb.Selection.End = userSelection.End;
     }
     else
         fctb.GoEnd();//scroll to end of the text
     //
     fctb.Selection.EndUpdate();
     fctb.EndUpdate();
 }
 private void Log(string text, Style style)
 {
     //some stuffs for best performance
     fctb.BeginUpdate();
     fctb.Selection.BeginUpdate();
     //remember user selection
     var userSelection = fctb.Selection.Clone();
     //goto end of the text
     fctb.Selection.Start = fctb.LinesCount > 0?new Place(fctb[fctb.LinesCount - 1].Count, fctb.LinesCount - 1):new Place(0, 0);
     //add text with predefined style
     fctb.InsertText(text, style);
     //restore user selection
     if (userSelection.Start != userSelection.End || userSelection.Start.iLine < fctb.LinesCount - 2)
     {
         fctb.Selection.Start = userSelection.Start;
         fctb.Selection.End = userSelection.End;
     }
     else
         fctb.DoCaretVisible();//scroll to end of the text
     //
     fctb.Selection.EndUpdate();
     fctb.EndUpdate();
 }
        private void miChangeColors_Click(object sender, EventArgs e)
        {
            var styles = new Style[] { fctb.SyntaxHighlighter.BlueBoldStyle, fctb.SyntaxHighlighter.BlueStyle, fctb.SyntaxHighlighter.BoldStyle, fctb.SyntaxHighlighter.BrownStyle, fctb.SyntaxHighlighter.GrayStyle, fctb.SyntaxHighlighter.GreenStyle, fctb.SyntaxHighlighter.MagentaStyle, fctb.SyntaxHighlighter.MaroonStyle, fctb.SyntaxHighlighter.RedStyle };
            fctb.SyntaxHighlighter.AttributeStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.ClassNameStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.CommentStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.CommentTagStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.KeywordStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.NumberStyle = styles[rnd.Next(styles.Length)];
            fctb.SyntaxHighlighter.StringStyle = styles[rnd.Next(styles.Length)];

            fctb.OnSyntaxHighlight(new TextChangedEventArgs(fctb.Range));
        }
 public static bool cursorIsOnTextOfStyle(Place place, Style style, FastColoredTextBox editor)
 {
     return editor.GetStylesOfChar(place).Contains(style);
 }
 public void InitStyleSchema(Language lang)
 {
     switch (lang)
     {
         case Language.CSharp:
             StringStyle = BrownStyle;
             CommentStyle = GreenStyle;
             NumberStyle = MagentaStyle;
             AttributeStyle = GreenStyle;
             ClassNameStyle = BoldStyle;
             KeywordStyle = BlueStyle;
             CommentTagStyle = GrayStyle;
             break;
         case Language.VB:
             StringStyle = BrownStyle;
             CommentStyle = GreenStyle;
             NumberStyle = MagentaStyle;
             ClassNameStyle = BoldStyle;
             KeywordStyle = BlueStyle;
             break;
         case Language.HTML:
             CommentStyle = GreenStyle;
             TagBracketStyle = BlueStyle;
             TagNameStyle = MaroonStyle;
             AttributeStyle = RedStyle;
             AttributeValueStyle = BlueStyle;
             HtmlEntityStyle = RedStyle;
             break;
         case Language.JS:
             StringStyle = BrownStyle;
             CommentStyle = GreenStyle;
             NumberStyle = MagentaStyle;
             KeywordStyle = BlueStyle;
             KeywordStyle = BlueStyle;
             break;
         case Language.PHP:
             StringStyle = RedStyle;
             CommentStyle = GreenStyle;
             NumberStyle = RedStyle;
             VariableStyle = MaroonStyle;
             KeywordStyle = MagentaStyle;
             KeywordStyle2 = BlueStyle;
             KeywordStyle3 = GrayStyle;
             break;
         case Language.SQL:
             StringStyle = RedStyle;
             CommentStyle = GreenStyle;
             NumberStyle = MagentaStyle;
             KeywordStyle = BlueStyle;
             StatementsStyle = BlueBoldStyle;
             FunctionsStyle = MaroonStyle;
             VariableStyle = MaroonStyle;
             TypesStyle = BrownStyle;
             break;
     }
 }
Beispiel #8
0
        private void UpdateConsole(string msg, Style s)
        {
            try
            {
                if (rtbConOut.InvokeRequired)
                {
                    // This is a worker thread so delegate the task.
                    rtbConOut.Invoke(new UpdateConsoleDelegate(this.UpdateConsole),msg, s);
                }
                else
                {
                    // This is the UI thread so perform the task.
                    msg = msg + Environment.NewLine;
                    rtbConOut.InsertText(msg, s);
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
Beispiel #9
0
 /// <summary>
 ///     Highlights Invisble Characters
 /// </summary>
 /// <param name="r"></param>
 private void HighlightInvisbleCharacters(Range r)
 {
     if (!Globals.Settings.HiddenChars) return;
     if (_invisibleCharsStyle == null)
         _invisibleCharsStyle = new InvisibleCharsRenderer(Pens.Gray);
     r.ClearStyle(_invisibleCharsStyle);
     r.SetStyle(_invisibleCharsStyle, @".$|.\r\n|\s");
 }
Beispiel #10
0
        private static string StyleToString(Style style)
        {
            TextStyle  s  = (TextStyle )style;
            if (s == null) return "null";
            SolidBrush bf = (SolidBrush)s.ForeBrush;
            SolidBrush bb = (SolidBrush)s.BackgroundBrush;

            string font = "";
            font = s.FontStyle.ToString();

            string result = "{";
            result += (bf == null) ? "" : "fore:"+ColorToString(bf.Color)+";";
            result += (bb == null) ? "" : "back:"+ColorToString(bb.Color)+";";
            result += (font == "") ? "" : "font:"+ font + ";";
            return result+"}";
        }
Beispiel #11
0
 // > By WendyH ------------------------------------------
 public void InitStyleSchema(Language lang)
 {
     FunctionsStyle    = null;
     DeclFunctionStyle = null;
     VariableStyle     = null;
     ConstantsStyle    = null;
     switch (lang) {
         case Language.CSharp:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             AttributeStyle  = GreenStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             CommentTagStyle = GrayStyle;
             break;
         case Language.VB:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             break;
         case Language.HTML:
             CommentStyle        = GreenStyle;
             TagBracketStyle     = BlueStyle;
             TagNameStyle        = MaroonStyle;
             AttributeStyle      = RedStyle;
             AttributeValueStyle = BlueStyle;
             HtmlEntityStyle     = RedStyle;
             break;
         case Language.XML:
             CommentStyle           = GreenStyle;
             XmlTagBracketStyle     = BlueStyle;
             XmlTagNameStyle        = MaroonStyle;
             XmlAttributeStyle      = RedStyle;
             XmlAttributeValueStyle = BlueStyle;
             XmlEntityStyle         = RedStyle;
             XmlCDataStyle          = BlackStyle;
             break;
         case Language.JS:
             StringStyle  = BrownStyle;
             CommentStyle = GreenStyle;
             NumberStyle  = MagentaStyle;
             KeywordStyle = BlueStyle;
             break;
         case Language.Lua:
             StringStyle    = BrownStyle;
             CommentStyle   = GreenStyle;
             NumberStyle    = MagentaStyle;
             KeywordStyle   = BlueBoldStyle;
             FunctionsStyle = MaroonStyle;
             break;
         case Language.PHP:
             StringStyle   = RedStyle;
             CommentStyle  = GreenStyle;
             NumberStyle   = RedStyle;
             VariableStyle = MaroonStyle;
             KeywordStyle  = MagentaStyle;
             KeywordStyle2 = BlueStyle;
             KeywordStyle3 = GrayStyle;
             break;
         case Language.SQL:
             StringStyle     = RedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueBoldStyle;
             StatementsStyle = BlueBoldStyle;
             FunctionsStyle  = MaroonStyle;
             VariableStyle   = MaroonStyle;
             TypesStyle      = BrownStyle;
             break;
         // By WendyH < -------------------------------
         case Language.CPPScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             AttributeStyle  = GreenStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             CommentTagStyle = GrayStyle;
             break;
         case Language.PascalScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             break;
         case Language.BasicScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             break;
         case Language.JScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueStyle;
             break;
         case Language.YAML:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = WendyHsLiteStyle;
             KeywordStyle    = BlueBoldStyle;
             TagBracketStyle = DarkOrangeStyle;
             break;
             // By WendyH > -------------------------------
     }
     InitStyleTheme();
 }
 // > By WendyH ------------------------------------------
 public void InitStyleSchema(Language lang)
 {
     FunctionsStyle    = null;
     DeclFunctionStyle = null;
     VariableStyle     = null;
     ConstantsStyle    = null;
     PunctuationSyle   = null;
     switch (lang) {
         case Language.CSharp:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             AttributeStyle  = GreenStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             CommentTagStyle = GrayStyle;
             break;
         case Language.VB:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.HTML:
             CommentStyle        = GreenStyle;
             TagBracketStyle     = BlueStyle;
             TagNameStyle        = MaroonStyle;
             AttributeStyle      = RedStyle;
             AttributeValueStyle = BlueStyle;
             HtmlEntityStyle     = RedStyle;
             break;
         case Language.XML:
             CommentStyle        = GreenStyle;
             XmlTagBracketStyle  = BlueStyle;
             XmlTagNameStyle     = MaroonStyle;
             XmlAttributeStyle   = RedStyle;
             XmlAttributeValueStyle = BlueStyle;
             XmlEntityStyle      = RedStyle;
             XmlCDataStyle       = BlackStyle;
             break;
         case Language.JS:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.Lua:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueBoldStyle;
             TypesStyle      = BlueStyle;
             FunctionsStyle  = MaroonStyle;
             break;
         case Language.PHP:
             StringStyle     = RedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = RedStyle;
             VariableStyle   = MaroonStyle;
             KeywordStyle    = MagentaStyle;
             KeywordStyle2   = BlueStyle;
             KeywordStyle3   = GrayStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.SQL:
             StringStyle     = RedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueBoldStyle;
             StatementsStyle = BlueBoldStyle;
             FunctionsStyle  = MaroonStyle;
             VariableStyle   = MaroonStyle;
             TypesStyle      = BrownStyle;
             break;
         // By WendyH < -------------------------------
         case Language.CPPScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             AttributeStyle  = GreenStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             CommentTagStyle = GrayStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.PascalScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = new TextStyle(null, null, AltPascalKeywordsHighlight ? FontStyle.Bold | FontStyle.Underline : FontStyle.Bold);
             TypesStyle      = BlueStyle;
             break;
         case Language.BasicScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.JScript:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             break;
         case Language.YAML:
             StringStyle     = DarkRedStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             ClassNameStyle  = WendyHsLiteStyle;
             KeywordStyle    = BlueBoldStyle;
             TypesStyle      = BlueStyle;
             TagBracketStyle = DarkOrangeStyle;
             break;
         case Language.Custom:
             StringStyle     = BrownStyle;
             CommentStyle    = GreenStyle;
             NumberStyle     = MagentaStyle;
             AttributeStyle  = GreenStyle;
             ClassNameStyle  = VSClassStyle;
             KeywordStyle    = BlueStyle;
             TypesStyle      = BlueStyle;
             CommentTagStyle = GrayStyle;
             break;
         // By WendyH > -------------------------------
     }
     InitStyleTheme(lang);
     if ((lang == Language.PascalScript) && (KeywordStyle != null))
         KeywordStyle = new TextStyle(((TextStyle)KeywordStyle).ForeBrush, ((TextStyle)KeywordStyle).BackgroundBrush, ((TextStyle)KeywordStyle).FontStyle | FontStyle.Bold | (AltPascalKeywordsHighlight ? FontStyle.Underline : FontStyle.Regular));
     if ((lang == Language.BasicScript) && (KeywordStyle != null))
         KeywordStyle = new TextStyle(((TextStyle)KeywordStyle).ForeBrush, ((TextStyle)KeywordStyle).BackgroundBrush, ((TextStyle)KeywordStyle).FontStyle | FontStyle.Bold);
     StringStyle = RedStringsHighlight ? RedStyle : StringStyle; // By WendyH
 }
 public StyleVisualMarker(Rectangle rectangle, Style style)
     : base(rectangle)
 {
     this.Style = style;
 }
 public VisualMarkerEventArgs(Style style, StyleVisualMarker marker, MouseEventArgs args)
     : base(args.Button, args.Clicks, args.X, args.Y, args.Delta)
 {
     this.Style  = style;
     this.Marker = marker;
 }
Beispiel #15
0
        private void Log(string text, Style style)
        {
            //remember user selection

            //add text with predefined style
            fctb.TextSource.CurrentTB = fctb;
            if (curLength > maxChars) {
                fctb.Clear();
                curLength = 0;
            }
            curLength += text.Length;
            fctb.AppendText(text, style);
            //restore user selection

            lastLogAdded = DateTime.Now;
        }
Beispiel #16
0
 public StyleVisualMarker(Rectangle rectangle, Style style)
     : base(rectangle)
 {
     this.Style = style;
 }
Beispiel #17
0
 public VisualMarkerEventArgs(Style style, StyleVisualMarker marker, MouseEventArgs args)
     : base(args.Button, args.Clicks, args.X, args.Y, args.Delta)
 {
     this.Style = style;
     this.Marker = marker;
 }
 public IncrementalSearcher()
 {
     InitializeComponent();
     _style = new MarkerStyle(new SolidBrush(Color.FromArgb(120, Color.Yellow)));
     tbFind.Focus();
 }