Пример #1
0
        private void InitSyntaxColoring(ScintillaWPF ScintillaNet)
        {
            // Configure the default style
            ScintillaNet.StyleResetDefault();
            ScintillaNet.Styles[ScintillaNET.Style.Default].Font      = "Consolas";
            ScintillaNet.Styles[ScintillaNET.Style.Default].Size      = 10;
            ScintillaNet.Styles[ScintillaNET.Style.Default].BackColor = IntToColor(0xFFFFFF);
            ScintillaNet.Styles[ScintillaNET.Style.Default].ForeColor = IntToColor(0x000000);
            ScintillaNet.StyleClearAll();

            // Configure the cursor color
            ScintillaNet.CaretForeColor = Color.FromRgb(0, 0, 0);

            // Configure the CPP (C#) lexer styles
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Identifier].ForeColor     = IntToColor(0x000000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.CommentLine].ForeColor    = IntToColor(0x008000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.CommentDoc].ForeColor     = IntToColor(0x008000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Number].ForeColor         = IntToColor(0x000000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.String].ForeColor         = IntToColor(0xA31515);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Preprocessor].ForeColor   = IntToColor(0x808080);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Operator].ForeColor       = IntToColor(0x000000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.CommentLineDoc].ForeColor = IntToColor(0x008000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Word].ForeColor           = IntToColor(0x0000FF);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.Word2].ForeColor          = IntToColor(0x000000);
            ScintillaNet.Styles[ScintillaNET.Style.Cpp.GlobalClass].ForeColor    = IntToColor(0x0000FF);

            ScintillaNet.Lexer = Lexer.Cpp;

            ScintillaNet.SetKeywords(0, "class extends implements import interface new case do while else if for in switch throw get set function var try catch finally while with default break continue delete return each const namespace package include use is as instanceof typeof author copy default deprecated eventType example exampleText exception haxe inheritDoc internal link mtasc mxmlc param private return see serial serialData serialField since throws usage version langversion playerversion productversion dynamic private public partial static intrinsic internal native override protected AS3 final super this arguments null Infinity NaN undefined true false abstract as base bool break by byte case catch char checked class const continue decimal default delegate do double descending explicit event extern else enum false finally fixed float for foreach from goto group if implicit in int interface internal into is lock long new null namespace object operator out override orderby params private protected public readonly ref return switch struct sbyte sealed short sizeof stackalloc static string select this throw true try typeof uint ulong unchecked unsafe ushort using var virtual volatile void while where yield");
            ScintillaNet.SetKeywords(1, "void Null ArgumentError arguments Array Boolean Class Date DefinitionError Error EvalError Function int Math Namespace Number Object RangeError ReferenceError RegExp SecurityError String SyntaxError TypeError uint XML XMLList Boolean Byte Char DateTime Decimal Double Int16 Int32 Int64 IntPtr SByte Single UInt16 UInt32 UInt64 UIntPtr Void Path File System Windows Forms ScintillaNET");
        }
Пример #2
0
        internal static void InitSyntaxColoring(ScintillaWPF scintillaNet)
        {
            scintillaNet.StyleResetDefault();
            scintillaNet.Styles[ScintillaNET.Style.Default].Font = "Consolas";
            scintillaNet.Styles[ScintillaNET.Style.Default].Size = 10;
            scintillaNet.StyleClearAll();

            // Configure the CPP (C#) lexer styles
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Default].ForeColor        = System.Drawing.Color.Silver;
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Comment].ForeColor        = System.Drawing.Color.FromArgb(0, 128, 0);     // Green
            scintillaNet.Styles[ScintillaNET.Style.Cpp.CommentLine].ForeColor    = System.Drawing.Color.FromArgb(0, 128, 0);     // Green
            scintillaNet.Styles[ScintillaNET.Style.Cpp.CommentLineDoc].ForeColor = System.Drawing.Color.FromArgb(128, 128, 128); // Gray
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Number].ForeColor         = System.Drawing.Color.Olive;
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Word].ForeColor           = System.Drawing.Color.Blue;
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Word2].ForeColor          = System.Drawing.Color.FromArgb(43, 145, 175);
            scintillaNet.Styles[ScintillaNET.Style.Cpp.String].ForeColor         = System.Drawing.Color.FromArgb(163, 21, 21); // Red
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Character].ForeColor      = System.Drawing.Color.FromArgb(163, 21, 21); // Red
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Verbatim].ForeColor       = System.Drawing.Color.FromArgb(163, 21, 21); // Red
            scintillaNet.Styles[ScintillaNET.Style.Cpp.StringEol].BackColor      = System.Drawing.Color.Pink;
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Operator].ForeColor       = System.Drawing.Color.Purple;
            scintillaNet.Styles[ScintillaNET.Style.Cpp.Preprocessor].ForeColor   = System.Drawing.Color.Maroon;
            scintillaNet.Lexer = Lexer.Cpp;

            // Set the keywords
            scintillaNet.SetKeywords(0, "abstract as base break case catch checked continue default delegate do else event explicit extern false finally fixed for foreach goto if implicit in interface internal is lock namespace new null object operator out override params private protected public readonly ref return sealed sizeof stackalloc switch this throw true try typeof unchecked unsafe using virtual while bool byte char class const decimal double enum float int long sbyte short static string struct uint ulong ushort void BigInteger");
            scintillaNet.SetKeywords(1, "DisplayName");
            //bool byte char class const decimal double enum float int long sbyte short static string struct uint ulong ushort void BigInteger
            scintillaNet.SetKeywords(2, "DisplayName");

            scintillaNet.CharAdded   += ScintillaNet_CharAdded;
            scintillaNet.InsertCheck += ScintillaNet_InsertCheck;
        }
