예제 #1
0
 //=========================================================================================
 internal StateParser(StateScanner scanner)
     : this()
 {
     this.Scanner  = scanner;
     this.Spec     = new ParserSpecification();
     this.Settings = new NonSyntaxSettings();
 }
예제 #2
0
        //=========================================================================================
        public StateParser(SyntaxSettings settings, int tabsize)
            : this()
        {
            this.Settings = settings;
            ScannerSpecification oScannerSpec = this.Settings.CreateScannerSpecification();

            this.Scanner = new StateScanner(oScannerSpec, tabsize);
            this.Spec    = this.Settings.CreateParserSpecification(oScannerSpec);
        }
예제 #3
0
        public void Getting_style_by_name()
        {
            CodeViewer oViewer = new CodeViewer();

            oViewer.Language = PredefinedLanguage.MsSql;
            oViewer.Text     = Script;

            SyntaxSettings oSettings = oViewer.SyntaxSettings;

            TextStyle oStyle = oSettings.GetStyleByName(SyntaxSettings.S_KEYWORDS_1);

            Assert.AreEqual(oStyle.ForeColor, Color.Blue);
        }
		public void Initialize()
		{
			SyntaxSettings settings = new SyntaxSettings();
			settings.BeginTag = "<b>";
			settings.EndTag = "</b>";
			settings.ConditionalStartCommand = "kui";
			settings.ConditionalElseCommand = "muidu";
			settings.ConditionalEndCommand = "/kui";
			settings.LoopStartCommand = "tsükkel";
			settings.LoopEndCommand = "/tsükkel";

			this.Engine = new TemplateProcessingEngine(settings);
		}
예제 #5
0
 public void FixupReferences(SyntaxSettings Owner)
 {
     this.owner          = Owner;
     this.Font           = new System.Drawing.Font(this.fontName, this.fontSize, this.fontStyle);
     this.NavOptions     = this.navigateOptions;
     this.ScrollBars     = this.scrollBars;
     this.SelOptions     = this.selectionOptions;
     this.GutterOptions  = this.gutterOptions;
     this.OutlineOptions = this.outlineOptions;
     this.ShowGutter     = this.showGutter;
     this.ShowMargin     = this.showMargin;
     this.HighlightUrls  = this.highlightUrls;
     this.AllowOutlining = this.allowOutlining;
     this.UseSpaces      = this.useSpaces;
     this.WordWrap       = this.wordWrap;
     this.GutterWidth    = this.gutterWidth;
     this.MarginPos      = this.marginPos;
     this.TabStops       = this.tabStops;
     this.LexStyles      = this.lexStyles;
 }
예제 #6
0
 public XmlSyntaxSettingsInfo(SyntaxSettings Owner) : this()
 {
     this.owner = Owner;
 }
