Browse Source
Conflicts: src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditSyntaxHighlighterAdapter.cs src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CustomizableHighlightingColorizer.cs src/AddIns/Misc/SearchAndReplace/Project/Engine/SearchManager.cs src/AddIns/Misc/SearchAndReplace/Project/Gui/SearchResultNode.cs src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs src/Main/Base/Project/Src/Editor/IEditorControlService.cs src/Main/Base/Project/Src/Editor/ISyntaxHighlighter.cs src/Main/Base/Project/Src/Editor/Search/SearchResultMatch.cs src/Main/Base/Project/Src/Editor/Search/SearchResultsPad.cs src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.csnewNRvisualizers
37 changed files with 549 additions and 100 deletions
@ -0,0 +1,110 @@
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.AvalonEdit.AddIn.Options; |
||||
using ICSharpCode.AvalonEdit.Document; |
||||
using ICSharpCode.AvalonEdit.Highlighting; |
||||
using ICSharpCode.NRefactory.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
||||
|
||||
namespace ICSharpCode.AvalonEdit.AddIn |
||||
{ |
||||
public class DocumentSyntaxHighlighter : ISyntaxHighlighter |
||||
{ |
||||
IDocument document; |
||||
IHighlighter highlighter; |
||||
string highlightingName; |
||||
|
||||
public DocumentSyntaxHighlighter(IDocument document, IHighlighter highlighter, string highlightingName) |
||||
{ |
||||
if (document == null) |
||||
throw new ArgumentNullException("document"); |
||||
this.document = document; |
||||
this.highlighter = highlighter; |
||||
this.highlightingName = highlightingName; |
||||
} |
||||
|
||||
public IEnumerable<string> GetSpanColorNamesFromLineStart(int lineNumber) |
||||
{ |
||||
if (highlighter != null) { |
||||
// delayed evaluation doesn't cause a problem here: GetSpanStack is called immediately,
|
||||
// only the where/select portian is evaluated later. But that won't be a problem because the
|
||||
// HighlightingSpan instance shouldn't change once it's in use.
|
||||
return from color in highlighter.GetColorStack(lineNumber - 1) |
||||
where color.Name != null |
||||
select color.Name; |
||||
} else { |
||||
return Enumerable.Empty<string>(); |
||||
} |
||||
} |
||||
|
||||
public HighlightingColor GetNamedColor(string name) |
||||
{ |
||||
return CustomizableHighlightingColorizer.CustomizeColor(name, CustomizedHighlightingColor.FetchCustomizations(highlightingName)); |
||||
} |
||||
|
||||
public HighlightedInlineBuilder BuildInlines(int lineNumber) |
||||
{ |
||||
HighlightedInlineBuilder builder = new HighlightedInlineBuilder(document.GetText(document.GetLineByNumber(lineNumber))); |
||||
if (highlighter != null) { |
||||
HighlightedLine highlightedLine = highlighter.HighlightLine(lineNumber); |
||||
int startOffset = highlightedLine.DocumentLine.Offset; |
||||
// copy only the foreground and background colors
|
||||
foreach (HighlightedSection section in highlightedLine.Sections) { |
||||
if (section.Color.Foreground != null) { |
||||
builder.SetForeground(section.Offset - startOffset, section.Length, section.Color.Foreground.GetBrush(null)); |
||||
} |
||||
if (section.Color.Background != null) { |
||||
builder.SetBackground(section.Offset - startOffset, section.Length, section.Color.Background.GetBrush(null)); |
||||
} |
||||
} |
||||
} |
||||
return builder; |
||||
} |
||||
|
||||
public HighlightingColor DefaultTextColor { |
||||
get { |
||||
return GetNamedColor(CustomizableHighlightingColorizer.DefaultTextAndBackground); |
||||
} |
||||
} |
||||
|
||||
public event EventHandler VisibleDocumentLinesChanged; |
||||
|
||||
public IHighlightingDefinition HighlightingDefinition { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public void AddAdditionalHighlighter(IHighlighter highlighter) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void RemoveAdditionalHighlighter(IHighlighter highlighter) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void InvalidateLine(IDocumentLine line) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void InvalidateAll() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IEnumerable<IDocumentLine> GetVisibleDocumentLines() |
||||
{ |
||||
return Enumerable.Empty<IDocumentLine>(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.AvalonEdit.Highlighting.Xshd |
||||
{ |
||||
/// <summary>
|
||||
/// A property in an Xshd file.
|
||||
/// </summary>
|
||||
[Serializable] |
||||
public class XshdProperty : XshdElement |
||||
{ |
||||
/// <summary>
|
||||
/// Gets/sets the name.
|
||||
/// </summary>
|
||||
public string Name { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the value.
|
||||
/// </summary>
|
||||
public string Value { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Creates a new XshdColor instance.
|
||||
/// </summary>
|
||||
public XshdProperty() |
||||
{ |
||||
} |
||||
|
||||
/// <inheritdoc/>
|
||||
public override object AcceptVisitor(IXshdVisitor visitor) |
||||
{ |
||||
return null; |
||||
// return visitor.VisitProperty(this);
|
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue