Inheritance: System.Windows.Forms.Control, INativeScintilla, ISupportInitialize
コード例 #1
1
 /// <summary>
 /// Initializes a new instance of the <see cref="MarginClickEventArgs" /> class.
 /// </summary>
 /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
 /// <param name="modifiers">The modifier keys that where held down at the time of the margin click.</param>
 /// <param name="bytePosition">The zero-based byte position within the document where the line adjacent to the clicked margin starts.</param>
 /// <param name="margin">The zero-based index of the clicked margin.</param>
 public MarginClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition, int margin)
 {
     this.scintilla = scintilla;
     this.bytePosition = bytePosition;
     Modifiers = modifiers;
     Margin = margin;
 }
コード例 #2
1
ファイル: CodeView.cs プロジェクト: zhh007/CKGen
        public CodeView()
        {
            InitializeComponent();

            this.scintilla1 = new ScintillaNET.Scintilla();
            this.Controls.Add(this.scintilla1);
            this.scintilla1.Dock = DockStyle.Fill;
            this.scintilla1.TabIndex = 1;
            this.scintilla1.Text = "scintilla1";
            this.scintilla1.HScrollBar = true;
            this.scintilla1.VScrollBar = true;

            scintilla1.Margins[0].Type = MarginType.Number;
            scintilla1.Margins[0].Width = 35;

            // Display whitespace in orange
            scintilla1.WhitespaceSize = 2;
            scintilla1.ViewWhitespace = WhitespaceMode.VisibleAlways;
            scintilla1.SetWhitespaceForeColor(true, Color.FromArgb(43, 145, 175));

            // Configuring the default style with properties
            // we have common to every lexer style saves time.
            scintilla1.StyleResetDefault();
            scintilla1.Styles[Style.Default].Font = "Consolas";
            scintilla1.Styles[Style.Default].Size = 14;
            scintilla1.StyleClearAll();

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

            // Set the keywords
            scintilla1.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");
            scintilla1.SetKeywords(1, "bool byte char class const decimal double enum float int long sbyte short static string struct uint ulong ushort void");

            scintilla1.CharAdded += Scintilla1_CharAdded;
        }
コード例 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            TextArea = new ScintillaNET.Scintilla();
            TextPanel.Controls.Add(TextArea);
            TextArea.Dock         = System.Windows.Forms.DockStyle.Fill;
            TextArea.TextChanged += (this.OnTextChanged);
            TextArea.WrapMode     = WrapMode.Word;
            InitNumberMargin();

            TextArea.StyleResetDefault();
            TextArea.Styles[Style.Default].Font = "Consolas";
            TextArea.Styles[Style.Default].Size = 15;
            TextArea.StyleClearAll();

            TextArea.Styles[Style.Cpp.Identifier].ForeColor  = Color.DeepPink;
            TextArea.Styles[Style.Cpp.Number].ForeColor      = Color.Red;
            TextArea.Styles[Style.Cpp.Word].ForeColor        = Color.Navy;
            TextArea.Styles[Style.Cpp.CommentLine].ForeColor = Color.Gray;
            TextArea.Styles[Style.Cpp.Comment].ForeColor     = Color.ForestGreen;
            TextArea.Lexer = Lexer.Cpp;
            TextArea.SetKeywords(0, "main if then else end do while repeat until cin cout real int boolean break");


            delegado = new ThreadStart(FilasYColumnas);

            hilo = new Thread(delegado);

            hilo.Start();
        }
コード例 #4
0
        private void MyScintilla_Load(object sender, EventArgs e)
        {
            scintilla1 = new ScintillaNET.Scintilla();

            TextPanel.Controls.Add(scintilla1);

            scintilla1.Dock         = System.Windows.Forms.DockStyle.Fill;
            scintilla1.TextChanged += (this.OnTextChanged);

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

            setContextMenu();

            // STYLING
            InitColors();
            InitSyntaxColoring();

            // NUMBER MARGIN
            InitNumberMargin();

            // BOOKMARK MARGIN
            InitBookmarkMargin();

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // INIT HOTKEYS
            InitHotkeys();
        }
コード例 #5
0
        /// <summary>
        /// Define AutoComplete list for Scintilla Control. Provide either string or List of words
        /// </summary>
        /// <param name="scintilla"></param>
        /// <param name="words"></param>
        /// <param name="Words"></param>
        public void Setup_AutoComplete(ScintillaNET.Scintilla scintilla, string words = "", List <string> Words = null)
        {
            if (scintilla != null)
            {
                selectedScintilla            = scintilla;
                selectedScintilla.CharAdded += new System.EventHandler <ScintillaNET.CharAddedEventArgs>(selectedScintilla_CharAdded);
            }

            _Lists lst = new _Lists();

            if (Words != null)
            {
                autoCompleteList = Words;
            }
            else if (words != "")
            {
                List <string> newWords = lst.Text_To_List(words, true, true, false);
                foreach (string w in newWords)
                {
                    autoCompleteList.Add(w);
                }
            }
            else
            {
                autoCompleteList = Return_AutoCompleteList("Scintilla_AutoComplete");
            }
        }
コード例 #6
0
        public KeywordCollection(Scintilla tb, List <Keyword> source)
        {
            _tb       = tb;
            _keywords = source;

            _tb.WordChars = _tb.WordChars + ".";
        }
コード例 #7
0
ファイル: Scrolling.cs プロジェクト: jtheisen/ScintillaNET26
        /// <summary>
        ///     Initializes a new instance of the <see cref="Scrolling" /> class
        ///     for the given <see cref="Scintilla" /> control.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that created this object.</param>
        /// <exception cref="ArgumentNullException"><paramref name="scintilla" /> is null.</exception>
        public Scrolling(Scintilla scintilla)
        {
            if (scintilla == null)
                throw new ArgumentNullException("scintilla");

            _scintilla = scintilla;
        }
コード例 #8
0
        public void UpdateListMargin(ScintillaNET.Scintilla sci, int?start, int?end)
        {
            int startLine = (start == null) ? 0                 : sci.LineFromPosition(start.Value);
            int endLine   = (end == null) ? sci.Lines.Count - 1 : sci.LineFromPosition(end.Value);

            startLine = Math.Max(0, startLine);
            endLine   = Math.Min(sci.Lines.Count - 1, endLine);

            for (int idxline = startLine; idxline <= endLine; idxline++)
            {
                var line = sci.Lines[idxline];

                line.MarkerDelete(STYLE_MARKER_LIST_ON);
                line.MarkerDelete(STYLE_MARKER_LIST_OFF);
                line.MarkerDelete(STYLE_MARKER_LIST_MIX);

                var hl = GetListHighlight(line.Text);

                if (hl == ListHighlightValue.TRUE)
                {
                    line.MarkerAdd(STYLE_MARKER_LIST_ON);
                }
                if (hl == ListHighlightValue.FALSE)
                {
                    line.MarkerAdd(STYLE_MARKER_LIST_OFF);
                }
                if (hl == ListHighlightValue.INTERMED)
                {
                    line.MarkerAdd(STYLE_MARKER_LIST_MIX);
                }
            }
        }
