More find/replace

This commit is contained in:
niksedk 2023-04-07 08:55:23 +02:00
parent f14ba0ae25
commit 0e4eaedc27
6 changed files with 19 additions and 7 deletions

View File

@ -725,7 +725,8 @@ Read more info (web)?</WhisperNotFound>
</ExtractDateTimeInfo> </ExtractDateTimeInfo>
<FindDialog> <FindDialog>
<Title>Find</Title> <Title>Find</Title>
<Find>&amp;Find</Find> <FindNext>&amp;Find next</FindNext>
<FindPrevious>Find &amp;previous</FindPrevious>
<Normal>&amp;Normal</Normal> <Normal>&amp;Normal</Normal>
<CaseSensitive>&amp;Case sensitive</CaseSensitive> <CaseSensitive>&amp;Case sensitive</CaseSensitive>
<RegularExpression>Regular e&amp;xpression</RegularExpression> <RegularExpression>Regular e&amp;xpression</RegularExpression>

View File

@ -271,12 +271,12 @@ namespace Nikse.SubtitleEdit.Forms
else if (radioButtonNormal.Checked) else if (radioButtonNormal.Checked)
{ {
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
_findAndReplaceMethods.FindDialogFindPrevious(); _findAndReplaceMethods.FindDialogFindPrevious(FindText);
} }
else if (radioButtonCaseSensitive.Checked) else if (radioButtonCaseSensitive.Checked)
{ {
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
_findAndReplaceMethods.FindDialogFindPrevious(); _findAndReplaceMethods.FindDialogFindPrevious(FindText);
} }
else if (radioButtonRegEx.Checked) else if (radioButtonRegEx.Checked)
{ {
@ -284,7 +284,7 @@ namespace Nikse.SubtitleEdit.Forms
{ {
_regEx = new Regex(RegexUtils.FixNewLine(searchText), RegexOptions.Compiled, TimeSpan.FromSeconds(5)); _regEx = new Regex(RegexUtils.FixNewLine(searchText), RegexOptions.Compiled, TimeSpan.FromSeconds(5));
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
_findAndReplaceMethods.FindDialogFindPrevious(); _findAndReplaceMethods.FindDialogFindPrevious(FindText);
} }
catch (Exception exception) catch (Exception exception)
{ {

View File

@ -6245,8 +6245,11 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
public void FindDialogFindPrevious() public void FindDialogFindPrevious(string findText)
{ {
_findHelper = _findHelper ?? _findDialog.GetFindDialogHelper(_subtitleListViewIndex);
_findHelper.FindText = findText;
_findHelper.FindTextLength = findText.Length;
FindPrevious(); FindPrevious();
} }

View File

@ -9827,13 +9827,15 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
} }
} }
public void FindDialogFindPrevious() public void FindDialogFindPrevious(string findText)
{ {
if (_findHelper == null) if (_findHelper == null)
{ {
return; return;
} }
_findHelper.FindText = findText;
_findHelper.FindTextLength = findText.Length;
_findHelper.InProgress = true; _findHelper.InProgress = true;
var tb = textBoxCurrentText; var tb = textBoxCurrentText;

View File

@ -3,7 +3,7 @@
public interface IFindAndReplace public interface IFindAndReplace
{ {
void FindDialogFind(string findText); void FindDialogFind(string findText);
void FindDialogFindPrevious(); void FindDialogFindPrevious(string findText);
void FindDialogClose(); void FindDialogClose();
void ReplaceDialogFind(); void ReplaceDialogFind();

View File

@ -1894,6 +1894,12 @@ namespace Nikse.SubtitleEdit.Logic
case "FindDialog/Title": case "FindDialog/Title":
language.FindDialog.Title = reader.Value; language.FindDialog.Title = reader.Value;
break; break;
case "FindDialog/FindNext":
language.FindDialog.FindNext = reader.Value;
break;
case "FindDialog/FindPrevious":
language.FindDialog.FindPrevious = reader.Value;
break;
case "FindDialog/Normal": case "FindDialog/Normal":
language.FindDialog.Normal = reader.Value; language.FindDialog.Normal = reader.Value;
break; break;