Esempio n. 1
1
 private Scintilla InstantiateScintilla()
 {
     // TODO: Read preferences from disk, via Controller and Preferences instances.
     Scintilla scintilla = new Scintilla();
     scintilla.AcceptsReturn = true;
     scintilla.AcceptsTab = true;
     scintilla.AllowDrop = true;
     scintilla.Dock = DockStyle.Fill;
     scintilla.ConfigurationManager.CustomLocation = "ScintillaNET.xml";
     scintilla.ConfigurationManager.Language = "xml";
     scintilla.Enabled = true;
     // TODO: Investigate indentation, do it.
     //scintilla.Indentation = SmartIndent.Simple;
     // TODO: Investigate what is required to claim accessibility, then do it.
     scintilla.IsAccessible = false;
     scintilla.IsReadOnly = false;
     scintilla.Location = new Point(0);
     scintilla.MatchBraces = true;
     scintilla.Margin = scintilla.Padding = new Padding(0);
     // TODO: Calculate the width of the line number margin dynamically.
     scintilla.Margins[0].Width = 40;
     scintilla.OverType = false;
     scintilla.Styles.LineNumber.BackColor = Color.Blue;
     scintilla.Styles.LineNumber.ForeColor = Color.Cyan;
     scintilla.TabIndex = 0;
     scintilla.TabStop = false;
     scintilla.Visible = true;
     return scintilla;
 }
Esempio n. 2
0
 internal Folding(Scintilla scintilla)
     : base(scintilla)
 {
     IsEnabled = true;
     UseCompactFolding = false;
     MarkerScheme = FoldMarkerScheme.BoxPlusMinus;
 }
Esempio n. 3
0
 private void closeAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     tabControl1.TabPages.Clear();
     string title = "New" + (tabControl1.TabCount + 1).ToString();
     TabPage myTabPage = new TabPage(title);
     ScintillaNet.Scintilla newtext = new ScintillaNet.Scintilla();
     myTabPage.Controls.Add(newtext);
     newtext.AllowDrop = true;
     newtext.AutoComplete.DropRestOfWord = true;
     newtext.AutoComplete.ListString = "";
     newtext.Dock = System.Windows.Forms.DockStyle.Fill;
     newtext.Folding.UseCompactFolding = true;
     newtext.Location = new System.Drawing.Point(3, 3);
     newtext.Margins.Margin0.Width = 20;
     newtext.Margins.Margin1.IsClickable = true;
     newtext.Margins.Margin1.IsFoldMargin = true;
     newtext.Margins.Margin1.Width = 3;
     newtext.Margins.Margin2.IsMarkerMargin = true;
     newtext.Margins.Margin2.Width = 16;
     newtext.Name = title;
     newtext.Size = new System.Drawing.Size(783, 353);
     newtext.Styles.BraceBad.FontName = "Verdana";
     newtext.Styles.BraceLight.FontName = "Verdana";
     newtext.Styles.ControlChar.FontName = "Verdana";
     newtext.Styles.Default.FontName = "Verdana";
     newtext.Styles.IndentGuide.FontName = "Verdana";
     newtext.Styles.LastPredefined.FontName = "Verdana";
     newtext.Styles.LineNumber.FontName = "Verdana";
     newtext.Styles.Max.FontName = "Verdana";
     newtext.TabIndex = 0;
     tabControl1.TabPages.Add(myTabPage);
     tabControl1.SelectedTab = myTabPage;
 }
Esempio n. 4
0
        internal KeywordCollection(Scintilla scintilla)
            : base(scintilla)
        {
            //	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
        }
        public BaseScincillaWraper()
        {
            InitializeComponent();
            var ui = TaskScheduler.FromCurrentSynchronizationContext();

            if (Process.GetCurrentProcess().ProcessName != "devenv")
            {
                _sca = new Scintilla();
                Initialize(_sca);
                _sca.CharAdded += new EventHandler<CharAddedEventArgs>(CharAdded);
                splitContainer1.Panel1.Controls.Add(_sca);

                var deafultColor = _sca.BackColor;
                _sca.BackColor = Color.Gray;
                _sca.Enabled = false;
                Task.Factory
                    .StartNew(EvaluationHelper.InitEvaluator)
                    .ContinueWith(_ =>
                                      {
                                          _sca.Enabled = true;
                                          _sca.BackColor = deafultColor;
                                      }, ui);
            }
            else
            {
                BackColor = Color.White;
            }
        }
Esempio n. 6
0
 private LexerInitializer(Scintilla scintilla, int startPos, int length)
 {
     this.scintilla = scintilla;
     this.startPos = startPos;
     // One line of text
     this.text = scintilla.GetRange(startPos, startPos + length).Text;
 }
Esempio n. 7
0
		public SnippetManager(Scintilla scintilla)
			: base(scintilla)
		{
			_list = new SnippetList(this);

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

			IsEnabled = _isEnabled;
		}
Esempio n. 8
0
		public Range(int start, int end, Scintilla scintilla) : base(scintilla)
		{
			if(start < end)
			{
				_start	= start;
				_end	= end;
			}
			else
			{
				_start	= end;
				_end	= start;
			}
		}
Esempio n. 9
0
        private void WindowLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            // Create the interop host control.
            var host = new WindowsFormsHost();
            this.codeEditorControl = new Scintilla { MatchBraces = true };
            this.codeEditorControl.DocumentChange += this.CodeEditorControlTextChanged;

            // Assign the MaskedTextBox control as the host control's child.
            host.Child = this.codeEditorControl;

            // Add the interop host control to the Grid
            // control's collection of child controls.
            this.CodeEditorGrid.Children.Add(host);
        }
Esempio n. 10
0
		internal StyleCollection(Scintilla scintilla) : base(scintilla)
		{
			Bits = 7;

			//	Defaulting CallTip Settings to Platform defaults
			Style s = CallTip;
			s.ForeColor = SystemColors.InfoText;
			s.BackColor = SystemColors.Info;
			s.Font = SystemFonts.StatusFont;

			//	Making Line Number's BackColor have a named system color
			//	instead of just the value
			LineNumber.BackColor = SystemColors.Control;
		}
Esempio n. 11
0
        internal KeywordCollection(Scintilla scintilla)
            : base(scintilla)
        {
            _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	);
        }
Esempio n. 12
0
		internal Lexing(Scintilla scintilla)
			: base(scintilla) 
		{
			WhitespaceChars = DEFAULT_WHITECHARS;
			WordChars = DEFAULT_WORDCHARS;
			_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");
		}
Esempio n. 13
0
		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;

			_window = new FindReplaceDialog();
			_window.Scintilla = scintilla;

			_incrementalSearcher = new IncrementalSearcher();
			_incrementalSearcher.Scintilla = scintilla;
			_incrementalSearcher.Visible = false;
			scintilla.Controls.Add(_incrementalSearcher);
		}
Esempio n. 14
0
        public static void Init(Scintilla scintilla)
        {
            // Reset any current language and enable the StyleNeeded
            // event by setting the lexer to container.
            scintilla.Indentation.SmartIndentType = SmartIndent.None;
            scintilla.ConfigurationManager.Language = String.Empty;
            scintilla.Lexing.LexerName = "container";
            scintilla.Lexing.Lexer = Lexer.Container;

            // Add our custom styles to the collection
            scintilla.Styles[QUOTED_STYLE].ForeColor = Color.FromArgb(153, 51, 51);
            scintilla.Styles[KEY_STYLE].ForeColor = Color.FromArgb(0, 0, 153);
            scintilla.Styles[ASSIGNMENT_STYLE].ForeColor = Color.OrangeRed;
            scintilla.Styles[VALUE_STYLE].ForeColor = Color.FromArgb(102, 0, 102);
            scintilla.Styles[COMMENT_STYLE].ForeColor = Color.FromArgb(102, 102, 102);
            scintilla.Styles[SECTION_STYLE].ForeColor = Color.FromArgb(0, 0, 102);
            scintilla.Styles[SECTION_STYLE].Bold = true;
        }
Esempio n. 15
0
        //apply custom style
        public static void ApplyUserStyle(Scintilla scintilla,CodeEditorConfig codeeditorcong )
        {
            Font userFont = new Font(codeeditorcong.Font, codeeditorcong.FontSize, codeeditorcong.FontStyle, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

            //config-style line marging
            scintilla.Styles[STYLE_LINENUMBER].BackColor = Color.White;
            scintilla.Styles[STYLE_LINENUMBER].ForeColor = Color.DarkTurquoise;
            scintilla.Styles[STYLE_LINENUMBER].Bold = true;

            //apply user configuration
            scintilla.UseFont = true;
            scintilla.Font = userFont;
            scintilla.Styles[STYLE_LINENUMBER].Size =(float)codeeditorcong.FontSize;

            int Ratio = (int)codeeditorcong.FontSize;
            scintilla.Margins[LINENUMBER_MARGIN].Width = Ratio * scintilla.Lines.Count.ToString().Length + 4;

            scintilla.Folding.MarkerScheme = codeeditorcong.FoldingMarker;
            scintilla.Caret.HighlightCurrentLine = codeeditorcong.IsLineHilighting;
        }
Esempio n. 16
0
 public override List<LuaError> GetError(String text, Scintilla editor)
 {
     // Search the editor's characters for SCE_LUA_STRINGEOL.
     Boolean insideInvalidEOL = false;
     String textBuffer = "";
     Int32 errorIndex = 0;
     List<LuaError> errorList = new List<LuaError>();
     for (Int32 currentIndex = 0; currentIndex < text.Length; currentIndex += 1)
     {
         Byte characterStyle = editor.Styles.GetStyleAt(currentIndex);
         if (characterStyle == (byte)LexerStyleConstants.SCE_LUA_STRINGEOL)
         {
             if (insideInvalidEOL)
             {
                 textBuffer += text[currentIndex];
             }
             else
             {
                 insideInvalidEOL = true;
                 errorIndex = currentIndex;
                 textBuffer = ""; // by not setting this to the character, we omit the leading " which
                 // is normally included in the STRINGEOL section.
             }
         }
         else if (insideInvalidEOL)
         {
             KeyValuePair<Int32, Int32> lineColumn = SyntaxChecker.LineColumnBeforeIndex(text, errorIndex);
             errorList.Add(new LuaError(
                 lineColumn.Key,
                 lineColumn.Value,
                 errorIndex,
                 textBuffer.Length,
                 String.Format(this.errorMsg, textBuffer.Trim())
                 ));
             insideInvalidEOL = false;
             errorIndex = 0;
             textBuffer = "";
         }
     }
     return errorList;
 }
Esempio n. 17
0
        public Styler(ScintillaNet.Scintilla ScintillaCtrl)
        {
            STLControl = ScintillaCtrl;

            InitStyleIndex();
            LoadStyle(STLControl);

            //ApplyStyle(@"(\$\w+)", styleIndex["Variable"], 1);
            //ApplyStyle(@"(\$\w+?)\s*=[^>]", styleIndex["Variable (declare)"], 1);
            //ApplyStyle(@"([=+&])", styleIndex["Operators"], 1);
            //ApplyStyle(@"(VK_\w+)", styleIndex["Virtual-key"], 1);
            //ApplyStyle(@"[Uu][0-9A-Fa-f]{4}", styleIndex["Hex Notation"], 0);
            //ApplyStyle(@"(?:NULL)|(?:null)", styleIndex["NULL Value"], 0);
            //ApplyStyle(@"(\[[*^]\])", styleIndex["Any Operator"], 1);
            //ApplyStyle(@"(\[\$\w+\])", styleIndex["Reference"], 1);
            //ApplyStyle(@"([><])", styleIndex["Virtual-key Start End Operator"], 1);
            //ApplyStyle(@"(=>)", styleIndex["Out Operator"], 1);
            //ApplyStyle(@"(\(\s*(?:['""])[^\1\n]+?\1\s*\))\B", styleIndex["Switch"], 1);
            //ApplyStyle(@"(\\)\s+?$", styleIndex["Line Joiner"], 1);
            //ApplyStyle(@"((['""])[^\1\n]+?\2\B)", styleIndex["String"], 1);
            //ApplyStyle(@"(['""])[^\1\n]*(\\[Uu][0-9a-fA-F]{4})[^\1\n]*?\1\B", styleIndex["In-string Hex Notation"], 2);
        }
Esempio n. 18
0
        internal AutoComplete(Scintilla scintilla) : base(scintilla)
		{
            scintilla.CharAdded += new EventHandler<CharAddedEventArgs>(scintilla_CharAdded);
            scintilla.KeyDown += new KeyEventHandler(scintilla_KeyDown);
            scintilla.AutoCompleteAccepted += new EventHandler<AutoCompleteAcceptedEventArgs>(scintilla_AutoCompleteAccepted);
        	RegisterImage(1, DefaultImages.PrivateClass);
        	RegisterImage(2, DefaultImages.PrivateEnum);
        	RegisterImage(3, DefaultImages.PrivateEvent);
        	RegisterImage(4, DefaultImages.PrivateExtension);
        	RegisterImage(5, DefaultImages.PrivateField);
        	RegisterImage(6, DefaultImages.PrivateInterface);
        	RegisterImage(7, DefaultImages.PrivateMethod);
        	RegisterImage(9, DefaultImages.PrivateProperty);
        	RegisterImage(10, DefaultImages.PrivateStructure);
        	RegisterImage(11, DefaultImages.ProtectedClass);
        	RegisterImage(12, DefaultImages.ProtectedDelegate);
        	RegisterImage(13, DefaultImages.ProtectedEnum);
        	RegisterImage(14, DefaultImages.ProtectedEvent);
        	RegisterImage(15, DefaultImages.ProtectedExtension);
        	RegisterImage(16, DefaultImages.ProtectedField);
        	RegisterImage(17, DefaultImages.ProtectedInterface);
        	RegisterImage(18, DefaultImages.ProtectedMethod);
        	RegisterImage(19, DefaultImages.ProtectedOperator);
        	RegisterImage(20, DefaultImages.ProtectedProperty);
        	RegisterImage(21, DefaultImages.ProtectedStructure);
        	RegisterImage(22, DefaultImages.PublicClass);
        	RegisterImage(23, DefaultImages.PublicDelegate);
        	RegisterImage(24, DefaultImages.PublicEnum);
        	RegisterImage(25, DefaultImages.PublicEvent);
        	RegisterImage(26, DefaultImages.PublicExtension);
        	RegisterImage(27, DefaultImages.PublicField);
        	RegisterImage(28, DefaultImages.PublicInterface);
        	RegisterImage(29, DefaultImages.PublicMethod);
        	RegisterImage(30, DefaultImages.PublicOperator);
        	RegisterImage(31, DefaultImages.PublicProperty);
            RegisterImage(32, DefaultImages.PublicStructure);
            RegisterImage(33, DefaultImages.Keyword);
            RegisterImage(34, DefaultImages.Snippet);
		}
Esempio n. 19
0
        public Styler(ScintillaNet.Scintilla ScintillaCtrl)
        {
            STLControl = ScintillaCtrl;

            InitStyleIndex();
            LoadStyle(STLControl);

            //ApplyStyle(@"(\$\w+)", styleIndex["Variable"], 1);
            //ApplyStyle(@"(\$\w+?)\s*=[^>]", styleIndex["Variable (declare)"], 1);
            //ApplyStyle(@"([=+&])", styleIndex["Operators"], 1);
            //ApplyStyle(@"(VK_\w+)", styleIndex["Virtual-key"], 1);
            //ApplyStyle(@"[Uu][0-9A-Fa-f]{4}", styleIndex["Hex Notation"], 0);
            //ApplyStyle(@"(?:NULL)|(?:null)", styleIndex["NULL Value"], 0);
            //ApplyStyle(@"(\[[*^]\])", styleIndex["Any Operator"], 1);
            //ApplyStyle(@"(\[\$\w+\])", styleIndex["Reference"], 1);
            //ApplyStyle(@"([><])", styleIndex["Virtual-key Start End Operator"], 1);
            //ApplyStyle(@"(=>)", styleIndex["Out Operator"], 1);
            //ApplyStyle(@"(\(\s*(?:['""])[^\1\n]+?\1\s*\))\B", styleIndex["Switch"], 1);
            //ApplyStyle(@"(\\)\s+?$", styleIndex["Line Joiner"], 1);
            //ApplyStyle(@"((['""])[^\1\n]+?\2\B)", styleIndex["String"], 1);
            //ApplyStyle(@"(['""])[^\1\n]*(\\[Uu][0-9a-fA-F]{4})[^\1\n]*?\1\B", styleIndex["In-string Hex Notation"], 2);
        }
Esempio n. 20
0
		internal Indicator(int number, Scintilla scintilla) : base(scintilla)
		{
			_number	= number;
		}
Esempio n. 21
0
		internal IndicatorCollection(Scintilla scintilla) : base(scintilla){}
Esempio n. 22
0
 internal LineWrap(Scintilla scintilla)
     : base(scintilla)
 {
 }
Esempio n. 23
0
		internal GoTo(Scintilla scintilla)
			: base(scintilla)
		{}
Esempio n. 24
0
        public void Configure(ScintillaNet.Scintilla scintilla, string language)
        {
            scintilla.Styles.ClearAll();
            scintilla.Folding.IsEnabled = false;

            IScintillaConfig conf = this;
            ILanguageConfig  lang = conf.Languages[language];

            if (lang != null)
            {
                lang = lang.CombinedLanguageConfig;

                //CauseError;
                //FIND THE MAP FOR THE NEXT 2 LINES
                if (lang.CodePage.HasValue)
                {
                    scintilla.NativeInterface.SetCodePage(lang.CodePage.Value);
                }
                //if (lang.SelectionAlpha.HasValue) scintilla.Selection.ForeColor = lang.SelectionAlpha.Value;
                if (lang.SelectionBackColor != Color.Empty)
                {
                    scintilla.Selection.BackColor = lang.SelectionBackColor;
                }
                if (lang.TabSize.HasValue)
                {
                    scintilla.Indentation.TabWidth = lang.TabSize.Value;
                }
                if (lang.IndentSize.HasValue)
                {
                    scintilla.Indentation.IndentWidth = lang.IndentSize.Value;
                }

                // Enable line numbers
                scintilla.Margins.Margin0.Width = 40;

                bool enableFolding = false;
                if (lang.Fold.HasValue)
                {
                    enableFolding = lang.Fold.Value;
                }
                if (enableFolding)
                {
                    // Lexer specific properties
                    scintilla.PropertyBag.Add("fold", "1");

                    //CAUSE ERROR;
                    //this Is TO CAUSE AN ERROR TO REMIND ME TO CHECK ALL OF THESE ELEMENTS!!!;

                    if (lang.FoldAtElse.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.at.else", (lang.FoldAtElse.Value ? "1" : "0"));
                    }
                    if (lang.FoldCompact.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.compact", (lang.FoldCompact.Value ? "1" : "0"));
                    }
                    if (lang.FoldComment.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.comment", (lang.FoldComment.Value ? "1" : "0"));
                    }
                    if (lang.FoldPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.preprocessor", (lang.FoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.StylingWithinPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("styling.within.preprocessor", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }

                    if (lang.HtmlFold.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.html", (lang.HtmlFold.Value ? "1" : "0"));
                    }
                    if (lang.HtmlFoldPreprocessor.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.html.preprocessor", (lang.HtmlFoldPreprocessor.Value ? "1" : "0"));
                    }
                    if (lang.HtmlTagsCaseSensitive.HasValue)
                    {
                        scintilla.PropertyBag.Add("html.tags.case.sensitive", (lang.HtmlTagsCaseSensitive.Value ? "1" : "0"));
                    }

                    if (lang.PythonFoldComment.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.comment.python", (lang.PythonFoldComment.Value ? "1" : "0"));
                    }
                    if (lang.PythonFoldQuotes.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.quotes.python", (lang.PythonFoldQuotes.Value ? "1" : "0"));
                    }
                    if (lang.PythonWhingeLevel.HasValue)
                    {
                        scintilla.PropertyBag.Add("tab.timmy.whinge.level", lang.PythonWhingeLevel.Value.ToString());
                    }

                    if (lang.SqlBackslashEscapes.HasValue)
                    {
                        scintilla.PropertyBag.Add("sql.backslash.escapes", (lang.SqlBackslashEscapes.Value ? "1" : "0"));
                    }
                    if (lang.SqlBackticksIdentifier.HasValue)
                    {
                        scintilla.PropertyBag.Add("lexer.sql.backticks.identifier", (lang.SqlBackticksIdentifier.Value ? "1" : "0"));
                    }
                    if (lang.SqlFoldOnlyBegin.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.sql.only.begin", (lang.SqlFoldOnlyBegin.Value ? "1" : "0"));
                    }

                    if (lang.PerlFoldPod.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.perl.pod", (lang.PerlFoldPod.Value ? "1" : "0"));
                    }
                    if (lang.PerlFoldPackage.HasValue)
                    {
                        scintilla.PropertyBag.Add("fold.perl.package", (lang.PerlFoldPackage.Value ? "1" : "0"));
                    }

                    if (lang.NsisIgnoreCase.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.ignorecase", (lang.NsisIgnoreCase.Value ? "1" : "0"));
                    }
                    if (lang.NsisUserVars.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.uservars", (lang.NsisUserVars.Value ? "1" : "0"));
                    }
                    if (lang.NsisFoldUtilCommand.HasValue)
                    {
                        scintilla.PropertyBag.Add("nsis.foldutilcmd", (lang.NsisFoldUtilCommand.Value ? "1" : "0"));
                    }
                    if (lang.CppAllowDollars.HasValue)
                    {
                        scintilla.PropertyBag.Add("lexer.cpp.allow.dollars", (lang.CppAllowDollars.Value ? "1" : "0"));
                    }

                    //for HTML lexer: "asp.default.language"
                    //enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };

                    scintilla.Margins.Margin1.Width       = 0;
                    scintilla.Margins.Margin1.Type        = MarginType.Symbol;
                    scintilla.Margins.Margin1.Mask        = unchecked ((int)0xFE000000);
                    scintilla.Margins.Margin1.IsClickable = true;

                    if (lang.FoldMarginWidth.HasValue)
                    {
                        scintilla.Margins.Margin1.Width = lang.FoldMarginWidth.Value;
                    }
                    else
                    {
                        scintilla.Margins.Margin1.Width = 20;
                    }

                    //if (lang.FoldMarginColor != Color.Empty)
                    //    scintilla.Margins.SetFoldMarginColor(true, lang.FoldMarginColor);
                    //if (lang.FoldMarginHighlightColor != Color.Empty)
                    //    scintilla.SetFoldMarginHiColor(true, lang.FoldMarginHighlightColor);
                    //if (lang.FoldFlags.HasValue)
                    //    scintilla.SetFoldFlags(lang.FoldFlags.Value);

                    scintilla.Markers.Folder.Symbol            = MarkerSymbol.Plus;
                    scintilla.Markers.FolderOpen.Symbol        = MarkerSymbol.Minus;
                    scintilla.Markers.FolderEnd.Symbol         = MarkerSymbol.Empty;
                    scintilla.Markers.FolderOpenMidTail.Symbol = MarkerSymbol.Empty;
                    scintilla.Markers.FolderOpenMid.Symbol     = MarkerSymbol.Minus;
                    scintilla.Markers.FolderSub.Symbol         = MarkerSymbol.Empty;
                    scintilla.Markers.FolderTail.Symbol        = MarkerSymbol.Empty;

                    //scintilla.EnableMarginClickFold();
                }

                if (!string.IsNullOrEmpty(lang.WhitespaceCharacters))
                {
                    scintilla.Lexing.WhitespaceChars = lang.WhitespaceCharacters;
                }

                if (!string.IsNullOrEmpty(lang.WordCharacters))
                {
                    scintilla.Lexing.WordChars = lang.WordCharacters;
                }

                ILexerConfig lexer = lang.Lexer;

                scintilla.Lexing.Lexer     = Utilities.LexerLookupByID(lexer.LexerID);
                scintilla.Lexing.LexerName = lang.Name;

                SortedDictionary <int, ILexerStyle> styles = lang.Styles;
                foreach (ILexerStyle style in styles.Values)
                {
                    if (style.ForeColor != Color.Empty)
                    {
                        scintilla.Styles[style.StyleIndex].ForeColor = style.ForeColor;
                    }

                    if (style.BackColor != Color.Empty)
                    {
                        scintilla.Styles[style.StyleIndex].BackColor = style.BackColor;
                    }

                    if (!string.IsNullOrEmpty(style.FontName))
                    {
                        scintilla.Styles[style.StyleIndex].FontName = style.FontName;
                    }

                    if (style.FontSize.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Size = style.FontSize.Value;
                    }

                    if (style.Bold.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Bold = style.Bold.Value;
                    }

                    if (style.Italics.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].Italic = style.Italics.Value;
                    }

                    if (style.EOLFilled.HasValue)
                    {
                        scintilla.Styles[style.StyleIndex].IsSelectionEolFilled = style.EOLFilled.Value;
                    }

                    scintilla.Styles[style.StyleIndex].Case = style.CaseVisibility;
                }


                for (int j = 0; j < 9; j++)
                {
                    if (lang.KeywordLists.ContainsKey(j))
                    {
                        scintilla.Lexing.SetKeywords(j, lang.KeywordLists[j]);
                    }
                    else
                    {
                        scintilla.Lexing.SetKeywords(j, string.Empty);
                    }
                }
            }

            scintilla.Lexing.Colorize(0, scintilla.Text.Length);
        }
Esempio n. 25
0
 internal MarkerCollection(Scintilla scintilla)
     : base(scintilla)
 {
 }
Esempio n. 26
0
 internal Marker(Scintilla scintilla, int number)
     : base(scintilla)
 {
     _number = number;
 }
Esempio n. 27
0
        public void createEditorTab(string Location)
        {
            ScintillaNet.Scintilla scintilla = new ScintillaNet.Scintilla();
            scintilla.Caret.BlinkRate = 500;
            if (Location.ToLower().EndsWith(".java"))
            {
                scintilla.ConfigurationManager.CustomLocation = "C:\\Program Files\\Bukkit Plugin Writer\\code highlighting.xml";
                scintilla.ConfigurationManager.Language       = "java";
            }
            else if (Location.ToLower().EndsWith(".yml") || Location.ToLower().EndsWith(".yaml"))
            {
                scintilla.ConfigurationManager.Language = "yaml";
            }
            scintilla.Dock = System.Windows.Forms.DockStyle.Fill;
            scintilla.Folding.IsEnabled            = false;
            scintilla.Indentation.TabWidth         = 4;
            scintilla.Indentation.UseTabs          = false;
            scintilla.Location                     = new System.Drawing.Point(0, 0);
            scintilla.Margins.Margin0.Width        = 20;
            scintilla.Margins.Margin2.IsClickable  = false;
            scintilla.Margins.Margin2.IsFoldMargin = false;
            scintilla.Name = "scintilla1";
            scintilla.Printing.PageSettings.Color = false;
            scintilla.Size        = new System.Drawing.Size(377, 147);
            scintilla.Styles.Bits = 5;
            scintilla.Styles.BraceBad.FontName       = "Verdana";
            scintilla.Styles.BraceLight.FontName     = "Verdana";
            scintilla.Styles.ControlChar.FontName    = "Verdana";
            scintilla.Styles.Default.FontName        = "Verdana";
            scintilla.Styles.IndentGuide.FontName    = "Verdana";
            scintilla.Styles.LastPredefined.FontName = "Verdana";
            scintilla.Styles.LineNumber.FontName     = "Verdana";
            scintilla.Styles.Max.FontName            = "Verdana";
            scintilla.TabIndex  = 0;
            scintilla.KeyPress += new KeyPressEventHandler(scintilla_KeyPress);
            DockContainerItem  tab       = new DockContainerItem();
            PanelDockContainer container = new PanelDockContainer();

            tab.Control = container;
            bar4.Items.Add(tab);
            container.Controls.Add(scintilla);
            tab.Text = "New File";
            if (Location != "")
            {
                if (System.IO.File.Exists(Location))
                {
                    System.IO.StreamReader reader = new System.IO.StreamReader(Location);
                    scintilla.Text = reader.ReadToEnd();
                    scintilla.Tag  = Location;

                    reader.Close();
                    tab.Text = Location.Split('\\')[Location.Split('\\').Count() - 1];
                    int i = 0;
                    foreach (DockContainerItem tabb in bar4.Items)
                    {
                        if (tabb == tab)
                        {
                            break;
                        }
                        else
                        {
                            i++;
                        }
                    }
                    bar4.SelectedDockTab = i;
                }
            }
        }
Esempio n. 28
0
		protected internal Selection(Scintilla scintilla) : base(scintilla) 
		{			
			NativeScintilla.SetSelBack(BackColor != Color.Transparent, Utilities.ColorToRgb(BackColor));
			NativeScintilla.SetSelFore(ForeColor != Color.Transparent, Utilities.ColorToRgb(ForeColor));
		}
Esempio n. 29
0
		protected internal LinesCollection(Scintilla scintilla) : base(scintilla) { }
Esempio n. 30
0
		internal EndOfLine(Scintilla scintilla) : base(scintilla) { }
Esempio n. 31
0
 internal MarkerInstance(Scintilla scintilla, Marker marker, int handle)
     : base(scintilla)
 {
     _marker = marker;
     _handle = handle;
 }
Esempio n. 32
0
		internal Indentation(Scintilla scintilla) : base(scintilla) { }
Esempio n. 33
0
		protected internal Selection(Scintilla scintilla) : base(scintilla) 
		{			
			NativeScintilla.SetSelBack(true, Utilities.ColorToRgb(BackColor));
			NativeScintilla.SetSelFore(true, Utilities.ColorToRgb(ForeColor));
		}