コード例 #9
0
 public override void SetKeywords(ScintillaNET.Scintilla scintilla)
 {
     scintilla.SetKeywords(1,
                           "break continue do else elseif filter for foreach function if in return switch until where while");
     scintilla.SetKeywords(2,
                           "add-content add-history add-member add-pssnapin clear-content clear-item clear-itemproperty " +
                           "clear-variable compare-object convertfrom-securestring convert-path convertto-html convertto-securestring " +
                           "copy-item copy-itemproperty export-alias export-clixml export-console export-csv foreach-object " +
                           "format-custom format-list format-table format-wide get-acl get-alias get-authenticodesignature " +
                           "get-childitem get-command get-content get-credential get-culture get-date get-eventlog get-executionpolicy " +
                           "get-help get-history get-host get-item get-itemproperty get-location get-member get-pfxcertificate " +
                           "get-process get-psdrive get-psprovider get-pssnapin get-service get-tracesource get-uiculture get-unique " +
                           "get-variable get-wmiobject group-object import-alias import-clixml import-csv invoke-expression " +
                           "invoke-history invoke-item join-path measure-command measure-object move-item move-itemproperty " +
                           "new-alias new-item new-itemproperty new-object new-psdrive new-service new-timespan new-variable " +
                           "out-default out-file out-host out-null out-printer out-string pop-location push-location read-host " +
                           "remove-item remove-itemproperty remove-psdrive remove-pssnapin remove-variable rename-item rename-itemproperty " +
                           "resolve-path restart-service resume-service select-object select-string set-acl set-alias set-authenticodesignature " +
                           "set-content set-date set-executionpolicy set-item set-itemproperty set-location set-psdebug set-service set-tracesource " +
                           "set-variable sort-object split-path start-service start-sleep start-transcript stop-process stop-service stop-transcript " +
                           "suspend-service tee-object test-path trace-command update-formatdata update-typedata where-object write-debug write-error " +
                           "write-host write-output write-progress write-verbose write-warning");
     scintilla.SetKeywords(3,
                           "ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl foreach ft fw gal gc gci gcm gdr ghy gi gl gm gp gps " +
                           "group gsv gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ri rni rnp rp rsnp rv rvpa sal sasv " +
                           "sc select si sl sleep sort sp spps spsv sv tee where write cat cd clear cp h history kill lp ls mount mv popd ps " +
                           "pushd pwd r rm rmdir echo cls chdir copy del dir erase move rd ren set type");
     scintilla.SetKeywords(4,
                           "component description example externalhelp forwardhelpcategory forwardhelptargetname functionality inputs link " +
                           "notes outputs parameter remotehelprunspace role synopsis");
 }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: RednibCoding/RedPad
        private void MainForm_Load(object sender, EventArgs e)
        {
            // CREATE CONTROL
            TextArea             = new ScintillaNET.Scintilla();
            TextArea.BorderStyle = BorderStyle.None;
            TextPanel.Controls.Add(TextArea);

            // BASIC CONFIG
            TextArea.Dock         = System.Windows.Forms.DockStyle.Fill;
            TextArea.TextChanged += (this.OnTextChanged);

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

            // STYLING
            InitColors();
            InitDefaultSyntaxColoring();

            // NUMBER MARGIN
            InitNumberMargin();

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // DRAG DROP
            InitDragDropFile();

            // CLEAR HOTKEYS
            ClearHotkeys();

            // POPULATE LANGUAGE COMBO BOX
            PopulateLanguageDropBox();
        }
コード例 #11
0
ファイル: Test_Form.cs プロジェクト: labeuze/source
        private static void InitSource(Scintilla scintilla)
        {
            scintilla.Text = @"using System;
using System.Text;
using System.IO;

// doc
// doc
// doc
// doc

/*
  doc
  doc
  doc
*/

namespace toto
{
  public class toto
  {
toto
  }
toto
}

";
        }
コード例 #12
0
        public BugDetails()
        {
            InitializeComponent();
            this.Text = "Bug Tracker - Ticket Details";
            this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            TextArea  = new ScintillaNET.Scintilla();
            CodeBox.Controls.Add(TextArea);
            //TextArea.Text = contents;

            // BASIC CONFIG
            TextArea.Dock = System.Windows.Forms.DockStyle.Fill;
            //TextArea.TextChanged += (this.OnTextChanged);

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

            // STYLING
            InitColors();
            InitSyntaxColoring();
            InitNumberMargin();

            // INIT HOTKEYS
            InitHotkeys();

            // Custom formats for date picker
            this.DeadlineDate.Format       = System.Windows.Forms.DateTimePickerFormat.Custom;
            this.DeadlineDate.CustomFormat = " dd/MM/yyyy ";
        }
コード例 #13
0
        protected void LinkHighlight(ScintillaNET.Scintilla sci, int start, string text)
        {
            var m = GetURLMatchingRegex().Matches(text);

            var urlAreas = ExtractRanges(m);

            sci.StartStyling(start);

            int relPos = 0;
            var relEnd = text.Length;

            foreach (var area in urlAreas)
            {
                if (area.Item1 > relPos)
                {
                    sci.SetStyling(area.Item1 - relPos, STYLE_DEFAULT);
                    relPos += (area.Item1 - relPos);
                }

                if (area.Item2 > relPos)
                {
                    sci.SetStyling(area.Item2 - relPos, STYLE_URL);
                    relPos += (area.Item2 - relPos);
                }
            }

            if (relEnd > relPos)
            {
                sci.SetStyling(relEnd - relPos, STYLE_DEFAULT);
            }
        }
コード例 #14
0
ファイル: SourceView.cs プロジェクト: hahoyer/reni.cs
        public SourceView(string text)
            : base("SourceView")
        {
            TextBox = new Scintilla
            {
                Lexer = ScintillaNET.Lexer.Container,
                VirtualSpaceOptions = VirtualSpace.UserAccessible
            };

            foreach (var id in TextStyle.All)
                StyleConfig(id);

            TextBox.StyleNeeded += (s, args) => SignalStyleNeeded(args.Position);
            TextBox.TextChanged += (s, args) => OnTextChanged();

            TextBox.ContextMenu = new ContextMenu();
            TextBox.ContextMenu.Popup += (s, args) => OnContextMenuPopup();

            CompilerCache = new ValueCache<CompilerBrowser>(CreateCompilerBrowser);

            ResultCachesViews = new FunctionCache<Value, ResultCachesView>
                (item => new ResultCachesView(item, this));
            ChildViews = new FunctionCache<object, ChildView>(CreateView);

            Client = TextBox;

            TextBox.Text = text;

            TraceLog = new BrowseTraceCollector(this);
            LogView = new TraceLogView(this);
        }
