mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Use "ContextMenuStrip" instead of "ContextMenu"
So it will work in dotnet 5
This commit is contained in:
parent
1032df63d9
commit
73c51c6285
@ -2181,6 +2181,7 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<AlignmentN7>Alignment top left - {\an7}</AlignmentN7>
|
||||
<AlignmentN8>Alignment top center - {\an8}</AlignmentN8>
|
||||
<AlignmentN9>Alignment top right - {\an9}</AlignmentN9>
|
||||
<ColorX>Color {0} ({1})</ColorX>
|
||||
<CopyTextOnly>Copy text only to clipboard (selected lines)</CopyTextOnly>
|
||||
<CopyTextOnlyFromOriginalToCurrent>Copy text from original to current</CopyTextOnlyFromOriginalToCurrent>
|
||||
<AutoDurationSelectedLines>Auto-duration (selected lines)</AutoDurationSelectedLines>
|
||||
|
@ -5965,6 +5965,9 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/AlignmentN9":
|
||||
language.Settings.AlignmentN9 = reader.Value;
|
||||
break;
|
||||
case "Settings/ColorX":
|
||||
language.Settings.ColorX = reader.Value;
|
||||
break;
|
||||
case "Settings/CopyTextOnly":
|
||||
language.Settings.CopyTextOnly = reader.Value;
|
||||
break;
|
||||
|
@ -32,7 +32,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
private TextBox _textBox;
|
||||
private int _mouseMoveSelectionLength;
|
||||
private WebBrowserEditBox _htmlBox;
|
||||
private bool _useWebBrowser = true;
|
||||
private const bool UseWebBrowser = false;
|
||||
|
||||
public SETextBox()
|
||||
{
|
||||
@ -74,7 +74,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
_richTextBoxTemp = null;
|
||||
if (useSyntaxColoring)
|
||||
{
|
||||
if (_useWebBrowser)
|
||||
if (UseWebBrowser)
|
||||
{
|
||||
_uiTextBox = null;
|
||||
_htmlBox = new WebBrowserEditBox();
|
||||
|
@ -213,7 +213,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (sender == radioButtonRegEx)
|
||||
{
|
||||
textBoxNoBreakAfter.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(textBoxNoBreakAfter);
|
||||
textBoxNoBreakAfter.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxNoBreakAfter);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -155,19 +155,19 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (textBoxFind.Visible)
|
||||
{
|
||||
comboBoxFind.ContextMenu = null;
|
||||
textBoxFind.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
|
||||
comboBoxFind.ContextMenuStrip = null;
|
||||
textBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxFind.ContextMenu = null;
|
||||
comboBoxFind.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(comboBoxFind);
|
||||
textBoxFind.ContextMenuStrip = null;
|
||||
comboBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(comboBoxFind);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxFind.ContextMenu = null;
|
||||
comboBoxFind.ContextMenu = null;
|
||||
textBoxFind.ContextMenuStrip = null;
|
||||
comboBoxFind.ContextMenuStrip = null;
|
||||
}
|
||||
checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked;
|
||||
labelCount.Text = string.Empty;
|
||||
|
@ -161,7 +161,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private readonly Timer _dragAndDropVideoTimer = new Timer(); // to prevent locking windows explorer
|
||||
private long _labelNextTicks = -1;
|
||||
private bool _showBookmarkLabel = true;
|
||||
private ContextMenu _bookmarkContextMenu;
|
||||
private ContextMenuStrip _bookmarkContextMenu;
|
||||
private readonly MainShortcuts _shortcuts = new MainShortcuts();
|
||||
private long _winLeftDownTicks = -1;
|
||||
private long _winRightDownTicks = -1;
|
||||
@ -28331,15 +28331,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
_bookmarkContextMenu = new ContextMenu();
|
||||
_bookmarkContextMenu = new ContextMenuStrip();
|
||||
|
||||
// edit bookmark
|
||||
var menuItem = new MenuItem(Configuration.Settings.Language.Main.Menu.ContextMenu.EditBookmark);
|
||||
var menuItem = new ToolStripMenuItem(Configuration.Settings.Language.Main.Menu.ContextMenu.EditBookmark);
|
||||
menuItem.Click += (sender2, e2) => { labelBookmark_DoubleClick(null, null); };
|
||||
_bookmarkContextMenu.MenuItems.Add(menuItem);
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
// remove bookmark
|
||||
menuItem = new MenuItem(Configuration.Settings.Language.Main.Menu.ContextMenu.RemoveBookmark);
|
||||
menuItem = new ToolStripMenuItem(Configuration.Settings.Language.Main.Menu.ContextMenu.RemoveBookmark);
|
||||
menuItem.Click += (sender2, e2) =>
|
||||
{
|
||||
var p2 = _subtitle.GetParagraphOrDefault(_subtitleListViewIndex);
|
||||
@ -28353,21 +28353,21 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
new BookmarkPersistence(_subtitle, _fileName).Save();
|
||||
}
|
||||
};
|
||||
_bookmarkContextMenu.MenuItems.Add(menuItem);
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
_bookmarkContextMenu.MenuItems.Add("-");
|
||||
_bookmarkContextMenu.Items.Add("-");
|
||||
|
||||
// go to bookmark
|
||||
menuItem = new MenuItem(Configuration.Settings.Language.Settings.GoToBookmark);
|
||||
menuItem = new ToolStripMenuItem(Configuration.Settings.Language.Settings.GoToBookmark);
|
||||
menuItem.Click += (sender2, e2) => { GoToBookmark(); };
|
||||
_bookmarkContextMenu.MenuItems.Add(menuItem);
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
// clear all bookmarks
|
||||
menuItem = new MenuItem(Configuration.Settings.Language.Settings.ClearBookmarks);
|
||||
menuItem = new ToolStripMenuItem(Configuration.Settings.Language.Settings.ClearBookmarks);
|
||||
menuItem.Click += (sender2, e2) => { ClearBookmarks(); };
|
||||
_bookmarkContextMenu.MenuItems.Add(menuItem);
|
||||
_bookmarkContextMenu.Items.Add(menuItem);
|
||||
|
||||
pictureBoxBookmark.ContextMenu = _bookmarkContextMenu;
|
||||
pictureBoxBookmark.ContextMenuStrip = _bookmarkContextMenu;
|
||||
}
|
||||
|
||||
private void labelBookmark_DoubleClick(object sender, EventArgs e)
|
||||
|
@ -432,7 +432,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
numericUpDownDuration.Visible = comboBoxRule.SelectedIndex == FunctionDurationLessThan || comboBoxRule.SelectedIndex == FunctionDurationGreaterThan;
|
||||
if (comboBoxRule.SelectedIndex == FunctionRegEx) // regex
|
||||
{
|
||||
textBoxText.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(textBoxText);
|
||||
textBoxText.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxText);
|
||||
checkBoxCaseSensitive.Enabled = false;
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionUnequal || comboBoxRule.SelectedIndex == FunctionEqual || comboBoxRule.SelectedIndex == FunctionMoreThanTwoLines)
|
||||
|
@ -60,7 +60,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
saveFileDialog1.FileName = string.Empty;
|
||||
|
||||
textBoxReplace.ContextMenu = FindReplaceDialogHelper.GetReplaceTextContextMenu(textBoxReplace);
|
||||
textBoxReplace.ContextMenuStrip = FindReplaceDialogHelper.GetReplaceTextContextMenu(textBoxReplace);
|
||||
buttonUpdate.Enabled = false;
|
||||
|
||||
Text = Configuration.Settings.Language.MultipleReplace.Title;
|
||||
@ -194,7 +194,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void RadioButtonCheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
textBoxFind.ContextMenu = sender == radioButtonRegEx ? FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind) : null;
|
||||
textBoxFind.ContextMenuStrip = sender == radioButtonRegEx ? FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind) : null;
|
||||
}
|
||||
|
||||
private void ButtonAddClick(object sender, EventArgs e)
|
||||
|
@ -175,11 +175,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (sender == radioButtonRegEx)
|
||||
{
|
||||
textBoxFind.ContextMenu = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
|
||||
textBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxFind.ContextMenu = null;
|
||||
textBoxFind.ContextMenuStrip = null;
|
||||
}
|
||||
checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked;
|
||||
}
|
||||
|
@ -239,48 +239,48 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ContextMenu GetRegExContextMenu(TextBox textBox)
|
||||
public static ContextMenuStrip GetRegExContextMenu(TextBox textBox)
|
||||
{
|
||||
var cm = new ContextMenu();
|
||||
var cm = new ContextMenuStrip();
|
||||
var l = Configuration.Settings.Language.RegularExpressionContextMenu;
|
||||
cm.MenuItems.Add(l.WordBoundary, delegate { textBox.SelectedText = "\\b"; });
|
||||
cm.MenuItems.Add(l.NonWordBoundary, delegate { textBox.SelectedText = "\\B"; });
|
||||
cm.MenuItems.Add(l.NewLine, delegate { textBox.SelectedText = "\\r\\n"; });
|
||||
cm.MenuItems.Add(l.AnyDigit, delegate { textBox.SelectedText = "\\d"; });
|
||||
cm.MenuItems.Add(l.NonDigit, delegate { textBox.SelectedText = "\\D"; });
|
||||
cm.MenuItems.Add(l.AnyCharacter, delegate { textBox.SelectedText = "."; });
|
||||
cm.MenuItems.Add(l.AnyWhitespace, delegate { textBox.SelectedText = "\\s"; });
|
||||
cm.MenuItems.Add(l.NonSpaceCharacter, delegate { textBox.SelectedText = "\\S"; });
|
||||
cm.MenuItems.Add(l.ZeroOrMore, delegate { textBox.SelectedText = "*"; });
|
||||
cm.MenuItems.Add(l.OneOrMore, delegate { textBox.SelectedText = "+"; });
|
||||
cm.MenuItems.Add(l.InCharacterGroup, delegate { textBox.SelectedText = "[test]"; });
|
||||
cm.MenuItems.Add(l.NotInCharacterGroup, delegate { textBox.SelectedText = "[^test]"; });
|
||||
cm.Items.Add(l.WordBoundary, null, delegate { textBox.SelectedText = "\\b"; });
|
||||
cm.Items.Add(l.NonWordBoundary, null, delegate { textBox.SelectedText = "\\B"; });
|
||||
cm.Items.Add(l.NewLine, null, delegate { textBox.SelectedText = "\\r\\n"; });
|
||||
cm.Items.Add(l.AnyDigit, null, delegate { textBox.SelectedText = "\\d"; });
|
||||
cm.Items.Add(l.NonDigit, null, delegate { textBox.SelectedText = "\\D"; });
|
||||
cm.Items.Add(l.AnyCharacter, null, delegate { textBox.SelectedText = "."; });
|
||||
cm.Items.Add(l.AnyWhitespace, null, delegate { textBox.SelectedText = "\\s"; });
|
||||
cm.Items.Add(l.NonSpaceCharacter, null, delegate { textBox.SelectedText = "\\S"; });
|
||||
cm.Items.Add(l.ZeroOrMore, null, delegate { textBox.SelectedText = "*"; });
|
||||
cm.Items.Add(l.OneOrMore, null, delegate { textBox.SelectedText = "+"; });
|
||||
cm.Items.Add(l.InCharacterGroup, null, delegate { textBox.SelectedText = "[test]"; });
|
||||
cm.Items.Add(l.NotInCharacterGroup, null, delegate { textBox.SelectedText = "[^test]"; });
|
||||
return cm;
|
||||
}
|
||||
|
||||
public static ContextMenu GetRegExContextMenu(ComboBox comboBox)
|
||||
public static ContextMenuStrip GetRegExContextMenu(ComboBox comboBox)
|
||||
{
|
||||
var cm = new ContextMenu();
|
||||
var cm = new ContextMenuStrip();
|
||||
var l = Configuration.Settings.Language.RegularExpressionContextMenu;
|
||||
cm.MenuItems.Add(l.WordBoundary, delegate { comboBox.SelectedText = "\\b"; });
|
||||
cm.MenuItems.Add(l.NonWordBoundary, delegate { comboBox.SelectedText = "\\B"; });
|
||||
cm.MenuItems.Add(l.NewLine, delegate { comboBox.SelectedText = "\\r\\n"; });
|
||||
cm.MenuItems.Add(l.AnyDigit, delegate { comboBox.SelectedText = "\\d"; });
|
||||
cm.MenuItems.Add(l.NonDigit, delegate { comboBox.SelectedText = "\\D"; });
|
||||
cm.MenuItems.Add(l.AnyCharacter, delegate { comboBox.SelectedText = "."; });
|
||||
cm.MenuItems.Add(l.AnyWhitespace, delegate { comboBox.SelectedText = "\\s"; });
|
||||
cm.MenuItems.Add(l.NonSpaceCharacter, delegate { comboBox.SelectedText = "\\S"; });
|
||||
cm.MenuItems.Add(l.ZeroOrMore, delegate { comboBox.SelectedText = "*"; });
|
||||
cm.MenuItems.Add(l.OneOrMore, delegate { comboBox.SelectedText = "+"; });
|
||||
cm.MenuItems.Add(l.InCharacterGroup, delegate { comboBox.SelectedText = "[test]"; });
|
||||
cm.MenuItems.Add(l.NotInCharacterGroup, delegate { comboBox.SelectedText = "[^test]"; });
|
||||
cm.Items.Add(l.WordBoundary, null, delegate { comboBox.SelectedText = "\\b"; });
|
||||
cm.Items.Add(l.NonWordBoundary, null, delegate { comboBox.SelectedText = "\\B"; });
|
||||
cm.Items.Add(l.NewLine, null, delegate { comboBox.SelectedText = "\\r\\n"; });
|
||||
cm.Items.Add(l.AnyDigit, null, delegate { comboBox.SelectedText = "\\d"; });
|
||||
cm.Items.Add(l.NonDigit, null, delegate { comboBox.SelectedText = "\\D"; });
|
||||
cm.Items.Add(l.AnyCharacter, null, delegate { comboBox.SelectedText = "."; });
|
||||
cm.Items.Add(l.AnyWhitespace, null, delegate { comboBox.SelectedText = "\\s"; });
|
||||
cm.Items.Add(l.NonSpaceCharacter, null, delegate { comboBox.SelectedText = "\\S"; });
|
||||
cm.Items.Add(l.ZeroOrMore, null, delegate { comboBox.SelectedText = "*"; });
|
||||
cm.Items.Add(l.OneOrMore, null, delegate { comboBox.SelectedText = "+"; });
|
||||
cm.Items.Add(l.InCharacterGroup, null, delegate { comboBox.SelectedText = "[test]"; });
|
||||
cm.Items.Add(l.NotInCharacterGroup, null, delegate { comboBox.SelectedText = "[^test]"; });
|
||||
return cm;
|
||||
}
|
||||
|
||||
public static ContextMenu GetReplaceTextContextMenu(TextBox textBox)
|
||||
public static ContextMenuStrip GetReplaceTextContextMenu(TextBox textBox)
|
||||
{
|
||||
var cm = new ContextMenu();
|
||||
cm.MenuItems.Add(Configuration.Settings.Language.RegularExpressionContextMenu.NewLineShort, delegate { textBox.SelectedText = "\\n"; });
|
||||
var cm = new ContextMenuStrip();
|
||||
cm.Items.Add(Configuration.Settings.Language.RegularExpressionContextMenu.NewLineShort, null, delegate { textBox.SelectedText = "\\n"; });
|
||||
return cm;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user