Browse Source

Remove unused code.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4695 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
1ffa5cbd86
  1. 11
      src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs
  2. 3
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 19
      src/Main/Base/Project/Src/Internal/Undo/IUndoableOperation.cs
  4. 50
      src/Main/Base/Project/Src/Internal/Undo/UndoQueue.cs
  5. 126
      src/Main/Base/Project/Src/Internal/Undo/UndoStack.cs

11
src/AddIns/DisplayBindings/ResourceEditor/Project/Src/ResourceEdit/ResourceList.cs

@ -15,7 +15,6 @@ using System.Windows.Forms; @@ -15,7 +15,6 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop.Internal.Undo;
using ICSharpCode.SharpDevelop.Widgets.ListViewSorting;
namespace ResourceEditor
@ -34,7 +33,6 @@ namespace ResourceEditor @@ -34,7 +33,6 @@ namespace ResourceEditor
Dictionary<string, ResourceItem> metadata = new Dictionary<string, ResourceItem>();
ImageList images = new ImageList();
UndoStack undoStack = null;
bool writeProtected = false;
int editListViewItemIndex = -1;
@ -59,13 +57,6 @@ namespace ResourceEditor @@ -59,13 +57,6 @@ namespace ResourceEditor
}
}
public UndoStack UndoStack
{
get {
return undoStack;
}
}
public PrintDocument PrintDocument
{
get {
@ -81,8 +72,6 @@ namespace ResourceEditor @@ -81,8 +72,6 @@ namespace ResourceEditor
public ResourceList(ResourceEditorControl editor)
{
undoStack = new UndoStack();
name.Text = ResourceService.GetString("Global.Name");
name.Width = 250;

3
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -201,9 +201,6 @@ @@ -201,9 +201,6 @@
<Compile Include="Src\Internal\Templates\File\FileTemplate.cs" />
<Compile Include="Src\Internal\Templates\TextTemplate.cs" />
<Compile Include="Src\Internal\Templates\File\INewFileCreator.cs" />
<Compile Include="Src\Internal\Undo\IUndoableOperation.cs" />
<Compile Include="Src\Internal\Undo\UndoQueue.cs" />
<Compile Include="Src\Internal\Undo\UndoStack.cs" />
<Compile Include="Src\Project\BuildEngine.cs" />
<Compile Include="Src\Project\ContextSpecificProperties.cs" />
<Compile Include="Src\Project\IBuildFeedbackSink.cs" />

19
src/Main/Base/Project/Src/Internal/Undo/IUndoableOperation.cs

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
namespace ICSharpCode.SharpDevelop.Internal.Undo
{
/// <summary>
/// This Interface describes a the basic Undo/Redo operation
/// all Undo Operations must implement this interface.
/// </summary>
public interface IUndoableOperation
{
void Undo();
void Redo();
}
}

50
src/Main/Base/Project/Src/Internal/Undo/UndoQueue.cs

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Internal.Undo
{
/// <summary>
/// This class stacks the last x operations from the undostack and makes
/// one undo/redo operation from it.
/// </summary>
internal class UndoQueue : IUndoableOperation
{
List<IUndoableOperation> undolist = new List<IUndoableOperation>();
public UndoQueue(UndoStack stack, int numops)
{
if (stack == null) {
throw new ArgumentNullException("stack");
}
System.Diagnostics.Debug.Assert(numops > 0 , "ICSharpCode.SharpDevelop.Internal.Undo.UndoQueue : numops should be > 0");
for (int i = 0; i < numops; ++i) {
if (stack._UndoStack.Count > 0) {
undolist.Add(stack._UndoStack.Pop());
}
}
}
public void Undo()
{
for (int i = 0; i < undolist.Count; ++i) {
undolist[i].Undo();
}
}
public void Redo()
{
for (int i = undolist.Count - 1 ; i >= 0 ; --i) {
((IUndoableOperation)undolist[i]).Redo();
}
}
}
}

126
src/Main/Base/Project/Src/Internal/Undo/UndoStack.cs

@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Internal.Undo
{
/// <summary>
/// This class implements an undo stack
/// </summary>
public class UndoStack
{
Stack<IUndoableOperation> undostack = new Stack<IUndoableOperation>();
Stack<IUndoableOperation> redostack = new Stack<IUndoableOperation>();
public event EventHandler ActionUndone;
public event EventHandler ActionRedone;
public bool AcceptChanges = true;
/// <summary>
/// This property is EXCLUSIVELY for the UndoQueue class, don't USE it
/// </summary>
internal Stack<IUndoableOperation> _UndoStack {
get {
return undostack;
}
}
public bool CanUndo {
get {
return undostack.Count > 0;
}
}
public bool CanRedo {
get {
return redostack.Count > 0;
}
}
// /// <summary>
// /// You call this method to pool the last x operations from the undo stack
// /// to make 1 operation from it.
// /// </summary>
// public void UndoLast(int x)
// {
// undostack.Push(new UndoQueue(this, x));
// }
/// <summary>
/// Call this method to undo the last operation on the stack
/// </summary>
public void Undo()
{
if (undostack.Count > 0) {
IUndoableOperation uedit = (IUndoableOperation)undostack.Pop();
redostack.Push(uedit);
uedit.Undo();
OnActionUndone();
}
}
/// <summary>
/// Call this method to redo the last undone operation
/// </summary>
public void Redo()
{
if (redostack.Count > 0) {
IUndoableOperation uedit = (IUndoableOperation)redostack.Pop();
undostack.Push(uedit);
uedit.Redo();
OnActionRedone();
}
}
/// <summary>
/// Call this method to push an UndoableOperation on the undostack, the redostack
/// will be cleared, if you use this method.
/// </summary>
public void Push(IUndoableOperation operation)
{
if (operation == null) {
throw new ArgumentNullException("UndoStack.Push(UndoableOperation operation) : operation can't be null");
}
if (AcceptChanges) {
undostack.Push(operation);
ClearRedoStack();
}
}
/// <summary>
/// Call this method, if you want to clear the redo stack
/// </summary>
public void ClearRedoStack()
{
redostack.Clear();
}
public void ClearAll()
{
undostack.Clear();
redostack.Clear();
}
protected void OnActionUndone()
{
if (ActionUndone != null) {
ActionUndone(null, null);
}
}
protected void OnActionRedone()
{
if (ActionRedone != null) {
ActionRedone(null, null);
}
}
}
}
Loading…
Cancel
Save