コード例 #15
0
 public override void SetKeywords(ScintillaNET.Scintilla scintilla)
 {
     scintilla.SetKeywords(0,
                           "!doctype a abbr accept accept-charset accesskey acronym action address align alink alt applet archive " +
                           "area article aside audio axis b background base basefont bdi bdo bgsound bgcolor big blink blockquote " +
                           "body border br button canvas caption cellpadding cellspacing center char charoff charset checkbox checked " +
                           "cite class classid clear code codebase codetype col colgroup color cols colspan command compact content " +
                           "contenteditable contextmenu coords data datafld dataformatas datalist datapagesize datasrc datetime dd " +
                           "declare defer del details dfn dialog dir disabled div dl draggable dropzone dt element em embed enctype " +
                           "event face fieldset figcaption figure file font footer for form frame frameborder frameset h1 h2 h3 h4 h5 h6 " +
                           "head header height hgroup hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex " +
                           "ismap kbd keygen label lang language leftmargin legend li link listing longdesc main map marginheight marginwidth " +
                           "mark marquee maxlength media menu menuitem meta meter multicol method multiple name nav nobr noembed noframes nohref " +
                           "noresize noscript noshade nowrap object ol onabort onautocomplete onautocompleteerror onafterprint onbeforeonload " +
                           "onbeforeprint onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " +
                           "ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied " +
                           "onended onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata " +
                           "onloadedmetadata onloadstart onmessage onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover " +
                           "onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpause onplay onplaying onpointercancel onpointerdown " +
                           "onpointerenter onpointerleave onpointerlockchange onpointerlockerror onpointermove onpointerout onpointerover " +
                           "onpointerup onpopstate onprogress onratechange onreadystatechange onredo onreset onresize onscroll onseeked onseeking " +
                           "onselect onshow onsort onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onundo onunload " +
                           "onvolumechange onwaiting optgroup option output p param picture plaintext password placeholder pre profile progress " +
                           "prompt public q radio readonly rel reset rev rows rowspan rp rt rtc ruby rules s samp scheme scope script section " +
                           "select shadow selected shape size small source spacer span spellcheck src standby start strike strong style sub submit " +
                           "summary sup svg svg:svg tabindex table target tbody td template text textarea tfoot th thead time title topmargin " +
                           "tr track tt type u ul usemap valign value valuetype var version video vlink vspace wbr xmp width xml xmlns");
 }
コード例 #16
0
 public void Set(ScintillaNET.Scintilla ed, ModificationEventArgs e)
 {
     Set(ed,
         e.Position,
         e.Text.Length
         );
 }
コード例 #17
0
        internal KeywordCollection(Scintilla scintilla)
            : base(scintilla)
        {
            if (_lexerStyleMap == null) 1.ToString();
            if (_lexerKeywordListMap == null) 1.ToString();

            // Auugh, this plagued me for a while. Each of the lexers cna define their own "Name"
            // and also asign themsleves to a Scintilla Lexer Constant. Most of the time these
            // match the defined constant, but sometimes they don't. We'll always use the constant
            // name since it's easier to use, consistent and will always have valid characters.
            // However its still valid to access the lexers by this name (as SetLexerLanguage
            // uses this value) so we'll create a lookup.
            _lexerAliasMap = new Dictionary<string, Lexer>(StringComparer.OrdinalIgnoreCase);

            // I have no idea how Progress fits into this. It's defined with the PS lexer const
            // and a name of "progress"

            _lexerAliasMap.Add("PL/M", Lexer.Plm);
            _lexerAliasMap.Add("props", Lexer.Properties);
            _lexerAliasMap.Add("inno", Lexer.InnoSetup);
            _lexerAliasMap.Add("clarion", Lexer.Clw);
            _lexerAliasMap.Add("clarionnocase", Lexer.ClwNoCase);

            //_lexerKeywordListMap = new Dictionary<string,string[]>(StringComparer.OrdinalIgnoreCase);

            //_lexerKeywordListMap.Add("xml", new string[] { "HTML elements and attributes", "JavaScript keywords", "VBScript keywords", "Python keywords", "PHP keywords", "SGML and DTD keywords" });
            //_lexerKeywordListMap.Add("yaml", new string[] { "Keywords" });
            // baan, kix, ave, scriptol, diff, props, makefile, errorlist, latex, null, lot, haskell
            // lexers don't have keyword list names
        }
コード例 #18
0
        public DevNoteLibForm()
        {
            InitializeComponent();

            #region scintilla
            // CREATE CONTROL
            TextArea = new ScintillaNET.Scintilla();
            TextPanel.Controls.Add(TextArea);

            // BASIC CONFIG
            TextArea.Dock = System.Windows.Forms.DockStyle.Fill;
            //TextArea.TextChanged += (this.OnTextChanged);

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

            // STYLING
            InitColors();
            InitSyntaxColoring();

            // NUMBER MARGIN
            InitNumberMargin();

            // BOOKMARK MARGIN
            InitBookmarkMargin();

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // DRAG DROP
            //InitDragDropFile();

            #endregion
        }
コード例 #19
0
        public CodeDetails()
        {
            InitializeComponent();

            this.Text = "Bug Tracker - Submit Code Details";
            this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            TextArea = new ScintillaNET.Scintilla(); //CODEBOX
            CodeBox.Controls.Add(TextArea);
            //TextArea.Text = contents;

            // BASIC CONFIG FOR CODEBOX
            TextArea.Dock = System.Windows.Forms.DockStyle.Fill;
            //TextArea.TextChanged += (this.OnTextChanged);

            // INITIAL VIEW CONFIG FOR CODEBOX
            TextArea.WrapMode          = WrapMode.None;
            TextArea.IndentationGuides = IndentView.LookBoth;

            // STYLING FOR CODEBOX
            InitColors();
            InitSyntaxColoring();
            InitNumberMargin();

            // INIT HOTKEYS FOR CODEBOX
            InitHotkeys();
        }
コード例 #20
0
 public void getPosicionActual()
 {
     while (true)
     {
         Console.WriteLine("Iniciando hilo. " + tabControlArchivos.TabCount);
         if (tabControlArchivos.TabCount > 0)
         {
             try
             {
                 int       panelSeleccionado = tabControlArchivos.SelectedIndex;
                 String    nombreArchivo     = tabControlArchivos.TabPages[panelSeleccionado].Text;
                 Control[] richActual        = tabControlArchivos.TabPages[panelSeleccionado].Controls.Find("rich", false);
                 if (richActual.Length > 0)
                 {
                     //contenidoArchivo = richActual[0].Text;
                     ScintillaNET.Scintilla editor = (ScintillaNET.Scintilla)richActual[0];
                     labelFila.Text    = editor.CurrentLine.ToString();
                     labelColumna.Text = editor.CurrentPosition.ToString();
                     Console.WriteLine("----------------------" + labelFila.Text + labelColumna.Text);
                 }
             }
             catch (Exception e)
             {
                 Console.WriteLine(e);
             }
         }
     }
 }
