mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
parent
c4c18b8d63
commit
90381af1d3
@ -6775,6 +6775,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Focus();
|
||||
}
|
||||
|
||||
public bool GetAllowReplaceInOriginal()
|
||||
{
|
||||
return Configuration.Settings.General.AllowEditOfOriginalSubtitle
|
||||
&& _subtitleOriginal != null
|
||||
&& _subtitleOriginal.Paragraphs.Count > 0;
|
||||
}
|
||||
|
||||
public void ListViewReplaceAll(ReplaceDialog replaceDialog, FindReplaceDialogHelper findHelper)
|
||||
{
|
||||
if (_findHelper == null)
|
||||
|
@ -9896,5 +9896,10 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool GetAllowReplaceInOriginal()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
src/ui/Forms/ReplaceDialog.Designer.cs
generated
1
src/ui/Forms/ReplaceDialog.Designer.cs
generated
@ -205,6 +205,7 @@
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Replace";
|
||||
this.Activated += new System.EventHandler(this.ReplaceDialog_Activated);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ReplaceDialog_FormClosing);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormReplaceDialog_KeyDown);
|
||||
this.ResumeLayout(false);
|
||||
|
@ -70,11 +70,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
result.FindType = FindType.RegEx;
|
||||
}
|
||||
|
||||
result.SearchOriginal = !comboBoxFindReplaceIn.Visible ||
|
||||
result.SearchOriginal = !comboBoxFindReplaceIn.Enabled ||
|
||||
comboBoxFindReplaceIn.SelectedIndex == 0 ||
|
||||
comboBoxFindReplaceIn.SelectedIndex == 2;
|
||||
|
||||
result.SearchTranslation = !comboBoxFindReplaceIn.Visible ||
|
||||
result.SearchTranslation = !comboBoxFindReplaceIn.Enabled ||
|
||||
comboBoxFindReplaceIn.SelectedIndex == 0 ||
|
||||
comboBoxFindReplaceIn.SelectedIndex == 1;
|
||||
|
||||
@ -139,8 +139,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
checkBoxWholeWord.Checked = findHelper.FindReplaceType.WholeWord;
|
||||
}
|
||||
|
||||
labelFindReplaceIn.Visible = replaceInOriginal;
|
||||
comboBoxFindReplaceIn.Visible = replaceInOriginal;
|
||||
labelFindReplaceIn.Enabled = replaceInOriginal;
|
||||
comboBoxFindReplaceIn.Enabled = replaceInOriginal;
|
||||
}
|
||||
|
||||
private void ButtonReplaceClick(object sender, EventArgs e)
|
||||
@ -285,5 +285,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_findNext = false;
|
||||
}
|
||||
|
||||
private void ReplaceDialog_Activated(object sender, EventArgs e)
|
||||
{
|
||||
var allowReplaceInOriginal = _findAndReplaceMethods.GetAllowReplaceInOriginal();
|
||||
labelFindReplaceIn.Enabled = allowReplaceInOriginal;
|
||||
comboBoxFindReplaceIn.Enabled = allowReplaceInOriginal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
void ReplaceDialogReplace(FindReplaceDialogHelper findReplaceDialogHelper);
|
||||
void ReplaceDialogReplaceAll(FindReplaceDialogHelper findReplaceDialogHelper);
|
||||
void ReplaceDialogClose();
|
||||
bool GetAllowReplaceInOriginal();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user