| 1: | // EditCommands.cs | |
| 2: | // Copyright (C) 2002 Mike Krueger | |
| 3: | // | |
| 4: | // This program is free software; you can redistribute it and/or modify | |
| 5: | // it under the terms of the GNU General Public License as published by | |
| 6: | // the Free Software Foundation; either version 2 of the License, or | |
| 7: | // (at your option) any later version. | |
| 8: | // | |
| 9: | // This program is distributed in the hope that it will be useful, | |
| 10: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12: | // GNU General Public License for more details. | |
| 13: | // | |
| 14: | // You should have received a copy of the GNU General Public License | |
| 15: | // along with this program; if not, write to the Free Software | |
| 16: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17: | ||
| 18: | using System; | |
| 19: | using System.IO; | |
| 20: | using System.Threading; | |
| 21: | using System.Drawing; | |
| 22: | using System.Drawing.Printing; | |
| 23: | using System.Collections; | |
| 24: | using System.ComponentModel; | |
| 25: | using System.Windows.Forms; | |
| 26: | using System.Diagnostics; | |
| 27: | ||
| 28: | using Core.AddIns; | |
| 29: | using Core.Util; | |
| 30: | using Core.Properties; | |
| 31: | using Core.Gui; | |
| 32: | using Core.Gui.Creators; | |
| 33: | ||
| 34: | using SharpDevelop.Gui; | |
| 35: | using SharpDevelop.Gui.Dialogs; | |
| 36: | using SharpDevelop.Gui.Edit; | |
| 37: | ||
| 38: | namespace SharpDevelop.Base.Commands { | |
| 39: | ||
| 40: | public class Undo : AbstractMenuCommand | |
| 41: | { | |
| 42: | public override void Run() | |
| 43: | { | |
| 44: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 45: | ||
| 46: | if (window != null && window.WindowContent is IEditable) { | |
| 47: | ((IEditable)window.WindowContent).UndoStack.Undo(); | |
| 48: | } | |
| 49: | } | |
| 50: | } | |
| 51: | public class Redo : AbstractMenuCommand | |
| 52: | { | |
| 53: | public override void Run() | |
| 54: | { | |
| 55: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 56: | ||
| 57: | if (window != null && window.WindowContent is IEditable) { | |
| 58: | ((IEditable)window.WindowContent).UndoStack.Redo(); | |
| 59: | } | |
| 60: | } | |
| 61: | } | |
| 62: | ||
| 63: | public class Cut : AbstractMenuCommand | |
| 64: | { | |
| 65: | public override void Run() | |
| 66: | { | |
| 67: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 68: | ||
| 69: | if (window != null && window.WindowContent is IEditable) { | |
| 70: | ((IEditable)window.WindowContent).ClipboardHandler.Cut(null, null); | |
| 71: | } | |
| 72: | } | |
| 73: | } | |
| 74: | ||
| 75: | public class Copy : AbstractMenuCommand | |
| 76: | { | |
| 77: | public override void Run() | |
| 78: | { | |
| 79: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 80: | ||
| 81: | if (window != null && window.WindowContent is IEditable) { | |
| 82: | ((IEditable)window.WindowContent).ClipboardHandler.Copy(null, null); | |
| 83: | } | |
| 84: | } | |
| 85: | } | |
| 86: | ||
| 87: | public class Paste : AbstractMenuCommand | |
| 88: | { | |
| 89: | public override void Run() | |
| 90: | { | |
| 91: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 92: | ||
| 93: | if (window != null && window.WindowContent is IEditable) { | |
| 94: | ((IEditable)window.WindowContent).ClipboardHandler.Paste(null, null); | |
| 95: | } | |
| 96: | } | |
| 97: | } | |
| 98: | ||
| 99: | public class Delete : AbstractMenuCommand | |
| 100: | { | |
| 101: | public override void Run() | |
| 102: | { | |
| 103: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 104: | ||
| 105: | if (window != null && window.WindowContent is IEditable) { | |
| 106: | ((IEditable)window.WindowContent).ClipboardHandler.Delete(null, null); | |
| 107: | } | |
| 108: | } | |
| 109: | } | |
| 110: | ||
| 111: | public class SelectAll : AbstractMenuCommand | |
| 112: | { | |
| 113: | public override void Run() | |
| 114: | { | |
| 115: | IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; | |
| 116: | ||
| 117: | if (window != null && window.WindowContent is IEditable) { | |
| 118: | ((IEditable)window.WindowContent).ClipboardHandler.SelectAll(null, null); | |
| 119: | } | |
| 120: | } | |
| 121: | } | |
| 122: | ||
| 123: | public class WordCount : AbstractMenuCommand | |
| 124: | { | |
| 125: | public override void Run() | |
| 126: | { | |
| 127: | WordCountDialog wcd = new WordCountDialog(); | |
| 128: | wcd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 129: | wcd.ShowDialog(); | |
| 130: | wcd.Dispose(); | |
| 131: | } | |
| 132: | } | |
| 133: | } |
This page was automatically generated by SharpDevelop.