Пример #1
0
        private void InitBookmarkMargin(ScintillaWPF ScintillaNet)
        {
            //TextArea.SetFoldMarginColor(true, IntToColor(BACK_COLOR));

            var margin = ScintillaNet.Margins[BREAKPOINT_MARGIN];

            margin.Width     = 20;
            margin.Sensitive = true;
            margin.Type      = MarginType.Symbol;

            // !!!!!!!!!!!注意
            margin.Mask   = 1 << BREAKPOINT_MARKER;
            margin.Cursor = MarginCursor.Arrow;

            var Dmarker = ScintillaNet.Markers[DEBUG_MARKER];

            Dmarker.SetBackColor(IntToColor(0xFF003B));
            Dmarker.SetForeColor(IntToColor(0x000000));
            Dmarker.SetAlpha(100);

            var Bmarker = ScintillaNet.Markers[BREAKPOINT_MARKER];

            Bmarker.Symbol = MarkerSymbol.Circle;
            Bmarker.SetBackColor(IntToColor(0xFF003B));
            Bmarker.SetForeColor(IntToColor(0xFF003B));
            Bmarker.SetAlpha(100);
        }
Пример #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
        internal static void InitBookmarkMargin(ScintillaWPF scintillaNet)
        {
            var margin = scintillaNet.Margins[ScintillaConstants.BREAKPOINT_MARGIN];

            margin.Width     = 20;
            margin.Sensitive = true;
            margin.Type      = MarginType.Symbol;
            margin.Mask      = (1 << ScintillaConstants.BREAKPOINT_MARKER);
            margin.Cursor    = MarginCursor.Arrow;

            var marker = scintillaNet.Markers[ScintillaConstants.BREAKPOINT_MARKER];

            marker.Symbol = MarkerSymbol.Circle;
            marker.SetBackColor(IntToColor(0xAB616B));
            marker.SetForeColor(IntToColor(0xFFFFFF));
            marker.SetAlpha(100);

            marker        = scintillaNet.Markers[ScintillaConstants.BREAKPOINT_BG];
            marker.Symbol = MarkerSymbol.Background;
            marker.SetBackColor(IntToColor(0xAB616B));

            scintillaNet.Indicators[ScintillaConstants.BREAKPOINT_INDICATOR].Style        = IndicatorStyle.StraightBox;
            scintillaNet.Indicators[ScintillaConstants.BREAKPOINT_INDICATOR].Under        = true;
            scintillaNet.Indicators[ScintillaConstants.BREAKPOINT_INDICATOR].ForeColor    = System.Drawing.Color.Maroon;
            scintillaNet.Indicators[ScintillaConstants.BREAKPOINT_INDICATOR].OutlineAlpha = 50;
            scintillaNet.Indicators[ScintillaConstants.BREAKPOINT_INDICATOR].Alpha        = 30;

            scintillaNet.Indicators[ScintillaConstants.ERROR_INDICATOR].Style        = IndicatorStyle.SquiggleLow;
            scintillaNet.Indicators[ScintillaConstants.ERROR_INDICATOR].Under        = true;
            scintillaNet.Indicators[ScintillaConstants.ERROR_INDICATOR].ForeColor    = System.Drawing.Color.Red;
            scintillaNet.Indicators[ScintillaConstants.ERROR_INDICATOR].OutlineAlpha = 50;
            scintillaNet.Indicators[ScintillaConstants.ERROR_INDICATOR].Alpha        = 30;
        }