コード例 #21
0
        private void ConfigureScintillaStyle(ScintillaNET.Scintilla scintilla)
        {
            // Reset the styles
            scintilla.StyleResetDefault();
            scintilla.Styles[Style.Default].Font = "Consolas";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();

            // Set the XML Lexer
            scintilla.Lexer = Lexer.Xml;

            // Show line numbers
            scintilla.Margins[0].Width = 40;

            // Enable folding
            scintilla.SetProperty("fold", "1");
            scintilla.SetProperty("fold.compact", "1");
            scintilla.SetProperty("fold.html", "1");

            // Use Margin 2 for fold markers
            scintilla.Margins[2].Type      = MarginType.Symbol;
            scintilla.Margins[2].Mask      = Marker.MaskFolders;
            scintilla.Margins[2].Sensitive = true;
            scintilla.Margins[2].Width     = 20;

            // Reset folder markers
            for (int i = Marker.FolderEnd; i <= Marker.FolderOpen; i++)
            {
                scintilla.Markers[i].SetForeColor(SystemColors.ControlLightLight);
                scintilla.Markers[i].SetBackColor(SystemColors.ControlDark);
            }

            // Style the folder markers
            scintilla.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus;
            scintilla.Markers[Marker.Folder].SetBackColor(SystemColors.ControlText);
            scintilla.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus;
            scintilla.Markers[Marker.FolderEnd].Symbol  = MarkerSymbol.BoxPlusConnected;
            scintilla.Markers[Marker.FolderEnd].SetBackColor(SystemColors.ControlText);
            scintilla.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner;
            scintilla.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected;
            scintilla.Markers[Marker.FolderSub].Symbol     = MarkerSymbol.VLine;
            scintilla.Markers[Marker.FolderTail].Symbol    = MarkerSymbol.LCorner;

            // Enable automatic folding
            scintilla.AutomaticFold = AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change;

            // Set the Styles
            scintilla.StyleResetDefault();
            // I like fixed font for XML
            scintilla.Styles[Style.Default].Font = "Courier";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();
            scintilla.Styles[Style.Xml.Attribute].ForeColor    = Color.Red;
            scintilla.Styles[Style.Xml.Entity].ForeColor       = Color.Red;
            scintilla.Styles[Style.Xml.Comment].ForeColor      = Color.Green;
            scintilla.Styles[Style.Xml.Tag].ForeColor          = Color.Blue;
            scintilla.Styles[Style.Xml.TagEnd].ForeColor       = Color.Blue;
            scintilla.Styles[Style.Xml.DoubleString].ForeColor = Color.DeepPink;
            scintilla.Styles[Style.Xml.SingleString].ForeColor = Color.DeepPink;
        }
コード例 #22
0
        public override void ApplyStyle(ScintillaNET.Scintilla scintilla)
        {
            scintilla.Styles[Style.Batch.Default].ForeColor = Color.Black;
            scintilla.Styles[Style.Batch.Default].BackColor = Color.White;

            scintilla.Styles[Style.Batch.Comment].ForeColor = ColorTranslator.FromHtml("#008000");
            scintilla.Styles[Style.Batch.Comment].BackColor = Color.White;

            scintilla.Styles[2].ForeColor = ColorTranslator.FromHtml("#0000FF");
            scintilla.Styles[2].BackColor = Color.White;

            scintilla.Styles[Style.Batch.Label].ForeColor = ColorTranslator.FromHtml("#FF0000");
            scintilla.Styles[Style.Batch.Label].BackColor = ColorTranslator.FromHtml("#FFFF80");

            scintilla.Styles[Style.Batch.Hide].ForeColor = ColorTranslator.FromHtml("#FF00FF");
            scintilla.Styles[Style.Batch.Hide].BackColor = Color.White;

            scintilla.Styles[Style.Batch.Command].ForeColor = ColorTranslator.FromHtml("#0080FF");
            scintilla.Styles[Style.Batch.Command].BackColor = Color.White;

            scintilla.Styles[6].ForeColor = ColorTranslator.FromHtml("#FF8000");
            scintilla.Styles[6].BackColor = ColorTranslator.FromHtml("#FCFFF0");

            scintilla.Styles[Style.Batch.Operator].ForeColor = Color.Red;
            scintilla.Styles[Style.Batch.Operator].BackColor = Color.White;
        }
コード例 #23
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // CREATE CONTROL
            TextArea = new ScintillaNET.Scintilla();
            TextPanel.Controls.Add(TextArea);

            // BASIC CONFIG
            TextArea.Dock         = System.Windows.Forms.DockStyle.Fill;
            TextArea.TextChanged += (this.OnTextChanged);

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

            // STYLING
            InitColors();
            InitSyntaxColoring();

            // NUMBER MARGIN
            InitNumberMargin();

            // BOOKMARK MARGIN
            InitBookmarkMargin();

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // DRAG DROP
            InitDragDropFile();

            // INIT HOTKEYS
            InitHotkeys();
        }
コード例 #24
0
 public CodeEditorControlHandler()
 {
     t = Type.GetType("Mono.Runtime");
     if (t != null)
     {
         te2            = new TextBox();
         te2.Font       = new System.Drawing.Font(FontFamily.GenericMonospace, 9.0f);
         te2.Multiline  = true;
         te2.ScrollBars = ScrollBars.Both;
         this.Control   = te2;
     }
     else
     {
         te = new Scintilla();
         te.AnnotationVisible = ScintillaNET.Annotation.Standard;
         te.AutoCChooseSingle = true;
         te.AutoCMaxHeight    = 10;
         te.AutoCOrder        = ScintillaNET.Order.PerformSort;
         te.BorderStyle       = System.Windows.Forms.BorderStyle.FixedSingle;
         te.Lexer             = ScintillaNET.Lexer.Python;
         te.UseTabs           = false;
         SetEditorStyle(te);
         this.Control = te;
     }
 }
コード例 #25
0
 public override void SetKeywords(ScintillaNET.Scintilla scintilla)
 {
     // Set keyword lists
     // Word = 0
     scintilla.SetKeywords(0, "go add alter as authorization backup begin bigint binary bit break " +
                           "browse bulk by cascade case catch check checkpoint close clustered " +
                           "column commit compute constraint containstable continue create current " +
                           "cursor cursor database date datetime datetime2 datetimeoffset dbcc " +
                           "deallocate decimal declare default delete deny desc disk distinct " +
                           "distributed double drop dump else end errlvl escape except exec execute " +
                           "exit external fetch file fillfactor float for foreign freetext freetexttable " +
                           "from full function goto grant group having hierarchyid holdlock identity " +
                           "identity_insert identitycol if image index insert int intersect into key kill " +
                           "lineno load merge money national nchar nocheck nocount nolock nonclustered " +
                           "ntext numeric nvarchar of off offsets on open opendatasource openquery " +
                           "openrowset openxml option order over percent plan precision primary print " +
                           "proc procedure public raiserror read readtext real reconfigure references " +
                           "replication restore restrict return revert revoke rollback rowcount " +
                           "rowguidcol rule save schema securityaudit select set setuser shutdown " +
                           "smalldatetime smallint smallmoney sql_variant statistics table " +
                           "tablesample text textsize then time timestamp tinyint to top tran " +
                           "transaction trigger truncate try union unique uniqueidentifier update " +
                           "updatetext use user values varbinary varchar varying view waitfor when " +
                           "where while with writetext xml ");
     // Word2 = 1
     scintilla.SetKeywords(1, "ascii cast char charindex ceiling coalesce collate contains convert " +
                           "current_date current_time current_timestamp current_user floor isnull " +
                           "max min nullif object_id session_user substring system_user tsequal ");
     // User1 = 4
     scintilla.SetKeywords(4, "all and any between cross exists in inner is join left like not null " +
                           "or outer pivot right some unpivot ( ) * ");
     // User2 = 5
     scintilla.SetKeywords(5, "sys objects sysobjects ");
 }
