Beispiel #1
0
        /// <summary>Initialise with reasonable default style</summary>
        public static ScintillaControl ConfigDefault(this ScintillaControl sc)
        {
            sc.CodePage = Sci.SC_CP_UTF8;
            sc.ClearDocumentStyle();
            sc.IndentationGuides = Sci.EIndentView.Lookboth;
            sc.TabWidth          = 4;
            sc.Indent            = 4;
            sc.CaretPeriod       = 400;

            // source folding section
            // tell the lexer that we want folding information - the lexer supplies "folding levels"
            sc.Property("fold", "1");
            sc.Property("fold.html", "1");
            sc.Property("fold.html.preprocessor", "1");
            sc.Property("fold.comment", "1");
            sc.Property("fold.at.else", "1");
            sc.Property("fold.flags", "1");
            sc.Property("fold.preprocessor", "1");
            sc.Property("styling.within.preprocessor", "1");
            sc.Property("asp.default.language", "1");

            // Tell scintilla to draw folding lines UNDER the folded line
            sc.FoldFlags(16);

            // Set margin 2 = folding margin to display folding symbols
            sc.MarginMaskN(2, unchecked ((uint)Sci.SC_MASK_FOLDERS));

            // allow notifications for folding actions
            sc.ModEventMask = Sci.SC_MOD_INSERTTEXT | Sci.SC_MOD_DELETETEXT;
            //sc.ModEventMask(SC_MOD_CHANGEFOLD|SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT);

            // make the folding margin sensitive to folding events = if you click into the margin you get a notification event
            sc.MarginSensitiveN(2, true);

            // define a set of markers to display folding symbols
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDEROPEN, Sci.SC_MARK_MINUS);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDER, Sci.SC_MARK_PLUS);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDERSUB, Sci.SC_MARK_EMPTY);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDERTAIL, Sci.SC_MARK_EMPTY);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDEREND, Sci.SC_MARK_EMPTY);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDEROPENMID, Sci.SC_MARK_EMPTY);
            sc.MarkerDefine(Sci.SC_MARKNUM_FOLDERMIDTAIL, Sci.SC_MARK_EMPTY);

            // Set the foreground color for some styles
            sc.StyleSetFore(0, new Colour32(0xFF, 0, 0, 0));
            sc.StyleSetFore(2, new Colour32(0xFF, 0, 64, 0));
            sc.StyleSetFore(5, new Colour32(0xFF, 0, 0, 255));
            sc.StyleSetFore(6, new Colour32(0xFF, 200, 20, 0));
            sc.StyleSetFore(9, new Colour32(0xFF, 0, 0, 255));
            sc.StyleSetFore(10, new Colour32(0xFF, 255, 0, 64));
            sc.StyleSetFore(11, new Colour32(0xFF, 0, 0, 0));

            // Set the background color of brace highlights
            sc.StyleSetBack(Sci.STYLE_BRACELIGHT, new Colour32(0xFF, 0, 255, 0));

            // Set end of line mode to CRLF
            sc.ConvertEOLs(Sci.EEndOfLine.Lf);
            sc.EOLMode = Sci.EEndOfLine.Lf;
            //SndMsg<void>(SCI_SETVIEWEOL, TRUE, 0);

            // set marker symbol for marker type 0 - bookmark
            sc.MarkerDefine(0, Sci.SC_MARK_CIRCLE);

            //// display all margins
            //DisplayLinenumbers(TRUE);
            //SetDisplayFolding(TRUE);
            //SetDisplaySelection(TRUE);
            return(sc);
        }