diff --git a/SharpDevelop.Tests.sln b/SharpDevelop.Tests.sln index 6a3094b7fe..5f0aa86876 100644 --- a/SharpDevelop.Tests.sln +++ b/SharpDevelop.Tests.sln @@ -290,10 +290,10 @@ Global {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_4_0_Release|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.Build.0 = Release|Any CPU + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.Build.0 = Release|WithNRefactory {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU @@ -322,10 +322,10 @@ Global {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|WithNRefactory {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.Build.0 = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SharpDevelop.sln b/SharpDevelop.sln index 681b50ed21..6f14419d1f 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -263,10 +263,10 @@ Global {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|WithNRefactory {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.Build.0 = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs index 2ab802e950..33cf62c387 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs @@ -94,7 +94,10 @@ namespace CSharpBinding.FormattingStrategy convertTabsToSpaces = effectiveConvertTabsToSpaces.Value; } - return ICSharpCode.AvalonEdit.TextEditorOptions.GetIndentationString(1, indentationSize, convertTabsToSpaces); + if (convertTabsToSpaces) + return new string(' ', indentationSize); + else + return "\t"; } /* NR indent engine (temporarily?) disabled as per #447 diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs index 8903371ca3..82bbbc556f 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs @@ -23,6 +23,7 @@ using System.Threading.Tasks; using ICSharpCode.AvalonEdit.CodeCompletion; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Editor.CodeCompletion; using ICSharpCode.SharpDevelop.Editor.ContextActions; using ICSharpCode.SharpDevelop.Refactoring; diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs index 4960bf507b..bedc044ae4 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/QuickClassBrowser.cs @@ -26,6 +26,7 @@ using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Editor.CodeCompletion; using ICSharpCode.SharpDevelop.Parser; using ICSharpCode.SharpDevelop.Project; diff --git a/src/Libraries/AvalonEdit/.gitignore b/src/Libraries/AvalonEdit/.gitignore new file mode 100644 index 0000000000..6f644d1bd1 --- /dev/null +++ b/src/Libraries/AvalonEdit/.gitignore @@ -0,0 +1,7 @@ +# ignore all obj and bin folders (even in subdirectories) +obj/ +bin/ +/Documentation/Help +/packages/AvalonEdit +/packages/AvalonEdit.Sample +/packages/NUnit.2.6.3 diff --git a/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj index 12b2d71731..c32b45524e 100644 --- a/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj +++ b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj @@ -39,20 +39,20 @@ - - - + + - + {@HelpFormatOutputPaths} - - - - - - - + + - - - - - - + + + + + + {@CachedFrameworkCommentList} {@CommentFileList} - - - - - - - - - - + + + + + + + + + + + + + + {@TokenFiles} - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -146,6 +156,12 @@ Additionally, the class HighlightingColorizer provides integration of the highli Guid en-US AboveNamespaces + OnlyWarningsAndErrors + HtmlHelp1, Website + False + True + False + False diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs index 9a4cf7e121..fc0295ea2c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs @@ -18,7 +18,9 @@ using System; using System.Linq; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs index 5b129c2fa6..1e481dc54b 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs @@ -18,7 +18,9 @@ using System; using System.Collections.Generic; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs index 64b1e5c858..d893583b26 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs @@ -18,7 +18,9 @@ using System; using System.Collections.Generic; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs index a7d93e74ec..ab9abffe97 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs @@ -17,7 +17,9 @@ // DEALINGS IN THE SOFTWARE. using System; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs index bc80726841..bc0176ad7d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs @@ -19,7 +19,9 @@ using System; using System.Text; using ICSharpCode.AvalonEdit.Document; +#if NREFACTORY using ICSharpCode.NRefactory; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Editing diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HighlightedLineMergeTests.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HighlightedLineMergeTests.cs index 5a1384fe38..b6c1eface6 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HighlightedLineMergeTests.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HighlightedLineMergeTests.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.Linq; +using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; using NUnit.Framework; @@ -27,7 +28,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting [TestFixture] public class HighlightedLineMergeTests { - IDocument document = new ReadOnlyDocument(new string(' ', 20)); + IDocument document = new TextDocument(new string(' ', 20)); [Test] public void SimpleMerge1() diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj index 5452e4b38f..acae917905 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj @@ -3,13 +3,12 @@ {6222A3A1-83CE-47A3-A4E4-A018F82D44D8} Debug - AnyCPU + Net40 Library ICSharpCode.AvalonEdit ICSharpCode.AvalonEdit.Tests - v4.5 + v4.0 Properties - "C:\Program Files\SharpDevelop\3.0\bin\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis" True ..\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.snk False @@ -18,44 +17,54 @@ False 4 False - ..\..\..\..\bin\UnitTests\ + bin\$(Configuration)\ OnBuildSuccess False obj\$(Configuration)\ + False + Auto + 4194304 + AnyCPU + 4096 + + + v3.5 + + + v4.0 + DOTNET4 + + + v4.5 + NREFACTORY true Full False True - DEBUG;TRACE obj\ + + false None True False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - False + obj\ + - - ..\..\..\AddIns\Misc\AddInManager\RequiredLibraries\ICSharpCode.SharpZipLib.dll - + + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} + ICSharpCode.NRefactory + ..\..\..\Tools\NUnit\nunit.framework.dll - True 3.0 @@ -103,10 +112,6 @@ - - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} - ICSharpCode.NRefactory - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} ICSharpCode.AvalonEdit @@ -115,4 +120,7 @@ + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs index d78a71af82..8cd9a24135 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs @@ -34,6 +34,7 @@ namespace ICSharpCode.AvalonEdit try { var window = new Window(); window.Content = new TextEditor(); + window.ShowActivated = false; window.Show(); } catch (Exception ex) { error = ex; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Properties/AssemblyInfo.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Properties/AssemblyInfo.cs index ff921bfb13..99842d5a6e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Properties/AssemblyInfo.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Properties/AssemblyInfo.cs @@ -51,3 +51,5 @@ using NUnit.Framework; // Run unit tests on STA thread. [assembly: RequiresSTA] + +namespace ICSharpCode.NRefactory.Editor {} \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Search/FindTests.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Search/FindTests.cs index 68ce3b4659..958baffa36 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Search/FindTests.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Search/FindTests.cs @@ -19,7 +19,9 @@ using System; using System.Linq; using ICSharpCode.AvalonEdit.Document; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Search diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs index bedcfa822e..ebc9c5a445 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs @@ -19,7 +19,9 @@ using System; using System.Windows.Documents; using ICSharpCode.AvalonEdit.Document; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using NUnit.Framework; namespace ICSharpCode.AvalonEdit.Utils diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs index 4b00ea64c0..bc1a88fefd 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs @@ -380,11 +380,15 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion static bool CamelCaseMatch(string text, string query) { + // We take the first letter of the text regardless of whether or not it's upper case so we match + // against camelCase text as well as PascalCase text ("cct" matches "camelCaseText") + var theFirstLetterOfEachWord = text.Take(1).Concat(text.Skip(1).Where(char.IsUpper)); + int i = 0; - foreach (char upper in text.Where(c => char.IsUpper(c))) { + foreach (var letter in theFirstLetterOfEachWord) { if (i > query.Length - 1) return true; // return true here for CamelCase partial match ("CQ" matches "CodeQualityAnalysis") - if (char.ToUpper(query[i], CultureInfo.InvariantCulture) != upper) + if (char.ToUpperInvariant(query[i]) != char.ToUpperInvariant(letter)) return false; i++; } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs index e4ada66aea..6d7daf78a4 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs @@ -19,7 +19,11 @@ using System; using System.Windows.Media; using ICSharpCode.AvalonEdit.Editing; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.CodeCompletion { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs index 86968ce9f1..df248941cf 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs index 9bf957ed42..68e6be95f1 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs @@ -19,7 +19,9 @@ using System; using System.Diagnostics; using System.Globalization; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs index ea376d6bd2..af058ecbb1 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs @@ -19,7 +19,9 @@ using System; using System.IO; using System.Text; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/IDocument.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/IDocument.cs new file mode 100644 index 0000000000..0b7e0c988d --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/IDocument.cs @@ -0,0 +1,343 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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; + +namespace ICSharpCode.AvalonEdit.Document +{ + #if !NREFACTORY + /// + /// A document representing a source code file for refactoring. + /// Line and column counting starts at 1. + /// Offset counting starts at 0. + /// + public interface IDocument : ITextSource, IServiceProvider + { + #if NREFACTORY + /// + /// Creates an immutable snapshot of this document. + /// + IDocument CreateDocumentSnapshot(); + #endif + + /// + /// Gets/Sets the text of the whole document.. + /// + new string Text { get; set; } // hides ITextSource.Text to add the setter + + /// + /// This event is called directly before a change is applied to the document. + /// + /// + /// It is invalid to modify the document within this event handler. + /// Aborting the change (by throwing an exception) is likely to cause corruption of data structures + /// that listen to the Changing and Changed events. + /// + event EventHandler TextChanging; + + /// + /// This event is called directly after a change is applied to the document. + /// + /// + /// It is invalid to modify the document within this event handler. + /// Aborting the event handler (by throwing an exception) is likely to cause corruption of data structures + /// that listen to the Changing and Changed events. + /// + event EventHandler TextChanged; + + /// + /// This event is called after a group of changes is completed. + /// + /// + event EventHandler ChangeCompleted; + + /// + /// Gets the number of lines in the document. + /// + int LineCount { get; } + + /// + /// Gets the document line with the specified number. + /// + /// The number of the line to retrieve. The first line has number 1. + IDocumentLine GetLineByNumber(int lineNumber); + + /// + /// Gets the document line that contains the specified offset. + /// + IDocumentLine GetLineByOffset(int offset); + + /// + /// Gets the offset from a text location. + /// + /// + int GetOffset(int line, int column); + + /// + /// Gets the offset from a text location. + /// + /// + int GetOffset(TextLocation location); + + /// + /// Gets the location from an offset. + /// + /// + TextLocation GetLocation(int offset); + + /// + /// Inserts text. + /// + /// The offset at which the text is inserted. + /// The new text. + /// + /// Anchors positioned exactly at the insertion offset will move according to their movement type. + /// For AnchorMovementType.Default, they will move behind the inserted text. + /// The caret will also move behind the inserted text. + /// + void Insert(int offset, string text); + + /// + /// Inserts text. + /// + /// The offset at which the text is inserted. + /// The new text. + /// + /// Anchors positioned exactly at the insertion offset will move according to their movement type. + /// For AnchorMovementType.Default, they will move behind the inserted text. + /// The caret will also move behind the inserted text. + /// + void Insert(int offset, ITextSource text); + + /// + /// Inserts text. + /// + /// The offset at which the text is inserted. + /// The new text. + /// + /// Anchors positioned exactly at the insertion offset will move according to the anchor's movement type. + /// For AnchorMovementType.Default, they will move according to the movement type specified by this parameter. + /// The caret will also move according to the parameter. + /// + void Insert(int offset, string text, AnchorMovementType defaultAnchorMovementType); + + /// + /// Inserts text. + /// + /// The offset at which the text is inserted. + /// The new text. + /// + /// Anchors positioned exactly at the insertion offset will move according to the anchor's movement type. + /// For AnchorMovementType.Default, they will move according to the movement type specified by this parameter. + /// The caret will also move according to the parameter. + /// + void Insert(int offset, ITextSource text, AnchorMovementType defaultAnchorMovementType); + + /// + /// Removes text. + /// + /// Starting offset of the text to be removed. + /// Length of the text to be removed. + void Remove(int offset, int length); + + /// + /// Replaces text. + /// + /// The starting offset of the text to be replaced. + /// The length of the text to be replaced. + /// The new text. + void Replace(int offset, int length, string newText); + + /// + /// Replaces text. + /// + /// The starting offset of the text to be replaced. + /// The length of the text to be replaced. + /// The new text. + void Replace(int offset, int length, ITextSource newText); + + /// + /// Make the document combine the following actions into a single + /// action for undo purposes. + /// + void StartUndoableAction(); + + /// + /// Ends the undoable action started with . + /// + void EndUndoableAction(); + + /// + /// Creates an undo group. Dispose the returned value to close the undo group. + /// + /// An object that closes the undo group when Dispose() is called. + IDisposable OpenUndoGroup(); + + /// + /// Creates a new at the specified offset. + /// + /// + ITextAnchor CreateAnchor(int offset); + + /// + /// Gets the name of the file the document is stored in. + /// Could also be a non-existent dummy file name or null if no name has been set. + /// + string FileName { get; } + + /// + /// Fired when the file name of the document changes. + /// + event EventHandler FileNameChanged; + } + + /// + /// A line inside a . + /// + public interface IDocumentLine : ISegment + { + /// + /// Gets the length of this line, including the line delimiter. + /// + int TotalLength { get; } + + /// + /// Gets the length of the line terminator. + /// Returns 1 or 2; or 0 at the end of the document. + /// + int DelimiterLength { get; } + + /// + /// Gets the number of this line. + /// The first line has the number 1. + /// + int LineNumber { get; } + + /// + /// Gets the previous line. Returns null if this is the first line in the document. + /// + IDocumentLine PreviousLine { get; } + + /// + /// Gets the next line. Returns null if this is the last line in the document. + /// + IDocumentLine NextLine { get; } + + /// + /// Gets whether the line was deleted. + /// + bool IsDeleted { get; } + } + + /// + /// Describes a change of the document text. + /// This class is thread-safe. + /// + [Serializable] + public class TextChangeEventArgs : EventArgs + { + readonly int offset; + readonly ITextSource removedText; + readonly ITextSource insertedText; + + /// + /// The offset at which the change occurs. + /// + public int Offset { + get { return offset; } + } + + /// + /// The text that was removed. + /// + public ITextSource RemovedText { + get { return removedText; } + } + + /// + /// The number of characters removed. + /// + public int RemovalLength { + get { return removedText.TextLength; } + } + + /// + /// The text that was inserted. + /// + public ITextSource InsertedText { + get { return insertedText; } + } + + /// + /// The number of characters inserted. + /// + public int InsertionLength { + get { return insertedText.TextLength; } + } + + /// + /// Creates a new TextChangeEventArgs object. + /// + public TextChangeEventArgs(int offset, string removedText, string insertedText) + { + if (offset < 0) + throw new ArgumentOutOfRangeException("offset", offset, "offset must not be negative"); + this.offset = offset; + this.removedText = removedText != null ? new StringTextSource(removedText) : StringTextSource.Empty; + this.insertedText = insertedText != null ? new StringTextSource(insertedText) : StringTextSource.Empty; + } + + /// + /// Creates a new TextChangeEventArgs object. + /// + public TextChangeEventArgs(int offset, ITextSource removedText, ITextSource insertedText) + { + if (offset < 0) + throw new ArgumentOutOfRangeException("offset", offset, "offset must not be negative"); + this.offset = offset; + this.removedText = removedText ?? StringTextSource.Empty; + this.insertedText = insertedText ?? StringTextSource.Empty; + } + + /// + /// Gets the new offset where the specified offset moves after this document change. + /// + public virtual int GetNewOffset(int offset, AnchorMovementType movementType = AnchorMovementType.Default) + { + if (offset >= this.Offset && offset <= this.Offset + this.RemovalLength) { + if (movementType == AnchorMovementType.BeforeInsertion) + return this.Offset; + else + return this.Offset + this.InsertionLength; + } else if (offset > this.Offset) { + return offset + this.InsertionLength - this.RemovalLength; + } else { + return offset; + } + } + + /// + /// Creates TextChangeEventArgs for the reverse change. + /// + public virtual TextChangeEventArgs Invert() + { + return new TextChangeEventArgs(offset, insertedText, removedText); + } + } + #endif +} \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextAnchor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextAnchor.cs new file mode 100644 index 0000000000..ba8977f0f0 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextAnchor.cs @@ -0,0 +1,142 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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 ICSharpCode.NRefactory; + +namespace ICSharpCode.AvalonEdit.Document +{ + #if !NREFACTORY + /// + /// The TextAnchor class references an offset (a position between two characters). + /// It automatically updates the offset when text is inserted/removed in front of the anchor. + /// + /// + /// Use the property to get the offset from a text anchor. + /// Use the method to create an anchor from an offset. + /// + /// + /// The document will automatically update all text anchors; and because it uses weak references to do so, + /// the garbage collector can simply collect the anchor object when you don't need it anymore. + /// + /// Moreover, the document is able to efficiently update a large number of anchors without having to look + /// at each anchor object individually. Updating the offsets of all anchors usually only takes time logarithmic + /// to the number of anchors. Retrieving the property also runs in O(lg N). + /// + /// + /// Usage: + /// TextAnchor anchor = document.CreateAnchor(offset); + /// ChangeMyDocument(); + /// int newOffset = anchor.Offset; + /// + /// + public interface ITextAnchor + { + /// + /// Gets the text location of this anchor. + /// + /// Thrown when trying to get the Offset from a deleted anchor. + TextLocation Location { get; } + + /// + /// Gets the offset of the text anchor. + /// + /// Thrown when trying to get the Offset from a deleted anchor. + int Offset { get; } + + /// + /// Controls how the anchor moves. + /// + /// Anchor movement is ambiguous if text is inserted exactly at the anchor's location. + /// Does the anchor stay before the inserted text, or does it move after it? + /// The property will be used to determine which of these two options the anchor will choose. + /// The default value is . + AnchorMovementType MovementType { get; set; } + + /// + /// + /// Specifies whether the anchor survives deletion of the text containing it. + /// + /// false: The anchor is deleted when the a selection that includes the anchor is deleted. + /// true: The anchor is not deleted. + /// + /// + /// + bool SurviveDeletion { get; set; } + + /// + /// Gets whether the anchor was deleted. + /// + /// + /// When a piece of text containing an anchor is removed, then that anchor will be deleted. + /// First, the property is set to true on all deleted anchors, + /// then the events are raised. + /// You cannot retrieve the offset from an anchor that has been deleted. + /// This deletion behavior might be useful when using anchors for building a bookmark feature, + /// but in other cases you want to still be able to use the anchor. For those cases, set = true. + /// + bool IsDeleted { get; } + + /// + /// Occurs after the anchor was deleted. + /// + /// + /// + /// Due to the 'weak reference' nature of text anchors, you will receive + /// the Deleted event only while your code holds a reference to the TextAnchor object. + /// + /// + event EventHandler Deleted; + + /// + /// Gets the line number of the anchor. + /// + /// Thrown when trying to get the Offset from a deleted anchor. + int Line { get; } + + /// + /// Gets the column number of this anchor. + /// + /// Thrown when trying to get the Offset from a deleted anchor. + int Column { get; } + } + + /// + /// Defines how a text anchor moves. + /// + public enum AnchorMovementType + { + /// + /// When text is inserted at the anchor position, the type of the insertion + /// determines where the caret moves to. For normal insertions, the anchor will move + /// after the inserted text. + /// + Default, + /// + /// Behaves like a start marker - when text is inserted at the anchor position, the anchor will stay + /// before the inserted text. + /// + BeforeInsertion, + /// + /// Behave like an end marker - when text is insered at the anchor position, the anchor will move + /// after the inserted text. + /// + AfterInsertion + } + #endif +} \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs new file mode 100644 index 0000000000..33077fe419 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ITextSource.cs @@ -0,0 +1,357 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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.Collections.Generic; +using System; +using System.IO; + +namespace ICSharpCode.AvalonEdit.Document +{ + #if !NREFACTORY + /// + /// A read-only view on a (potentially mutable) text source. + /// The IDocument interface derives from this interface. + /// + public interface ITextSource + { + /// + /// Gets a version identifier for this text source. + /// Returns null for unversioned text sources. + /// + ITextSourceVersion Version { get; } + + /// + /// Creates an immutable snapshot of this text source. + /// Unlike all other methods in this interface, this method is thread-safe. + /// + ITextSource CreateSnapshot(); + + /// + /// Creates an immutable snapshot of a part of this text source. + /// Unlike all other methods in this interface, this method is thread-safe. + /// + ITextSource CreateSnapshot(int offset, int length); + + /// + /// Creates a new TextReader to read from this text source. + /// + TextReader CreateReader(); + + /// + /// Creates a new TextReader to read from this text source. + /// + TextReader CreateReader(int offset, int length); + + /// + /// Gets the total text length. + /// + /// The length of the text, in characters. + /// This is the same as Text.Length, but is more efficient because + /// it doesn't require creating a String object. + int TextLength { get; } + + /// + /// Gets the whole text as string. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] + string Text { get; } + + /// + /// Gets a character at the specified position in the document. + /// + /// The index of the character to get. + /// Offset is outside the valid range (0 to TextLength-1). + /// The character at the specified position. + /// This is the same as Text[offset], but is more efficient because + /// it doesn't require creating a String object. + char GetCharAt(int offset); + + /// + /// Retrieves the text for a portion of the document. + /// + /// offset or length is outside the valid range. + /// This is the same as Text.Substring, but is more efficient because + /// it doesn't require creating a String object for the whole document. + string GetText(int offset, int length); + + /// + /// Retrieves the text for a portion of the document. + /// + /// offset or length is outside the valid range. + string GetText(ISegment segment); + + /// + /// Writes the text from this document into the TextWriter. + /// + void WriteTextTo(TextWriter writer); + + /// + /// Writes the text from this document into the TextWriter. + /// + void WriteTextTo(TextWriter writer, int offset, int length); + + /// + /// Gets the index of the first occurrence of the character in the specified array. + /// + /// Character to search for + /// Start index of the area to search. + /// Length of the area to search. + /// The first index where the character was found; or -1 if no occurrence was found. + int IndexOf(char c, int startIndex, int count); + + /// + /// Gets the index of the first occurrence of any character in the specified array. + /// + /// Characters to search for + /// Start index of the area to search. + /// Length of the area to search. + /// The first index where any character was found; or -1 if no occurrence was found. + int IndexOfAny(char[] anyOf, int startIndex, int count); + + /// + /// Gets the index of the first occurrence of the specified search text in this text source. + /// + /// The search text + /// Start index of the area to search. + /// Length of the area to search. + /// String comparison to use. + /// The first index where the search term was found; or -1 if no occurrence was found. + int IndexOf(string searchText, int startIndex, int count, StringComparison comparisonType); + + /// + /// Gets the index of the last occurrence of the specified character in this text source. + /// + /// The search character + /// Start index of the area to search. + /// Length of the area to search. + /// The last index where the search term was found; or -1 if no occurrence was found. + /// The search proceeds backwards from (startIndex+count) to startIndex. + /// This is different than the meaning of the parameters on string.LastIndexOf! + int LastIndexOf(char c, int startIndex, int count); + + /// + /// Gets the index of the last occurrence of the specified search text in this text source. + /// + /// The search text + /// Start index of the area to search. + /// Length of the area to search. + /// String comparison to use. + /// The last index where the search term was found; or -1 if no occurrence was found. + /// The search proceeds backwards from (startIndex+count) to startIndex. + /// This is different than the meaning of the parameters on string.LastIndexOf! + int LastIndexOf(string searchText, int startIndex, int count, StringComparison comparisonType); + + /* What about: + void Insert (int offset, string value); + void Remove (int offset, int count); + void Remove (ISegment segment); + + void Replace (int offset, int count, string value); + + Or more search operations: + + IEnumerable SearchForward (string pattern, int startIndex); + IEnumerable SearchForwardIgnoreCase (string pattern, int startIndex); + + IEnumerable SearchBackward (string pattern, int startIndex); + IEnumerable SearchBackwardIgnoreCase (string pattern, int startIndex); + */ + } + + /// + /// Represents a version identifier for a text source. + /// + /// + /// Verions can be used to efficiently detect whether a document has changed and needs reparsing; + /// or even to implement incremental parsers. + /// It is a separate class from ITextSource to allow the GC to collect the text source while + /// the version checkpoint is still in use. + /// + public interface ITextSourceVersion + { + /// + /// Gets whether this checkpoint belongs to the same document as the other checkpoint. + /// + /// + /// Returns false when given null. + /// + bool BelongsToSameDocumentAs(ITextSourceVersion other); + + /// + /// Compares the age of this checkpoint to the other checkpoint. + /// + /// This method is thread-safe. + /// Raised if 'other' belongs to a different document than this version. + /// -1 if this version is older than . + /// 0 if this version instance represents the same version as . + /// 1 if this version is newer than . + int CompareAge(ITextSourceVersion other); + + /// + /// Gets the changes from this checkpoint to the other checkpoint. + /// If 'other' is older than this checkpoint, reverse changes are calculated. + /// + /// This method is thread-safe. + /// Raised if 'other' belongs to a different document than this checkpoint. + IEnumerable GetChangesTo(ITextSourceVersion other); + + /// + /// Calculates where the offset has moved in the other buffer version. + /// + /// Raised if 'other' belongs to a different document than this checkpoint. + int MoveOffsetTo(ITextSourceVersion other, int oldOffset, AnchorMovementType movement = AnchorMovementType.Default); + } + + /// + /// Implements the ITextSource interface using a string. + /// + [Serializable] + public class StringTextSource : ITextSource + { + /// + /// Gets a text source containing the empty string. + /// + public static readonly StringTextSource Empty = new StringTextSource(string.Empty); + + readonly string text; + readonly ITextSourceVersion version; + + /// + /// Creates a new StringTextSource with the given text. + /// + public StringTextSource(string text) + { + if (text == null) + throw new ArgumentNullException("text"); + this.text = text; + } + + /// + /// Creates a new StringTextSource with the given text. + /// + public StringTextSource(string text, ITextSourceVersion version) + { + if (text == null) + throw new ArgumentNullException("text"); + this.text = text; + this.version = version; + } + + /// + public ITextSourceVersion Version { + get { return version; } + } + + /// + public int TextLength { + get { return text.Length; } + } + + /// + public string Text { + get { return text; } + } + + /// + public ITextSource CreateSnapshot() + { + return this; // StringTextSource is immutable + } + + /// + public ITextSource CreateSnapshot(int offset, int length) + { + return new StringTextSource(text.Substring(offset, length)); + } + + /// + public TextReader CreateReader() + { + return new StringReader(text); + } + + /// + public TextReader CreateReader(int offset, int length) + { + return new StringReader(text.Substring(offset, length)); + } + + /// + public void WriteTextTo(TextWriter writer) + { + writer.Write(text); + } + + /// + public void WriteTextTo(TextWriter writer, int offset, int length) + { + writer.Write(text.Substring(offset, length)); + } + + /// + public char GetCharAt(int offset) + { + return text[offset]; + } + + /// + public string GetText(int offset, int length) + { + return text.Substring(offset, length); + } + + /// + public string GetText(ISegment segment) + { + if (segment == null) + throw new ArgumentNullException("segment"); + return text.Substring(segment.Offset, segment.Length); + } + + /// + public int IndexOf(char c, int startIndex, int count) + { + return text.IndexOf(c, startIndex, count); + } + + /// + public int IndexOfAny(char[] anyOf, int startIndex, int count) + { + return text.IndexOfAny(anyOf, startIndex, count); + } + + /// + public int IndexOf(string searchText, int startIndex, int count, StringComparison comparisonType) + { + return text.IndexOf(searchText, startIndex, count, comparisonType); + } + + /// + public int LastIndexOf(char c, int startIndex, int count) + { + return text.LastIndexOf(c, startIndex + count - 1, count); + } + + /// + public int LastIndexOf(string searchText, int startIndex, int count, StringComparison comparisonType) + { + return text.LastIndexOf(searchText, startIndex + count - 1, count, comparisonType); + } + } + #endif +} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/LineManager.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/LineManager.cs index fcc4cc3d06..7ff71d2eb0 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/LineManager.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/LineManager.cs @@ -16,7 +16,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using ICSharpCode.AvalonEdit.Utils; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs index 4f4b206af6..07cb18a809 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs @@ -18,7 +18,9 @@ using System; using System.Text; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs index 8c7598c92b..5584392bb7 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs @@ -21,7 +21,9 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs index 43ebcb413f..73a6f0b0c3 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/RopeTextSource.cs @@ -19,7 +19,9 @@ using System; using System.IO; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs index 0c4adb8632..27c646e408 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/SimpleSegment.cs @@ -20,7 +20,9 @@ using System; using System.Diagnostics; using System.Globalization; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs index 9571bd51e1..45bddde16c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs @@ -20,6 +20,7 @@ using System; using ICSharpCode.AvalonEdit.Utils; using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs index cc409c0340..5c285d47cf 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchorTree.cs @@ -21,7 +21,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs index 83de7780c2..e7e02e0120 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs @@ -27,7 +27,6 @@ using System.Threading; using ICSharpCode.AvalonEdit.Utils; using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; -using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.AvalonEdit.Document { @@ -133,8 +132,10 @@ namespace ICSharpCode.AvalonEdit.Document if (textSource == null) throw new ArgumentNullException("textSource"); + #if NREFACTORY if (textSource is ReadOnlyDocument) textSource = textSource.CreateSnapshot(); // retrieve underlying text source, which might be a RopeTextSource + #endif RopeTextSource rts = textSource as RopeTextSource; if (rts != null) @@ -362,11 +363,13 @@ namespace ICSharpCode.AvalonEdit.Document } } + #if NREFACTORY /// public IDocument CreateDocumentSnapshot() { return new ReadOnlyDocument(this, fileName); } + #endif /// public ITextSourceVersion Version { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs index d2a8335944..52d9c6fbc2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs @@ -17,7 +17,9 @@ // DEALINGS IN THE SOFTWARE. using System; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Document diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs new file mode 100644 index 0000000000..f2950e64a9 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs @@ -0,0 +1,271 @@ +// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team +// +// 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.ComponentModel; +using System.Globalization; + +namespace ICSharpCode.AvalonEdit.Document +{ + #if !NREFACTORY + /// + /// A line/column position. + /// Text editor lines/columns are counted started from one. + /// + /// + /// The document provides the methods and + /// to convert between offsets and TextLocations. + /// + [Serializable] + [TypeConverter(typeof(TextLocationConverter))] + public struct TextLocation : IComparable, IEquatable + { + /// + /// Represents no text location (0, 0). + /// + public static readonly TextLocation Empty = new TextLocation(0, 0); + + /// + /// Creates a TextLocation instance. + /// + public TextLocation(int line, int column) + { + this.line = line; + this.column = column; + } + + readonly int column, line; + + /// + /// Gets the line number. + /// + public int Line { + get { return line; } + } + + /// + /// Gets the column number. + /// + public int Column { + get { return column; } + } + + /// + /// Gets whether the TextLocation instance is empty. + /// + public bool IsEmpty { + get { + return column <= 0 && line <= 0; + } + } + + /// + /// Gets a string representation for debugging purposes. + /// + public override string ToString() + { + return string.Format(CultureInfo.InvariantCulture, "(Line {1}, Col {0})", this.column, this.line); + } + + /// + /// Gets a hash code. + /// + public override int GetHashCode() + { + return unchecked (191 * column.GetHashCode() ^ line.GetHashCode()); + } + + /// + /// Equality test. + /// + public override bool Equals(object obj) + { + if (!(obj is TextLocation)) return false; + return (TextLocation)obj == this; + } + + /// + /// Equality test. + /// + public bool Equals(TextLocation other) + { + return this == other; + } + + /// + /// Equality test. + /// + public static bool operator ==(TextLocation left, TextLocation right) + { + return left.column == right.column && left.line == right.line; + } + + /// + /// Inequality test. + /// + public static bool operator !=(TextLocation left, TextLocation right) + { + return left.column != right.column || left.line != right.line; + } + + /// + /// Compares two text locations. + /// + public static bool operator <(TextLocation left, TextLocation right) + { + if (left.line < right.line) + return true; + else if (left.line == right.line) + return left.column < right.column; + else + return false; + } + + /// + /// Compares two text locations. + /// + public static bool operator >(TextLocation left, TextLocation right) + { + if (left.line > right.line) + return true; + else if (left.line == right.line) + return left.column > right.column; + else + return false; + } + + /// + /// Compares two text locations. + /// + public static bool operator <=(TextLocation left, TextLocation right) + { + return !(left > right); + } + + /// + /// Compares two text locations. + /// + public static bool operator >=(TextLocation left, TextLocation right) + { + return !(left < right); + } + + /// + /// Compares two text locations. + /// + public int CompareTo(TextLocation other) + { + if (this == other) + return 0; + if (this < other) + return -1; + else + return 1; + } + } + + /// + /// Converts strings of the form '0+[;,]0+' to a . + /// + public class TextLocationConverter : TypeConverter + { + /// + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof(TextLocation) || base.CanConvertTo(context, destinationType); + } + + /// + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (value is string) { + string[] parts = ((string)value).Split(';', ','); + if (parts.Length == 2) { + return new TextLocation(int.Parse(parts[0], culture), int.Parse(parts[1], culture)); + } + } + return base.ConvertFrom(context, culture, value); + } + + /// + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + if (value is TextLocation && destinationType == typeof(string)) { + var loc = (TextLocation)value; + return loc.Line.ToString(culture) + ";" + loc.Column.ToString(culture); + } + return base.ConvertTo(context, culture, value, destinationType); + } + } + + /// + /// An (Offset,Length)-pair. + /// + public interface ISegment + { + /// + /// Gets the start offset of the segment. + /// + int Offset { get; } + + /// + /// Gets the length of the segment. + /// + /// For line segments (IDocumentLine), the length does not include the line delimeter. + int Length { get; } + + /// + /// Gets the end offset of the segment. + /// + /// EndOffset = Offset + Length; + int EndOffset { get; } + } + + /// + /// Extension methods for . + /// + public static class ISegmentExtensions + { + /// + /// Gets whether fully contains the specified segment. + /// + /// + /// Use segment.Contains(offset, 0) to detect whether a segment (end inclusive) contains offset; + /// use segment.Contains(offset, 1) to detect whether a segment (end exclusive) contains offset. + /// + public static bool Contains (this ISegment segment, int offset, int length) + { + return segment.Offset <= offset && offset + length <= segment.EndOffset; + } + + /// + /// Gets whether fully contains the specified segment. + /// + public static bool Contains (this ISegment thisSegment, ISegment segment) + { + return segment != null && thisSegment.Offset <= segment.Offset && segment.EndOffset <= thisSegment.EndOffset; + } + } + #endif +} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs index 7a9090afa2..e0d8873c22 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs @@ -18,7 +18,9 @@ using System; using System.Diagnostics; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs index 96f7be86bb..88861db9f3 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs @@ -24,7 +24,9 @@ using System.Linq; using System.Text; using System.Windows; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { @@ -47,7 +49,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// /// - public sealed class TextSegmentCollection : ICollection, IReadOnlyCollection, ISegmentTree, IWeakEventListener where T : TextSegment + public sealed class TextSegmentCollection : ICollection, ISegmentTree, IWeakEventListener where T : TextSegment { // Implementation: this is basically a mixture of an augmented interval tree // and the TextAnchorTree. diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSourceVersionProvider.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSourceVersionProvider.cs new file mode 100644 index 0000000000..c2dffc19ad --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSourceVersionProvider.cs @@ -0,0 +1,136 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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 System.Diagnostics; +using System.Linq; +using ICSharpCode.AvalonEdit.Utils; + +namespace ICSharpCode.AvalonEdit.Document +{ + #if !NREFACTORY + /// + /// Provides ITextSourceVersion instances. + /// + public class TextSourceVersionProvider + { + Version currentVersion; + + /// + /// Creates a new TextSourceVersionProvider instance. + /// + public TextSourceVersionProvider() + { + this.currentVersion = new Version(this); + } + + /// + /// Gets the current version. + /// + public ITextSourceVersion CurrentVersion { + get { return currentVersion; } + } + + /// + /// Replaces the current version with a new version. + /// + /// Change from current version to new version + public void AppendChange(TextChangeEventArgs change) + { + if (change == null) + throw new ArgumentNullException("change"); + currentVersion.change = change; + currentVersion.next = new Version(currentVersion); + currentVersion = currentVersion.next; + } + + [DebuggerDisplay("Version #{id}")] + sealed class Version : ITextSourceVersion + { + // Reference back to the provider. + // Used to determine if two checkpoints belong to the same document. + readonly TextSourceVersionProvider provider; + // ID used for CompareAge() + readonly int id; + + // the change from this version to the next version + internal TextChangeEventArgs change; + internal Version next; + + internal Version(TextSourceVersionProvider provider) + { + this.provider = provider; + } + + internal Version(Version prev) + { + this.provider = prev.provider; + this.id = unchecked( prev.id + 1 ); + } + + public bool BelongsToSameDocumentAs(ITextSourceVersion other) + { + Version o = other as Version; + return o != null && provider == o.provider; + } + + public int CompareAge(ITextSourceVersion other) + { + if (other == null) + throw new ArgumentNullException("other"); + Version o = other as Version; + if (o == null || provider != o.provider) + throw new ArgumentException("Versions do not belong to the same document."); + // We will allow overflows, but assume that the maximum distance between checkpoints is 2^31-1. + // This is guaranteed on x86 because so many checkpoints don't fit into memory. + return Math.Sign(unchecked( this.id - o.id )); + } + + public IEnumerable GetChangesTo(ITextSourceVersion other) + { + int result = CompareAge(other); + Version o = (Version)other; + if (result < 0) + return GetForwardChanges(o); + else if (result > 0) + return o.GetForwardChanges(this).Reverse().Select(change => change.Invert()); + else + return Empty.Array; + } + + IEnumerable GetForwardChanges(Version other) + { + // Return changes from this(inclusive) to other(exclusive). + for (Version node = this; node != other; node = node.next) { + yield return node.change; + } + } + + public int MoveOffsetTo(ITextSourceVersion other, int oldOffset, AnchorMovementType movement) + { + int offset = oldOffset; + foreach (var e in GetChangesTo(other)) { + offset = e.GetNewOffset(offset, movement); + } + return offset; + } + } + } + #endif +} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs index 3dd0e647e7..2d6f757843 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextUtilities.cs @@ -19,7 +19,9 @@ using System; using System.Globalization; using System.Windows.Documents; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Document { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs index badc106212..7f33289f1c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Caret.cs @@ -27,8 +27,10 @@ using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs index 247f03adff..9666e044d9 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EditingCommandHandler.cs @@ -29,7 +29,9 @@ using System.Windows.Input; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EmptySelection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EmptySelection.cs index 2cef05f068..1f43206181 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EmptySelection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/EmptySelection.cs @@ -22,8 +22,10 @@ using System.Runtime.CompilerServices; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs index daf8458b3c..5f37fc3668 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs @@ -18,7 +18,11 @@ using System; using System.Collections.Generic; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs index 98ebf022f7..dbafa600f2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs @@ -19,8 +19,9 @@ using System; using System.Collections.Generic; using System.Linq; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Editing { @@ -48,9 +49,9 @@ namespace ICSharpCode.AvalonEdit.Editing /// /// that completely disables editing. /// - sealed class ReadOnlyDocument : IReadOnlySectionProvider + sealed class ReadOnlySectionDocument : IReadOnlySectionProvider { - public static readonly ReadOnlyDocument Instance = new ReadOnlyDocument(); + public static readonly ReadOnlySectionDocument Instance = new ReadOnlySectionDocument(); public bool CanInsert(int offset) { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs index abaa80d797..8d6a991388 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/RectangleSelection.cs @@ -28,8 +28,10 @@ using System.Windows.Media.TextFormatting; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs index ba4034accf..b25a31b050 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs @@ -24,7 +24,9 @@ using System.Windows; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs index 17c1c842ba..3c6be06c86 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionColorizer.cs @@ -18,7 +18,9 @@ using System; using ICSharpCode.AvalonEdit.Rendering; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs index 6fde39781d..dcb2f16149 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionMouseHandler.cs @@ -29,7 +29,9 @@ using System.Windows.Threading; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionSegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionSegment.cs index 8b258dc6e3..6c0b1e7a34 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionSegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SelectionSegment.cs @@ -17,7 +17,11 @@ // DEALINGS IN THE SOFTWARE. using System; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs index abbbe0b7cc..24f27825db 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/SimpleSelection.cs @@ -20,7 +20,9 @@ using System; using System.Collections.Generic; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs index d4eb99264a..11dcf3e70a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs @@ -35,7 +35,6 @@ using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.Editor; -using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.AvalonEdit.Editing { @@ -1023,9 +1022,11 @@ namespace ICSharpCode.AvalonEdit.Editing this.MouseEnter += delegate { ShowMouseCursor(); }; this.MouseLeave += delegate { ShowMouseCursor(); }; this.PreviewMouseMove += delegate { ShowMouseCursor(); }; + #if DOTNET4 this.TouchEnter += delegate { ShowMouseCursor(); }; this.TouchLeave += delegate { ShowMouseCursor(); }; this.PreviewTouchMove += delegate { ShowMouseCursor(); }; + #endif } void ShowMouseCursor() diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs index 09c50f8ab8..fb26624710 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextSegmentReadOnlySectionProvider.cs @@ -19,7 +19,9 @@ using System; using System.Collections.Generic; using ICSharpCode.AvalonEdit.Document; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif namespace ICSharpCode.AvalonEdit.Editing { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs index 78791398d4..c84a962f8e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs @@ -19,7 +19,9 @@ using System; using System.Diagnostics; using System.Text; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#endif using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Utils; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs index 0491ace072..5e6205a508 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/NewFolding.cs @@ -17,7 +17,11 @@ // DEALINGS IN THE SOFTWARE. using System; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.Folding { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/DocumentHighlighter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/DocumentHighlighter.cs index 96afdbfcda..8ba6c044c8 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/DocumentHighlighter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/DocumentHighlighter.cs @@ -20,12 +20,10 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Text.RegularExpressions; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Utils; -using ICSharpCode.NRefactory.Editor; -using ICSharpCode.NRefactory.Utils; -using SpanStack = ICSharpCode.NRefactory.Utils.ImmutableStack; +using SpanStack = ICSharpCode.AvalonEdit.Utils.ImmutableStack; namespace ICSharpCode.AvalonEdit.Highlighting { @@ -74,6 +72,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting InvalidateHighlighting(); } + #if NREFACTORY /// /// Creates a new DocumentHighlighter instance. /// @@ -88,6 +87,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting this.engine = new HighlightingEngine(definition.MainRuleSet); InvalidateHighlighting(); } + #endif /// /// Disposes the document highlighter. diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs index c48a97bc9f..e5f2e24bba 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs @@ -24,7 +24,7 @@ using System.Text; using System.Windows; using System.Windows.Documents; using System.Windows.Media; -using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs index 0d42809431..55842a1d8e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs index b42abb43f3..f1ffdfd9ea 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs @@ -17,7 +17,11 @@ // DEALINGS IN THE SOFTWARE. using System; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs index 067e75693c..f8f13182a7 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs @@ -23,8 +23,7 @@ using System.Security.Permissions; using System.Text; using System.Windows; using System.Windows.Media; -using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs index 1754d3d4b0..68a625745e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs @@ -289,7 +289,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting // If the highlighting state change applies to the lines below, too, the construction of each line // will invalidate the next line, and the construction pass will regenerate all lines. - Debug.WriteLine("OnHighlightStateChanged forces redraw of lines {0} to {1}", fromLineNumber, toLineNumber); + Debug.WriteLine(string.Format("OnHighlightStateChanged forces redraw of lines {0} to {1}", fromLineNumber, toLineNumber)); // If the VisualLine construction is in progress, we have to avoid sending redraw commands for // anything above the line currently being constructed. diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingEngine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingEngine.cs index b80d9ac9a3..e08753130d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingEngine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingEngine.cs @@ -21,9 +21,13 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text.RegularExpressions; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif using ICSharpCode.AvalonEdit.Utils; -using SpanStack = ICSharpCode.NRefactory.Utils.ImmutableStack; +using SpanStack = ICSharpCode.AvalonEdit.Utils.ImmutableStack; namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingManager.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingManager.cs index 37b666b7b7..c9ea32f074 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingManager.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingManager.cs @@ -22,8 +22,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Xml; - -using ICSharpCode.NRefactory.Utils; +using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs index 68eba79c3e..eb0afc0c24 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs @@ -19,7 +19,6 @@ using System; using System.Diagnostics; using System.Globalization; -using System.IO; using System.Text; using System.Windows; using ICSharpCode.AvalonEdit.Document; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs index c3458a7015..13c76c2415 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs @@ -18,7 +18,11 @@ using System; using System.IO; +#if DOTNET4 using System.Net; +#else +using System.Web; +#endif namespace ICSharpCode.AvalonEdit.Highlighting { @@ -60,7 +64,11 @@ namespace ICSharpCode.AvalonEdit.Highlighting if (color == null) throw new ArgumentNullException("color"); writer.Write(" style=\""); + #if DOTNET4 WebUtility.HtmlEncode(color.ToCss(), writer); + #else + HttpUtility.HtmlEncode(color.ToCss(), writer); + #endif writer.Write('"'); } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs index d1ec19709a..b29d452a3d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs @@ -19,7 +19,11 @@ using System; using System.Collections.Generic; using System.IO; +#if DOTNET4 using System.Net; +#else +using System.Web; +#endif using System.Text; using System.Windows; using System.Windows.Media; @@ -132,7 +136,11 @@ namespace ICSharpCode.AvalonEdit.Highlighting needIndentation = true; break; default: + #if DOTNET4 WebUtility.HtmlEncode(c.ToString(), htmlWriter); + #else + HttpUtility.HtmlEncode(c.ToString(), htmlWriter); + #endif break; } // If we just handled a space by setting hasSpace = true, @@ -173,7 +181,11 @@ namespace ICSharpCode.AvalonEdit.Highlighting if (value.Length == 0) return; WriteIndentationAndSpace(); + #if DOTNET4 WebUtility.HtmlEncode(value, htmlWriter); + #else + HttpUtility.HtmlEncode(value, htmlWriter); + #endif } /// @@ -244,7 +256,12 @@ namespace ICSharpCode.AvalonEdit.Highlighting public override void BeginHyperlinkSpan(Uri uri) { WriteIndentationAndSpace(); - htmlWriter.Write(""); + #if DOTNET4 + string link = WebUtility.HtmlEncode(uri.ToString()); + #else + string link = HttpUtility.HtmlEncode(uri.ToString()); + #endif + htmlWriter.Write(""); endTagStack.Push(""); } } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs index 8edbd89061..66702adf92 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs @@ -18,7 +18,11 @@ using System; using System.Collections.Generic; +#if NREFACTORY using ICSharpCode.NRefactory.Editor; +#else +using ICSharpCode.AvalonEdit.Document; +#endif namespace ICSharpCode.AvalonEdit.Highlighting { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs index b41012bee0..10c018e98e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs @@ -17,24 +17,20 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Documents; -using System.Windows.Media; -using ICSharpCode.NRefactory.Editor; -using ICSharpCode.NRefactory.TypeSystem.Implementation; using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Utils; +using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Highlighting { /// /// Stores rich-text formatting. /// - public sealed class RichTextModel : AbstractFreezable + public sealed class RichTextModel { List stateChangeOffsets = new List(); List stateChanges = new List(); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs index c965343be7..66c455e269 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs @@ -18,8 +18,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.IO; using System.Windows; using System.Windows.Media; using ICSharpCode.NRefactory.Editor; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index ff6cf09d56..52536368c3 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -3,52 +3,72 @@ {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} Debug - AnyCPU + Net40 Library ICSharpCode.AvalonEdit ICSharpCode.AvalonEdit - v4.5 Properties - "C:\Program Files\SharpDevelop\3.0\bin\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis" False False 4 - false + False True ICSharpCode.AvalonEdit.snk False File False -Microsoft.Design#CA1020;-Microsoft.Design#CA1033;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1810 - ..\..\..\..\bin\ - ..\..\..\..\bin\ICSharpCode.AvalonEdit.xml 1607 + False + obj\$(Configuration)\ + False + Auto + 4194304 + AnyCPU + 4096 + + + v3.5 + + + v4.0 + DOTNET4 + + + v4.5 + DOTNET4;NREFACTORY + bin\Debug\ + bin\Debug\ICSharpCode.AvalonEdit.xml true - Full False True - DEBUG;TRACE;DOTNET4 + obj\ + Full + + + bin\Release\ + bin\Release\ICSharpCode.AvalonEdit.xml false - PdbOnly True False - TRACE;DOTNET4 - - - False - Auto - 4194304 - AnyCPU - 4096 + Full + + + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} + ICSharpCode.NRefactory + + + 4.0 + 3.0 @@ -67,6 +87,7 @@ 3.0 + 4.0 @@ -86,9 +107,6 @@ - - Properties\GlobalAssemblyInfo.cs - @@ -97,7 +115,6 @@ Code - @@ -106,7 +123,10 @@ UndoStack.cs + + + @@ -120,6 +140,7 @@ TextDocument.cs + @@ -129,6 +150,7 @@ TextAnchor.cs + UndoStack.cs @@ -355,6 +377,7 @@ + @@ -364,6 +387,8 @@ + + @@ -412,51 +437,10 @@ - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - false - - - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} - ICSharpCode.NRefactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs index b84853ab7d..2ac7c2e485 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs @@ -17,8 +17,8 @@ // DEALINGS IN THE SOFTWARE. using System; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Indentation { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs index 1d9f84ff64..21160ccbc5 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs @@ -50,6 +50,13 @@ using System.Windows.Markup; // app, or any theme specific resource dictionaries) )] +[assembly: System.Runtime.InteropServices.ComVisible(false)] +[assembly: AssemblyCompany("ic#code")] +[assembly: AssemblyProduct("SharpDevelop")] +[assembly: AssemblyCopyright("2000-2014 AlphaSierraPapa for the SharpDevelop Team")] +[assembly: AssemblyVersion("5.0.1")] +[assembly: NeutralResourcesLanguage("en-US")] + [assembly: XmlnsPrefix("http://icsharpcode.net/sharpdevelop/avalonedit", "avalonedit")] [assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit")] @@ -57,3 +64,8 @@ using System.Windows.Markup; [assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Rendering")] [assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Highlighting")] [assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/avalonedit", "ICSharpCode.AvalonEdit.Search")] + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", + Justification = "AssemblyInformationalVersion does not need to be a parsable version")] + +namespace ICSharpCode.NRefactory.Editor {} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs index cde47d1ef1..73f135cfe3 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/BackgroundGeometryBuilder.cs @@ -23,9 +23,10 @@ using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Media; using System.Windows.Media.TextFormatting; +using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Utils; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Rendering { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs index 2871c38fe4..516c0a4623 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs @@ -31,10 +31,9 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.TextFormatting; using System.Windows.Threading; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Utils; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Rendering { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/DropDownButton.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/DropDownButton.cs index cf7d5d1c35..31cb5f9963 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/DropDownButton.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/DropDownButton.cs @@ -18,26 +18,33 @@ using System; using System.Windows; -using System.Windows.Controls; using System.Windows.Controls.Primitives; -using System.Windows.Input; namespace ICSharpCode.AvalonEdit.Search { /// /// A button that opens a drop-down menu when clicked. /// - class DropDownButton : ButtonBase + public class DropDownButton : ButtonBase { + /// + /// Identifies the  dependency property. + /// public static readonly DependencyProperty DropDownContentProperty - = DependencyProperty.Register("DropDownContent", typeof(Popup), - typeof(DropDownButton), new FrameworkPropertyMetadata(null)); + = DependencyProperty.Register("DropDownContent", typeof(Popup), + typeof(DropDownButton), new FrameworkPropertyMetadata(null)); + /// + /// The key that identifies the  dependency property. + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] protected static readonly DependencyPropertyKey IsDropDownContentOpenPropertyKey - = DependencyProperty.RegisterReadOnly("IsDropDownContentOpen", typeof(bool), - typeof(DropDownButton), new FrameworkPropertyMetadata(false)); + = DependencyProperty.RegisterReadOnly("IsDropDownContentOpen", typeof(bool), + typeof(DropDownButton), new FrameworkPropertyMetadata(false)); + /// + /// Identifies the  dependency property. + /// public static readonly DependencyProperty IsDropDownContentOpenProperty = IsDropDownContentOpenPropertyKey.DependencyProperty; static DropDownButton() @@ -45,16 +52,23 @@ namespace ICSharpCode.AvalonEdit.Search DefaultStyleKeyProperty.OverrideMetadata(typeof(DropDownButton), new FrameworkPropertyMetadata(typeof(DropDownButton))); } + /// + /// Gets/Sets the popup that is used as drop-down content. + /// public Popup DropDownContent { get { return (Popup)GetValue(DropDownContentProperty); } set { SetValue(DropDownContentProperty, value); } } + /// + /// Gets whether the drop-down is opened. + /// public bool IsDropDownContentOpen { get { return (bool)GetValue(IsDropDownContentOpenProperty); } protected set { SetValue(IsDropDownContentOpenPropertyKey, value); } } + /// protected override void OnClick() { if (DropDownContent != null && !IsDropDownContentOpen) { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs index 77f80fc33d..9121a454ad 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/ISearchStrategy.cs @@ -19,8 +19,8 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; - using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Search { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/RegexSearchStrategy.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/RegexSearchStrategy.cs index 44bf6d22d1..47bde5af07 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/RegexSearchStrategy.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/RegexSearchStrategy.cs @@ -22,7 +22,6 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Documents; - using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs index b4444e331d..03057f3321 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs @@ -86,9 +86,9 @@ namespace ICSharpCode.AvalonEdit.Search void RegisterCommands(ICollection commandBindings) { commandBindings.Add(new CommandBinding(ApplicationCommands.Find, ExecuteFind)); - commandBindings.Add(new CommandBinding(SearchCommands.FindNext, ExecuteFindNext)); - commandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, ExecuteFindPrevious)); - commandBindings.Add(new CommandBinding(SearchCommands.CloseSearchPanel, ExecuteCloseSearchPanel)); + commandBindings.Add(new CommandBinding(SearchCommands.FindNext, ExecuteFindNext, CanExecuteWithOpenSearchPanel)); + commandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, ExecuteFindPrevious, CanExecuteWithOpenSearchPanel)); + commandBindings.Add(new CommandBinding(SearchCommands.CloseSearchPanel, ExecuteCloseSearchPanel, CanExecuteWithOpenSearchPanel)); } SearchPanel panel; @@ -100,20 +100,41 @@ namespace ICSharpCode.AvalonEdit.Search panel.SearchPattern = TextArea.Selection.GetText(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate { panel.Reactivate(); }); } + + void CanExecuteWithOpenSearchPanel(object sender, CanExecuteRoutedEventArgs e) + { + if (panel.IsClosed) { + e.CanExecute = false; + // Continue routing so that the key gesture can be consumed by another component. + e.ContinueRouting = true; + } else { + e.CanExecute = true; + e.Handled = true; + } + } void ExecuteFindNext(object sender, ExecutedRoutedEventArgs e) { - panel.FindNext(); + if (!panel.IsClosed) { + panel.FindNext(); + e.Handled = true; + } } void ExecuteFindPrevious(object sender, ExecutedRoutedEventArgs e) { - panel.FindPrevious(); + if (!panel.IsClosed) { + panel.FindPrevious(); + e.Handled = true; + } } void ExecuteCloseSearchPanel(object sender, ExecutedRoutedEventArgs e) { - panel.Close(); + if (!panel.IsClosed) { + panel.Close(); + e.Handled = true; + } } /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs index 02466ce7a6..1c566d7c5c 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs @@ -18,6 +18,7 @@ using System; using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs index 3130a97ca1..17438c6af4 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/InsertionContext.cs @@ -19,9 +19,9 @@ using System; using System.Collections.Generic; using System.Windows; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Snippets { @@ -70,7 +70,7 @@ namespace ICSharpCode.AvalonEdit.Snippets /// /// Gets the text document. /// - public TextDocument Document { get; private set; } + public ICSharpCode.AvalonEdit.Document.TextDocument Document { get; private set; } /// /// Gets the text that was selected before the insertion of the snippet. @@ -98,7 +98,7 @@ namespace ICSharpCode.AvalonEdit.Snippets public int InsertionPosition { get; set; } readonly int startPosition; - AnchorSegment wholeSnippetAnchor; + ICSharpCode.AvalonEdit.Document.AnchorSegment wholeSnippetAnchor; bool deactivateIfSnippetEmpty; /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs index 619e7c2f39..ebc2771bfc 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/Snippet.cs @@ -17,9 +17,9 @@ // DEALINGS IN THE SOFTWARE. using System; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs index f3efd15adc..0fd8ac05de 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs @@ -18,9 +18,8 @@ using System; using System.Runtime.Serialization; -using System.Windows.Input; -using ICSharpCode.AvalonEdit.Document; using ICSharpCode.NRefactory.Editor; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs index 65af6935e2..e07b2843b7 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Snippets/SnippetReplaceableTextElement.cs @@ -21,9 +21,9 @@ using System.Linq; using System.Windows; using System.Windows.Documents; using System.Windows.Media; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Rendering; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Snippets { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs index a69bd2e831..91e183d46d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs @@ -408,7 +408,7 @@ namespace ICSharpCode.AvalonEdit TextEditor editor = d as TextEditor; if (editor != null) { if ((bool)e.NewValue) - editor.TextArea.ReadOnlySectionProvider = ReadOnlyDocument.Instance; + editor.TextArea.ReadOnlySectionProvider = ReadOnlySectionDocument.Instance; else editor.TextArea.ReadOnlySectionProvider = NoReadOnlySections.Instance; @@ -905,7 +905,7 @@ namespace ICSharpCode.AvalonEdit if (start < 0 || start > documentLength) throw new ArgumentOutOfRangeException("start", start, "Value must be between 0 and " + documentLength); if (length < 0 || start + length > documentLength) - throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - length)); + throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - start)); textArea.Selection = SimpleSelection.Create(textArea, start, start + length); textArea.Caret.Offset = start + length; } @@ -944,9 +944,9 @@ namespace ICSharpCode.AvalonEdit { using (StreamReader reader = FileReader.OpenStream(stream, this.Encoding ?? Encoding.UTF8)) { this.Text = reader.ReadToEnd(); - this.Encoding = reader.CurrentEncoding; // assign encoding after ReadToEnd() so that the StreamReader can autodetect the encoding + SetCurrentValue(EncodingProperty, reader.CurrentEncoding); // assign encoding after ReadToEnd() so that the StreamReader can autodetect the encoding } - this.IsModified = false; + SetCurrentValue(IsModifiedProperty, Boxes.False); } /// @@ -997,7 +997,7 @@ namespace ICSharpCode.AvalonEdit document.WriteTextTo(writer); writer.Flush(); // do not close the stream - this.IsModified = false; + SetCurrentValue(IsModifiedProperty, Boxes.False); } /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs index e771f10e3c..5b0fa5538e 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs @@ -264,19 +264,11 @@ namespace ICSharpCode.AvalonEdit /// Gets text required to indent from the specified to the next indentation level. /// public virtual string GetIndentationString(int column) - { - return GetIndentationString(column, IndentationSize, ConvertTabsToSpaces); - } - - /// - /// Gets text required to indent from the specified to the next indentation level, - /// considering given and settings. - /// - public static string GetIndentationString(int column, int indentationSize, bool convertTabsToSpaces) { if (column < 1) throw new ArgumentOutOfRangeException("column", column, "Value must be at least 1."); - if (convertTabsToSpaces) { + int indentationSize = this.IndentationSize; + if (ConvertTabsToSpaces) { return new string(' ', indentationSize - ((column - 1) % indentationSize)); } else { return "\t"; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs index 635e116277..3fcbfbf5fa 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextViewPosition.cs @@ -19,6 +19,7 @@ using System; using System.Globalization; using ICSharpCode.NRefactory; +using ICSharpCode.AvalonEdit.Document; namespace ICSharpCode.AvalonEdit { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CallbackOnDispose.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CallbackOnDispose.cs new file mode 100644 index 0000000000..ffcc717c11 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CallbackOnDispose.cs @@ -0,0 +1,101 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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 System.Threading; + +namespace ICSharpCode.AvalonEdit.Utils +{ + /// + /// Invokes an action when it is disposed. + /// + /// + /// This class ensures the callback is invoked at most once, + /// even when Dispose is called on multiple threads. + /// + sealed class CallbackOnDispose : IDisposable + { + Action action; + + public CallbackOnDispose(Action action) + { + if (action == null) + throw new ArgumentNullException("action"); + this.action = action; + } + + public void Dispose() + { + Action a = Interlocked.Exchange(ref action, null); + if (a != null) { + a(); + } + } + } + + /// + /// This class is used to prevent stack overflows by representing a 'busy' flag + /// that prevents reentrance when another call is running. + /// However, using a simple 'bool busy' is not thread-safe, so we use a + /// thread-static BusyManager. + /// + static class BusyManager + { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", + Justification = "Should always be used with 'var'")] + public struct BusyLock : IDisposable + { + public static readonly BusyLock Failed = new BusyLock(null); + + readonly List objectList; + + internal BusyLock(List objectList) + { + this.objectList = objectList; + } + + public bool Success { + get { return objectList != null; } + } + + public void Dispose() + { + if (objectList != null) { + objectList.RemoveAt(objectList.Count - 1); + } + } + } + + [ThreadStatic] static List _activeObjects; + + public static BusyLock Enter(object obj) + { + List activeObjects = _activeObjects; + if (activeObjects == null) + activeObjects = _activeObjects = new List(); + for (int i = 0; i < activeObjects.Count; i++) { + if (activeObjects[i] == obj) + return BusyLock.Failed; + } + activeObjects.Add(obj); + return new BusyLock(activeObjects); + } + } +} diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs index 964c6833db..d67a6b17b2 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Deque.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.AvalonEdit.Utils /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [Serializable] - public sealed class Deque : ICollection, IReadOnlyCollection + public sealed class Deque : ICollection { T[] arr = Empty.Array; int size, head, tail; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/DocumentPrinter.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/DocumentPrinter.cs index f92e36d649..49d3abc79a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/DocumentPrinter.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/DocumentPrinter.cs @@ -18,17 +18,12 @@ using System; using System.Collections.Generic; -using System.IO; -using System.IO.Packaging; -using System.Printing; using System.Windows; -using System.Windows.Controls; using System.Windows.Documents; -using System.Windows.Xps; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; -using ICSharpCode.NRefactory.Editor; namespace ICSharpCode.AvalonEdit.Utils { @@ -37,6 +32,7 @@ namespace ICSharpCode.AvalonEdit.Utils /// public static class DocumentPrinter { + #if NREFACTORY /// /// Converts a readonly TextDocument to a Block and applies the provided highlighting definition. /// @@ -49,6 +45,7 @@ namespace ICSharpCode.AvalonEdit.Utils highlighter = null; return ConvertTextDocumentToBlock(document, highlighter); } + #endif /// /// Converts an IDocument to a Block and applies the provided highlighter. @@ -73,6 +70,7 @@ namespace ICSharpCode.AvalonEdit.Utils return p; } + #if NREFACTORY /// /// Converts a readonly TextDocument to a RichText and applies the provided highlighting definition. /// @@ -85,6 +83,7 @@ namespace ICSharpCode.AvalonEdit.Utils highlighter = null; return ConvertTextDocumentToRichText(document, highlighter); } + #endif /// /// Converts an IDocument to a RichText and applies the provided highlighter. diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/IFreezable.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/IFreezable.cs new file mode 100644 index 0000000000..1529e29428 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/IFreezable.cs @@ -0,0 +1,123 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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 System.Collections.ObjectModel; +using System.Linq; + +namespace ICSharpCode.AvalonEdit.Utils +{ + interface IFreezable + { + /// + /// Gets if this instance is frozen. Frozen instances are immutable and thus thread-safe. + /// + bool IsFrozen { get; } + + /// + /// Freezes this instance. + /// + void Freeze(); + } + + static class FreezableHelper + { + public static void ThrowIfFrozen(IFreezable freezable) + { + if (freezable.IsFrozen) + throw new InvalidOperationException("Cannot mutate frozen " + freezable.GetType().Name); + } + + public static IList FreezeListAndElements(IList list) + { + if (list != null) { + foreach (T item in list) + Freeze(item); + } + return FreezeList(list); + } + + public static IList FreezeList(IList list) + { + if (list == null || list.Count == 0) + return Empty.Array; + if (list.IsReadOnly) { + // If the list is already read-only, return it directly. + // This is important, otherwise we might undo the effects of interning. + return list; + } else { + return new ReadOnlyCollection(list.ToArray()); + } + } + + public static void Freeze(object item) + { + IFreezable f = item as IFreezable; + if (f != null) + f.Freeze(); + } + + public static T FreezeAndReturn(T item) where T : IFreezable + { + item.Freeze(); + return item; + } + + /// + /// If the item is not frozen, this method creates and returns a frozen clone. + /// If the item is already frozen, it is returned without creating a clone. + /// + public static T GetFrozenClone(T item) where T : IFreezable, ICloneable + { + if (!item.IsFrozen) { + item = (T)item.Clone(); + item.Freeze(); + } + return item; + } + } + + [Serializable] + abstract class AbstractFreezable : IFreezable + { + bool isFrozen; + + /// + /// Gets if this instance is frozen. Frozen instances are immutable and thus thread-safe. + /// + public bool IsFrozen { + get { return isFrozen; } + } + + /// + /// Freezes this instance. + /// + public void Freeze() + { + if (!isFrozen) { + FreezeInternal(); + isFrozen = true; + } + } + + protected virtual void FreezeInternal() + { + } + } +} \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/ImmutableStack.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/ImmutableStack.cs new file mode 100644 index 0000000000..17e717d283 --- /dev/null +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/ImmutableStack.cs @@ -0,0 +1,132 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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 System.Diagnostics; +using System.Text; + +namespace ICSharpCode.AvalonEdit.Utils +{ + /// + /// An immutable stack. + /// + /// Using 'foreach' on the stack will return the items from top to bottom (in the order they would be popped). + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] + [Serializable] + public sealed class ImmutableStack : IEnumerable + { + /// + /// Gets the empty stack instance. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "ImmutableStack is immutable")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")] + public static readonly ImmutableStack Empty = new ImmutableStack(); + + readonly T value; + readonly ImmutableStack next; + + private ImmutableStack() + { + } + + private ImmutableStack(T value, ImmutableStack next) + { + this.value = value; + this.next = next; + } + + /// + /// Pushes an item on the stack. This does not modify the stack itself, but returns a new + /// one with the value pushed. + /// + public ImmutableStack Push(T item) + { + return new ImmutableStack(item, this); + } + + /// + /// Gets the item on the top of the stack. + /// + /// The stack is empty. + public T Peek() + { + if (IsEmpty) + throw new InvalidOperationException("Operation not valid on empty stack."); + return value; + } + + /// + /// Gets the item on the top of the stack. + /// Returns default(T) if the stack is empty. + /// + public T PeekOrDefault() + { + return value; + } + + /// + /// Gets the stack with the top item removed. + /// + /// The stack is empty. + public ImmutableStack Pop() + { + if (IsEmpty) + throw new InvalidOperationException("Operation not valid on empty stack."); + return next; + } + + /// + /// Gets if this stack is empty. + /// + public bool IsEmpty { + get { return next == null; } + } + + /// + /// Gets an enumerator that iterates through the stack top-to-bottom. + /// + public IEnumerator GetEnumerator() + { + ImmutableStack t = this; + while (!t.IsEmpty) { + yield return t.value; + t = t.next; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + + /// + public override string ToString() + { + StringBuilder b = new StringBuilder("[Stack"); + foreach (T val in this) { + b.Append(' '); + b.Append(val); + } + b.Append(']'); + return b.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Rope.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Rope.cs index e45df86b55..2e489c2369 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Rope.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/Rope.cs @@ -23,7 +23,6 @@ using System.Diagnostics; using System.Globalization; using System.Runtime.Serialization; using System.Text; -using ICSharpCode.NRefactory.Utils; namespace ICSharpCode.AvalonEdit.Utils { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Class.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Class.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Class.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Class.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/CompletionImage.cs b/src/Main/Base/Project/Editor/CodeCompletion/Images/CompletionImage.cs similarity index 98% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/CompletionImage.cs rename to src/Main/Base/Project/Editor/CodeCompletion/Images/CompletionImage.cs index 3691fac331..e45926db42 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/CompletionImage.cs +++ b/src/Main/Base/Project/Editor/CodeCompletion/Images/CompletionImage.cs @@ -25,7 +25,7 @@ using System.Windows.Media.Imaging; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; -namespace ICSharpCode.AvalonEdit.CodeCompletion +namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion { /// /// Provides icons for code-completion. @@ -44,7 +44,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion static BitmapImage LoadBitmap(string name) { - BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/ICSharpCode.AvalonEdit;component/CodeCompletion/Images/" + name + ".png")); + BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/ICSharpCode.SharpDevelop;component/Editor/CodeCompletion/Images/" + name + ".png")); image.Freeze(); return image; } diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Constructor.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Constructor.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Constructor.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Constructor.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Delegate.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Delegate.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Delegate.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Delegate.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Enum.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Enum.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Enum.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Enum.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/EnumValue.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/EnumValue.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/EnumValue.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/EnumValue.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Event.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Event.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Event.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Event.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/ExtensionMethod.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/ExtensionMethod.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/ExtensionMethod.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/ExtensionMethod.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Field.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Field.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Field.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Field.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/FieldReadOnly.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/FieldReadOnly.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/FieldReadOnly.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/FieldReadOnly.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Indexer.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Indexer.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Indexer.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Indexer.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Interface.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Interface.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Interface.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Interface.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Literal.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Literal.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Literal.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Literal.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Method.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Method.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Method.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Method.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/NameSpace.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/NameSpace.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/NameSpace.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/NameSpace.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Operator.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Operator.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Operator.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Operator.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayInternal.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayInternal.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayInternal.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayInternal.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayPrivate.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayPrivate.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayPrivate.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayPrivate.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayProtected.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayProtected.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayProtected.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayProtected.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayProtectedInternal.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayProtectedInternal.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayProtectedInternal.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayProtectedInternal.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayStatic.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayStatic.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/OverlayStatic.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/OverlayStatic.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/PInvokeMethod.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/PInvokeMethod.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/PInvokeMethod.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/PInvokeMethod.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Property.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Property.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Property.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Property.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/StaticClass.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/StaticClass.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/StaticClass.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/StaticClass.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Struct.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/Struct.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/Struct.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/Struct.png diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/VirtualMethod.png b/src/Main/Base/Project/Editor/CodeCompletion/Images/VirtualMethod.png similarity index 100% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/Images/VirtualMethod.png rename to src/Main/Base/Project/Editor/CodeCompletion/Images/VirtualMethod.png diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index 07b470e716..ee778929a9 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -140,6 +140,7 @@ + @@ -380,6 +381,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ExtractInterfaceDialog.cs @@ -854,6 +880,7 @@ + diff --git a/src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs b/src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs index d7cb76e052..4bf0774962 100644 --- a/src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs +++ b/src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs @@ -24,6 +24,7 @@ using System.Windows.Forms; using System.Windows.Media; using ICSharpCode.AvalonEdit.CodeCompletion; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.SharpDevelop.Editor.CodeCompletion; namespace ICSharpCode.SharpDevelop {