コード例 #26
0
ファイル: ScintillaBookmark.cs プロジェクト: labeuze/source
        public ScintillaBookmark(Scintilla scintillaControl)
        {
            _scintillaControl = scintillaControl;
            InitScintillaControl();

            InitParentForm();
        }
コード例 #27
0
        public override void ApplyStyle(ScintillaNET.Scintilla scintilla)
        {
            scintilla.SetProperty("tab.timmy.whinge.level", "1");

            // Set the styles
            scintilla.Styles[Style.Python.Default].ForeColor      = Color.FromArgb(0x80, 0x80, 0x80);
            scintilla.Styles[Style.Python.CommentLine].ForeColor  = Color.FromArgb(0x00, 0x7F, 0x00);
            scintilla.Styles[Style.Python.CommentLine].Italic     = true;
            scintilla.Styles[Style.Python.Number].ForeColor       = Color.FromArgb(0x00, 0x7F, 0x7F);
            scintilla.Styles[Style.Python.String].ForeColor       = Color.FromArgb(0x7F, 0x00, 0x7F);
            scintilla.Styles[Style.Python.Character].ForeColor    = Color.FromArgb(0x7F, 0x00, 0x7F);
            scintilla.Styles[Style.Python.Word].ForeColor         = Color.FromArgb(0x00, 0x00, 0x7F);
            scintilla.Styles[Style.Python.Word].Bold              = true;
            scintilla.Styles[Style.Python.Triple].ForeColor       = Color.FromArgb(0x7F, 0x00, 0x00);
            scintilla.Styles[Style.Python.TripleDouble].ForeColor = Color.FromArgb(0x7F, 0x00, 0x00);
            scintilla.Styles[Style.Python.ClassName].ForeColor    = Color.FromArgb(0x00, 0x00, 0xFF);
            scintilla.Styles[Style.Python.ClassName].Bold         = true;
            scintilla.Styles[Style.Python.DefName].ForeColor      = Color.FromArgb(0x00, 0x7F, 0x7F);
            scintilla.Styles[Style.Python.DefName].Bold           = true;
            scintilla.Styles[Style.Python.Operator].Bold          = true;
            // scintilla.Styles[Style.Python.Identifier] ... your keywords styled here
            scintilla.Styles[Style.Python.CommentBlock].ForeColor = Color.FromArgb(0x7F, 0x7F, 0x7F);
            scintilla.Styles[Style.Python.CommentBlock].Italic    = true;
            scintilla.Styles[Style.Python.StringEol].ForeColor    = Color.FromArgb(0x00, 0x00, 0x00);
            scintilla.Styles[Style.Python.StringEol].BackColor    = Color.FromArgb(0xE0, 0xC0, 0xE0);
            scintilla.Styles[Style.Python.StringEol].FillLine     = true;
            scintilla.Styles[Style.Python.Word2].ForeColor        = Color.FromArgb(0x40, 0x70, 0x90);
            scintilla.Styles[Style.Python.Decorator].ForeColor    = Color.FromArgb(0x80, 0x50, 0x00);

            // Important for Python
            scintilla.ViewWhitespace = WhitespaceMode.VisibleAlways;
        }
コード例 #28
0
        private void ConfigureScintillaStyle(ScintillaNET.Scintilla scintilla)
        {
            var selectionColor = Color.FromArgb(255, 192, 192, 192);

            // Reset the styles
            scintilla.StyleResetDefault();
            scintilla.StyleClearAll();

            // Set the XML Lexer
            scintilla.Lexer        = Lexer.Container;
            scintilla.StyleNeeded += scintilla_StyleNeeded;

            scintilla.Styles[(int)RdlScriptLexer.Style.Default].ForeColor    = Color.Black;
            scintilla.Styles[(int)RdlScriptLexer.Style.Identifier].ForeColor = Color.Black;
            scintilla.Styles[(int)RdlScriptLexer.Style.Error].ForeColor      = Color.Red;
            scintilla.Styles[(int)RdlScriptLexer.Style.Error].Underline      = true;
            scintilla.Styles[(int)RdlScriptLexer.Style.Number].ForeColor     = Color.OrangeRed;
            scintilla.Styles[(int)RdlScriptLexer.Style.String].ForeColor     = Color.Brown;
            scintilla.Styles[(int)RdlScriptLexer.Style.Method].ForeColor     = Color.Blue;
            scintilla.Styles[(int)RdlScriptLexer.Style.AggrMethod].ForeColor = Color.Blue;
            scintilla.Styles[(int)RdlScriptLexer.Style.AggrMethod].Bold      = true;
            scintilla.Styles[(int)RdlScriptLexer.Style.UserInfo].ForeColor   = Color.BlueViolet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Globals].ForeColor    = Color.BlueViolet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Parameter].ForeColor  = Color.Violet;
            scintilla.Styles[(int)RdlScriptLexer.Style.Field].ForeColor      = Color.DodgerBlue;
        }
コード例 #29
0
    /// <summary>
    /// Returns the last typed word in the editor.
    /// </summary>
    /// <param name="scintilla"></param>
    /// <returns></returns>
    /// <remarks></remarks>
    private static string getLastWord(this ScintillaNET.Scintilla scintilla)
    {
        string word = "";

        int pos = scintilla.SelectionStart;

        if (pos > 1)
        {
            string tmp = "";
            char   f   = new char();
            while (f != ' ' & pos > 0)
            {
                pos  -= 1;
                tmp   = scintilla.Text.Substring(pos, 1);
                f     = Convert.ToChar(tmp[0]);
                word += f;
            }

            char[] ca = word.ToCharArray();
            Array.Reverse(ca);

            word = new String(ca);
        }
        return(word.Trim());
    }
