Merge branch 'SubtitleEdit:main' into main

This commit is contained in:
Mihai Pavelescu 2024-06-04 22:58:42 +03:00 committed by GitHub
commit 94b1b4e158
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 486 additions and 27 deletions

View File

@ -876,6 +876,7 @@
<Word from="koaj" to="koja" /> <Word from="koaj" to="koja" />
<Word from="kofu" to="kavu" /> <Word from="kofu" to="kavu" />
<Word from="kogao" to="mogao" /> <Word from="kogao" to="mogao" />
<Word from="kojiam" to="kojima" />
<Word from="kola" to="auto" /> <Word from="kola" to="auto" />
<Word from="kolima" to="autu" /> <Word from="kolima" to="autu" />
<Word from="komandni" to="zapovjedni" /> <Word from="komandni" to="zapovjedni" />
@ -2710,6 +2711,7 @@
<Word from="uopšte" to="uopće" /> <Word from="uopšte" to="uopće" />
<Word from="uopše" to="uopće" /> <Word from="uopše" to="uopće" />
<Word from="uopče" to="uopće" /> <Word from="uopče" to="uopće" />
<Word from="uopcr" to="uopće" />
<Word from="upakujem" to="upakiram" /> <Word from="upakujem" to="upakiram" />
<Word from="upakovano" to="upakirano" /> <Word from="upakovano" to="upakirano" />
<Word from="upustva" to="uputstva" /> <Word from="upustva" to="uputstva" />
@ -3035,6 +3037,7 @@
<Word from="zevati" to="zijevati" /> <Word from="zevati" to="zijevati" />
<Word from="zevali" to="zijevali" /> <Word from="zevali" to="zijevali" />
<Word from="zobg" to="zbog" /> <Word from="zobg" to="zbog" />
<Word from="zgob" to="zbog" />
<Word from="zdelu" to="zdjelu" /> <Word from="zdelu" to="zdjelu" />
<Word from="zdrvo" to="zdravo" /> <Word from="zdrvo" to="zdravo" />
<Word from="Zdrvo" to="Zdravo" /> <Word from="Zdrvo" to="Zdravo" />
@ -5380,6 +5383,7 @@
<RegEx find="mrn" replaceWith="men" /> <RegEx find="mrn" replaceWith="men" />
<RegEx find="mro([as])" replaceWith="mor$1" /> <RegEx find="mro([as])" replaceWith="mor$1" />
<RegEx find="msč" replaceWith="mač" /> <RegEx find="msč" replaceWith="mač" />
<RegEx find="msd" replaceWith="mad" />
<RegEx find="([Mm])sl" replaceWith="$1isl" /> <RegEx find="([Mm])sl" replaceWith="$1isl" />
<RegEx find="mtić" replaceWith="mtit ć" /> <RegEx find="mtić" replaceWith="mtit ć" />
<RegEx find="mzn" replaceWith="mun" /> <RegEx find="mzn" replaceWith="mun" />
@ -5517,6 +5521,7 @@
<RegEx find="rčaće" replaceWith="rčat će" /> <RegEx find="rčaće" replaceWith="rčat će" />
<RegEx find="renaduvan" replaceWith="renapuhan" /> <RegEx find="renaduvan" replaceWith="renapuhan" />
<RegEx find="resed" replaceWith="resjed" /> <RegEx find="resed" replaceWith="resjed" />
<RegEx find="rgk" replaceWith="rgl" />
<RegEx find="rgv" replaceWith="rgov" /> <RegEx find="rgv" replaceWith="rgov" />
<RegEx find="rijedel" replaceWith="rijedil" /> <RegEx find="rijedel" replaceWith="rijedil" />
<RegEx find="r([mv])isa" replaceWith="r$1ira" /> <RegEx find="r([mv])isa" replaceWith="r$1ira" />
@ -5552,7 +5557,7 @@
<RegEx find="(?&lt;!star)aćemo" replaceWith="at ćemo" /> <RegEx find="(?&lt;!star)aćemo" replaceWith="at ćemo" />
<RegEx find="\bstaral" replaceWith="brinul" /> <RegEx find="\bstaral" replaceWith="brinul" />
<RegEx find="\bStaral" replaceWith="Brinul" /> <RegEx find="\bStaral" replaceWith="Brinul" />
<RegEx find="stba" replaceWith="stva" /> <RegEx find="tba" replaceWith="tva" />
<RegEx find="stkl" replaceWith="stakl" /> <RegEx find="stkl" replaceWith="stakl" />
<RegEx find="struis" replaceWith="struir" /> <RegEx find="struis" replaceWith="struir" />
<RegEx find="struiše" replaceWith="struira" /> <RegEx find="struiše" replaceWith="struira" />
@ -5720,6 +5725,7 @@
<RegEx find="zvešć" replaceWith="zvest ć" /> <RegEx find="zvešć" replaceWith="zvest ć" />
<RegEx find="zvolić" replaceWith="zvolit ć" /> <RegEx find="zvolić" replaceWith="zvolit ć" />
<RegEx find="zwm" replaceWith="zem" /> <RegEx find="zwm" replaceWith="zem" />
<RegEx find="žw" replaceWith="ze" />
<RegEx find="žbać" replaceWith="žbat ć" /> <RegEx find="žbać" replaceWith="žbat ć" />
<RegEx find="žalj?ev" replaceWith="žalijev" /> <RegEx find="žalj?ev" replaceWith="žalijev" />
<RegEx find="([žzt])ivać" replaceWith="$1ivat ć" /> <RegEx find="([žzt])ivać" replaceWith="$1ivat ć" />

