Browse Source

move MyersDiff to SD.Widgets

pull/18/head
Siegfried Pammer 14 years ago
parent
commit
d46b921b6a
  1. 2
      SharpDevelop.sln
  2. 10
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
  3. 1
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs
  4. 2
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs
  5. 3
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DefaultChangeWatcher.cs
  6. 3
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DocumentSequence.cs
  7. 12
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/LineChangeInfo.cs
  8. 16
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Utils.cs
  9. 6
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ICSharpCode.SharpDevelop.Widgets.csproj
  10. 13
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/Edit.cs
  11. 3
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/ISequence.cs
  12. 3
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/MyersDiffAlgorithm.cs
  13. 3
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/StringSequence.cs
  14. 22
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/Utils.cs

2
SharpDevelop.sln

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
# SharpDevelop 4.2.0.8590-beta # SharpDevelop 4.2.0.8634-beta
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection

10
src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj

@ -72,6 +72,8 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Src\DocumentSequence.cs" />
<Compile Include="Src\Utils.cs" />
<None Include="AvalonEdit.AddIn.addin"> <None Include="AvalonEdit.AddIn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@ -108,12 +110,6 @@
</Compile> </Compile>
<Compile Include="Src\HiddenDefinition\HiddenDefinitionRenderer.cs" /> <Compile Include="Src\HiddenDefinition\HiddenDefinitionRenderer.cs" />
<Compile Include="Src\LineChangeInfo.cs" /> <Compile Include="Src\LineChangeInfo.cs" />
<Compile Include="Src\MyersDiff\DocumentSequence.cs" />
<Compile Include="Src\MyersDiff\Edit.cs" />
<Compile Include="Src\MyersDiff\ISequence.cs" />
<Compile Include="Src\MyersDiff\MyersDiffAlgorithm.cs" />
<Compile Include="Src\MyersDiff\StringSequence.cs" />
<Compile Include="Src\MyersDiff\Utils.cs" />
<Compile Include="Src\NewLineConsistencyCheck.cs" /> <Compile Include="Src\NewLineConsistencyCheck.cs" />
<Compile Include="Src\SearchPanelLocalization.cs" /> <Compile Include="Src\SearchPanelLocalization.cs" />
<Compile Include="Src\SharpDevelopTextEditor.cs" /> <Compile Include="Src\SharpDevelopTextEditor.cs" />
@ -244,7 +240,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Src\MyersDiff" /> <Folder Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\MyersDiff" />
<Folder Include="Src\HiddenDefinition" /> <Folder Include="Src\HiddenDefinition" />
</ItemGroup> </ItemGroup>
</Project> </Project>

1
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ChangeMarkerMargin.cs

