Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7ccbe3
commit fec0669
Showing
141 changed files
with
3,661 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.cs text diff=csharp | ||
*.sln text eol=crlf | ||
*.csproj text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ignore all obj and bin folders (even in subdirectories) | ||
obj/ | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<id>AvalonEdit.Sample</id> | ||
<version>4.4.0.9727</version> | ||
<authors>Daniel Grunwald</authors> | ||
<owners>SharpDevelop</owners> | ||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> | ||
<projectUrl>http://www.avalonedit.net</projectUrl> | ||
<iconUrl>http://community.sharpdevelop.net/blogs/mattward/SharpDevelop.png</iconUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Sample code for AvalonEdit the WPF-based text editor used in SharpDevelop 4.0. | ||
Modify your App.xaml file so the StartupUri points to the AvalonEdit Sample window: | ||
|
||
StartupUri="/Samples/AvalonEdit/Window1.xaml"</description> | ||
<summary>Sample code for AvalonEdit the WPF-based text editor used in SharpDevelop 4.0.</summary> | ||
<language>en-US</language> | ||
<dependencies> | ||
<dependency id="AvalonEdit" version="4.4.0.9727" /> | ||
</dependencies> | ||
<frameworkAssemblies> | ||
<frameworkAssembly assemblyName="System.Windows.Forms" /> | ||
<frameworkAssembly assemblyName="WindowsFormsIntegration" /> | ||
</frameworkAssemblies> | ||
<tags>WPF Text Editor SharpDevelop AvalonEdit</tags> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
<id>AvalonEdit</id> | ||
<version>4.4.0.9727</version> | ||
<authors>Daniel Grunwald</authors> | ||
<owners>SharpDevelop</owners> | ||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> | ||
<projectUrl>http://www.avalonedit.net</projectUrl> | ||
<iconUrl>http://community.sharpdevelop.net/blogs/mattward/SharpDevelop.png</iconUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>AvalonEdit is the WPF-based text editor used in SharpDevelop. There are two builds of AvalonEdit included in this package. One that targets .NET 4.0 and one that targets .NET 3.5.</description> | ||
<summary>AvalonEdit is the WPF-based text editor used in SharpDevelop</summary> | ||
<releaseNotes>AvalonEdit 4.4 changes the Home/End keys to only act on the current TextLine when word-wrapping is enabled. It also removes the caret stop in the middle of surrogate pairs, making characters outside the basic multilingual plane work as expected.</releaseNotes> | ||
<language>en-US</language> | ||
<tags>WPF Text Editor SharpDevelop AvalonEdit</tags> | ||
</metadata> | ||
<files> | ||
<file src="lib\Net35\*.*" target="lib\Net35" /> | ||
<file src="lib\Net40\*.*" target="lib\Net40" /> | ||
<file src="..\..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\**\*.cs" target="src" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application x:Class="ICSharpCode.AvalonEdit.Sample.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
StartupUri="Window1.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2009 Daniel Grunwald | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
// software and associated documentation files (the "Software"), to deal in the Software | ||
// without restriction, including without limitation the rights to use, copy, modify, merge, | ||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | ||
// to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
using System; | ||
using System.Windows; | ||
using System.Data; | ||
using System.Xml; | ||
using System.Configuration; | ||
|
||
namespace ICSharpCode.AvalonEdit.Sample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright (c) 2009 Daniel Grunwald | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
// software and associated documentation files (the "Software"), to deal in the Software | ||
// without restriction, including without limitation the rights to use, copy, modify, merge, | ||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | ||
// to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using ICSharpCode.AvalonEdit.Document; | ||
using ICSharpCode.AvalonEdit.Folding; | ||
#if NREFACTORY | ||
using ICSharpCode.NRefactory.Editor; | ||
#endif | ||
|
||
namespace ICSharpCode.AvalonEdit.Sample | ||
{ | ||
/// <summary> | ||
/// Allows producing foldings from a document based on braces. | ||
/// </summary> | ||
public class BraceFoldingStrategy | ||
{ | ||
/// <summary> | ||
/// Gets/Sets the opening brace. The default value is '{'. | ||
/// </summary> | ||
public char OpeningBrace { get; set; } | ||
|
||
/// <summary> | ||
/// Gets/Sets the closing brace. The default value is '}'. | ||
/// </summary> | ||
public char ClosingBrace { get; set; } | ||
|
||
/// <summary> | ||
/// Creates a new BraceFoldingStrategy. | ||
/// </summary> | ||
public BraceFoldingStrategy() | ||
{ | ||
this.OpeningBrace = '{'; | ||
this.ClosingBrace = '}'; | ||
} | ||
|
||
public void UpdateFoldings(FoldingManager manager, TextDocument document) | ||
{ | ||
int firstErrorOffset; | ||
IEnumerable<NewFolding> newFoldings = CreateNewFoldings(document, out firstErrorOffset); | ||
manager.UpdateFoldings(newFoldings, firstErrorOffset); | ||
} | ||
|
||
/// <summary> | ||
/// Create <see cref="NewFolding"/>s for the specified document. | ||
/// </summary> | ||
public IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset) | ||
{ | ||
firstErrorOffset = -1; | ||
return CreateNewFoldings(document); | ||
} | ||
|
||
/// <summary> | ||
/// Create <see cref="NewFolding"/>s for the specified document. | ||
/// </summary> | ||
public IEnumerable<NewFolding> CreateNewFoldings(ITextSource document) | ||
{ | ||
List<NewFolding> newFoldings = new List<NewFolding>(); | ||
|
||
Stack<int> startOffsets = new Stack<int>(); | ||
int lastNewLineOffset = 0; | ||
char openingBrace = this.OpeningBrace; | ||
char closingBrace = this.ClosingBrace; | ||
for (int i = 0; i < document.TextLength; i++) { | ||
char c = document.GetCharAt(i); | ||
if (c == openingBrace) { | ||
startOffsets.Push(i); | ||
} else if (c == closingBrace && startOffsets.Count > 0) { | ||
int startOffset = startOffsets.Pop(); | ||
// don't fold if opening and closing brace are on the same line | ||
if (startOffset < lastNewLineOffset) { | ||
newFoldings.Add(new NewFolding(startOffset, i + 1)); | ||
} | ||
} else if (c == '\n' || c == '\r') { | ||
lastNewLineOffset = i + 1; | ||
} | ||
} | ||
newFoldings.Sort((a,b) => a.StartOffset.CompareTo(b.StartOffset)); | ||
return newFoldings; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) 2009 Daniel Grunwald | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
// software and associated documentation files (the "Software"), to deal in the Software | ||
// without restriction, including without limitation the rights to use, copy, modify, merge, | ||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | ||
// to whom the Software is furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
using System; | ||
using System.Windows; | ||
using System.Windows.Media; | ||
|
||
using ICSharpCode.AvalonEdit.Document; | ||
using ICSharpCode.AvalonEdit.Rendering; | ||
|
||
namespace AvalonEdit.Sample | ||
{ | ||
/// <summary> | ||
/// Finds the word 'AvalonEdit' and makes it bold and italic. | ||
/// </summary> | ||
public class ColorizeAvalonEdit : DocumentColorizingTransformer | ||
{ | ||
protected override void ColorizeLine(DocumentLine line) | ||
{ | ||
int lineStartOffset = line.Offset; | ||
string text = CurrentContext.Document.GetText(line); | ||
int start = 0; | ||
int index; | ||
while ((index = text.IndexOf("AvalonEdit", start)) >= 0) { | ||
base.ChangeLinePart( | ||
lineStartOffset + index, // startOffset | ||
lineStartOffset + index + 10, // endOffset | ||
(VisualLineElement element) => { | ||
// This lambda gets called once for every VisualLineElement | ||
// between the specified offsets. | ||
Typeface tf = element.TextRunProperties.Typeface; | ||
// Replace the typeface with a modified version of | ||
// the same typeface | ||
element.TextRunProperties.SetTypeface(new Typeface( | ||
tf.FontFamily, | ||
FontStyles.Italic, | ||
FontWeights.Bold, | ||
tf.Stretch | ||
)); | ||
}); | ||
start = index + 1; // search for next occurrence | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0"?> | ||
<SyntaxDefinition name="Custom Highlighting" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> | ||
<Color name="Comment" foreground="Green" /> | ||
<Color name="String" foreground="Blue" /> | ||
|
||
<!-- This is the main ruleset. --> | ||
<RuleSet> | ||
<Span color="Comment" begin="//" /> | ||
<Span color="Comment" multiline="true" begin="/\*" end="\*/" /> | ||
|
||
<Span color="String"> | ||
<Begin>"</Begin> | ||
<End>"</End> | ||
<RuleSet> | ||
<!-- nested span for escape sequences --> | ||
<Span begin="\\" end="." /> | ||
</RuleSet> | ||
</Span> | ||
|
||
<Keywords fontWeight="bold" foreground="Blue"> | ||
<Word>if</Word> | ||
<Word>else</Word> | ||
<!-- ... --> | ||
</Keywords> | ||
|
||
<Keywords fontWeight="bold" fontStyle="italic" foreground="Red"> | ||
<Word>AvalonEdit</Word> | ||
</Keywords> | ||
|
||
<!-- Digits --> | ||
<Rule foreground="DarkBlue"> | ||
\b0[xX][0-9a-fA-F]+ # hex number | ||
| \b | ||
( \d+(\.[0-9]+)? #number with optional floating point | ||
| \.[0-9]+ #or just starting with floating point | ||
) | ||
([eE][+-]?[0-9]+)? # optional exponent | ||
</Rule> | ||
</RuleSet> | ||
</SyntaxDefinition> |
Oops, something went wrong.