mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 07:26:05 +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
|
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);
|
ToolStripMenuItem tsmiCut = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Cut);
|
||||||
tsmiCut.Click += (sender, e) => rtb.Cut();
|
tsmiCut.Click += (sender, e) => rtb.Cut();
|
||||||
cms.Items.Add(tsmiCut);
|
cms.Items.Add(tsmiCut);
|
||||||
|
@ -246,20 +256,20 @@ public static void AddContextMenu(this RichTextBox rtb)
|
||||||
tsmiPaste.Click += (sender, e) => rtb.Paste();
|
tsmiPaste.Click += (sender, e) => rtb.Paste();
|
||||||
cms.Items.Add(tsmiPaste);
|
cms.Items.Add(tsmiPaste);
|
||||||
|
|
||||||
// TODO: Translate
|
ToolStripMenuItem tsmiDelete = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_Delete);
|
||||||
ToolStripMenuItem tsmiDelete = new ToolStripMenuItem("Delete");
|
|
||||||
tsmiDelete.Click += (sender, e) => rtb.SelectedText = "";
|
tsmiDelete.Click += (sender, e) => rtb.SelectedText = "";
|
||||||
cms.Items.Add(tsmiDelete);
|
cms.Items.Add(tsmiDelete);
|
||||||
|
|
||||||
cms.Items.Add(new ToolStripSeparator());
|
cms.Items.Add(new ToolStripSeparator());
|
||||||
|
|
||||||
// TODO: Translate
|
ToolStripMenuItem tsmiSelectAll = new ToolStripMenuItem(Resources.Extensions_AddContextMenu_SelectAll);
|
||||||
ToolStripMenuItem tsmiSelectAll = new ToolStripMenuItem("Select All");
|
|
||||||
tsmiSelectAll.Click += (sender, e) => rtb.SelectAll();
|
tsmiSelectAll.Click += (sender, e) => rtb.SelectAll();
|
||||||
cms.Items.Add(tsmiSelectAll);
|
cms.Items.Add(tsmiSelectAll);
|
||||||
|
|
||||||
cms.Opening += (sender, e) =>
|
cms.Opening += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
tsmiUndo.Enabled = !rtb.ReadOnly && rtb.CanUndo;
|
||||||
|
tsmiRedo.Enabled = !rtb.ReadOnly && rtb.CanRedo;
|
||||||
tsmiCut.Enabled = !rtb.ReadOnly && rtb.SelectionLength > 0;
|
tsmiCut.Enabled = !rtb.ReadOnly && rtb.SelectionLength > 0;
|
||||||
tsmiCopy.Enabled = rtb.SelectionLength > 0;
|
tsmiCopy.Enabled = rtb.SelectionLength > 0;
|
||||||
tsmiPaste.Enabled = !rtb.ReadOnly && Clipboard.ContainsText();
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Paste.
|
/// Looks up a localized string similar to Paste.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Custom file uploader.
|
/// Looks up a localized string similar to Custom file uploader.
|
||||||
/// </summary>
|
/// </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">
|
<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>
|
<value>..\Resources\ShareX_Icon_White.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</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>
|
</root>
|
Loading…
Reference in a new issue