mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-01-31 21:11:39 +01:00
Add "Bookmark contains..." option to "Modify selection" - thx BlohoJo :)
Fix #9229
This commit is contained in:
parent
9136e21150
commit
cff1053f30
@ -2144,6 +2144,7 @@ Download and continue?</VideoFromUrlRequirements>
|
||||
<ExactlyTwoLines>Exactly two lines</ExactlyTwoLines>
|
||||
<MoreThanTwoLines>More than two lines</MoreThanTwoLines>
|
||||
<Bookmarked>Bookmarked</Bookmarked>
|
||||
<BookmarkContains>Bookmark contains</BookmarkContains>
|
||||
<BlankLines>Blank lines</BlankLines>
|
||||
</ModifySelection>
|
||||
<MultipleReplace>
|
||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Controls.Adapters;
|
||||
using System.CodeDom;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
@ -36,9 +37,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private const int FunctionExactlyTwoLines = 15;
|
||||
private const int FunctionMoreThanTwoLines = 16;
|
||||
private const int FunctionBookmarked = 17;
|
||||
private const int FunctionBlankLines = 18;
|
||||
private const int FunctionStyle = 19;
|
||||
private const int FunctionActor = 20;
|
||||
private const int FunctionBookmarkContains = 18;
|
||||
private const int FunctionBlankLines = 19;
|
||||
private const int FunctionStyle = 20;
|
||||
private const int FunctionActor = 21;
|
||||
|
||||
private const string ContainsString = "Contains";
|
||||
private const string StartsWith = "Starts with";
|
||||
@ -58,6 +60,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private const string ExactlyTwoLines = "Exactly two lines";
|
||||
private const string MoreThanTwoLines = "More than two lines";
|
||||
private const string Bookmarked = "Bookmarked";
|
||||
private const string BookmarkContains = "Bookmark contains";
|
||||
private const string BlankLines = "Blank lines";
|
||||
private const string Style = "Style";
|
||||
private const string Actor = "Actor";
|
||||
@ -113,6 +116,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
comboBoxRule.Items.Add(LanguageSettings.Current.ModifySelection.ExactlyTwoLines);
|
||||
comboBoxRule.Items.Add(LanguageSettings.Current.ModifySelection.MoreThanTwoLines);
|
||||
comboBoxRule.Items.Add(LanguageSettings.Current.ModifySelection.Bookmarked);
|
||||
comboBoxRule.Items.Add(LanguageSettings.Current.ModifySelection.BookmarkContains);
|
||||
comboBoxRule.Items.Add(LanguageSettings.Current.ModifySelection.BlankLines);
|
||||
if (_format.HasStyleSupport)
|
||||
{
|
||||
@ -178,6 +182,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
case Bookmarked:
|
||||
comboBoxRule.SelectedIndex = FunctionBookmarked;
|
||||
break;
|
||||
case BookmarkContains:
|
||||
comboBoxRule.SelectedIndex = FunctionBookmarkContains;
|
||||
break;
|
||||
case BlankLines:
|
||||
comboBoxRule.SelectedIndex = FunctionBlankLines;
|
||||
break;
|
||||
@ -274,6 +281,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
case FunctionBookmarked:
|
||||
Configuration.Settings.Tools.ModifySelectionRule = Bookmarked;
|
||||
break;
|
||||
case FunctionBookmarkContains:
|
||||
Configuration.Settings.Tools.ModifySelectionRule = BookmarkContains;
|
||||
break;
|
||||
case FunctionBlankLines:
|
||||
Configuration.Settings.Tools.ModifySelectionRule = BlankLines;
|
||||
break;
|
||||
@ -496,6 +506,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionBookmarkContains) // Bookmark contains
|
||||
{
|
||||
if (p.Bookmark != null && !string.IsNullOrEmpty(text))
|
||||
{
|
||||
var comparison = checkBoxCaseSensitive.Checked ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
if (p.Bookmark.Contains(text, comparison))
|
||||
{
|
||||
listViewItems.Add(MakeListViewItem(p, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (comboBoxRule.SelectedIndex == FunctionBlankLines) // Select blank lines
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(HtmlUtil.RemoveHtmlTags(p.Text, true)))
|
||||
|
@ -2477,6 +2477,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
ExactlyTwoLines = "Exactly two lines",
|
||||
MoreThanTwoLines = "More than two lines",
|
||||
Bookmarked = "Bookmarked",
|
||||
BookmarkContains = "Bookmark contains",
|
||||
BlankLines = "Blank lines",
|
||||
};
|
||||
|
||||
|
@ -5824,6 +5824,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "ModifySelection/Bookmarked":
|
||||
language.ModifySelection.Bookmarked = reader.Value;
|
||||
break;
|
||||
case "ModifySelection/BookmarkContains":
|
||||
language.ModifySelection.BookmarkContains = reader.Value;
|
||||
break;
|
||||
case "ModifySelection/BlankLines":
|
||||
language.ModifySelection.BlankLines = reader.Value;
|
||||
break;
|
||||
|
@ -2289,6 +2289,7 @@
|
||||
public string ExactlyTwoLines { get; set; }
|
||||
public string MoreThanTwoLines { get; set; }
|
||||
public string Bookmarked { get; set; }
|
||||
public string BookmarkContains { get; set; }
|
||||
public string BlankLines { get; set; }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user