@ -14,6 +14,7 @@ using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn namespace ICSharpCode.AvalonEdit.AddIn
{ {

2
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs

@ -14,7 +14,6 @@ using System.Windows.Data;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Threading; using System.Windows.Threading;
using ICSharpCode.AvalonEdit.AddIn.MyersDiff;
using ICSharpCode.AvalonEdit.AddIn.Options; using ICSharpCode.AvalonEdit.AddIn.Options;
using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Editing;
@ -30,6 +29,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn namespace ICSharpCode.AvalonEdit.AddIn
{ {

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DefaultChangeWatcher.cs

@ -6,11 +6,12 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using ICSharpCode.AvalonEdit.AddIn.MyersDiff;
using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Utils; using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn namespace ICSharpCode.AvalonEdit.AddIn
{ {

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/DocumentSequence.cs → src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DocumentSequence.cs

@ -4,8 +4,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.AvalonEdit.AddIn
{ {
public class DocumentSequence : ISequence public class DocumentSequence : ISequence
{ {

12
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/LineChangeInfo.cs

@ -3,6 +3,7 @@
using System; using System;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn namespace ICSharpCode.AvalonEdit.AddIn
{ {
@ -21,16 +22,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
IDocument CurrentDocument { get; } IDocument CurrentDocument { get; }
IDocument BaseDocument { get; } IDocument BaseDocument { get; }
} }
public enum ChangeType
{
None,
Added,
Deleted,
Modified,
Unsaved
}
public struct LineChangeInfo : IEquatable<LineChangeInfo> public struct LineChangeInfo : IEquatable<LineChangeInfo>
{ {
public static readonly LineChangeInfo EMPTY = new LineChangeInfo(ChangeType.None, 1, 1); public static readonly LineChangeInfo EMPTY = new LineChangeInfo(ChangeType.None, 1, 1);

16
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/Utils.cs → src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Utils.cs

@ -4,24 +4,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.SharpDevelop.Widgets.MyersDiff;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.AvalonEdit.AddIn
{ {
public static class Utils public static class Utils
{ {
public static void Set<T>(this IList<T> instance, int index, T value)
{
if (instance == null)
throw new ArgumentNullException("instance");
if (index == instance.Count)
instance.Add(value);
else
instance[index] = value;
}
public static OffsetChangeMap ToOffsetChangeMap(this IEnumerable<Edit> edits) public static OffsetChangeMap ToOffsetChangeMap(this IEnumerable<Edit> edits)
{ {
var map = new OffsetChangeMap(); var map = new OffsetChangeMap();

6
src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ICSharpCode.SharpDevelop.Widgets.csproj

@ -78,6 +78,11 @@
<Compile Include="ListViewSorting\IListViewItemComparer.cs" /> <Compile Include="ListViewSorting\IListViewItemComparer.cs" />
<Compile Include="ListViewSorting\ListViewItemSorter.cs" /> <Compile Include="ListViewSorting\ListViewItemSorter.cs" />
<Compile Include="MouseWheelHandler.cs" /> <Compile Include="MouseWheelHandler.cs" />
<Compile Include="MyersDiff\Edit.cs" />
<Compile Include="MyersDiff\ISequence.cs" />
<Compile Include="MyersDiff\MyersDiffAlgorithm.cs" />
<Compile Include="MyersDiff\StringSequence.cs" />
<Compile Include="MyersDiff\Utils.cs" />
<Compile Include="NumericUpDown.cs"> <Compile Include="NumericUpDown.cs">
<DependentUpon>NumericUpDown.xaml</DependentUpon> <DependentUpon>NumericUpDown.xaml</DependentUpon>
</Compile> </Compile>
@ -117,6 +122,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Images" /> <Folder Include="Images" />
<Folder Include="MyersDiff" />
<Folder Include="themes" /> <Folder Include="themes" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

13
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/Edit.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/Edit.cs

@ -37,9 +37,8 @@
*/ */
using System; using System;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.SharpDevelop.Widgets.MyersDiff
{ {
/// <summary> /// <summary>
/// A modified region detected between two versions of roughly the same content. /// A modified region detected between two versions of roughly the same content.
@ -200,5 +199,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff
} }
} }
/// <remarks>Moved from AvaloEdit</remarks>
public enum ChangeType
{
None,
Added,
Deleted,
Modified,
Unsaved
}
} }

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/ISequence.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/ISequence.cs

@ -38,7 +38,7 @@
using System; using System;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.SharpDevelop.Widgets.MyersDiff
{ {
/// <summary> /// <summary>
/// Arbitrary sequence of elements with fast comparison support. /// Arbitrary sequence of elements with fast comparison support.
@ -85,5 +85,4 @@ namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff
bool Equals(int thisIdx, ISequence other, int otherIdx); bool Equals(int thisIdx, ISequence other, int otherIdx);
} }
} }

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/MyersDiffAlgorithm.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/MyersDiffAlgorithm.cs

@ -38,9 +38,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.SharpDevelop.Widgets.MyersDiff
{ {
/// <summary> /// <summary>
/// Diff algorithm, based on "An O(ND) Difference Algorithm and its /// Diff algorithm, based on "An O(ND) Difference Algorithm and its

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/MyersDiff/StringSequence.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/StringSequence.cs

@ -3,9 +3,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.AvalonEdit.AddIn.MyersDiff namespace ICSharpCode.SharpDevelop.Widgets.MyersDiff
{ {
public class StringSequence : ISequence public class StringSequence : ISequence
{ {

22
src/Main/ICSharpCode.SharpDevelop.Widgets/Project/MyersDiff/Utils.cs

@ -0,0 +1,22 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Widgets.MyersDiff
{
public static class Utils
{
public static void Set<T>(this IList<T> instance, int index, T value)
{
if (instance == null)
throw new ArgumentNullException("instance");
if (index == instance.Count)
instance.Add(value);
else
instance[index] = value;
}
}
}
Loading…
Cancel
Save