View File

@ -474,6 +474,11 @@ namespace Nikse.SubtitleEdit.Forms
internal MakeBitmapParameter MakeMakeBitmapParameter(int index, int screenWidth, int screenHeight) internal MakeBitmapParameter MakeMakeBitmapParameter(int index, int screenWidth, int screenHeight)
{ {
var p = _subtitle.GetParagraphOrDefault(index); var p = _subtitle.GetParagraphOrDefault(index);
if (p == null)
{
p = new Paragraph();
}
var parameter = new MakeBitmapParameter var parameter = new MakeBitmapParameter
{ {
Type = _exportType, Type = _exportType,
@ -510,6 +515,7 @@ namespace Nikse.SubtitleEdit.Forms
FullFrame = checkBoxFullFrameImage.Checked, FullFrame = checkBoxFullFrameImage.Checked,
FullFrameBackgroundColor = panelFullFrameBackground.BackColor, FullFrameBackgroundColor = panelFullFrameBackground.BackColor,
}; };
if (index < _subtitle.Paragraphs.Count) if (index < _subtitle.Paragraphs.Count)
{ {
parameter.P = _subtitle.Paragraphs[index]; parameter.P = _subtitle.Paragraphs[index];
@ -571,6 +577,7 @@ namespace Nikse.SubtitleEdit.Forms
{ {
parameter.P = null; parameter.P = null;
} }
return parameter; return parameter;
} }

View File

@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.textBoxFind = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.textBoxFind = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.buttonFind = new System.Windows.Forms.Button(); this.buttonFind = new System.Windows.Forms.Button();
this.radioButtonNormal = new System.Windows.Forms.RadioButton(); this.radioButtonNormal = new System.Windows.Forms.RadioButton();
@ -39,6 +40,12 @@
this.checkBoxWholeWord = new System.Windows.Forms.CheckBox(); this.checkBoxWholeWord = new System.Windows.Forms.CheckBox();
this.buttonFindPrev = new System.Windows.Forms.Button(); this.buttonFindPrev = new System.Windows.Forms.Button();
this.labelFindWhat = new System.Windows.Forms.Label(); this.labelFindWhat = new System.Windows.Forms.Label();
this.contextMenuStripNormal = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripNormal.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBoxFind // textBoxFind
@ -171,6 +178,48 @@
this.labelFindWhat.TabIndex = 12; this.labelFindWhat.TabIndex = 12;
this.labelFindWhat.Text = "Find what:"; this.labelFindWhat.Text = "Find what:";
// //
// contextMenuStripNormal
//
this.contextMenuStripNormal.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.deleteToolStripMenuItem});
this.contextMenuStripNormal.Name = "contextMenuStripNormal";
this.contextMenuStripNormal.Size = new System.Drawing.Size(145, 92);
this.contextMenuStripNormal.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripNormal_Opening);
//
// cutToolStripMenuItem
//
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.cutToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.cutToolStripMenuItem.Text = "Cut";
this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// pasteToolStripMenuItem
//
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.pasteToolStripMenuItem.Text = "Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.deleteToolStripMenuItem.Text = "Delete";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
//
// FindDialog // FindDialog
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -199,6 +248,7 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindDialog_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindDialog_FormClosing);
this.Shown += new System.EventHandler(this.FindDialog_Shown); this.Shown += new System.EventHandler(this.FindDialog_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormFindDialog_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormFindDialog_KeyDown);
this.contextMenuStripNormal.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -217,5 +267,10 @@
private System.Windows.Forms.CheckBox checkBoxWholeWord; private System.Windows.Forms.CheckBox checkBoxWholeWord;
private System.Windows.Forms.Button buttonFindPrev; private System.Windows.Forms.Button buttonFindPrev;
private System.Windows.Forms.Label labelFindWhat; private System.Windows.Forms.Label labelFindWhat;
private System.Windows.Forms.ContextMenuStrip contextMenuStripNormal;
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
} }
} }

