diff --git a/Irony.GrammarExplorer/Highlighter/FastColoredTextBoxHighlighter.cs b/Irony.GrammarExplorer/Highlighter/FastColoredTextBoxHighlighter.cs index d6a40db..f831fa5 100644 --- a/Irony.GrammarExplorer/Highlighter/FastColoredTextBoxHighlighter.cs +++ b/Irony.GrammarExplorer/Highlighter/FastColoredTextBoxHighlighter.cs @@ -220,7 +220,7 @@ private int VScrollPos { public void LockTextBox() { // Stop redrawing: TextBox.BeginUpdate(); - //SendMessage(TextBox.Handle, WM_SETREDRAW, 0, IntPtr.Zero); + SendMessage(TextBox.Handle, WM_SETREDRAW, 0, IntPtr.Zero); // Stop sending of events: _savedEventMask = SendMessage(TextBox.Handle, EM_GETEVENTMASK, 0, IntPtr.Zero); SendMessage(TextBox.Handle, EM_SETEVENTMASK, 0, IntPtr.Zero); @@ -230,28 +230,25 @@ public void UnlockTextBox() { // turn on events SendMessage(TextBox.Handle, EM_SETEVENTMASK, 0, _savedEventMask); // turn on redrawing - //SendMessage(TextBox.Handle, WM_SETREDRAW, 1, IntPtr.Zero); + SendMessage(TextBox.Handle, WM_SETREDRAW, 1, IntPtr.Zero); TextBox.EndUpdate(); } void Adapter_ColorizeTokens(object sender, ColorizeEventArgs args) { if (_disposed) return; - //Debug.WriteLine("Coloring " + args.Tokens.Count + " tokens."); - _colorizing = true; TextBox.BeginUpdate(); try { foreach (Token tkn in args.Tokens) { var tokenRange = TextBox.GetRange(tkn.Location.Position, tkn.Location.Position + tkn.Length); var tokenStyle = GetTokenStyle(tkn); + tokenRange.ClearStyle(StyleIndex.All); tokenRange.SetStyle(tokenStyle); } } finally { TextBox.EndUpdate(); _colorizing = false; } - - TextBox.Refresh(); } private Style GetTokenStyle(Token token) { diff --git a/Libraries/FastColoredTextBox/FastColoredTextBox.XML b/Libraries/FastColoredTextBox/FastColoredTextBox.XML new file mode 100644 index 0000000..1799438 --- /dev/null +++ b/Libraries/FastColoredTextBox/FastColoredTextBox.XML @@ -0,0 +1,1953 @@ + + + + FastColoredTextBox + + + + + Required designer variable. + + + + + Clean up any resources being used. + + true if managed resources should be disposed; otherwise, false. + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Highlights syntax for given language + + + + + Highlights syntax for given XML description file + + + + + Highlights C# code + + + + + + Highlights VB code + + + + + + Highlights HTML code + + + + + + Highlights SQL code + + + + + + Highlights PHP code + + + + + + Highlights JavaScript code + + + + + + Language + + + + + Item of autocomplete menu + + + + + Returns text for inserting into Textbox + + + + + Compares fragment text with this item + + + + + Returns text for display into popup menu + + + + + This method is called after item inserted into text + + + + + Title for tooltip. + + Return null for disable tooltip for this item + + + + Tooltip text. + + For display tooltip text, ToolTipTitle must be not null + + + + Menu text. This text is displayed in the drop-down menu. + + + + + Item do not appears + + + + + Item appears + + + + + Item appears and will selected + + + + + Autocomplete item for code snippets + + Snippet can contain special char ^ for caret position. + + + + Compares fragment text with this item + + + + + This autocomplete item appears after dot + + + + + Style of chars + + This is base class for all text and design renderers + + + + Constructor + + + + + Renders given range of text + + Graphics object + Position of the range in absolute control coordinates + Rendering range of text + + + + Occurs when user click on StyleVisualMarker joined to this style + + + + + Shows VisualMarker + Call this method in Draw method, when you need to show VisualMarker for your style + + + + + This style is exported to outer formats (HTML for example) + + + + + Occurs when user click on StyleVisualMarker joined to this style + + + + + Style for chars rendering + This renderer can draws chars, with defined fore and back colors + + + + + Renderer for folded block + + + + + Renderer for selection area + + + + + Marker style + Draws background color for text + + + + + Popup menu for autocomplete + + + + + Shows popup menu immediately + + If True - MinFragmentLength will be ignored + + + + Regex pattern for serach fragment around caret + + + + + Minimum fragment length for popup + + + + + User selects item + + + + + It fires after item inserting + + + + + Occurs when popup menu is opening + + + + + Allow TAB for select menu item + + + + + Interval of menu appear (ms) + + + + + This class contains the source text (chars and styles). + It stores a text lines, the manager of commands, undo/redo stack, styles. + + + + + This class contains the source text (chars and styles). + It stores a text lines, the manager of commands, undo/redo stack, styles. + + + + + Styles + Maximum style count is 16 + + + + + Occurs when line was inserted/added + + + + + Occurs when line was removed + + + + + Occurs when text was changed + + + + + Occurs when recalc is needed + + + + + Occurs before text changing + + + + + Occurs after CurrentTB was changed + + + + + Current focused FastColoredTextBox + + + + + Default text style + This style is using when no one other TextStyle is not defined in Char.style + + + + + Text lines + + + + + Occurs when need to display line in the textbox + + + + + Occurs when need to save line in the file + + + + + This text will be displayed in textbox + + + + + This property contains only changed text. + If text of line is not changed, this property contains null. + + + + + This text will be saved in the file + + + + + Required designer variable. + + + + + Clean up any resources being used. + + true if managed resources should be disposed; otherwise, false. + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + This classes is required for correct data binding to Text property of FastColoredTextbox + + + + + Diapason of text chars + + + + + Constructor + + + + + Constructor + + + + + Constructor + + + + + Returns intersection with other range, + empty range returned otherwise + + + + + + + Returns union with other range. + + + + + + + Select all chars of control + + + + + Clone range + + + + + + Move range right + + This method jump over folded blocks + + + + Move range left + + This method can to go inside folded blocks + + + + Move range left + + This method jump over folded blocks + + + + Move range left + + This method can to go inside folded blocks + + + + Set style for range + + + + + Set style for given regex pattern + + + + + Set style for given regex + + + + + Set style for given regex pattern + + + + + Set style for given regex pattern + + + + + Set style for given regex pattern + + + + + Appends style to chars of range + + + + + Sets folding markers + + Pattern for start folding line + Pattern for finish folding line + + + + Sets folding markers + + Pattern for start folding line + Pattern for finish folding line + + + + Finds ranges for given regex pattern + + Regex pattern + Enumeration of ranges + + + + Finds ranges for given regex pattern + + Regex pattern + Enumeration of ranges + + + + Finds ranges for given regex pattern. + Search is separately in each line. + This method requires less memory than GetRanges(). + + Regex pattern + Enumeration of ranges + + + + Finds ranges for given regex + + Enumeration of ranges + + + + Clear styles of range + + + + + Clear styles of range + + + + + Clear folding markers of all lines of range + + + + + Starts selection position updating + + + + + Ends selection position updating + + + + + Exchanges Start and End if End appears before Start + + + + + Exchanges Start and End + + + + + Expands range from first char of Start line to last char of End line + + + + + Get fragment of text around Start place. Returns maximal mathed to pattern fragment. + + Allowed chars pattern for fragment + Range of found fragment + + + + Get fragment of text around Start place. Returns maximal mathed to pattern fragment. + + Allowed chars pattern for fragment + Range of found fragment + + + + Start line and char position + + + + + Finish line and char position + + + + + Text of range + + This property has not 'set' accessor because undo/redo stack works only with + FastColoredTextBox.Selection range. So, if you want to set text, you need to use FastColoredTextBox.Selection + and FastColoredTextBox.InsertText() mehtod. + + + + + Returns first char after Start place + + + + + Returns first char before Start place + + + + + Return minimum of end.X and start.X + + + + + Return maximum of end.X and start.X + + + + + Exports colored text as HTML + + At this time only TextStyle renderer is supported. Other styles is not exported. + + + + Use nbsp; instead space + + + + + Use nbsp; instead space in beginning of line + + + + + Use original font + + + + + Use style tag instead style attribute + + + + + Use br tag instead \n + + + + + Fast colored textbox + + + + + Constructor + + + + + Occurs when VisibleRange is changed + + + + + Invalidates the entire surface of the control and causes the control to be redrawn. + This method is thread safe and does not require Invoke. + + + + + Call this method if the recalc of the position of lines is needed. + + + + + Navigates forward (by Line.LastVisit property) + + + + + Navigates backward (by Line.LastVisit property) + + + + + Navigates to defined line, without Line.LastVisit reseting + + + + + Adds new style + + Layer index of this style + + + + Shows find dialog + + + + + Shows find dialog + + + + + Shows replace dialog + + + + + Shows replace dialog + + + + + Gets length of given line + + Line index + Length of line + + + + Get range of line + + Line index + + + + Copy selected text into Clipboard + + + + + Cut selected text into Clipboard + + + + + Paste text from clipboard into selection position + + + + + Select all chars of text + + + + + Move caret to end of text + + + + + Move caret to first position + + + + + Clear text, styles, history, caches + + + + + Clear buffer of styles + + + + + Clear style of all text + + + + + Clears undo and redo stacks + + + + + Insert text into current selection position + + + + + + Insert text into current selection position (with predefined style) + + + + + + Append string to end of the Text + + + + + + Returns index of the style in Styles + -1 otherwise + + + Index of the style in Styles + + + + Returns StyleIndex mask of given styles + + + StyleIndex mask of given styles + + + + Deletes selected chars + + + + + Deletes current line(s) + + + + + Scroll control for display defined rectangle + + + + + + Scroll control for display caret + + + + + Scroll control left + + + + + Scroll control for display selection area + + + + + Convert selected text to upper case + + + + + Convert selected text to lower case + + + + + Insert/remove comment prefix into selected lines + + + + + Insert/remove comment prefix into selected lines + + + + + Inserts autoindent's spaces in the line + + + + + Returns needed start space count for the line + + + + + Undo last operation + + + + + Redo + + + + + Draw control + + + + + Gets nearest line and char position from coordinates + + Point + Line and char position + + + + Gets nearest absolute text position for given point + + Point + Position + + + + Fires TextChanging event + + + + + Fires TextChanged event + + + + + Fires TextChanged event + + + + + Fires TextChanged event + + + + + Fires TextChanged event + + + + + Fires SelectionCnaged event + + + + + Gets absolute text position from line and char position + + Line and char position + Index of text char + + + + Gets line and char position from absolute text position + + + + + + + Gets point for given line and char position + + Line and char position + Coordiantes + + + + Get range of text + + Absolute start position + Absolute finish position + Range + + + + Get range of text + + Line and char position + Line and char position + Range + + + + Finds ranges for given regex pattern + + Regex pattern + Enumeration of ranges + + + + Finds ranges for given regex pattern + + Regex pattern + Enumeration of ranges + + + + Get text of given line + + Line index + Text + + + + Exapnds folded block + + + + + + Expand collapsed block + + + + + Expand collapsed block + + Any line inside collapsed block + + + + Collapses all folding blocks + + + + + Exapnds all folded blocks + + + + + + Collapses folding block + + Start folding line + + + + Collapse text block + + + + + Insert TAB into front of seletcted lines + + + + + Remove TAB from front of seletcted lines + + + + + Insert autoindents into selected lines + + + + + Insert prefix into front of seletcted lines + + + + + Remove prefix from front of seletcted lines + + + + + Begins AutoUndo block. + All changes of text between BeginAutoUndo() and EndAutoUndo() will be canceled in one operation Undo. + + + + + Ends AutoUndo block. + All changes of text between BeginAutoUndo() and EndAutoUndo() will be canceled in one operation Undo. + + + + + Prints range of text + + + + + Prints all text + + + + + Prints all text, without any dialog windows + + + + + Open file binding mode + + + + + + + Close file binding mode + + + + + Save text to the file + + + + + + + Set VisibleState of line + + + + + Returns VisibleState of the line + + + + + Shows Goto dialog form + + + + + Occurs when undo/redo stack is changed + + + + + Indicates if tab characters are accepted as input + + + + + Indicates if return characters are accepted as input + + + + + Background color for current line + + + + + Background color for highlighting of changed lines + + + + + Fore color (default style color) + + + + + Height of char in pixels + + + + + Interval between lines (in pixels) + + + + + Width of char in pixels + + + + + Spaces count for tab + + + + + Text was changed + + + + + Text version + + This counter is incremented each time changes the text + + + + Read only + + + + + Shows line numbers. + + + + + Color of line numbers. + + + + + Start value of first line number. + + + + + Background color of indent area + + + + + Color of service lines (folding lines, borders of blocks etc.) + + + + + Color of folding area indicator + + + + + Enables folding indicator (left vertical line between folding bounds) + + + + + Left indent in pixels + + + + + Left padding in pixels + + + + + This property draws vertical line after defined char position. + Set to 0 for disable drawing of vertical line. + + + + + Styles + Maximum style count is 16 + + + + + Default text style + This style is using when no one other TextStyle is not defined in Char.style + + + + + Style for rendering Selection area + + + + + Style for folded block rendering + + + + + Style for brackets highlighting + + + + + Style for alternative brackets highlighting + + + + + Opening bracket for brackets highlighting. + Set to '\x0' for disable brackets highlighting. + + + + + Closing bracket for brackets highlighting. + Set to '\x0' for disable brackets highlighting. + + + + + Alternative opening bracket for brackets highlighting. + Set to '\x0' for disable brackets highlighting. + + + + + Alternative closing bracket for brackets highlighting. + Set to '\x0' for disable brackets highlighting. + + + + + Comment line prefix. + + + + + This property specifies which part of the text will be highlighted as you type (by built-in highlighter). + + When a user enters text, a component of rebuilding the highlight (because the text is changed). + This property specifies exactly which section of the text will be re-highlighted. + This can be useful to highlight multi-line comments, for example. + + + + Is keyboard in replace mode (wide caret) ? + + + + + Allows text rendering several styles same time. + + + + + Allows AutoIndent. Inserts spaces before new line. + + + + + Minimal delay(ms) for delayed events (except TextChangedDelayed). + + + + + Minimal delay(ms) for TextChangedDelayed event. + + + + + Language for highlighting by built-in highlighter. + + + + + Syntax Highlighter + + + + + XML file with description of syntax highlighting. + This property works only with Language == Language.Custom. + + + + + Position of left highlighted bracket. + + + + + Position of right highlighted bracket. + + + + + Position of left highlighted alternative bracket. + + + + + Position of right highlighted alternative bracket. + + + + + Start line index of current highlighted folding area. Return -1 if start of area is not found. + + + + + End line index of current highlighted folding area. Return -1 if end of area is not found. + + + + + TextSource + + + + + The source of the text. + Allows to get text from other FastColoredTextBox. + + + + + Returns current visible range of text + + + + + Current selection range + + + + + Background color. + + + + + Multiline + + + + + WordWrap. + + + + + WordWrap mode. + + + + + Count of lines with wordwrap effect + + + + + Do not change this property + + + + + Count of lines + + + + + Gets or sets char and styleId for given place + This property does not fire OnTextChanged event + + + + + Gets Line + + + + + Text of control + + + + + Text lines + + + + + Gets colored text as HTML + + For more flexibility you can use ExportToHTML class also + + + + Text of current selection + + + + + Start position of selection + + + + + Length of selected text + + + + + Font + + Use only monospaced font + + + + Indicates that IME is allowed (for CJK language entering) + + + + + Is undo enabled? + + + + + Is redo enabled? + + + + + Range of all text + + + + + TextChanged event. + It occurs after insert, delete, clear, undo and redo operations. + + + + + Fake event for correct data binding + + + + + TextChanging event. + It occurs before insert, delete, clear, undo and redo operations. + + + + + SelectionChanged event. + It occurs after changing of selection. + + + + + VisibleRangeChanged event. + It occurs after changing of visible range. + + + + + TextChangedDelayed event. + It occurs after insert, delete, clear, undo and redo operations. + This event occurs with a delay relative to TextChanged, and fires only once. + + + + + SelectionChangedDelayed event. + It occurs after changing of selection. + This event occurs with a delay relative to SelectionChanged, and fires only once. + + + + + VisibleRangeChangedDelayed event. + It occurs after changing of visible range. + This event occurs with a delay relative to VisibleRangeChanged, and fires only once. + + + + + It occurs when user click on VisualMarker. + + + + + It occurs when visible char is enetering (alphabetic, digit, punctuation, DEL, BACKSPACE) + + Set Handle to True for cancel key + + + + It occurs when visible char is enetered (alphabetic, digit, punctuation, DEL, BACKSPACE) + + + + + It occurs when calculates AutoIndent for new line + + + + + It occurs when line background is painting + + + + + Occurs when line was inserted/added + + + + + Occurs when line was removed + + + + + Occurs when current highlighted folding area is changed. + Current folding area see in StartFoldingLine and EndFoldingLine. + + + + + + Occurs when undo/redo stack is changed + + + + + + Inserted line index + + + + + Count of inserted lines + + + + + Removed line index + + + + + Count of removed lines + + + + + UniqueIds of removed lines + + + + + TextChanged event argument + + + + + Constructor + + + + + This range contains changed area of text + + + + + Word wrapping by control width + + + + + Word wrapping by preferred line width (PreferredLineWidth) + + + + + Char wrapping by control width + + + + + Char wrapping by preferred line width (PreferredLineWidth) + + + + + Additional spaces count for this line, relative to previous line + + + + + Additional spaces count for next line, relative to previous line + + + + + Type of highlighting + + + + + Highlight only changed range of text. Highest performance. + + + + + Highlight visible range of text. Middle performance. + + + + + Highlight all (visible and invisible) text. Lowest performance. + + + + + Required designer variable. + + + + + Clean up any resources being used. + + true if managed resources should be disposed; otherwise, false. + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + Line index and char index + + + + + Line of text + + + + + Clears style of chars, delete folding markers + + + + + Clears folding markers + + + + + Text of line was changed + + + + + Time of last visit of caret in this line + + This property can be used for forward/backward navigating + + + + Background brush. + + + + + Unique ID + + + + + Count of needed start spaces for AutoIndent + + + + + Text of the line + + + + + Count of start spaces + + + + + Visible state + + + + + Gets index of wordwrap string for given char position + + + + + Calculates wordwrap cutoffs + + + + + Positions for wordwrap cutoffs + + + + + Count of wordwrap string count for this line + + + + + Limited stack + + + + + Constructor + + Maximum length of stack + + + + Pop item + + + + + Peek item + + + + + Push item + + + + + Clear stack + + + + + Max stack length + + + + + Current length of stack + + + + + Char and style + + + + + Unicode character + + + + + Style bit mask + + Bit 1 in position n means that this char will rendering by FastColoredTextBox.Styles[n] + + + + Style index mask + + + + + Insert single char + + This operation includes also insertion of new line and removing char by backspace + + + + Constructor + + Underlaying textbox + Inserting char + + + + Undo operation + + + + + Execute operation + + + + + Merge lines i and i+1 + + + + + Insert text + + + + + Constructor + + Underlaying textbox + Text for inserting + + + + Undo operation + + + + + Execute operation + + + + + Insert text into given ranges + + + + + Constructor + + Underlaying textbox + List of ranges for replace + Text for inserting + + + + Undo operation + + + + + Execute operation + + + + + Clear selected text + + + + + Construstor + + Underlaying textbox + + + + Undo operation + + + + + Execute operation + + + + + Insert texts into given ranges + + + + + Constructor + + Underlaying textsource + List of ranges for replace + + + + Undo operation + + + + + Execute operation + + + +