예제 #7
0
        //========================================================================================
        // SetOptions()
        //========================================================================================

        public void SetOptions()
        {
            string fontName = UserOptions.GetString("editor/editorFonts/font/family");
            int    fontSize = UserOptions.GetInt("editor/editorFonts/font/size");

            editor.Font = new Font(fontName, fontSize);

            bool            beyondEof       = UserOptions.GetBoolean("editor/general/beyondEof");
            bool            beyondEoln      = UserOptions.GetBoolean("editor/general/beyondEoln");
            NavigateOptions navigateOptions = NavigateOptions.DownAtLineEnd | NavigateOptions.UpAtLineBegin;

            if (beyondEof)
            {
                navigateOptions |= NavigateOptions.BeyondEof;
            }
            if (beyondEoln)
            {
                navigateOptions |= NavigateOptions.BeyondEol;
            }
            editor.NavigateOptions = navigateOptions;

            editor.IndentOptions = IndentOptions.AutoIndent;

            bool verticalScroll   = UserOptions.GetBoolean("editor/general/verticalScroll");
            bool horizontalScroll = UserOptions.GetBoolean("editor/general/horizontalScroll");

            if (verticalScroll && horizontalScroll)
            {
                editor.Scrolling.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
            }
            else if (verticalScroll)
            {
                editor.Scrolling.ScrollBars = RichTextBoxScrollBars.ForcedVertical;
            }
            else if (horizontalScroll)
            {
                editor.Scrolling.ScrollBars = RichTextBoxScrollBars.ForcedHorizontal;
            }
            else
            {
                editor.Scrolling.ScrollBars = RichTextBoxScrollBars.None;
            }

            bool showGutter  = UserOptions.GetBoolean("editor/general/showGutter");
            int  gutterWidth = UserOptions.GetInt("editor/general/gutterWidth");
            bool lineNumbers = UserOptions.GetBoolean("editor/general/lineNumbers");

            editor.Gutter.Visible = showGutter;
            editor.Gutter.Width   = gutterWidth;
            editor.Gutter.Options = (lineNumbers ? GutterOptions.PaintLineNumbers | GutterOptions.PaintLinesOnGutter : GutterOptions.None);

            bool showMargin     = UserOptions.GetBoolean("editor/general/showMargin");
            int  marginPosition = UserOptions.GetInt("editor/general/marginPosition");
            bool wordWrap       = UserOptions.GetBoolean("editor/general/wordWrap");
            bool wrapAtMargin   = UserOptions.GetBoolean("editor/general/wrapAtMargin");

            editor.Margin.Visible  = showMargin;
            editor.Margin.Position = marginPosition;
            editor.WordWrap        = wordWrap;
            editor.WrapAtMargin    = wrapAtMargin;

            SyntaxSettings settings = new SyntaxSettings();

            bool keepTabs = UserOptions.GetBoolean("editor/editorTabs/keepTabs");
            int  tabSize  = UserOptions.GetInt("editor/editorTabs/size");

            editor.Source.Lines.TabStops = new int[1] {
                tabSize
            };
            editor.Source.Lines.UseSpaces = !keepTabs;

            // set lex styles

            XPathNavigator nav = UserOptions.OptionsDoc.CreateNavigator();

            nav.MoveToFirstChild();
            nav = nav.SelectSingleNode("editor/editorFonts/lexStyles");

            nav.MoveToFirstChild();
            LexStyleItem item;
            string       colorName;

            var foreground = FontsAndColors.PlainTextForeground;
            var background = FontsAndColors.PlainTextBackground;

            do
            {
                if (nav.NodeType == XPathNodeType.Element)
                {
                    item              = new LexStyleItem();
                    item.Name         = nav.LocalName;
                    item.InternalName = nav.LocalName;

                    colorName      = nav.GetAttribute("foreColor", nav.NamespaceURI);
                    item.ForeColor = Color.FromName(colorName);
                    if (!item.ForeColor.IsKnownColor)
                    {
                        item.ForeColor = Color.FromArgb(unchecked ((int)uint.Parse(
                                                                       colorName, System.Globalization.NumberStyles.HexNumber)));
                    }

                    if (item.Name.Equals("whitespace"))
                    {
                        foreground = item.ForeColor;
                    }

                    colorName      = nav.GetAttribute("backColor", nav.NamespaceURI);
                    item.BackColor = Color.FromName(colorName);
                    if (!item.BackColor.IsKnownColor)
                    {
                        item.BackColor = Color.FromArgb(unchecked ((int)uint.Parse(
                                                                       colorName, System.Globalization.NumberStyles.HexNumber)));
                    }

                    if (item.Name.Equals("whitespace"))
                    {
                        background = item.BackColor;
                    }

                    item.FontStyle
                        = (FontStyle)Enum.Parse(
                              typeof(FontStyle), nav.GetAttribute("style", nav.NamespaceURI));

                    ApplyLeXStyle(item);
                }
            }while (nav.MoveToNext(XPathNodeType.Element));

            editor.ForeColor = foreground;
            editor.BackColor = background;
            editor.Refresh();
        }