View File

@ -32,6 +32,11 @@ namespace Nikse.SubtitleEdit.Forms
radioButtonRegEx.Text = LanguageSettings.Current.FindDialog.RegularExpression; radioButtonRegEx.Text = LanguageSettings.Current.FindDialog.RegularExpression;
checkBoxWholeWord.Text = LanguageSettings.Current.FindDialog.WholeWord; checkBoxWholeWord.Text = LanguageSettings.Current.FindDialog.WholeWord;
buttonCount.Text = LanguageSettings.Current.FindDialog.Count; buttonCount.Text = LanguageSettings.Current.FindDialog.Count;
cutToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Cut;
copyToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Copy;
pasteToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Paste;
deleteToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Delete;
labelCount.Text = string.Empty; labelCount.Text = string.Empty;
_subtitle = subtitle; _subtitle = subtitle;
_findAndReplaceMethods = findAndReplaceMethods; _findAndReplaceMethods = findAndReplaceMethods;
@ -213,22 +218,7 @@ namespace Nikse.SubtitleEdit.Forms
private void RadioButton_CheckedChanged(object sender, EventArgs e) private void RadioButton_CheckedChanged(object sender, EventArgs e)
{ {
// remove any existing context menu SetContextMenuStrip();
textBoxFind.ContextMenuStrip = null;
comboBoxFind.ContextMenuStrip = null;
// only hook context menu if regex radio button is checked
if (sender == radioButtonRegEx && radioButtonRegEx.Checked)
{
if (textBoxFind.Visible)
{
textBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
}
else if (radioButtonRegEx.Checked)
{
comboBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(comboBoxFind);
}
}
checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked; checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked;
labelCount.Text = string.Empty; labelCount.Text = string.Empty;
@ -337,6 +327,32 @@ namespace Nikse.SubtitleEdit.Forms
buttonFindPrev.Focus(); buttonFindPrev.Focus();
} }
private void SetContextMenuStrip()
{
comboBoxFind.ContextMenuStrip = null;
textBoxFind.ContextMenuStrip = null;
if (radioButtonRegEx.Checked)
{
if (textBoxFind.Visible)
{
textBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
}
else if (radioButtonRegEx.Checked)
{
comboBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(comboBoxFind);
}
}
else if (comboBoxFind.Visible)
{
comboBoxFind.ContextMenuStrip = contextMenuStripNormal;
}
else
{
textBoxFind.ContextMenuStrip = contextMenuStripNormal;
}
}
private void FindDialog_Shown(object sender, EventArgs e) private void FindDialog_Shown(object sender, EventArgs e)
{ {
if (comboBoxFind.Visible) if (comboBoxFind.Visible)
@ -347,6 +363,103 @@ namespace Nikse.SubtitleEdit.Forms
{ {
textBoxFind.Focus(); textBoxFind.Focus();
} }
SetContextMenuStrip();
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.Cut();
}
else if (comboBoxFind.Visible)
{
if (comboBoxFind.SelectedText.Length > 0)
{
Clipboard.SetText(comboBoxFind.SelectedText);
comboBoxFind.SelectedText = string.Empty;
}
}
}
catch
{
// ignore
}
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.Copy();
}
else if (comboBoxFind.Visible)
{
if (comboBoxFind.SelectedText.Length > 0)
{
Clipboard.SetText(comboBoxFind.SelectedText);
}
}
}
catch
{
// ignore
}
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
var text = Clipboard.GetText();
if (string.IsNullOrEmpty(text))
{
return;
}
if (textBoxFind.Visible)
{
textBoxFind.Paste(text);
}
else if (comboBoxFind.Visible)
{
comboBoxFind.SelectedText = text;
}
}
catch
{
// ignore
}
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.SelectedText = string.Empty;
}
else if (comboBoxFind.Visible)
{
comboBoxFind.SelectedText = string.Empty;
}
}
catch
{
// ignore
}
}
private void contextMenuStripNormal_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
pasteToolStripMenuItem.Enabled = Clipboard.ContainsText();
} }
} }
} }