Пример #3
0
        private void InitSyntaxColoring(ScintillaWPF ScintillaNet)
        {
            // Configure the default style
            ScintillaNet.StyleResetDefault();
            ScintillaNet.Styles[ScintillaNET.Style.Default].Font      = "Consolas";
            ScintillaNet.Styles[ScintillaNET.Style.Default].Size      = 10;
            ScintillaNet.Styles[ScintillaNET.Style.Default].BackColor = IntToColor(0x212121);
            ScintillaNet.Styles[ScintillaNET.Style.Default].ForeColor = IntToColor(0xFFFFFF);
            ScintillaNet.StyleClearAll();

            // Configure the Lua lexer styles
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Identifier].ForeColor   = IntToColor(0xD0DAE2);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Comment].ForeColor      = IntToColor(0xBD758B);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.CommentLine].ForeColor  = IntToColor(0x40BF57);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.CommentDoc].ForeColor   = IntToColor(0x2FAE35);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Number].ForeColor       = IntToColor(0xFFFF00);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.String].ForeColor       = IntToColor(0xFFFF00);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Character].ForeColor    = IntToColor(0xE95454);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Preprocessor].ForeColor = IntToColor(0x8AAFEE);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Operator].ForeColor     = IntToColor(0xE0E0E0);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Word].ForeColor         = IntToColor(0x48A8EE);
            ScintillaNet.Styles[ScintillaNET.Style.Lua.Word2].ForeColor        = IntToColor(0xF98906);


            ScintillaNet.Lexer = Lexer.Lua;
            ScintillaNet.SetKeywords(0, "and or not function table nil for while do break in return until goto repeat true false if then else elseif local end");
        }
        private void InitCodeHighlighting()
        {
            ScintillaWPF ScintillaNet = scintilla;

            ScintillaNet.StyleResetDefault();
            ScintillaNet.Styles[ScintillaNET.Style.Default].Font      = viewModel.EditorSettings.FontFamily.ToString();
            ScintillaNet.Styles[ScintillaNET.Style.Default].Size      = (int)(viewModel.EditorSettings.FontSize * (72.0 / 96.0));
            ScintillaNet.Styles[ScintillaNET.Style.Default].Italic    = viewModel.EditorSettings.FontStyle == FontStyles.Italic;
            ScintillaNet.Styles[ScintillaNET.Style.Default].Weight    = viewModel.EditorSettings.FontWeight.ToOpenTypeWeight();
            ScintillaNet.Styles[ScintillaNET.Style.Default].BackColor = viewModel.EditorSettings.BackColor.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.Default].ForeColor = viewModel.EditorSettings.ForeColor.ToDrawingColor();
            ScintillaNet.StyleClearAll(); // i.e. Apply to all

            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Asm].ForeColor          = viewModel.EditorSettings.Asm.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.BinNumber].ForeColor    = viewModel.EditorSettings.BinNumber.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Comment].ForeColor      = viewModel.EditorSettings.Comment.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.CommentBlock].ForeColor = viewModel.EditorSettings.CommentBlock.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Constant].ForeColor     = viewModel.EditorSettings.Constant.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Default].ForeColor      = viewModel.EditorSettings.Default.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Error].ForeColor        = viewModel.EditorSettings.Error.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.HexNumber].ForeColor    = viewModel.EditorSettings.HexNumber.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Identifier].ForeColor   = viewModel.EditorSettings.Identifier.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Keyword].ForeColor      = viewModel.EditorSettings.Keyword0.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Keyword2].ForeColor     = viewModel.EditorSettings.Keyword1.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Keyword3].ForeColor     = viewModel.EditorSettings.Keyword2.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Keyword4].ForeColor     = viewModel.EditorSettings.Keyword3.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Label].ForeColor        = viewModel.EditorSettings.Label.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Number].ForeColor       = viewModel.EditorSettings.Number.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Operator].ForeColor     = viewModel.EditorSettings.Operator.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.Preprocessor].ForeColor = viewModel.EditorSettings.PreProcessor.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.String].ForeColor       = viewModel.EditorSettings.String.ToDrawingColor();
            ScintillaNet.Styles[ScintillaNET.Style.VbScript.StringEol].BackColor    = viewModel.EditorSettings.StringEol.ToDrawingColor();
            //// Set the lexer
            ScintillaNet.Lexer = Lexer.VbScript;
            ScintillaNet.SetKeywords(0, "addhandler addressof andalso alias and ansi as assembly attribute auto begin boolean byref byte byval call case catch cbool cbyte cchar cdate cdec cdbl char cint class clng cobj compare const continue cshort csng cstr ctype currency date decimal declare default delegate dim do double each else elseif end enum erase error event exit explicit false finally for friend function get gettype global gosub goto handles if implement implements imports in inherits integer interface is let lib like load long loop lset me mid mod module mustinherit mustoverride mybase myclass namespace new next not nothing notinheritable notoverridable object on option optional or orelse overloads overridable overrides paramarray preserve private property protected public raiseevent readonly redim rem removehandler rset resume return select set shadows shared short single static step stop string structure sub synclock then throw to true try type typeof unload unicode until variant wend when while with withevents writeonly xor");
            ScintillaNet.SetKeywords(1, "form_onload form_onsave form_onentertab form_onleavetab form_onenterfield form_onleavefield form_oncancel form_onactivexcontrolevent");
        }
