rename SyntaxHighlighter to SyntaxSupport

This commit is contained in:
Vadim Lopatin 2015-02-24 11:19:37 +03:00
parent 2428b06ad8
commit 9275b8c811
3 changed files with 23 additions and 23 deletions

View File

@ -395,7 +395,7 @@
<File path="src\dlangui\widgets\widget.d" /> <File path="src\dlangui\widgets\widget.d" />
<File path="src\dlangui\widgets\winframe.d" /> <File path="src\dlangui\widgets\winframe.d" />
</Folder> </Folder>
<File path="src\dlangui\all.d" /> <File path="src\dlangui\package.d" />
</Folder> </Folder>
</Folder> </Folder>
</Folder> </Folder>

View File

@ -436,12 +436,12 @@ alias TokenProp = ubyte;
alias TokenPropString = TokenProp[]; alias TokenPropString = TokenProp[];
/// interface for custom syntax highlight /// interface for custom syntax highlight
interface SyntaxHighlighter { interface SyntaxSupport {
/// returns editable content /// returns editable content
@property EditableContent content(); @property EditableContent content();
/// set editable content /// set editable content
@property SyntaxHighlighter content(EditableContent content); @property SyntaxSupport content(EditableContent content);
/// categorize characters in content by token types /// categorize characters in content by token types
void updateHighlight(dstring[] lines, TokenPropString[] props, int changeStartLine, int changeEndLine); void updateHighlight(dstring[] lines, TokenPropString[] props, int changeStartLine, int changeEndLine);
@ -495,16 +495,16 @@ class EditableContent {
protected UndoBuffer _undoBuffer; protected UndoBuffer _undoBuffer;
protected SyntaxHighlighter _syntaxHighlighter; protected SyntaxSupport _syntaxSupport;
@property SyntaxHighlighter syntaxHighlighter() { @property SyntaxSupport syntaxSupport() {
return _syntaxHighlighter; return _syntaxSupport;
} }
@property EditableContent syntaxHighlighter(SyntaxHighlighter syntaxHighlighter) { @property EditableContent syntaxSupport(SyntaxSupport syntaxSupport) {
_syntaxHighlighter = syntaxHighlighter; _syntaxSupport = syntaxSupport;
if (_syntaxHighlighter) { if (_syntaxSupport) {
_syntaxHighlighter.content = this; _syntaxSupport.content = this;
updateTokenProps(0, cast(int)_lines.length); updateTokenProps(0, cast(int)_lines.length);
} }
return this; return this;
@ -516,7 +516,7 @@ class EditableContent {
/// returns true if content has syntax highlight handler set /// returns true if content has syntax highlight handler set
@property bool hasSyntaxHighlight() { @property bool hasSyntaxHighlight() {
return _syntaxHighlighter !is null; return _syntaxSupport !is null;
} }
protected bool _readOnly; protected bool _readOnly;
@ -656,9 +656,9 @@ class EditableContent {
} }
bool findMatchedBraces(TextPosition p, out TextRange range) { bool findMatchedBraces(TextPosition p, out TextRange range) {
if (!_syntaxHighlighter) if (!_syntaxSupport)
return false; return false;
TextPosition p2 = _syntaxHighlighter.findPairedBracket(p); TextPosition p2 = _syntaxSupport.findPairedBracket(p);
if (p == p2) if (p == p2)
return false; return false;
if (p < p2) { if (p < p2) {
@ -673,8 +673,8 @@ class EditableContent {
protected void updateTokenProps(int startLine, int endLine) { protected void updateTokenProps(int startLine, int endLine) {
clearTokenProps(startLine, endLine); clearTokenProps(startLine, endLine);
if (_syntaxHighlighter) { if (_syntaxSupport) {
_syntaxHighlighter.updateHighlight(_lines, _tokenProps, startLine, endLine); _syntaxSupport.updateHighlight(_lines, _tokenProps, startLine, endLine);
} }
} }

View File

@ -920,17 +920,17 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
override bool handleActionStateRequest(const Action a) { override bool handleActionStateRequest(const Action a) {
switch (a.id) { switch (a.id) {
case EditorActions.ToggleBlockComment: case EditorActions.ToggleBlockComment:
if (!_content.syntaxHighlighter || !_content.syntaxHighlighter.supportsToggleBlockComment) if (!_content.syntaxSupport || !_content.syntaxSupport.supportsToggleBlockComment)
a.state = ACTION_STATE_INVISIBLE; a.state = ACTION_STATE_INVISIBLE;
else if (enabled && _content.syntaxHighlighter.canToggleBlockComment(_selectionRange)) else if (enabled && _content.syntaxSupport.canToggleBlockComment(_selectionRange))
a.state = ACTION_STATE_ENABLED; a.state = ACTION_STATE_ENABLED;
else else
a.state = ACTION_STATE_DISABLE; a.state = ACTION_STATE_DISABLE;
return true; return true;
case EditorActions.ToggleLineComment: case EditorActions.ToggleLineComment:
if (!_content.syntaxHighlighter || !_content.syntaxHighlighter.supportsToggleLineComment) if (!_content.syntaxSupport || !_content.syntaxSupport.supportsToggleLineComment)
a.state = ACTION_STATE_INVISIBLE; a.state = ACTION_STATE_INVISIBLE;
else if (enabled && _content.syntaxHighlighter.canToggleLineComment(_selectionRange)) else if (enabled && _content.syntaxSupport.canToggleLineComment(_selectionRange))
a.state = ACTION_STATE_ENABLED; a.state = ACTION_STATE_ENABLED;
else else
a.state = ACTION_STATE_DISABLE; a.state = ACTION_STATE_DISABLE;
@ -2070,12 +2070,12 @@ class EditBox : EditWidgetBase {
} }
return true; return true;
case EditorActions.ToggleBlockComment: case EditorActions.ToggleBlockComment:
if (_content.syntaxHighlighter && _content.syntaxHighlighter.supportsToggleBlockComment && _content.syntaxHighlighter.canToggleBlockComment(_selectionRange)) if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleBlockComment && _content.syntaxSupport.canToggleBlockComment(_selectionRange))
_content.syntaxHighlighter.toggleBlockComment(_selectionRange, this); _content.syntaxSupport.toggleBlockComment(_selectionRange, this);
return true; return true;
case EditorActions.ToggleLineComment: case EditorActions.ToggleLineComment:
if (_content.syntaxHighlighter && _content.syntaxHighlighter.supportsToggleLineComment && _content.syntaxHighlighter.canToggleLineComment(_selectionRange)) if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleLineComment && _content.syntaxSupport.canToggleLineComment(_selectionRange))
_content.syntaxHighlighter.toggleLineComment(_selectionRange, this); _content.syntaxSupport.toggleLineComment(_selectionRange, this);
return true; return true;
case EditorActions.AppendNewLine: case EditorActions.AppendNewLine:
{ {