View File

@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenuStripNormal.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.radioButtonRegEx = new System.Windows.Forms.RadioButton(); this.radioButtonRegEx = new System.Windows.Forms.RadioButton();
this.radioButtonCaseSensitive = new System.Windows.Forms.RadioButton(); this.radioButtonCaseSensitive = new System.Windows.Forms.RadioButton();
this.radioButtonNormal = new System.Windows.Forms.RadioButton(); this.radioButtonNormal = new System.Windows.Forms.RadioButton();
@ -42,6 +43,18 @@
this.comboBoxFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.comboBoxFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.labelFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.comboBoxFind = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.comboBoxFind = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.contextMenuStripNormal = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripReplace = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItemCutReplace = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemCopyReplace = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemPasteReplace = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemDeleteReplace = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripNormal.SuspendLayout();
this.contextMenuStripReplace.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// radioButtonRegEx // radioButtonRegEx
@ -116,6 +129,7 @@
// //
// textBoxReplace // textBoxReplace
// //
this.textBoxReplace.ContextMenuStrip = this.contextMenuStripReplace;
this.textBoxReplace.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); this.textBoxReplace.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.textBoxReplace.Location = new System.Drawing.Point(15, 71); this.textBoxReplace.Location = new System.Drawing.Point(15, 71);
this.textBoxReplace.Name = "textBoxReplace"; this.textBoxReplace.Name = "textBoxReplace";
@ -220,6 +234,90 @@
this.comboBoxFind.UsePopupWindow = false; this.comboBoxFind.UsePopupWindow = false;
this.comboBoxFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxFind_KeyDown); this.comboBoxFind.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxFind_KeyDown);
// //
// contextMenuStripNormal
//
this.contextMenuStripNormal.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.deleteToolStripMenuItem});
this.contextMenuStripNormal.Name = "contextMenuStripNormal";
this.contextMenuStripNormal.Size = new System.Drawing.Size(181, 114);
this.contextMenuStripNormal.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripNormal_Opening);
//
// cutToolStripMenuItem
//
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.cutToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.cutToolStripMenuItem.Text = "Cut";
this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.copyToolStripMenuItem.Text = "Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// pasteToolStripMenuItem
//
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.pasteToolStripMenuItem.Text = "Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click);
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.deleteToolStripMenuItem.Text = "Delete";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
//
// contextMenuStripReplace
//
this.contextMenuStripReplace.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemCutReplace,
this.toolStripMenuItemCopyReplace,
this.toolStripMenuItemPasteReplace,
this.toolStripMenuItemDeleteReplace});
this.contextMenuStripReplace.Name = "contextMenuStripNormal";
this.contextMenuStripReplace.Size = new System.Drawing.Size(145, 92);
this.contextMenuStripReplace.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripReplace_Opening);
//
// toolStripMenuItemCutReplace
//
this.toolStripMenuItemCutReplace.Name = "toolStripMenuItemCutReplace";
this.toolStripMenuItemCutReplace.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.toolStripMenuItemCutReplace.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemCutReplace.Text = "Cut";
this.toolStripMenuItemCutReplace.Click += new System.EventHandler(this.toolStripMenuItemCutReplace_Click);
//
// toolStripMenuItemCopyReplace
//
this.toolStripMenuItemCopyReplace.Name = "toolStripMenuItemCopyReplace";
this.toolStripMenuItemCopyReplace.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.toolStripMenuItemCopyReplace.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemCopyReplace.Text = "Copy";
this.toolStripMenuItemCopyReplace.Click += new System.EventHandler(this.toolStripMenuItemCopyReplace_Click);
//
// toolStripMenuItemPasteReplace
//
this.toolStripMenuItemPasteReplace.Name = "toolStripMenuItemPasteReplace";
this.toolStripMenuItemPasteReplace.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.toolStripMenuItemPasteReplace.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemPasteReplace.Text = "Paste";
this.toolStripMenuItemPasteReplace.Click += new System.EventHandler(this.toolStripMenuItemPasteReplace_Click);
//
// toolStripMenuItemDeleteReplace
//
this.toolStripMenuItemDeleteReplace.Name = "toolStripMenuItemDeleteReplace";
this.toolStripMenuItemDeleteReplace.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemDeleteReplace.Text = "Delete";
this.toolStripMenuItemDeleteReplace.Click += new System.EventHandler(this.toolStripMenuItemDeleteReplace_Click);
//
// ReplaceDialog // ReplaceDialog
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -252,6 +350,8 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ReplaceDialog_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ReplaceDialog_FormClosing);
this.Shown += new System.EventHandler(this.ReplaceDialog_Shown); this.Shown += new System.EventHandler(this.ReplaceDialog_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormReplaceDialog_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormReplaceDialog_KeyDown);
this.contextMenuStripNormal.ResumeLayout(false);
this.contextMenuStripReplace.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -273,5 +373,15 @@
private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFindReplaceIn; private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFindReplaceIn;
private Nikse.SubtitleEdit.Controls.NikseLabel labelFindReplaceIn; private Nikse.SubtitleEdit.Controls.NikseLabel labelFindReplaceIn;
private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFind; private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFind;
private System.Windows.Forms.ContextMenuStrip contextMenuStripNormal;
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStripReplace;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCutReplace;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCopyReplace;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemPasteReplace;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemDeleteReplace;
} }
} }