コード例 #30
0
ファイル: Indicator.cs プロジェクト: jtheisen/ScintillaNET26
        /// <summary>
        ///     Initializes a new instance of the <see cref="Indicator" /> class.
        /// </summary>
        /// <param name="owner">The <see cref="Scintilla" /> control that created this object.</param>
        /// <param name="index">The zero-based index of the document line containing the annotation.</param>
        protected internal Indicator(Scintilla owner, int index)
        {
            _scintilla = owner;
            _index = index;

            _colorBagKey = "Indicator." + index + ".Color";
        }
コード例 #31
0
        public static void InitSyntaxColoring(ScintillaNET.Scintilla editor)
        {
            // Configure the default style
            editor.StyleResetDefault();
            editor.Styles[Style.Default].Font      = "Consolas";
            editor.Styles[Style.Default].Size      = 10;
            editor.Styles[Style.Default].BackColor = IntToColor(0x212121);
            editor.Styles[Style.Default].ForeColor = IntToColor(0xFFFFFF);
            editor.StyleClearAll();

            // Configure the CPP (C#) lexer styles
            editor.Styles[Style.Cpp.Identifier].ForeColor             = IntToColor(0xD0DAE2);
            editor.Styles[Style.Cpp.Comment].ForeColor                = IntToColor(0xBD758B);
            editor.Styles[Style.Cpp.CommentLine].ForeColor            = IntToColor(0x40BF57);
            editor.Styles[Style.Cpp.CommentDoc].ForeColor             = IntToColor(0x2FAE35);
            editor.Styles[Style.Cpp.Number].ForeColor                 = IntToColor(0xFFFF00);
            editor.Styles[Style.Cpp.String].ForeColor                 = IntToColor(0xFFFF00);
            editor.Styles[Style.Cpp.Character].ForeColor              = IntToColor(0xE95454);
            editor.Styles[Style.Cpp.Preprocessor].ForeColor           = IntToColor(0x8AAFEE);
            editor.Styles[Style.Cpp.Operator].ForeColor               = IntToColor(0xE0E0E0);
            editor.Styles[Style.Cpp.Regex].ForeColor                  = IntToColor(0xff00ff);
            editor.Styles[Style.Cpp.CommentLineDoc].ForeColor         = IntToColor(0x77A7DB);
            editor.Styles[Style.Cpp.Word].ForeColor                   = IntToColor(0x48A8EE);
            editor.Styles[Style.Cpp.Word2].ForeColor                  = IntToColor(0xF98906);
            editor.Styles[Style.Cpp.CommentDocKeyword].ForeColor      = IntToColor(0xB3D991);
            editor.Styles[Style.Cpp.CommentDocKeywordError].ForeColor = IntToColor(0xFF0000);
            editor.Styles[Style.Cpp.GlobalClass].ForeColor            = IntToColor(0x48A8EE);

            editor.Lexer = Lexer.Cpp;

            editor.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");
            editor.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");
        }
コード例 #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InsertCheckEventArgs" /> class.
 /// </summary>
 /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
 /// <param name="bytePosition">The zero-based byte position within the document where text is being inserted.</param>
 /// <param name="byteLength">The length in bytes of the inserted text.</param>
 /// <param name="text">A pointer to the text being inserted.</param>
 public InsertCheckEventArgs(Scintilla scintilla, int bytePosition, int byteLength, IntPtr text)
 {
     this.scintilla = scintilla;
     this.bytePosition = bytePosition;
     this.byteLength = byteLength;
     this.textPtr = text;
 }
コード例 #33
0
        private void VbaEditBox_Load(object sender, EventArgs e)
        {
            // CREATE CONTROL
            scEdit = new ScintillaNET.Scintilla();
            this.Controls.Add(scEdit);

            InitHotkeys(this.ParentForm);
            // BASIC CONFIG
            scEdit.Dock         = System.Windows.Forms.DockStyle.Fill;
            scEdit.TextChanged += (this.OnTextChanged);
            scEdit.CharAdded   += ScEdit_CharAdded;
            // INITIAL VIEW CONFIG
            scEdit.WrapMode          = WrapMode.None;
            scEdit.IndentationGuides = IndentView.LookBoth;

            // STYLING
            InitColors();
            InitSyntaxColoring();

            // NUMBER MARGIN
            InitNumberMargin();

            // BOOKMARK MARGIN
            InitBookmarkMargin();

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // DRAG DROP
            InitDragDropFile();
        }
コード例 #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AutoCSelectionEventArgs" /> class.
 /// </summary>
 /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
 /// <param name="bytePosition">The zero-based byte position within the document of the word being completed.</param>
 /// <param name="text">A pointer to the selected autocompletion text.</param>
 /// <param name="ch">The character that caused the completion.</param>
 /// <param name="listCompletionMethod">A value indicating the way in which the completion occurred.</param>
 public AutoCSelectionEventArgs(Scintilla scintilla, int bytePosition, IntPtr text, int ch, ListCompletionMethod listCompletionMethod)
 {
     this.scintilla = scintilla;
     this.bytePosition = bytePosition;
     this.textPtr = text;
     Char = ch;
     ListCompletionMethod = listCompletionMethod;
 }
コード例 #35
0
        public Functions( Scintilla RT)
        {
            InitializeComponent();
            this.RT = RT;

            dataGridView1.Columns.Add("Nombre","Nombre");
            dataGridView1.Columns.Add("Tipo","Tipo");
        }
コード例 #36
0
    /// <summary>
    /// Sets the column margins to correctly show line numbers.
    /// </summary>
    /// <param name="scintilla"></param>
    /// <remarks></remarks>
    public static void SetColumnMargins(this ScintillaNET.Scintilla scintilla)
    {
        dynamic maxLineNumberCharLength = scintilla.Lines.Count.ToString().Length;

        const int padding = 2;

        scintilla.Margins[0].Width = scintilla.TextWidth(Style.LineNumber, new string('9', maxLineNumberCharLength + 1)) + padding;
    }
コード例 #37
0
 public override void SetKeywords(ScintillaNET.Scintilla scintilla)
 {
     scintilla.SetKeywords(0,
                           "assoc aux break call cd chcp chdir choice cls cmdextversion color com com1 com2 com3 com4 con copy country " +
                           "ctty date defined del dir do dpath echo else endlocal erase errorlevel exist exit for ftype goto if in loadfix " +
                           "loadhigh lpt lpt1 lpt2 lpt3 lpt4 md mkdir move not nul path pause popd prn prompt pushd rd rem ren rename " +
                           "rmdir set setlocal shift start time title type ver verify vol");
 }
コード例 #38
0
 private void frmEditor_Load(object sender, EventArgs e)
 {
     this.Text = "Text Editor - " + yarnFile;
     TextArea  = new ScintillaNET.Scintilla();
     pnlEditor.Controls.Add(TextArea);
     InitTextarea();
     LoadDataFromFile(yarnPath);
 }
コード例 #39
0
 public Trigger_Create(NpgsqlConnection conn,Scintilla rt,RichTextBox t)
 {
     InitializeComponent();
     this.conn = conn;
     pc = new Postgres_Connection();
     this.t = t;
     this.rt = rt;
 }
