From 9275b8c811819f41f670c78ec4adba1f52dc8aec Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 24 Feb 2015 11:19:37 +0300 Subject: [PATCH] rename SyntaxHighlighter to SyntaxSupport --- dlanguilib.visualdproj | 2 +- src/dlangui/core/editable.d | 28 ++++++++++++++-------------- src/dlangui/widgets/editors.d | 16 ++++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj index 63ecfed8..c0e17faf 100644 --- a/dlanguilib.visualdproj +++ b/dlanguilib.visualdproj @@ -395,7 +395,7 @@ - + diff --git a/src/dlangui/core/editable.d b/src/dlangui/core/editable.d index 74b1a744..3af95e39 100644 --- a/src/dlangui/core/editable.d +++ b/src/dlangui/core/editable.d @@ -436,12 +436,12 @@ alias TokenProp = ubyte; alias TokenPropString = TokenProp[]; /// interface for custom syntax highlight -interface SyntaxHighlighter { +interface SyntaxSupport { /// returns editable content @property EditableContent content(); /// set editable content - @property SyntaxHighlighter content(EditableContent content); + @property SyntaxSupport content(EditableContent content); /// categorize characters in content by token types void updateHighlight(dstring[] lines, TokenPropString[] props, int changeStartLine, int changeEndLine); @@ -495,16 +495,16 @@ class EditableContent { protected UndoBuffer _undoBuffer; - protected SyntaxHighlighter _syntaxHighlighter; + protected SyntaxSupport _syntaxSupport; - @property SyntaxHighlighter syntaxHighlighter() { - return _syntaxHighlighter; + @property SyntaxSupport syntaxSupport() { + return _syntaxSupport; } - @property EditableContent syntaxHighlighter(SyntaxHighlighter syntaxHighlighter) { - _syntaxHighlighter = syntaxHighlighter; - if (_syntaxHighlighter) { - _syntaxHighlighter.content = this; + @property EditableContent syntaxSupport(SyntaxSupport syntaxSupport) { + _syntaxSupport = syntaxSupport; + if (_syntaxSupport) { + _syntaxSupport.content = this; updateTokenProps(0, cast(int)_lines.length); } return this; @@ -516,7 +516,7 @@ class EditableContent { /// returns true if content has syntax highlight handler set @property bool hasSyntaxHighlight() { - return _syntaxHighlighter !is null; + return _syntaxSupport !is null; } protected bool _readOnly; @@ -656,9 +656,9 @@ class EditableContent { } bool findMatchedBraces(TextPosition p, out TextRange range) { - if (!_syntaxHighlighter) + if (!_syntaxSupport) return false; - TextPosition p2 = _syntaxHighlighter.findPairedBracket(p); + TextPosition p2 = _syntaxSupport.findPairedBracket(p); if (p == p2) return false; if (p < p2) { @@ -673,8 +673,8 @@ class EditableContent { protected void updateTokenProps(int startLine, int endLine) { clearTokenProps(startLine, endLine); - if (_syntaxHighlighter) { - _syntaxHighlighter.updateHighlight(_lines, _tokenProps, startLine, endLine); + if (_syntaxSupport) { + _syntaxSupport.updateHighlight(_lines, _tokenProps, startLine, endLine); } } diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index 2a3d35ca..e918e2ad 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -920,17 +920,17 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction override bool handleActionStateRequest(const Action a) { switch (a.id) { case EditorActions.ToggleBlockComment: - if (!_content.syntaxHighlighter || !_content.syntaxHighlighter.supportsToggleBlockComment) + if (!_content.syntaxSupport || !_content.syntaxSupport.supportsToggleBlockComment) a.state = ACTION_STATE_INVISIBLE; - else if (enabled && _content.syntaxHighlighter.canToggleBlockComment(_selectionRange)) + else if (enabled && _content.syntaxSupport.canToggleBlockComment(_selectionRange)) a.state = ACTION_STATE_ENABLED; else a.state = ACTION_STATE_DISABLE; return true; case EditorActions.ToggleLineComment: - if (!_content.syntaxHighlighter || !_content.syntaxHighlighter.supportsToggleLineComment) + if (!_content.syntaxSupport || !_content.syntaxSupport.supportsToggleLineComment) a.state = ACTION_STATE_INVISIBLE; - else if (enabled && _content.syntaxHighlighter.canToggleLineComment(_selectionRange)) + else if (enabled && _content.syntaxSupport.canToggleLineComment(_selectionRange)) a.state = ACTION_STATE_ENABLED; else a.state = ACTION_STATE_DISABLE; @@ -2070,12 +2070,12 @@ class EditBox : EditWidgetBase { } return true; case EditorActions.ToggleBlockComment: - if (_content.syntaxHighlighter && _content.syntaxHighlighter.supportsToggleBlockComment && _content.syntaxHighlighter.canToggleBlockComment(_selectionRange)) - _content.syntaxHighlighter.toggleBlockComment(_selectionRange, this); + if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleBlockComment && _content.syntaxSupport.canToggleBlockComment(_selectionRange)) + _content.syntaxSupport.toggleBlockComment(_selectionRange, this); return true; case EditorActions.ToggleLineComment: - if (_content.syntaxHighlighter && _content.syntaxHighlighter.supportsToggleLineComment && _content.syntaxHighlighter.canToggleLineComment(_selectionRange)) - _content.syntaxHighlighter.toggleLineComment(_selectionRange, this); + if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleLineComment && _content.syntaxSupport.canToggleLineComment(_selectionRange)) + _content.syntaxSupport.toggleLineComment(_selectionRange, this); return true; case EditorActions.AppendNewLine: {