コード例 #1
0
        /// <summary>Set up this control for Ldr script</summary>
        public static ScintillaControl ConfigLdr(this ScintillaControl sc, bool dark)
        {
            sc.ClearDocumentStyle();
            sc.IndentationGuides = Sci.EIndentView.Lookboth;
            sc.AutoIndent        = true;
            sc.TabWidth          = 4;
            sc.Indent            = 4;
            sc.CaretFore         = dark ? 0xFFffffff : 0xFF000000;
            sc.CaretPeriod       = 400;
            sc.ConvertEOLs(Sci.EEndOfLine.Lf);
            sc.EOLMode = Sci.EEndOfLine.Lf;
            sc.Property("fold", "1");
            sc.MultipleSelection         = true;
            sc.AdditionalSelectionTyping = true;
            sc.VirtualSpace = Sci.EVirtualSpace.Rectangularselection;

            Debug.Assert(LdrDark.Length == LdrLight.Length);
            sc.ApplyStyles(dark ? LdrDark : LdrLight);

            sc.MarginTypeN(0, Sci.EMarginType.Number);
            sc.MarginTypeN(1, Sci.EMarginType.Symbol);
            sc.MarginMaskN(1, unchecked ((uint)Sci.SC_MASK_FOLDERS));
            sc.MarginWidthN(0, sc.TextWidth(Sci.STYLE_LINENUMBER, "_9999"));
            sc.MarginWidthN(1, 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);

            // Initialise UTF-8 with the ldr lexer
            sc.CodePage = Sci.SC_CP_UTF8;
            sc.Lexer    = Sci.ELexer.Ldr;
            sc.LexerLanguage("ldr");

            return(sc);
        }
コード例 #2
0
 /// <summary>
 /// Does the cleanup tasks to the code
 /// </summary>
 public static void CleanUpCode(ScintillaControl sci)
 {
     try
     {
         if (Globals.Settings.EnsureLastLineEnd)
         {
             sci.AddLastLineEnd();
         }
         if (Globals.Settings.EnsureConsistentLineEnds)
         {
             sci.ConvertEOLs(sci.EOLMode);
         }
         if (Globals.Settings.StripTrailingSpaces)
         {
             sci.StripTrailingSpaces();
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
コード例 #3
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);
        }