C# Class Alsing.SourceCode.SyntaxDocument

The SyntaxDocument is a component that is responsible for Parsing , Folding , Undo / Redo actions and various text actions.
Inheritance: System.ComponentModel.Component, IEnumerable
Datei anzeigen Open project: vchelaru/FlatRedBall Class Usage Examples

Public Properties

Property Type Description
KeywordQueue RowList
NeedResetRows bool
ParseQueue RowList
Parser IParser
Tag object
UndoBuffer UndoBuffer
VisibleRows RowList

Private Properties

Property Type Description
Init void
InitializeComponent void
InternalResetVisibleRows void
OnChange void
OnModifiedChanged void
OnRowDeleted void
OnRowParsed void
ParseRows int
ParseRows int

Public Methods

Method Description
Add ( string text ) : Row

Add a new row with the specified text to the bottom of the document

Add ( string text, bool StoreUndo ) : Row

Add a new row with the specified text to the bottom of the document

AddToUndoList ( UndoBlock undo ) : void
AddToUndoList ( UndoBlockCollection ActionGroup ) : void

Add an action to the undo stack

AutoIndentSegment ( Span span ) : void
ChangeVersion ( ) : void

For internal use only

Clear ( ) : void
ClearBookmarks ( ) : void

Removes all bookmarks in the document

ClearBreakpoints ( ) : void

Removes all breakpoints in the document.

DeleteRange ( TextRange Range ) : void

Deletes a range of text

DeleteRange ( TextRange Range, bool StoreUndo ) : void

Deletes a range of text

EndUndoCapture ( ) : UndoBlockCollection

Ends an Undo capture and pushes the collected actions onto the undostack StartUndoCapture

EnsureParsed ( Row Row ) : void

Call this method to ensure that a specific row is fully parsed

FoldAll ( ) : void

Folds all foldable rows

GetEndBracketWord ( Word Start, Pattern End, Span FindIn ) : Word
GetEnumerator ( ) : IEnumerator

GetFormatWordFromPos ( TextPoint p ) : Word

Gets a Word object form a given column , Row index (this only applies if the row is fully parsed)

GetNextBookmark ( int StartIndex ) : int

Gets the row index of the next bookmarked row

GetPreviousBookmark ( int StartIndex ) : int

Gets the row index of the previous bookmarked row

GetRange ( TextRange Range ) : string

Get a range of text

GetRangeFromText ( string text, int xPos, int yPos ) : TextRange

Gets a Range from a given text

GetSegmentFromPos ( TextPoint p ) : Span

Gets a span object form a given column , Row index (This only applies if the row is fully parsed)

GetStartBracketWord ( Word Start, Pattern End, Span FindIn ) : Word
GetWordFromPos ( TextPoint p ) : Word

Gets a Word object form a given column , Row index (this only applies if the row is fully parsed)

IndexOf ( Row xtr ) : int

Returns the index of a given row

Insert ( string text, int index ) : Row

Insert a text at the specified row index

Insert ( string text, int index, bool storeUndo ) : Row

Insert a text at the specified row index

InsertText ( string text, int xPos, int yPos ) : TextPoint

Inserts a text into the document at a given column,row.

InsertText ( string text, int xPos, int yPos, bool StoreUndo ) : TextPoint

Inserts a text into the document at a given column,row.

IntPosToPoint ( int pos ) : TextPoint

Converts a char index into a Column/Row index

InvokeBookmarkAdded ( Row r ) : void
InvokeBookmarkRemoved ( Row r ) : void
InvokeBreakPointAdded ( Row r ) : void
InvokeBreakPointRemoved ( Row r ) : void
InvokeChange ( ) : void

Call this method to make the SyntaxDocument raise the Changed event

InvokeRowParsed ( Row row ) : void

Call this method to make the document raise the RowParsed event

OnApplyFormatRanges ( Row row ) : void
ParseAll ( ) : void

Performs a span parse on all rows. No Keyword colorizing

ParseAll ( bool ParseKeywords ) : void

Parses all rows , either a span parse or a full parse with keyword colorizing

ParseRow ( Row r ) : void