View File

@ -37,6 +37,10 @@ namespace Nikse.SubtitleEdit.Forms
buttonReplace.Text = LanguageSettings.Current.ReplaceDialog.Replace; buttonReplace.Text = LanguageSettings.Current.ReplaceDialog.Replace;
buttonReplaceAll.Text = LanguageSettings.Current.ReplaceDialog.ReplaceAll; buttonReplaceAll.Text = LanguageSettings.Current.ReplaceDialog.ReplaceAll;
labelFindReplaceIn.Text = LanguageSettings.Current.ReplaceDialog.FindReplaceIn; labelFindReplaceIn.Text = LanguageSettings.Current.ReplaceDialog.FindReplaceIn;
cutToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Cut;
copyToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Copy;
pasteToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Paste;
deleteToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.Delete;
if (Width < radioButtonRegEx.Right + 5) if (Width < radioButtonRegEx.Right + 5)
{ {
@ -134,6 +138,7 @@ namespace Nikse.SubtitleEdit.Forms
var s = Configuration.Settings.Tools.FindHistory[index]; var s = Configuration.Settings.Tools.FindHistory[index];
comboBoxFind.Items.Add(s); comboBoxFind.Items.Add(s);
} }
comboBoxFind.Text = selectedText; comboBoxFind.Text = selectedText;
comboBoxFind.SelectAll(); comboBoxFind.SelectAll();
} }
@ -155,6 +160,7 @@ namespace Nikse.SubtitleEdit.Forms
{ {
textBoxReplace.Text = findHelper.ReplaceText.Replace(Environment.NewLine, "\\n"); textBoxReplace.Text = findHelper.ReplaceText.Replace(Environment.NewLine, "\\n");
} }
textBoxFind.SelectAll(); textBoxFind.SelectAll();
if (findHelper.FindReplaceType.FindType == FindType.RegEx) if (findHelper.FindReplaceType.FindType == FindType.RegEx)
{ {
@ -310,11 +316,8 @@ namespace Nikse.SubtitleEdit.Forms
private void RadioButtonCheckedChanged(object sender, EventArgs e) private void RadioButtonCheckedChanged(object sender, EventArgs e)
{ {
textBoxFind.ContextMenuStrip = sender == radioButtonRegEx
? FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind)
: null;
checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked; checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked;
SetContextMenuStrip();
} }
private void TextBoxFindKeyDown(object sender, KeyEventArgs e) private void TextBoxFindKeyDown(object sender, KeyEventArgs e)
@ -410,6 +413,154 @@ namespace Nikse.SubtitleEdit.Forms
BringToFront(); BringToFront();
Activate(); Activate();
}); });
SetContextMenuStrip();
}
private void SetContextMenuStrip()
{
comboBoxFind.ContextMenuStrip = null;
textBoxFind.ContextMenuStrip = null;
if (radioButtonRegEx.Checked)
{
if (textBoxFind.Visible)
{
textBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind);
}
else if (radioButtonRegEx.Checked)
{
comboBoxFind.ContextMenuStrip = FindReplaceDialogHelper.GetRegExContextMenu(comboBoxFind);
}
}
else if (comboBoxFind.Visible)
{
comboBoxFind.ContextMenuStrip = contextMenuStripNormal;
}
else
{
textBoxFind.ContextMenuStrip = contextMenuStripNormal;
}
}
private void cutToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.Cut();
}
else if (comboBoxFind.Visible)
{
if (comboBoxFind.SelectedText.Length > 0)
{
Clipboard.SetText(comboBoxFind.SelectedText);
comboBoxFind.SelectedText = string.Empty;
}
}
}
catch
{
// ignore
}
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.Copy();
}
else if (comboBoxFind.Visible)
{
if (comboBoxFind.SelectedText.Length > 0)
{
Clipboard.SetText(comboBoxFind.SelectedText);
}
}
}
catch
{
// ignore
}
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
var text = Clipboard.GetText();
if (string.IsNullOrEmpty(text))
{
return;
}
if (textBoxFind.Visible)
{
textBoxFind.Paste(text);
}
else if (comboBoxFind.Visible)
{
comboBoxFind.SelectedText = text;
}
}
catch
{
// ignore
}
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (textBoxFind.Visible)
{
textBoxFind.SelectedText = string.Empty;
}
else if (comboBoxFind.Visible)
{
comboBoxFind.SelectedText = string.Empty;
}
}
catch
{
// ignore
}
}
private void toolStripMenuItemCutReplace_Click(object sender, EventArgs e)
{
textBoxReplace.Cut();
}
private void toolStripMenuItemCopyReplace_Click(object sender, EventArgs e)
{
textBoxReplace.Copy();
}
private void toolStripMenuItemPasteReplace_Click(object sender, EventArgs e)
{
textBoxReplace.Paste();
}
private void toolStripMenuItemDeleteReplace_Click(object sender, EventArgs e)
{
textBoxReplace.SelectedText = string.Empty;
}
private void contextMenuStripReplace_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
toolStripMenuItemPasteReplace.Enabled = Clipboard.ContainsText();
}
private void contextMenuStripNormal_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
pasteToolStripMenuItem.Enabled = Clipboard.ContainsText();
} }
} }
} }

