|
| 1 | +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team |
| 2 | +// |
| 3 | +// Permission is hereby granted, free of charge, to any person obtaining a copy of this |
| 4 | +// software and associated documentation files (the "Software"), to deal in the Software |
| 5 | +// without restriction, including without limitation the rights to use, copy, modify, merge, |
| 6 | +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons |
| 7 | +// to whom the Software is furnished to do so, subject to the following conditions: |
| 8 | +// |
| 9 | +// The above copyright notice and this permission notice shall be included in all copies or |
| 10 | +// substantial portions of the Software. |
| 11 | +// |
| 12 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
| 13 | +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
| 14 | +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
| 15 | +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 16 | +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 17 | +// DEALINGS IN THE SOFTWARE. |
| 18 | + |
| 19 | +using System.Windows.Input; |
| 20 | + |
| 21 | +namespace ICSharpCode.AvalonEdit |
| 22 | +{ |
| 23 | + /// <summary> |
| 24 | + /// Custom commands for AvalonEdit. |
| 25 | + /// </summary> |
| 26 | + public static class AvalonEditCommands |
| 27 | + { |
| 28 | + /// <summary> |
| 29 | + /// Toggles Overstrike mode |
| 30 | + /// The default shortcut is Ins. |
| 31 | + /// </summary> |
| 32 | + public static readonly RoutedCommand ToggleOverstrike = new RoutedCommand( |
| 33 | + "ToggleOverstrike", typeof(TextEditor), |
| 34 | + new InputGestureCollection { |
| 35 | + new KeyGesture(Key.Insert) |
| 36 | + }); |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Deletes the current line. |
| 40 | + /// The default shortcut is Ctrl+D. |
| 41 | + /// </summary> |
| 42 | + public static readonly RoutedCommand DeleteLine = new RoutedCommand( |
| 43 | + "DeleteLine", typeof(TextEditor), |
| 44 | + new InputGestureCollection { |
| 45 | + new KeyGesture(Key.D, ModifierKeys.Control) |
| 46 | + }); |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Removes leading whitespace from the selected lines (or the whole document if the selection is empty). |
| 50 | + /// </summary> |
| 51 | + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", |
| 52 | + Justification = "WPF uses 'Whitespace'")] |
| 53 | + public static readonly RoutedCommand RemoveLeadingWhitespace = new RoutedCommand("RemoveLeadingWhitespace", typeof(TextEditor)); |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Removes trailing whitespace from the selected lines (or the whole document if the selection is empty). |
| 57 | + /// </summary> |
| 58 | + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", |
| 59 | + Justification = "WPF uses 'Whitespace'")] |
| 60 | + public static readonly RoutedCommand RemoveTrailingWhitespace = new RoutedCommand("RemoveTrailingWhitespace", typeof(TextEditor)); |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Converts the selected text to upper case. |
| 64 | + /// </summary> |
| 65 | + public static readonly RoutedCommand ConvertToUppercase = new RoutedCommand("ConvertToUppercase", typeof(TextEditor)); |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Converts the selected text to lower case. |
| 69 | + /// </summary> |
| 70 | + public static readonly RoutedCommand ConvertToLowercase = new RoutedCommand("ConvertToLowercase", typeof(TextEditor)); |
| 71 | + |
| 72 | + /// <summary> |
| 73 | + /// Converts the selected text to title case. |
| 74 | + /// </summary> |
| 75 | + public static readonly RoutedCommand ConvertToTitleCase = new RoutedCommand("ConvertToTitleCase", typeof(TextEditor)); |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Inverts the case of the selected text. |
| 79 | + /// </summary> |
| 80 | + public static readonly RoutedCommand InvertCase = new RoutedCommand("InvertCase", typeof(TextEditor)); |
| 81 | + |
| 82 | + /// <summary> |
| 83 | + /// Converts tabs to spaces in the selected text. |
| 84 | + /// </summary> |
| 85 | + public static readonly RoutedCommand ConvertTabsToSpaces = new RoutedCommand("ConvertTabsToSpaces", typeof(TextEditor)); |
| 86 | + |
| 87 | + /// <summary> |
| 88 | + /// Converts spaces to tabs in the selected text. |
| 89 | + /// </summary> |
| 90 | + public static readonly RoutedCommand ConvertSpacesToTabs = new RoutedCommand("ConvertSpacesToTabs", typeof(TextEditor)); |
| 91 | + |
| 92 | + /// <summary> |
| 93 | + /// Converts leading tabs to spaces in the selected lines (or the whole document if the selection is empty). |
| 94 | + /// </summary> |
| 95 | + public static readonly RoutedCommand ConvertLeadingTabsToSpaces = new RoutedCommand("ConvertLeadingTabsToSpaces", typeof(TextEditor)); |
| 96 | + |
| 97 | + /// <summary> |
| 98 | + /// Converts leading spaces to tabs in the selected lines (or the whole document if the selection is empty). |
| 99 | + /// </summary> |
| 100 | + public static readonly RoutedCommand ConvertLeadingSpacesToTabs = new RoutedCommand("ConvertLeadingSpacesToTabs", typeof(TextEditor)); |
| 101 | + |
| 102 | + /// <summary> |
| 103 | + /// Runs the IIndentationStrategy on the selected lines (or the whole document if the selection is empty). |
| 104 | + /// </summary> |
| 105 | + public static readonly RoutedCommand IndentSelection = new RoutedCommand( |
| 106 | + "IndentSelection", typeof(TextEditor), |
| 107 | + new InputGestureCollection { |
| 108 | + new KeyGesture(Key.I, ModifierKeys.Control) |
| 109 | + }); |
| 110 | + } |
| 111 | +} |
0 commit comments