Forces a row to be parsed

ParseRow ( Row r, bool ParseKeywords ) : void

Forces a row to be parsed

ParseSome ( ) : void

Parses a chunk of 1000 rows , this is not thread safe

ParseSome ( int RowCount ) : void

Parse a chunk of rows, this is not thread safe

PointToIntPos ( TextPoint pos ) : int

Converts a Column/Row index position into a char index

PushUndoBlock ( UndoAction Action, string text, int x, int y ) : void
ReParse ( ) : void

ReParses the document

Redo ( ) : TextPoint

Perform an redo action

Remove ( int index ) : void

Remove a row at specified row index

Remove ( int index, bool StoreUndo ) : void
Remove ( int index, bool storeUndo, bool raiseChanged ) : void

Remove a row at specified row index

ResetVisibleRows ( ) : void

Call this method to recalculate the visible rows

SetSyntaxFromEmbeddedResource ( Assembly assembly, String resourceName ) : void

Sets a syntax file, from an embedded resource.

StartUndoCapture ( ) : void

Starts an Undo Capture. This method can be called if you with to collect multiple text operations into one undo action

SyntaxDocument ( ) : System

SyntaxDocument ( IContainer container ) : System

ToggleRow ( Row r ) : void

Toggle expansion of a given row

UnFoldAll ( ) : void

UnFolds all foldable rows

Undo ( ) : TextPoint

Perform an undo action

clear ( ) : void

Clear all content in the document

this ( int index ) : Row

Returns the row at the specified index

Protected Methods

Method Description
OnBookmarkAdded ( Row r ) : void
OnBookmarkRemoved ( Row r ) : void
OnBreakPointAdded ( Row r ) : void
OnBreakPointRemoved ( Row r ) : void
OnUndoBufferChanged ( ) : void

Private Methods

Method Description
Init ( ) : void
InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

InternalResetVisibleRows ( ) : void
OnChange ( ) : void
OnModifiedChanged ( ) : void
OnRowDeleted ( Row r ) : void
OnRowParsed ( Row r ) : void
ParseRows ( Row row ) : int
ParseRows ( Row row, bool Keywords ) : int

Method Details

Add() public method

Add a new row with the specified text to the bottom of the document
public Add ( string text ) : Row
text string Text to add
return Row

Add() public method

Add a new row with the specified text to the bottom of the document
public Add ( string text, bool StoreUndo ) : Row
text string Text to add
StoreUndo bool true if and undo action should be added to the undo stack
return Row

AddToUndoList() public method

public AddToUndoList ( UndoBlock undo ) : void
undo UndoBlock
return void

AddToUndoList() public method

Add an action to the undo stack
public AddToUndoList ( UndoBlockCollection ActionGroup ) : void
ActionGroup UndoBlockCollection action to add
return void

AutoIndentSegment() public method

public AutoIndentSegment ( Span span ) : void
span Span
return void

ChangeVersion() public method

For internal use only
public ChangeVersion ( ) : void
return void

Clear() public method

public Clear ( ) : void
return void

ClearBookmarks() public method

Removes all bookmarks in the document
public ClearBookmarks ( ) : void
return void

ClearBreakpoints() public method

Removes all breakpoints in the document.
public ClearBreakpoints ( ) : void
return void

DeleteRange() public method

Deletes a range of text
public DeleteRange ( TextRange Range ) : void
Range TextRange the range that should be deleted
return void

DeleteRange() public method

Deletes a range of text
public DeleteRange ( TextRange Range, bool StoreUndo ) : void
Range TextRange Range to delete
StoreUndo bool true if the actions should be pushed onto the undo stack
return void

EndUndoCapture() public method

Ends an Undo capture and pushes the collected actions onto the undostack StartUndoCapture
public EndUndoCapture ( ) : UndoBlockCollection
return UndoBlockCollection

EnsureParsed() public method

Call this method to ensure that a specific row is fully parsed
public EnsureParsed ( Row Row ) : void
Row Row
return void

FoldAll() public method

Folds all foldable rows
public FoldAll ( ) : void
return void