コード例 #40
0
ファイル: IniLexer.cs プロジェクト: herbert2008/WeCode
        private IniLexer(Scintilla scintilla, int startPos, int length)
        {
            this._scintilla = scintilla;
            this._startPos = startPos;

            // One line of _text
            this._text = scintilla.GetRange(startPos, startPos + length).Text;
        }
コード例 #41
0
 public override void SetKeywords(ScintillaNET.Scintilla scintilla)
 {
     scintilla.SetKeywords(0,
                           "ARGF ARGV BEGIN END ENV FALSE DATA NIL RUBY_PATCHLEVEL RUBY_PLATFORM RUBY_RELEASE_DATE RUBY_VERSION " +
                           "PLATFORM RELEASE_DATE STDERR STDIN STDOUT TOPLEVEL_BINDING TRUE __ENCODING__ __END__ __FILE__ __LINE__ " +
                           "alias and begin break case class def defined? do else elsif end ensure false for if in module next nil " +
                           "not or redo rescue retry return self super then true undef unless until when while yield");
 }
コード例 #42
0
 protected internal FindReplace(Scintilla scintilla)
     : base(scintilla)
 {
     _marker = scintilla.Markers[10];
     _marker.SetSymbolInternal(MarkerSymbol.Arrows);
     _indicator = scintilla.Indicators[16];
     _indicator.Color = Color.Purple;
     _indicator.Style = IndicatorStyle.RoundBox;
 }
コード例 #43
0
        public override void SetKeywords(ScintillaNET.Scintilla scintilla)
        {
            var python = "and as assert break class continue def del elif else except exec finally for from global " +
                         "if import in is lambda not or pass print raise return try while with yield";
            //var python = "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";
            var cython = "cdef cimport cpdef";

            scintilla.SetKeywords(0, python + " " + cython);
        }
コード例 #44
0
ファイル: ScintillaFindText.cs プロジェクト: labeuze/source
 //int scintillaIndicator = 0
 public ScintillaFindText(Scintilla scintillaControl)
 {
     _scintillaControl = scintillaControl;
     InitScintillaControl();
     //InitForm();
     InitFindForm();
     InitScintillaControlEvent();
     ControlFindForm.Find(_scintillaControl, InitParentForm);
 }
コード例 #45
0
        bool leftFlag;  //标签是否为左键

        public FormConfigurationEditor()
        {
            InitializeComponent();
            scintillaTextArea             = new ScintillaNET.Scintilla();
            scintillaTextArea.Margin      = new Padding(0);
            scintillaTextArea.BorderStyle = BorderStyle.None;
            scintillaTextArea.Dock        = System.Windows.Forms.DockStyle.Fill;
            TextPanel.Controls.Add(scintillaTextArea);
        }
コード例 #46
0
        private void SetupScintilla(Scintilla scintilla)
        {
            scintilla.StyleResetDefault();
            scintilla.Styles[Style.Default].Font = "Consolas";
            scintilla.Styles[Style.Default].Size = 10;
            scintilla.StyleClearAll();

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

            if (true)
            {
                BackColor = Color.FromArgb(0, 0, 0);
                this.progressBar.BackColor = BackColor;
                scintilla.Styles[Style.Default].ForeColor = Color.Silver;
                scintilla.Styles[Style.Default].BackColor = Color.FromArgb(30, 30, 30);
                scintilla.CaretForeColor = Color.Silver;
                scintilla.SetSelectionBackColor(true, Color.FromArgb(50, 80, 140));

                scintilla.StyleClearAll();
                scintilla.Styles[Style.IndentGuide].BackColor = Color.FromArgb(50, 50, 50);
                scintilla.Styles[Style.IndentGuide].ForeColor = Color.FromArgb(50, 50, 50);

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

            //scintilla.Margins[1].Width = 0;
            scintilla.Margins[1].Type = MarginType.BackColor;
            //scintilla.Margins[0].Width = 16;
        }
コード例 #47
0
ファイル: ScintillaFindText.cs プロジェクト: labeuze/source
        public ScintillaFindText(Scintilla scintillaControl, int scintillaIndicator = 0)
        {
            _scintillaControl = scintillaControl;
            if (scintillaIndicator != 0)
                _scintillaIndicator = scintillaIndicator;
            InitScintillaControl();

            InitForm();
        }
コード例 #48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HotspotClickEventArgs" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
        /// <param name="modifiers">The modifier keys that where held down at the time of the click.</param>
        /// <param name="bytePosition">The zero-based byte position of the clicked text.</param>
        public HotspotClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition)
        {
            this.scintilla = scintilla;
            this.bytePosition = bytePosition;
            Modifiers = modifiers;

            if (bytePosition == -1)
                position = -1;
        }
コード例 #49
0
ファイル: MainForm.cs プロジェクト: procfxgen/MGShaderEditor
        /// <summary>
        /// Ctor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            //Init Scintilla Component
            m_scintillaCtrl = new Scintilla();

            m_scintillaCtrl.Parent = panelTextEditor;
            m_scintillaCtrl.Dock = DockStyle.Fill;
            m_scintillaCtrl.Margins[0].Width = 16;
            m_scintillaCtrl.TabWidth = 2;

            // Configuring the default style with properties
            // we have common to every lexer style saves time.
            m_scintillaCtrl.StyleResetDefault();
            m_scintillaCtrl.Styles[Style.Default].Font = "Consolas";
            m_scintillaCtrl.Styles[Style.Default].Size = 10;
            m_scintillaCtrl.Styles[Style.Default].BackColor = Color.FromArgb(219, 227, 227);
            m_scintillaCtrl.StyleClearAll();

            // Configure the lexer styles
            m_scintillaCtrl.Styles[Style.Cpp.Default].ForeColor = Color.Silver;
            m_scintillaCtrl.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0); // Green
            m_scintillaCtrl.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0); // Green
            m_scintillaCtrl.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128); // Gray
            m_scintillaCtrl.Styles[Style.Cpp.Number].ForeColor = Color.Olive;
            m_scintillaCtrl.Styles[Style.Cpp.Word].ForeColor = Color.Blue;
            m_scintillaCtrl.Styles[Style.Cpp.Word2].ForeColor = Color.Blue;
            m_scintillaCtrl.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21); // Red
            m_scintillaCtrl.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
            m_scintillaCtrl.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
            m_scintillaCtrl.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Maroon;

            m_scintillaCtrl.Lexer = Lexer.Cpp;


            //Create keywords for HLSL
            StringBuilder sb = new StringBuilder();
            var map = new EnumMap<ShaderToken>();
            map.Load("HLSLKeywords.map");
            foreach (var kw in map)
            {
                var str = kw.Key + " ";

                if (str[0] == ':')
                    str = str.Substring(1);

                sb.Append(str);
            }
            m_scintillaCtrl.SetKeywords(0, sb.ToString());

            //MRU
            mruMenu = new MruStripMenuInline(fileToolStripMenuItem, recentFilesToolStripMenuItem, new MruStripMenu.ClickedHandler(OnMruFile), mruRegKey + "\\MRU", 16);
            mruMenu.LoadFromRegistry();
        }