Пример #5
0
        private void InitSyntaxColoring(ScintillaWPF ScintillaNet)
        {
            // Configure the default style
            ScintillaNet.StyleResetDefault();
            ScintillaNet.Styles[ScintillaNET.Style.Default].Font      = "Consolas";
            ScintillaNet.Styles[ScintillaNET.Style.Default].Size      = 10;
            ScintillaNet.Styles[ScintillaNET.Style.Default].BackColor = IntToColor(0xFFFFFF);
            ScintillaNet.Styles[ScintillaNET.Style.Default].ForeColor = IntToColor(0x000000);
            ScintillaNet.StyleClearAll();

            // Configure the Python lexer styles
            ScintillaNet.Styles[ScintillaNET.Style.Python.Default].ForeColor      = System.Drawing.Color.Black;
            ScintillaNet.Styles[ScintillaNET.Style.Python.CommentLine].ForeColor  = System.Drawing.Color.Red;
            ScintillaNet.Styles[ScintillaNET.Style.Python.CommentLine].Italic     = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Number].ForeColor       = System.Drawing.Color.FromArgb(0x00, 0x7F, 0x7F);
            ScintillaNet.Styles[ScintillaNET.Style.Python.String].ForeColor       = System.Drawing.Color.LightBlue;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Character].ForeColor    = System.Drawing.Color.Silver;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Word].ForeColor         = System.Drawing.Color.FromArgb(0x00, 0x00, 0x7F);
            ScintillaNet.Styles[ScintillaNET.Style.Python.Word].Bold              = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Triple].ForeColor       = System.Drawing.Color.DarkRed;
            ScintillaNet.Styles[ScintillaNET.Style.Python.TripleDouble].ForeColor = System.Drawing.Color.FromArgb(0x7F, 0x00, 0x00);
            ScintillaNet.Styles[ScintillaNET.Style.Python.ClassName].ForeColor    = System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF);
            ScintillaNet.Styles[ScintillaNET.Style.Python.ClassName].Bold         = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.DefName].ForeColor      = System.Drawing.Color.FromArgb(0x00, 0x7F, 0x7F);
            ScintillaNet.Styles[ScintillaNET.Style.Python.DefName].Bold           = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Operator].Bold          = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.CommentBlock].ForeColor = System.Drawing.Color.FromArgb(0x7F, 0x7F, 0x7F);
            ScintillaNet.Styles[ScintillaNET.Style.Python.CommentBlock].Italic    = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.StringEol].ForeColor    = System.Drawing.Color.FromArgb(0x00, 0x00, 0x00);
            ScintillaNet.Styles[ScintillaNET.Style.Python.StringEol].BackColor    = System.Drawing.Color.FromArgb(0xE0, 0xC0, 0xE0);
            ScintillaNet.Styles[ScintillaNET.Style.Python.StringEol].FillLine     = true;
            ScintillaNet.Styles[ScintillaNET.Style.Python.Word2].ForeColor        = System.Drawing.Color.FromArgb(0x40, 0x70, 0x90);
            ScintillaNet.Styles[ScintillaNET.Style.Python.Decorator].ForeColor    = System.Drawing.Color.FromArgb(0x80, 0x50, 0x00);

            ScintillaNet.Lexer = Lexer.Python;;

            ScintillaNet.SetKeywords(0, "False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield cdef cimport cpdef");
            //ScintillaNet.SetKeywords(1, "void Null ArgumentError arguments Array Boolean Class Date DefinitionError Error EvalError Function int Math Namespace Number Object RangeError ReferenceError RegExp SecurityError String SyntaxError TypeError uint XML XMLList Boolean Byte Char DateTime Decimal Double Int16 Int32 Int64 IntPtr SByte Single UInt16 UInt32 UInt64 UIntPtr Void Path File System Windows Forms ScintillaNET");
        }