GetEndBracketWord() public method

public GetEndBracketWord ( Word Start, Pattern End, Span FindIn ) : Word
Start Word
End Pattern
FindIn Span
return Word

GetEnumerator() public method

public GetEnumerator ( ) : IEnumerator
return IEnumerator

GetFormatWordFromPos() public method

Gets a Word object form a given column , Row index (this only applies if the row is fully parsed)
public GetFormatWordFromPos ( TextPoint p ) : Word
p TextPoint Column and Rowindex
return Word

GetNextBookmark() public method

Gets the row index of the next bookmarked row
public GetNextBookmark ( int StartIndex ) : int
StartIndex int Start index
return int

GetPreviousBookmark() public method

Gets the row index of the previous bookmarked row
public GetPreviousBookmark ( int StartIndex ) : int
StartIndex int Start index
return int

GetRange() public method

Get a range of text
public GetRange ( TextRange Range ) : string
Range TextRange The range to get
return string

GetRangeFromText() public method

Gets a Range from a given text
public GetRangeFromText ( string text, int xPos, int yPos ) : TextRange
text string
xPos int
yPos int
return TextRange

GetSegmentFromPos() public method

Gets a span object form a given column , Row index (This only applies if the row is fully parsed)
public GetSegmentFromPos ( TextPoint p ) : Span
p TextPoint Column and Rowindex
return Span

GetStartBracketWord() public method

public GetStartBracketWord ( Word Start, Pattern End, Span FindIn ) : Word
Start Word
End Pattern
FindIn Span
return Word

GetWordFromPos() public method

Gets a Word object form a given column , Row index (this only applies if the row is fully parsed)
public GetWordFromPos ( TextPoint p ) : Word
p TextPoint Column and Rowindex
return Word

IndexOf() public method

Returns the index of a given row
public IndexOf ( Row xtr ) : int
xtr Row row to find
return int

Insert() public method

Insert a text at the specified row index
public Insert ( string text, int index ) : Row
text string Text to insert
index int Row index where the text should be inserted
return Row

Insert() public method

Insert a text at the specified row index
public Insert ( string text, int index, bool storeUndo ) : Row
text string Text to insert
index int Row index where the text should be inserted
storeUndo bool true if and undo action should be added to the undo stack
return Row

InsertText() public method

Inserts a text into the document at a given column,row.
public InsertText ( string text, int xPos, int yPos ) : TextPoint
text string Text to insert
xPos int Column
yPos int Row index
return TextPoint

InsertText() public method

Inserts a text into the document at a given column,row.
public InsertText ( string text, int xPos, int yPos, bool StoreUndo ) : TextPoint
text string Text to insert
xPos int Column
yPos int Row index
StoreUndo bool true if this action should be pushed onto the undo stack
return TextPoint

IntPosToPoint() public method

Converts a char index into a Column/Row index
public IntPosToPoint ( int pos ) : TextPoint
pos int Char index to convert
return TextPoint

InvokeBookmarkAdded() public method

public InvokeBookmarkAdded ( Row r ) : void
r Row
return void

InvokeBookmarkRemoved() public method

public InvokeBookmarkRemoved ( Row r ) : void
r Row
return void

InvokeBreakPointAdded() public method

public InvokeBreakPointAdded ( Row r ) : void
r Row
return void

InvokeBreakPointRemoved() public method

public InvokeBreakPointRemoved ( Row r ) : void
r Row
return void

InvokeChange() public method

Call this method to make the SyntaxDocument raise the Changed event
public InvokeChange ( ) : void
return void

InvokeRowParsed() public method

Call this method to make the document raise the RowParsed event
public InvokeRowParsed ( Row row ) : void
row Row
return void

OnApplyFormatRanges() public method

public OnApplyFormatRanges ( Row row ) : void
row Row
return void

OnBookmarkAdded() protected method

protected OnBookmarkAdded ( Row r ) : void
r Row
return void

OnBookmarkRemoved() protected method

protected OnBookmarkRemoved ( Row r ) : void
r Row
return void

OnBreakPointAdded() protected method