コード例 #50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModificationEventArgs" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
        /// <param name="source">The source of the modification.</param>
        /// <param name="bytePosition">The zero-based byte position within the document where text was modified.</param>
        /// <param name="byteLength">The length in bytes of the inserted or deleted text.</param>
        /// <param name="text">>A pointer to the text inserted or deleted.</param>
        /// <param name="linesAdded">The number of lines added or removed (delta).</param>
        public ModificationEventArgs(Scintilla scintilla, ModificationSource source, int bytePosition, int byteLength, IntPtr text, int linesAdded) : base(scintilla, source, bytePosition, byteLength, text)
        {
            this.scintilla = scintilla;
            this.bytePosition = bytePosition;
            this.byteLength = byteLength;
            this.textPtr = text;

            LinesAdded = linesAdded;
        }
コード例 #51
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BeforeModificationEventArgs" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
        /// <param name="source">The source of the modification.</param>
        /// <param name="bytePosition">The zero-based byte position within the document where text is being modified.</param>
        /// <param name="byteLength">The length in bytes of the text being modified.</param>
        /// <param name="text">A pointer to the text being inserted.</param>
        public BeforeModificationEventArgs(Scintilla scintilla, ModificationSource source, int bytePosition, int byteLength, IntPtr text)
        {
            this.scintilla = scintilla;
            this.bytePosition = bytePosition;
            this.byteLength = byteLength;
            this.textPtr = text;

            Source = source;
        }
コード例 #52
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DoubleClickEventArgs" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
        /// <param name="modifiers">The modifier keys that where held down at the time of the double click.</param>
        /// <param name="bytePosition">The zero-based byte position of the double clicked text.</param>
        /// <param name="line">The zero-based line index of the double clicked text.</param>
        public DoubleClickEventArgs(Scintilla scintilla, Keys modifiers, int bytePosition, int line)
        {
            this.scintilla = scintilla;
            this.bytePosition = bytePosition;
            Modifiers = modifiers;
            Line = line;

            if (bytePosition == -1)
                position = -1;
        }
コード例 #53
0
ファイル: SnippetManager.cs プロジェクト: NekoProject/NekoKun
        public SnippetManager(Scintilla scintilla)
            : base(scintilla)
        {
            _list = new SnippetList(this);

            _snippetLinkTimer.Interval = 1;
            _snippetLinkTimer.Tick += new EventHandler(snippetLinkTimer_Tick);

            IsEnabled = _isEnabled;
        }
コード例 #54
0
ファイル: DwellEventArgs.cs プロジェクト: uQr/ScintillaNET
        /// <summary>
        /// Initializes a new instance of the <see cref="DwellEventArgs" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that generated this event.</param>
        /// <param name="bytePosition">The zero-based byte position within the document where the mouse pointer was lingering.</param>
        /// <param name="x">The x-coordinate of the mouse pointer relative to the <see cref="Scintilla" /> control.</param>
        /// <param name="y">The y-coordinate of the mouse pointer relative to the <see cref="Scintilla" /> control.</param>
        public DwellEventArgs(Scintilla scintilla, int bytePosition, int x, int y)
        {
            this.scintilla = scintilla;
            this.bytePosition = bytePosition;
            X = x;
            Y = y;

            // The position is not over text
            if (bytePosition < 0)
                position = bytePosition;
        }
コード例 #55
0
ファイル: ScintillaBrace.cs プロジェクト: labeuze/source
        public ScintillaBrace(Scintilla scintillaControl)
        {
            _scintillaControl = scintillaControl;

            _scintillaControl.Styles[Style.BraceLight].BackColor = Color.LightGray;
            _scintillaControl.Styles[Style.BraceLight].ForeColor = Color.BlueViolet;
            _scintillaControl.Styles[Style.BraceBad].ForeColor = Color.Red;

            _scintillaControl.UpdateUI += scintillaControl_UpdateUI;
            //ControlFindForm.Find(_scintillaControl, InitForm);
        }
コード例 #56
0
ファイル: ScriptForm.cs プロジェクト: slawer/devicemanager
        protected Script _script = null; // скрипт

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        public ScriptForm()
        {
            InitializeComponent();

            editor = new Scintilla();
            editor.Dock = DockStyle.Fill;
            editor.ConfigurationManager.Language = "cs";

            editor.Margins.Margin0.Width = 35;
            editor.Text = Script.TempladeScriptCode;

            panel1.Controls.Add(editor);
        }
コード例 #57
0
ファイル: ScintillaBrace.cs プロジェクト: labeuze/source
        public ScintillaBrace(Scintilla scintillaControl)
        {
            _scintillaControl = scintillaControl;

            _scintillaControl.Styles[Style.BraceLight].BackColor = Color.LightGray;
            _scintillaControl.Styles[Style.BraceLight].ForeColor = Color.BlueViolet;
            _scintillaControl.Styles[Style.BraceBad].ForeColor = Color.Red;

            _scintillaControl.UpdateUI += scintillaControl_UpdateUI;
            _parentForm = _scintillaControl.FindForm();
            _parentForm.KeyDown += ParentForm_KeyDown;
            _parentForm.KeyPreview = true;
        }
コード例 #58
0
ファイル: Range.cs プロジェクト: jtheisen/ScintillaNET26
 public Range(int start, int end, Scintilla scintilla)
     : base(scintilla)
 {
     if (start < end)
     {
         _start = start;
         _end = end;
     }
     else
     {
         _start = end;
         _end = start;
     }
 }
コード例 #59
0
ファイル: CallTip.cs プロジェクト: NekoProject/NekoKun
 internal CallTip(Scintilla scintilla)
     : base(scintilla)
 {
     //	Go ahead and enable this. It's all pretty idiosyncratic IMO. For one
     //	thing you can't turn it off. We set the CallTip styles by default
     //	anyhow.
     NativeScintilla.CallTipUseStyle(10);
     Scintilla.BeginInvoke(new MethodInvoker(delegate()
     {
         HighlightTextColor = HighlightTextColor;
         ForeColor = ForeColor;
         BackColor = BackColor;
     }));
 }
コード例 #60
0
ファイル: Lexing.cs プロジェクト: jtheisen/ScintillaNET26
        internal Lexing(Scintilla scintilla)
            : base(scintilla)
        {
            _keywords = new KeywordCollection(scintilla);

            // Language names are a superset lexer names. For instance the c and cs (c#)
            // langauges both use the cpp lexer (by default). Languages are kind of a
            // SCite concept, while Scintilla only cares about Lexers. However we don't
            // need to explicetly map a language to a lexer if they are the same name
            // like cpp.
            _lexerLanguageMap.Add("cs", "cpp");
            _lexerLanguageMap.Add("html", "hypertext");
            _lexerLanguageMap.Add("xml", "hypertext");
        }