View File

@ -117,4 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenuStripReplace.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>172, 17</value>
</metadata>
<metadata name="contextMenuStripNormal.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@ -2132,10 +2132,12 @@ Transferir e continuar?</VideoFromUrlRequirements>
<RegEx>Expressão regular</RegEx> <RegEx>Expressão regular</RegEx>
<OddLines>Linhas ímpares</OddLines> <OddLines>Linhas ímpares</OddLines>
<EvenLines>Linhas pares</EvenLines> <EvenLines>Linhas pares</EvenLines>
<DurationLessThan>Duração menor que</DurationLessThan> <DurationLessThan>Duração inferior a</DurationLessThan>
<DurationGreaterThan>Duração maior que</DurationGreaterThan> <DurationGreaterThan>Duração superior a</DurationGreaterThan>
<CpsLessThan>CPS menor que</CpsLessThan> <CpsLessThan>CPS inferior a</CpsLessThan>
<CpsGreaterThan>CPS maior que</CpsGreaterThan> <CpsGreaterThan>CPS superior a</CpsGreaterThan>
<LengthLessThan>Comprimento inferior a</LengthLessThan>
<LengthGreaterThan>Comprimento superior a</LengthGreaterThan>
<ExactlyOneLine>Exactamente uma linha</ExactlyOneLine> <ExactlyOneLine>Exactamente uma linha</ExactlyOneLine>
<ExactlyTwoLines>Exactamente duas linhas</ExactlyTwoLines> <ExactlyTwoLines>Exactamente duas linhas</ExactlyTwoLines>
<MoreThanTwoLines>Mais de duas linhas</MoreThanTwoLines> <MoreThanTwoLines>Mais de duas linhas</MoreThanTwoLines>

