diff --git a/Dictionaries/hrv_OCRFixReplaceList.xml b/Dictionaries/hrv_OCRFixReplaceList.xml index e10caa06b..860a91b0e 100644 --- a/Dictionaries/hrv_OCRFixReplaceList.xml +++ b/Dictionaries/hrv_OCRFixReplaceList.xml @@ -876,6 +876,7 @@ + @@ -2710,6 +2711,7 @@ + @@ -3035,6 +3037,7 @@ + @@ -5380,6 +5383,7 @@ + @@ -5517,6 +5521,7 @@ + @@ -5552,7 +5557,7 @@ - + @@ -5720,6 +5725,7 @@ + diff --git a/src/ui/Forms/ExportPngXml.cs b/src/ui/Forms/ExportPngXml.cs index 5136fc24f..3834684de 100644 --- a/src/ui/Forms/ExportPngXml.cs +++ b/src/ui/Forms/ExportPngXml.cs @@ -474,6 +474,11 @@ namespace Nikse.SubtitleEdit.Forms internal MakeBitmapParameter MakeMakeBitmapParameter(int index, int screenWidth, int screenHeight) { var p = _subtitle.GetParagraphOrDefault(index); + if (p == null) + { + p = new Paragraph(); + } + var parameter = new MakeBitmapParameter { Type = _exportType, @@ -510,6 +515,7 @@ namespace Nikse.SubtitleEdit.Forms FullFrame = checkBoxFullFrameImage.Checked, FullFrameBackgroundColor = panelFullFrameBackground.BackColor, }; + if (index < _subtitle.Paragraphs.Count) { parameter.P = _subtitle.Paragraphs[index]; @@ -571,6 +577,7 @@ namespace Nikse.SubtitleEdit.Forms { parameter.P = null; } + return parameter; } diff --git a/src/ui/Forms/FindDialog.Designer.cs b/src/ui/Forms/FindDialog.Designer.cs index daf2a4974..eafdf98f4 100644 --- a/src/ui/Forms/FindDialog.Designer.cs +++ b/src/ui/Forms/FindDialog.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.textBoxFind = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.buttonFind = new System.Windows.Forms.Button(); this.radioButtonNormal = new System.Windows.Forms.RadioButton(); @@ -39,6 +40,12 @@ this.checkBoxWholeWord = new System.Windows.Forms.CheckBox(); this.buttonFindPrev = new System.Windows.Forms.Button(); 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(); // // textBoxFind @@ -171,6 +178,48 @@ this.labelFindWhat.TabIndex = 12; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -199,6 +248,7 @@ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindDialog_FormClosing); this.Shown += new System.EventHandler(this.FindDialog_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormFindDialog_KeyDown); + this.contextMenuStripNormal.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -217,5 +267,10 @@ private System.Windows.Forms.CheckBox checkBoxWholeWord; private System.Windows.Forms.Button buttonFindPrev; 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; } } diff --git a/src/ui/Forms/FindDialog.cs b/src/ui/Forms/FindDialog.cs index 05512b240..4c0a2e14b 100644 --- a/src/ui/Forms/FindDialog.cs +++ b/src/ui/Forms/FindDialog.cs @@ -32,6 +32,11 @@ namespace Nikse.SubtitleEdit.Forms radioButtonRegEx.Text = LanguageSettings.Current.FindDialog.RegularExpression; checkBoxWholeWord.Text = LanguageSettings.Current.FindDialog.WholeWord; 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; _subtitle = subtitle; _findAndReplaceMethods = findAndReplaceMethods; @@ -213,22 +218,7 @@ namespace Nikse.SubtitleEdit.Forms private void RadioButton_CheckedChanged(object sender, EventArgs e) { - // remove any existing context menu - 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); - } - } + SetContextMenuStrip(); checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked; labelCount.Text = string.Empty; @@ -337,6 +327,32 @@ namespace Nikse.SubtitleEdit.Forms 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) { if (comboBoxFind.Visible) @@ -347,6 +363,103 @@ namespace Nikse.SubtitleEdit.Forms { 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(); } } } diff --git a/src/ui/Forms/FindDialog.resx b/src/ui/Forms/FindDialog.resx index d58980a38..d42225b8f 100644 --- a/src/ui/Forms/FindDialog.resx +++ b/src/ui/Forms/FindDialog.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/src/ui/Forms/ReplaceDialog.Designer.cs b/src/ui/Forms/ReplaceDialog.Designer.cs index 89a8696cb..c093d692f 100644 --- a/src/ui/Forms/ReplaceDialog.Designer.cs +++ b/src/ui/Forms/ReplaceDialog.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.radioButtonRegEx = new System.Windows.Forms.RadioButton(); this.radioButtonCaseSensitive = new System.Windows.Forms.RadioButton(); this.radioButtonNormal = new System.Windows.Forms.RadioButton(); @@ -42,6 +43,18 @@ this.comboBoxFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.labelFindReplaceIn = new Nikse.SubtitleEdit.Controls.NikseLabel(); 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(); // // radioButtonRegEx @@ -116,6 +129,7 @@ // // textBoxReplace // + this.textBoxReplace.ContextMenuStrip = this.contextMenuStripReplace; 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.Name = "textBoxReplace"; @@ -220,6 +234,90 @@ this.comboBoxFind.UsePopupWindow = false; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -252,6 +350,8 @@ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ReplaceDialog_FormClosing); this.Shown += new System.EventHandler(this.ReplaceDialog_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormReplaceDialog_KeyDown); + this.contextMenuStripNormal.ResumeLayout(false); + this.contextMenuStripReplace.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -273,5 +373,15 @@ private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFindReplaceIn; private Nikse.SubtitleEdit.Controls.NikseLabel labelFindReplaceIn; 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; } } \ No newline at end of file diff --git a/src/ui/Forms/ReplaceDialog.cs b/src/ui/Forms/ReplaceDialog.cs index e439378c7..c7966aeeb 100644 --- a/src/ui/Forms/ReplaceDialog.cs +++ b/src/ui/Forms/ReplaceDialog.cs @@ -37,6 +37,10 @@ namespace Nikse.SubtitleEdit.Forms buttonReplace.Text = LanguageSettings.Current.ReplaceDialog.Replace; buttonReplaceAll.Text = LanguageSettings.Current.ReplaceDialog.ReplaceAll; 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) { @@ -134,6 +138,7 @@ namespace Nikse.SubtitleEdit.Forms var s = Configuration.Settings.Tools.FindHistory[index]; comboBoxFind.Items.Add(s); } + comboBoxFind.Text = selectedText; comboBoxFind.SelectAll(); } @@ -155,6 +160,7 @@ namespace Nikse.SubtitleEdit.Forms { textBoxReplace.Text = findHelper.ReplaceText.Replace(Environment.NewLine, "\\n"); } + textBoxFind.SelectAll(); if (findHelper.FindReplaceType.FindType == FindType.RegEx) { @@ -310,11 +316,8 @@ namespace Nikse.SubtitleEdit.Forms private void RadioButtonCheckedChanged(object sender, EventArgs e) { - textBoxFind.ContextMenuStrip = sender == radioButtonRegEx - ? FindReplaceDialogHelper.GetRegExContextMenu(textBoxFind) - : null; - checkBoxWholeWord.Enabled = !radioButtonRegEx.Checked; + SetContextMenuStrip(); } private void TextBoxFindKeyDown(object sender, KeyEventArgs e) @@ -410,6 +413,154 @@ namespace Nikse.SubtitleEdit.Forms BringToFront(); 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(); } } } diff --git a/src/ui/Forms/ReplaceDialog.resx b/src/ui/Forms/ReplaceDialog.resx index d58980a38..1ca3ffbc0 100644 --- a/src/ui/Forms/ReplaceDialog.resx +++ b/src/ui/Forms/ReplaceDialog.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 172, 17 + + + 17, 17 + \ No newline at end of file diff --git a/src/ui/Languages/pt-PT.xml b/src/ui/Languages/pt-PT.xml index 36c54d01d..c949603fa 100644 --- a/src/ui/Languages/pt-PT.xml +++ b/src/ui/Languages/pt-PT.xml @@ -2132,10 +2132,12 @@ Transferir e continuar? Expressão regular Linhas ímpares Linhas pares - Duração menor que - Duração maior que - CPS menor que - CPS maior que + Duração inferior a + Duração superior a + CPS inferior a + CPS superior a + Comprimento inferior a + Comprimento superior a Exactamente uma linha Exactamente duas linhas Mais de duas linhas diff --git a/src/ui/Logic/CommandLineConvert/TsToBluRaySup.cs b/src/ui/Logic/CommandLineConvert/TsToBluRaySup.cs index 3a9bdb0a2..2daf926b3 100644 --- a/src/ui/Logic/CommandLineConvert/TsToBluRaySup.cs +++ b/src/ui/Logic/CommandLineConvert/TsToBluRaySup.cs @@ -21,13 +21,19 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert 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 outputFileName = CommandLineConverter.FormatOutputFileNameForBatchConvert(Utilities.GetPathAndFileNameWithoutExtension(fileName) + language + Path.GetExtension(fileName), ".sup", outputFolder, overwrite); stdOutWriter?.Write($"{count}: {Path.GetFileName(fileName)} -> PID {pid} to {outputFileName}..."); - var sub = tsParser.GetDvbSubtitles(pid); progressCallback?.Invoke($"Save PID {pid}"); var subtitleScreenSize = GetSubtitleScreenSize(sub, overrideScreenSize, resolution); using (var binarySubtitleFile = new FileStream(outputFileName, FileMode.Create))