mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 14:11:38 +12:00
Added undo and redo buttons to context menu
This commit is contained in:
parent
d7f994c6be
commit
e546b3bc9e
|
@ -234,6 +234,16 @@ public static void AddContextMenu(this RichTextBox rtb)
|
|||
ShowImageMargin = false
|
||||
};
|
||||
|
||||
ToolStripMenuItem tsmiUndo = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Undo);
|
||||
tsmiUndo.Click += (sender, e) => rtb.Undo();
|
||||
cms.Items.Add(tsmiUndo);
|
||||
|
||||
ToolStripMenuItem tsmiRedo = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Redo);
|
||||
tsmiRedo.Click += (sender, e) => rtb.Redo();
|
||||
cms.Items.Add(tsmiRedo);
|
||||
|
||||
cms.Items.Add(new ToolStripSeparator());
|
||||
|
||||
ToolStripMenuItem tsmiCut = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Cut);
|
||||
tsmiCut.Click += (sender, e) => rtb.Cut();
|
||||
cms.Items.Add(tsmiCut);
|
||||
|
@ -246,20 +256,20 @@ public static void AddContextMenu(this RichTextBox rtb)
|
|||
tsmiPaste.Click += (sender, e) => rtb.Paste();
|
||||
cms.Items.Add(tsmiPaste);
|
||||
|
||||
// TODO: Translate
|
||||
ToolStripMenuItem tsmiDelete = new ToolStripMenuItem("Delete");
|
||||
ToolStripMenuItem tsmiDelete = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Delete);
|
||||
tsmiDelete.Click += (sender, e) => rtb.SelectedText = "";
|
||||
cms.Items.Add(tsmiDelete);
|
||||
|
||||
cms.Items.Add(new ToolStripSeparator());
|
||||
|
||||
// TODO: Translate
|
||||
ToolStripMenuItem tsmiSelectAll = new ToolStripMenuItem("Select All");
|
||||
ToolStripMenuItem tsmiSelectAll = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_SelectAll);
|
||||
tsmiSelectAll.Click += (sender, e) => rtb.SelectAll();
|
||||
cms.Items.Add(tsmiSelectAll);
|
||||
|
||||
cms.Opening += (sender, e) =>
|
||||
{
|
||||
tsmiUndo.Enabled = !rtb.ReadOnly && rtb.CanUndo;
|
||||
tsmiRedo.Enabled = !rtb.ReadOnly && rtb.CanRedo;
|
||||
tsmiCut.Enabled = !rtb.ReadOnly && rtb.SelectionLength > 0;
|
||||
tsmiCopy.Enabled = rtb.SelectionLength > 0;
|
||||
tsmiPaste.Enabled = !rtb.ReadOnly && Clipboard.ContainsText();
|
||||
|
|
36
ShareX.HelpersLib/Properties/Resources.Designer.cs
generated
36
ShareX.HelpersLib/Properties/Resources.Designer.cs
generated
|
@ -780,6 +780,15 @@ internal class Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
internal static string Extensions_AddContextMenu_Delete {
|
||||
get {
|
||||
return ResourceManager.GetString("Extensions_AddContextMenu_Delete", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Paste.
|
||||
/// </summary>
|
||||
|
@ -789,6 +798,33 @@ internal class Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Redo.
|
||||
/// </summary>
|
||||
internal static string Extensions_AddContextMenu_Redo {
|
||||
get {
|
||||
return ResourceManager.GetString("Extensions_AddContextMenu_Redo", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select All.
|
||||
/// </summary>
|
||||
internal static string Extensions_AddContextMenu_SelectAll {
|
||||
get {
|
||||
return ResourceManager.GetString("Extensions_AddContextMenu_SelectAll", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Undo.
|
||||
/// </summary>
|
||||
internal static string Extensions_AddContextMenu_Undo {
|
||||
get {
|
||||
return ResourceManager.GetString("Extensions_AddContextMenu_Undo", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Custom file uploader.
|
||||
/// </summary>
|
||||
|
|
|
@ -1178,4 +1178,16 @@ Would you like to download and install it?</value>
|
|||
<data name="ShareX_Icon_White" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ShareX_Icon_White.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Extensions_AddContextMenu_Delete" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="Extensions_AddContextMenu_SelectAll" xml:space="preserve">
|
||||
<value>Select All</value>
|
||||
</data>
|
||||
<data name="Extensions_AddContextMenu_Redo" xml:space="preserve">
|
||||
<value>Redo</value>
|
||||
</data>
|
||||
<data name="Extensions_AddContextMenu_Undo" xml:space="preserve">
|
||||
<value>Undo</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue