mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Improve "Modify selection" + "Delete x lines"-prompt for large subs
This commit is contained in:
parent
0b637828e7
commit
e63720ab0d
@ -1392,8 +1392,8 @@ Continue?</SubtitleAppendPrompt>
|
||||
<LineXOfY>line {0} of {1}</LineXOfY>
|
||||
<XLinesSavedAsY>{0} lines saved as {1}</XLinesSavedAsY>
|
||||
<XLinesDeleted>{0} lines deleted</XLinesDeleted>
|
||||
<BeforeDeletingXLines>Before deleting {0} lines</BeforeDeletingXLines>
|
||||
<DeleteXLinesPrompt>Delete {0} lines?</DeleteXLinesPrompt>
|
||||
<BeforeDeletingXLines>Before deleting {0:#,##0} lines</BeforeDeletingXLines>
|
||||
<DeleteXLinesPrompt>Delete {0:#,##0} lines?</DeleteXLinesPrompt>
|
||||
<OneLineDeleted>Line deleted</OneLineDeleted>
|
||||
<BeforeDeletingOneLine>Before deleting one line</BeforeDeletingOneLine>
|
||||
<DeleteOneLinePrompt>Delete one line?</DeleteOneLinePrompt>
|
||||
@ -1600,7 +1600,7 @@ If you have edited this file with Subtitle Edit you might be able to find a back
|
||||
<AddToCurrentSelection>Add to current selection</AddToCurrentSelection>
|
||||
<SubtractFromCurrentSelection>Subtract from current selection</SubtractFromCurrentSelection>
|
||||
<IntersectWithCurrentSelection>Intersect with current selection</IntersectWithCurrentSelection>
|
||||
<MatchingLinesX>Matching lines: {0}</MatchingLinesX>
|
||||
<MatchingLinesX>Matching lines: {0:#,##0}</MatchingLinesX>
|
||||
<Contains>Contains</Contains>
|
||||
<StartsWith>Starts with</StartsWith>
|
||||
<EndsWith>Ends with</EndsWith>
|
||||
|
@ -1286,8 +1286,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
LineXOfY = "line {0} of {1}",
|
||||
XLinesSavedAsY = "{0} lines saved as {1}",
|
||||
XLinesDeleted = "{0} lines deleted",
|
||||
BeforeDeletingXLines = "Before deleting {0} lines",
|
||||
DeleteXLinesPrompt = "Delete {0} lines?",
|
||||
BeforeDeletingXLines = "Before deleting {0:#,##0} lines",
|
||||
DeleteXLinesPrompt = "Delete {0:#,##0} lines?",
|
||||
OneLineDeleted = "Line deleted",
|
||||
BeforeDeletingOneLine = "Before deleting one line",
|
||||
DeleteOneLinePrompt = "Delete one line?",
|
||||
@ -1864,7 +1864,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
AddToCurrentSelection = "Add to current selection",
|
||||
SubtractFromCurrentSelection = "Subtract from current selection",
|
||||
IntersectWithCurrentSelection = "Intersect with current selection",
|
||||
MatchingLinesX = "Matching lines: {0}",
|
||||
MatchingLinesX = "Matching lines: {0:#,##0}",
|
||||
Contains = "Contains",
|
||||
StartsWith = "Starts with",
|
||||
EndsWith = "Ends with",
|
||||
|
@ -202,7 +202,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ApplySelection();
|
||||
}
|
||||
|
||||
private void AddToListView(Paragraph p, int index)
|
||||
private ListViewItem MakeListViewItem(Paragraph p, int index)
|
||||
{
|
||||
var item = new ListViewItem(string.Empty) { Tag = index, Checked = true };
|
||||
item.SubItems.Add(p.Number.ToString());
|
||||
@ -211,7 +211,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
item.SubItems.Add(string.IsNullOrEmpty(p.Style) ? p.Extra : p.Style);
|
||||
}
|
||||
listViewFixes.Items.Add(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private void Preview()
|
||||
@ -222,6 +223,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
Regex regEx = null;
|
||||
var listViewItems = new List<ListViewItem>();
|
||||
listViewFixes.BeginUpdate();
|
||||
listViewFixes.Items.Clear();
|
||||
string text = textBoxText.Text;
|
||||
@ -258,35 +260,35 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if ((radioButtonSubtractFromSelection.Checked || radioButtonIntersect.Checked) && _subtitleListView.Items[i].Selected ||
|
||||
!radioButtonSubtractFromSelection.Checked && !radioButtonIntersect.Checked)
|
||||
{
|
||||
Paragraph p = _subtitle.Paragraphs[i];
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (text.Length > 0)
|
||||
{
|
||||
if (comboBoxRule.SelectedIndex == FunctionContains) // Contains
|
||||
{
|
||||
if (checkBoxCaseSensitive.Checked && p.Text.Contains(text, StringComparison.Ordinal) || !checkBoxCaseSensitive.Checked && p.Text.Contains(text, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionStartsWith) // Starts with
|
||||
{
|
||||
if (checkBoxCaseSensitive.Checked && p.Text.StartsWith(text, StringComparison.Ordinal) || !checkBoxCaseSensitive.Checked && p.Text.StartsWith(text, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionEndsWith) // Ends with
|
||||
{
|
||||
if (checkBoxCaseSensitive.Checked && p.Text.EndsWith(text, StringComparison.Ordinal) || !checkBoxCaseSensitive.Checked && p.Text.EndsWith(text, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionNotContains) // Not contains
|
||||
{
|
||||
if (checkBoxCaseSensitive.Checked && !p.Text.Contains(text, StringComparison.Ordinal) || !checkBoxCaseSensitive.Checked && !p.Text.Contains(text, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionRegEx) // RegEx
|
||||
@ -306,7 +308,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
if (regEx.IsMatch(p.Text))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -314,54 +316,55 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionEqual) // select equal lines
|
||||
{
|
||||
if (i % 2 == 1)
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionDurationLessThan) // duration less than
|
||||
{
|
||||
if (p.Duration.TotalMilliseconds < (double)numericUpDownDuration.Value)
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionDurationGreaterThan) // duration greater than
|
||||
{
|
||||
if (p.Duration.TotalMilliseconds > (double)numericUpDownDuration.Value)
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionAlUppercase) // all uppercase
|
||||
{
|
||||
if (p.Text == p.Text.ToUpperInvariant() && p.Text != p.Text.ToLowerInvariant())
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionStyle) // select styles
|
||||
{
|
||||
if (styles.Contains(string.IsNullOrEmpty(p.Style) ? p.Extra : p.Style))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionActor) // select actors
|
||||
{
|
||||
if (actors.Contains(p.Actor))
|
||||
{
|
||||
AddToListView(p, i);
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listViewFixes.Items.AddRange(listViewItems.ToArray());
|
||||
listViewFixes.EndUpdate();
|
||||
groupBoxPreview.Text = string.Format(Configuration.Settings.Language.ModifySelection.MatchingLinesX, listViewFixes.Items.Count);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user