protected OnBreakPointAdded ( Row r ) : void
r Row
return void

OnBreakPointRemoved() protected method

protected OnBreakPointRemoved ( Row r ) : void
r Row
return void

OnUndoBufferChanged() protected method

protected OnUndoBufferChanged ( ) : void
return void

ParseAll() public method

Performs a span parse on all rows. No Keyword colorizing
public ParseAll ( ) : void
return void

ParseAll() public method

Parses all rows , either a span parse or a full parse with keyword colorizing
public ParseAll ( bool ParseKeywords ) : void
ParseKeywords bool
return void

ParseRow() public method

Forces a row to be parsed
public ParseRow ( Row r ) : void
r Row Row to parse
return void

ParseRow() public method

Forces a row to be parsed
public ParseRow ( Row r, bool ParseKeywords ) : void
r Row Row to parse
ParseKeywords bool true if keywords and operators should be parsed
return void

ParseSome() public method

Parses a chunk of 1000 rows , this is not thread safe
public ParseSome ( ) : void
return void

ParseSome() public method

Parse a chunk of rows, this is not thread safe
public ParseSome ( int RowCount ) : void
RowCount int The number of rows to parse
return void

PointToIntPos() public method

Converts a Column/Row index position into a char index
public PointToIntPos ( TextPoint pos ) : int
pos TextPoint TextPoint where x is column and y is row index
return int

PushUndoBlock() public method

public PushUndoBlock ( UndoAction Action, string text, int x, int y ) : void
Action UndoAction
text string
x int
y int
return void

ReParse() public method

ReParses the document
public ReParse ( ) : void
return void

Redo() public method

Perform an redo action
public Redo ( ) : TextPoint
return TextPoint

Remove() public method

Remove a row at specified row index
public Remove ( int index ) : void
index int index of the row that should be removed
return void

Remove() public method

public Remove ( int index, bool StoreUndo ) : void
index int
StoreUndo bool
return void

Remove() public method

Remove a row at specified row index
public Remove ( int index, bool storeUndo, bool raiseChanged ) : void
index int index of the row that should be removed
storeUndo bool true if and undo action should be added to the undo stack
raiseChanged bool
return void

ResetVisibleRows() public method

Call this method to recalculate the visible rows
public ResetVisibleRows ( ) : void
return void

SetSyntaxFromEmbeddedResource() public method

Sets a syntax file, from an embedded resource.
public SetSyntaxFromEmbeddedResource ( Assembly assembly, String resourceName ) : void
assembly System.Reflection.Assembly The assembly which contains the embedded resource.
resourceName String The name of the resource.
return void

StartUndoCapture() public method

Starts an Undo Capture. This method can be called if you with to collect multiple text operations into one undo action
public StartUndoCapture ( ) : void
return void

SyntaxDocument() public method

public SyntaxDocument ( ) : System
return System

SyntaxDocument() public method

public SyntaxDocument ( IContainer container ) : System
container IContainer
return System

ToggleRow() public method

Toggle expansion of a given row
public ToggleRow ( Row r ) : void
r Row
return void

UnFoldAll() public method

UnFolds all foldable rows
public UnFoldAll ( ) : void
return void

Undo() public method

Perform an undo action
public Undo ( ) : TextPoint
return TextPoint

clear() public method

Clear all content in the document
public clear ( ) : void
return void

this() public method

Returns the row at the specified index
public this ( int index ) : Row
index int
return Row

Property Details

KeywordQueue public_oe property

public RowList KeywordQueue
return RowList

NeedResetRows public_oe property

Gets or Sets if folding needs to be recalculated
public bool NeedResetRows
return bool

ParseQueue public_oe property

List of rows that should be parsed
public RowList ParseQueue
return RowList

Parser public_oe property

The active parser of the document
public IParser Parser
return IParser

Tag public_oe property

Tag property , lets the user store custom data in the row.
public object Tag
return object

UndoBuffer public_oe property

Buffer containing undo actions
public UndoBuffer UndoBuffer
return UndoBuffer

VisibleRows public_oe property

List of rows that is not hidden by folding
public RowList VisibleRows
return RowList