Пример #4
0
        private void InitCodeFolding(ScintillaWPF ScintillaNet)
        {
            ScintillaNet.SetFoldMarginColor(true, IntToMediaColor(BACK_COLOR));
            ScintillaNet.SetFoldMarginHighlightColor(true, IntToMediaColor(BACK_COLOR));

            // Enable code folding
            ScintillaNet.SetProperty("fold", "1");
            ScintillaNet.SetProperty("fold.compact", "1");

            // Configure a margin to display folding symbols
            ScintillaNet.Margins[FOLDING_MARGIN].Type      = MarginType.Symbol;
            ScintillaNet.Margins[FOLDING_MARGIN].Mask      = Marker.MaskFolders;
            ScintillaNet.Margins[FOLDING_MARGIN].Sensitive = true;
            ScintillaNet.Margins[FOLDING_MARGIN].Width     = 20;

            // Set colors for all folding markers
            for (int i = 25; i <= 31; i++)
            {
                ScintillaNet.Markers[i].SetForeColor(IntToColor(BACK_COLOR)); // styles for [+] and [-]
                ScintillaNet.Markers[i].SetBackColor(IntToColor(FORE_COLOR)); // styles for [+] and [-]
            }

            // Configure folding markers with respective symbols
            ScintillaNet.Markers[Marker.Folder].Symbol        = CODEFOLDING_CIRCULAR ? MarkerSymbol.CirclePlus : MarkerSymbol.BoxPlus;
            ScintillaNet.Markers[Marker.FolderOpen].Symbol    = CODEFOLDING_CIRCULAR ? MarkerSymbol.CircleMinus : MarkerSymbol.BoxMinus;
            ScintillaNet.Markers[Marker.FolderEnd].Symbol     = CODEFOLDING_CIRCULAR ? MarkerSymbol.CirclePlusConnected : MarkerSymbol.BoxPlusConnected;
            ScintillaNet.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
            ScintillaNet.Markers[Marker.FolderOpenMid].Symbol = CODEFOLDING_CIRCULAR ? MarkerSymbol.CircleMinusConnected : MarkerSymbol.BoxMinusConnected;
            ScintillaNet.Markers[Marker.FolderSub].Symbol     = MarkerSymbol.VLine;
            ScintillaNet.Markers[Marker.FolderTail].Symbol    = MarkerSymbol.LCorner;

            // Enable automatic folding
            ScintillaNet.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
        }
Пример #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 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");
        }
Пример #6
0
        private void InitColors(ScintillaWPF ScintillaNet)
        {
            ScintillaNet.CaretForeColor = Colors.White;
            ScintillaNet.SetSelectionBackColor(true, IntToMediaColor(0x114D9C));

            //FindReplace.Indicator.ForeColor = System.Drawing.Color.DarkOrange;
        }
        internal static bool IsBreakPointAllowed(ScintillaWPF scintilla, Line line, out int breakPointStartPosition, out int breakPointHighlightLength)
        {
            string lineString       = line.Text.Trim();
            int    lineStringLength = lineString.Length;

            breakPointStartPosition   = 0;
            breakPointHighlightLength = 0;
            string firstWord            = string.Empty;
            int    firstWhiteSpaceIndex = lineString.IndexOf(" ");

            if (lineStringLength > 1 && firstWhiteSpaceIndex >= 0)
            {
                firstWord = lineString.Substring(0, firstWhiteSpaceIndex);
            }
            else
            {
                firstWord = lineString;
            }

            string[] disAllowedString = new string[] { "NAMESPACE" };
            if (!disAllowedString.Contains(firstWord.ToUpper()) && !string.IsNullOrEmpty(firstWord))
            {
                breakPointStartPosition   = line.Position + (line.Length - lineStringLength - 2);
                breakPointHighlightLength = lineStringLength;
                return(true);
            }

            return(false);
        }
Пример #8
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");
        }
Пример #9
0
        private void SetScintillaToCurrentOptions(DocumentForm doc)
        {
            ScintillaWPF ScintillaNet = doc.Scintilla;

            ScintillaNet.KeyDown += ScintillaNet_KeyDown;

            // INITIAL VIEW CONFIG
            ScintillaNet.WrapMode          = WrapMode.None;
            ScintillaNet.IndentationGuides = IndentView.LookBoth;

            // STYLING
            InitColors(ScintillaNet);
            InitSyntaxColoring(ScintillaNet);

            // NUMBER MARGIN
            InitNumberMargin(ScintillaNet);

            // BOOKMARK MARGIN
            InitBookmarkMargin(ScintillaNet);

            // CODE FOLDING MARGIN
            InitCodeFolding(ScintillaNet);

            // DRAG DROP
            // TODO - Enable InitDragDropFile
            //InitDragDropFile();

            // INIT HOTKEYS
            // TODO - Enable InitHotkeys
            //InitHotkeys(ScintillaNet);
            #region Uncomment Later
            //// Turn on line numbers?
            //if (lineNumbersMenuItem.IsChecked)
            //    doc.Scintilla.Margins[NUMBER_MARGIN].Width = LINE_NUMBERS_MARGIN_WIDTH;
            //else
            //    doc.Scintilla.Margins[NUMBER_MARGIN].Width = 0;

            //// Turn on white space?
            //if (whitespaceMenuItem.IsChecked)
            //    doc.Scintilla.ViewWhitespace = WhitespaceMode.VisibleAlways;
            //else
            //    doc.Scintilla.ViewWhitespace = WhitespaceMode.Invisible;

            //// Turn on word wrap?
            //if (wordWrapMenuItem.IsChecked)
            //    doc.Scintilla.WrapMode = WrapMode.Word;
            //else
            //    doc.Scintilla.WrapMode = WrapMode.None;

            //// Show EOL?
            //doc.Scintilla.ViewEol = endOfLineMenuItem.IsChecked;

            //// Set the zoom
            //doc.Scintilla.Zoom = _zoomLevel;
            #endregion
        }