View File

@ -21,13 +21,19 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
using (var form = new ExportPngXml()) using (var form = new ExportPngXml())
{ {
form.Initialize(new Subtitle(), new SubRip(), BatchConvert.BluRaySubtitle, fileName, null, fileName); var sub = tsParser.GetDvbSubtitles(pid);
var tempSubtitle = new Subtitle();
foreach (var x in sub)
{
tempSubtitle.Paragraphs.Add(new Paragraph(string.Empty, x.StartMilliseconds, x.EndMilliseconds));
}
form.Initialize(tempSubtitle, new SubRip(), BatchConvert.BluRaySubtitle, fileName, null, fileName);
var language = GetFileNameEnding(programMapTableParser, pid); var language = GetFileNameEnding(programMapTableParser, pid);
var outputFileName = CommandLineConverter.FormatOutputFileNameForBatchConvert(Utilities.GetPathAndFileNameWithoutExtension(fileName) + language + Path.GetExtension(fileName), ".sup", outputFolder, overwrite); var outputFileName = CommandLineConverter.FormatOutputFileNameForBatchConvert(Utilities.GetPathAndFileNameWithoutExtension(fileName) + language + Path.GetExtension(fileName), ".sup", outputFolder, overwrite);
stdOutWriter?.Write($"{count}: {Path.GetFileName(fileName)} -> PID {pid} to {outputFileName}..."); stdOutWriter?.Write($"{count}: {Path.GetFileName(fileName)} -> PID {pid} to {outputFileName}...");
var sub = tsParser.GetDvbSubtitles(pid);
progressCallback?.Invoke($"Save PID {pid}"); progressCallback?.Invoke($"Save PID {pid}");
var subtitleScreenSize = GetSubtitleScreenSize(sub, overrideScreenSize, resolution); var subtitleScreenSize = GetSubtitleScreenSize(sub, overrideScreenSize, resolution);
using (var binarySubtitleFile = new FileStream(outputFileName, FileMode.Create)) using (var binarySubtitleFile = new FileStream(outputFileName, FileMode.Create))