Пример #6
0
        private void SetKeyWords(ScintillaWPF ScintillaNet)
        {
            ScintillaNet.CharAdded += ScintillaNet_CharAdded;
            ScintillaNet.Delete    += ScintillaNet_Delete;

            //For AutoComplete
            foreach (var it in rawDataDic)
            {
                sbWord1.Append(it.Key);
                sbWord1.Append(" ");
                strCateDic.Add(it.Key, "");
                foreach (var funcName in it.Value)
                {
                    sbWord1.Append(it.Key);
                    sbWord1.Append(".");
                    sbWord1.Append(funcName);
                    sbWord1.Append(" ");
                    sbWord1.Append(funcName);
                    sbWord1.Append(" ");
                    strCateDic[it.Key] += funcName;
                    strCateDic[it.Key] += " ";
                }
            }

            //Axis
            LogicAxisList  = (DataContext as ViewModelLocator).Service.LogicalAxisCollection;
            InstrumentList = (DataContext as ViewModelLocator).Service.MeasurementInstrumentCollection;
            foreach (var axis in LogicAxisList)
            {
                string strAxisPromt = axis.ToString().Replace(" ", "").Replace("*", "").Replace("@", "_").ToUpper();
                sbWord1.Append(strAxisPromt);
                sbWord1.Append(" ");
                sbWord1.Append("AXIS.");
                sbWord1.Append(strAxisPromt);
                sbWord1.Append(" ");

                sbAxisStructPromt.Append(strAxisPromt);
                sbAxisStructPromt.Append(" ");
            }
            sbWord1.Append("AXIS");
            sbWord1.Append(" ");

            //Instrument
            foreach (var instrument in InstrumentList)
            {
                string strInstrumentPromt = instrument.Config.Caption.Replace(" ", "_").ToUpper();
                sbWord1.Append(strInstrumentPromt);
                sbWord1.Append(" ");
                sbWord1.Append("INST.");
                sbWord1.Append(strInstrumentPromt);
                sbWord1.Append(" ");

                sbInstrumentStructPromt.Append(strInstrumentPromt);
                sbInstrumentStructPromt.Append(" ");
            }
            sbWord1.Append("INST");
            sbWord1.Append(" ");

            //Enum
            List <KeyValuePair <string, List <KeyValuePair <string, int> > > > enumInfos = (DataContext as ViewModelLocator).Service.EnumInfos["ENUM"];

            sbWord1.Append("ENUM");
            sbWord1.Append(" ");

            foreach (var kp in enumInfos)
            {
                sbWord1.Append("ENUM.");
                sbWord1.Append(kp.Key);
                sbWord1.Append(" ");
                sbWord1.Append(kp.Key);
                sbWord1.Append(" ");

                sbEnumPromt1.Append(kp.Key);
                sbEnumPromt1.Append(" ");

                StringBuilder sbEnumPromt2 = new StringBuilder();
                foreach (var it in kp.Value)
                {
                    sbWord1.Append("ENUM.");
                    sbWord1.Append(kp.Key);
                    sbWord1.Append(".");
                    sbWord1.Append(it.Key);
                    sbWord1.Append(" ");
                    sbWord1.Append(it.Key);
                    sbWord1.Append(" ");

                    sbEnumPromt2.Append(it.Key);
                    sbEnumPromt2.Append(" ");
                }
                sbEnumPromt2Dic.Add(kp.Key, sbEnumPromt2);
            }
            ScintillaNet.SetKeywords(1, sbWord1.ToString());
        }