Пример #10
0
        internal static bool Compile()
        {
            DocumentView activeDocument = ((MainWindow)App.Current.MainWindow).ActiveDocument;

            if (activeDocument == null)
            {
                return(false);
            }
            ScintillaWPF scintilla = activeDocument.scintilla;

            if (activeDocument.FilePath != null)
            {
                using (CodeDomProvider csc = Microsoft.CSharp.CSharpCodeProvider.CreateProvider("CSharp"))
                {
                    ((MainWindow)App.Current.MainWindow).errorView.ClearError();
                    System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
                    parameters.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
                    parameters.ReferencedAssemblies.Add("Neo.SmartContract.Framework.dll");
                    parameters.ReferencedAssemblies.Add("System.dll");
                    parameters.ReferencedAssemblies.Add("System.Data.DataSetExtensions.dll");
                    parameters.ReferencedAssemblies.Add("System.Data.dll");
                    parameters.ReferencedAssemblies.Add("System.Core.dll");
                    parameters.ReferencedAssemblies.Add("System.Numerics.dll");
                    parameters.ReferencedAssemblies.Add("System.Drawing.dll");
                    parameters.ReferencedAssemblies.Add("System.Runtime.Serialization.dll");
                    parameters.ReferencedAssemblies.Add("System.ComponentModel.dll");
                    parameters.ReferencedAssemblies.Add("System.Xml.dll");
                    parameters.ReferencedAssemblies.Add("System.Xml.Linq.dll");
                    parameters.GenerateExecutable = false;
                    parameters.GenerateInMemory   = true;
                    parameters.OutputAssembly     = activeDocument.FilePath.Remove(activeDocument.FilePath.Length - 2, 2) + "dll";
                    CompilerResults results = csc.CompileAssemblyFromSource(parameters, activeDocument.scintilla.Text);

                    scintilla.IndicatorCurrent = ScintillaConstants.ERROR_INDICATOR;
                    scintilla.IndicatorClearRange(0, scintilla.TextLength);


                    if (results.Errors.Count > 0)
                    {
                        ((MainWindow)App.Current.MainWindow).errorView.IsNoError(false);
                        foreach (CompilerError CompErr in results.Errors)
                        {
                            ((MainWindow)App.Current.MainWindow).errorView.AddError(CompErr);
                            UnderLineCompiledError(CompErr, scintilla);
                        }
                    }
                    else
                    {
                        ((MainWindow)App.Current.MainWindow).errorView.IsNoError(true);
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #11
0
        private void InitBookmarkMargin(ScintillaWPF ScintillaNet)
        {
            //TextArea.SetFoldMarginColor(true, IntToColor(BACK_COLOR));

            var margin = ScintillaNet.Margins[BOOKMARK_MARGIN];

            margin.Width     = 20;
            margin.Sensitive = true;
            margin.Type      = MarginType.Symbol;
            margin.Mask      = (1 << BOOKMARK_MARKER);
            //margin.Cursor = MarginCursor.Arrow;
        }
Пример #12
0
        internal static void InitBase(DocumentView doc)
        {
            ScintillaWPF scintillaNet = doc.scintilla;

            scintillaNet.WrapMode          = WrapMode.None;
            scintillaNet.IndentationGuides = IndentView.LookBoth;

            InitSyntaxColoring(scintillaNet);
            InitBookmarkMargin(scintillaNet);
            InitCodeFolding(scintillaNet);
            InitColors(scintillaNet);
            InitNumberMargin(scintillaNet);
        }
Пример #13
0
        private void InitIndicator(ScintillaWPF ScintillaNet)
        {
            const int NUM = 8;

            // Remove all uses of our indicator
            textEditor.IndicatorCurrent = NUM;
            textEditor.IndicatorClearRange(0, textEditor.TextLength);

            // Update indicator appearance
            textEditor.Indicators[NUM].Style        = IndicatorStyle.FullBox;
            textEditor.Indicators[NUM].Under        = false;
            textEditor.Indicators[NUM].ForeColor    = System.Drawing.Color.Red;
            textEditor.Indicators[NUM].OutlineAlpha = 100;
            textEditor.Indicators[NUM].Alpha        = 100;
        }
Пример #14
0
        private void InitNumberMargin(ScintillaWPF ScintillaNet)
        {
            ScintillaNet.Styles[ScintillaNET.Style.LineNumber].BackColor  = IntToColor(BACK_COLOR);
            ScintillaNet.Styles[ScintillaNET.Style.LineNumber].ForeColor  = IntToColor(FORE_COLOR);
            ScintillaNet.Styles[ScintillaNET.Style.IndentGuide].ForeColor = IntToColor(FORE_COLOR);
            ScintillaNet.Styles[ScintillaNET.Style.IndentGuide].BackColor = IntToColor(BACK_COLOR);

            var nums = ScintillaNet.Margins[NUMBER_MARGIN];

            nums.Width                = LINE_NUMBERS_MARGIN_WIDTH;
            nums.Type                 = MarginType.Number;
            nums.Sensitive            = true;
            nums.Mask                 = 0;
            ScintillaNet.MarginClick += TextArea_MarginClick;
        }
Пример #15
0
        internal static void InitNumberMargin(ScintillaWPF scintillaNet)
        {
            scintillaNet.Styles[ScintillaNET.Style.LineNumber].BackColor  = IntToColor(ScintillaConstants.BACK_COLOR);
            scintillaNet.Styles[ScintillaNET.Style.LineNumber].ForeColor  = IntToColor(ScintillaConstants.FORE_COLOR);
            scintillaNet.Styles[ScintillaNET.Style.IndentGuide].ForeColor = IntToColor(ScintillaConstants.FORE_COLOR);
            scintillaNet.Styles[ScintillaNET.Style.IndentGuide].BackColor = IntToColor(ScintillaConstants.BACK_COLOR);

            var nums = scintillaNet.Margins[ScintillaConstants.NUMBER_MARGIN];

            nums.Width     = ScintillaConstants.LINE_NUMBERS_MARGIN_WIDTH;
            nums.Type      = MarginType.Number;
            nums.Sensitive = true;
            nums.Mask      = 0;

            scintillaNet.MarginClick += TextArea_MarginClick;
        }
Пример #16
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");
        }
Пример #17
0
        private void InitBookmarkMargin(ScintillaWPF ScintillaNet)
        {
            //TextArea.SetFoldMarginColor(true, IntToColor(BACK_COLOR));

            var margin = ScintillaNet.Margins[BOOKMARK_MARGIN];

            margin.Width     = 20;
            margin.Sensitive = true;
            margin.Type      = MarginType.Symbol;
            margin.Mask      = (1 << BOOKMARK_MARKER);
            //margin.Cursor = MarginCursor.Arrow;

            var marker = ScintillaNet.Markers[BOOKMARK_MARKER];

            marker.Symbol = MarkerSymbol.Arrows;
            //marker.SetBackColor(IntToColor(0xFF003B));
            //marker.SetForeColor(IntToColor(0x000000));

            marker.SetBackColor(IntToColor(0xFF003B));
            marker.SetForeColor(IntToColor(0x00FF00));

            marker.SetAlpha(100);
        }
        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");
        }
 internal ScintillaWPFConfigItemCollection(ScintillaWPF parent)
 {
     this.mParentScintilla = parent;
 }
Пример #20
0
        internal static void UnderLineCompiledError(CompilerError compilerError, ScintillaWPF scintilla)
        {
            Line line = scintilla.Lines[compilerError.Line - 1];

            scintilla.IndicatorFillRange(line.Position + compilerError.Column - 1, line.Length - compilerError.Column - 1);
        }
Пример #21
0
 internal virtual void ApplyConfig(ScintillaWPF scintilla)
 {
     mLastAppliedParent = scintilla;
 }
Пример #22
0
 internal abstract void Reset(ScintillaWPF scintilla);
Пример #23
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());
        }
Пример #24
0
 public TextProvider(ScintillaWPF editor)
 {
     this.editor = editor;
 }
Пример #25
0
 public ValueProvider(ScintillaWPF editor)
 {
     this.editor = editor;
 }
 public ScintillaAutomationPeer(ScintillaWPF owner) : base(owner)
 {
     this.editor = owner;
 }
Пример #27
0
 internal static void InitColors(ScintillaWPF scintillaNet)
 {
     scintillaNet.CaretForeColor = System.Windows.Media.Colors.Black;
     scintillaNet.SetSelectionBackColor(true, IntToMediaColor(0x99C9EF));
 }
Пример #28
0
 public TextRangeProvider(ScintillaWPF owner, int position, int endPosition)
 {
     this.editor      = owner;
     this.Position    = position;
     this.EndPosition = endPosition;
 }
Пример #29
0
 private void InitColors(ScintillaWPF ScintillaNet)
 {
     ScintillaNet.CaretForeColor = Colors.Black;
     ScintillaNet.SetSelectionBackColor(true, IntToMediaColor(0x6070CC));
 }