mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Work on interjections skip-if-starts-with list - thx darnn :)
Work on #7563
This commit is contained in:
parent
ef09db7531
commit
7bcf47b9a5
@ -1140,6 +1140,8 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog
|
|||||||
</ImportText>
|
</ImportText>
|
||||||
<Interjections>
|
<Interjections>
|
||||||
<Title>Interjections</Title>
|
<Title>Interjections</Title>
|
||||||
|
<EditSkipList>Edit skip list...</EditSkipList>
|
||||||
|
<EditSkipListInfo>Interjections will be skipped if source text starts with these:</EditSkipListInfo>
|
||||||
</Interjections>
|
</Interjections>
|
||||||
<JoinSubtitles>
|
<JoinSubtitles>
|
||||||
<Title>Join subtitles</Title>
|
<Title>Join subtitles</Title>
|
||||||
|
@ -70,7 +70,7 @@ namespace Test.Logic.Forms
|
|||||||
"Uhh",
|
"Uhh",
|
||||||
"Uhhh",
|
"Uhhh",
|
||||||
"Whew",
|
"Whew",
|
||||||
});
|
}, new List<string>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveInterjections(string twoLetterIsoLanguageName, List<string> interjections)
|
public static void SaveInterjections(string twoLetterIsoLanguageName, List<string> interjections, List<string> skipList)
|
||||||
{
|
{
|
||||||
var seFileName = twoLetterIsoLanguageName + SeFileName;
|
var seFileName = twoLetterIsoLanguageName + SeFileName;
|
||||||
var userFileName = twoLetterIsoLanguageName + UserFileName;
|
var userFileName = twoLetterIsoLanguageName + UserFileName;
|
||||||
@ -59,7 +59,8 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
}
|
}
|
||||||
|
|
||||||
var xmlDocument = new XmlDocument();
|
var xmlDocument = new XmlDocument();
|
||||||
xmlDocument.LoadXml("<interjections><ignore></ignore></interjections>");
|
xmlDocument.LoadXml("<interjections><ignore></ignore><skipIfStartsWith></skipIfStartsWith></interjections>");
|
||||||
|
|
||||||
var ignoreNode = xmlDocument.DocumentElement.SelectSingleNode("ignore");
|
var ignoreNode = xmlDocument.DocumentElement.SelectSingleNode("ignore");
|
||||||
foreach (var w in ignoreList)
|
foreach (var w in ignoreList)
|
||||||
{
|
{
|
||||||
@ -68,6 +69,14 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
ignoreNode.AppendChild(node);
|
ignoreNode.AppendChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var skipNode = xmlDocument.DocumentElement.SelectSingleNode("skipIfStartsWith");
|
||||||
|
foreach (var w in skipList)
|
||||||
|
{
|
||||||
|
var node = xmlDocument.CreateElement("text");
|
||||||
|
node.InnerText = w;
|
||||||
|
skipNode.AppendChild(node);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var w in interjections)
|
foreach (var w in interjections)
|
||||||
{
|
{
|
||||||
if (!se.Contains(w))
|
if (!se.Contains(w))
|
||||||
|
26
src/ui/Forms/InterjectionsEditList.Designer.cs
generated
26
src/ui/Forms/InterjectionsEditList.Designer.cs
generated
@ -33,13 +33,14 @@
|
|||||||
this.TextBoxInterjections = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
this.TextBoxInterjections = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||||
this.buttonSort = new System.Windows.Forms.Button();
|
this.buttonSort = new System.Windows.Forms.Button();
|
||||||
this.labelInfo = new System.Windows.Forms.Label();
|
this.labelInfo = new System.Windows.Forms.Label();
|
||||||
|
this.buttonEditSkipList = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.buttonCancel.Location = new System.Drawing.Point(339, 460);
|
this.buttonCancel.Location = new System.Drawing.Point(395, 460);
|
||||||
this.buttonCancel.Name = "buttonCancel";
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonCancel.TabIndex = 5;
|
this.buttonCancel.TabIndex = 5;
|
||||||
@ -50,7 +51,7 @@
|
|||||||
//
|
//
|
||||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
this.buttonOK.Location = new System.Drawing.Point(260, 460);
|
this.buttonOK.Location = new System.Drawing.Point(316, 460);
|
||||||
this.buttonOK.Name = "buttonOK";
|
this.buttonOK.Name = "buttonOK";
|
||||||
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||||
this.buttonOK.TabIndex = 4;
|
this.buttonOK.TabIndex = 4;
|
||||||
@ -68,15 +69,15 @@
|
|||||||
this.TextBoxInterjections.Multiline = true;
|
this.TextBoxInterjections.Multiline = true;
|
||||||
this.TextBoxInterjections.Name = "TextBoxInterjections";
|
this.TextBoxInterjections.Name = "TextBoxInterjections";
|
||||||
this.TextBoxInterjections.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.TextBoxInterjections.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.TextBoxInterjections.Size = new System.Drawing.Size(282, 406);
|
this.TextBoxInterjections.Size = new System.Drawing.Size(290, 406);
|
||||||
this.TextBoxInterjections.TabIndex = 6;
|
this.TextBoxInterjections.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// buttonSort
|
// buttonSort
|
||||||
//
|
//
|
||||||
this.buttonSort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonSort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonSort.Location = new System.Drawing.Point(311, 42);
|
this.buttonSort.Location = new System.Drawing.Point(319, 42);
|
||||||
this.buttonSort.Name = "buttonSort";
|
this.buttonSort.Name = "buttonSort";
|
||||||
this.buttonSort.Size = new System.Drawing.Size(106, 23);
|
this.buttonSort.Size = new System.Drawing.Size(154, 23);
|
||||||
this.buttonSort.TabIndex = 23;
|
this.buttonSort.TabIndex = 23;
|
||||||
this.buttonSort.Text = "Sort";
|
this.buttonSort.Text = "Sort";
|
||||||
this.buttonSort.UseVisualStyleBackColor = true;
|
this.buttonSort.UseVisualStyleBackColor = true;
|
||||||
@ -91,11 +92,23 @@
|
|||||||
this.labelInfo.TabIndex = 24;
|
this.labelInfo.TabIndex = 24;
|
||||||
this.labelInfo.Text = "Edit all interjections (one interjection on each line)";
|
this.labelInfo.Text = "Edit all interjections (one interjection on each line)";
|
||||||
//
|
//
|
||||||
|
// buttonEditSkipList
|
||||||
|
//
|
||||||
|
this.buttonEditSkipList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonEditSkipList.Location = new System.Drawing.Point(319, 71);
|
||||||
|
this.buttonEditSkipList.Name = "buttonEditSkipList";
|
||||||
|
this.buttonEditSkipList.Size = new System.Drawing.Size(154, 23);
|
||||||
|
this.buttonEditSkipList.TabIndex = 27;
|
||||||
|
this.buttonEditSkipList.Text = "Edit skip list...";
|
||||||
|
this.buttonEditSkipList.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonEditSkipList.Click += new System.EventHandler(this.EditSkipListStartsWithToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// InterjectionsEditList
|
// InterjectionsEditList
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(429, 494);
|
this.ClientSize = new System.Drawing.Size(485, 494);
|
||||||
|
this.Controls.Add(this.buttonEditSkipList);
|
||||||
this.Controls.Add(this.labelInfo);
|
this.Controls.Add(this.labelInfo);
|
||||||
this.Controls.Add(this.buttonSort);
|
this.Controls.Add(this.buttonSort);
|
||||||
this.Controls.Add(this.TextBoxInterjections);
|
this.Controls.Add(this.TextBoxInterjections);
|
||||||
@ -121,5 +134,6 @@
|
|||||||
private Controls.NikseTextBox TextBoxInterjections;
|
private Controls.NikseTextBox TextBoxInterjections;
|
||||||
private System.Windows.Forms.Button buttonSort;
|
private System.Windows.Forms.Button buttonSort;
|
||||||
private System.Windows.Forms.Label labelInfo;
|
private System.Windows.Forms.Label labelInfo;
|
||||||
|
private System.Windows.Forms.Button buttonEditSkipList;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,12 +12,15 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
public sealed partial class InterjectionsEditList : Form
|
public sealed partial class InterjectionsEditList : Form
|
||||||
{
|
{
|
||||||
public List<string> Interjections { get; set; }
|
public List<string> Interjections { get; set; }
|
||||||
|
public List<string> SkipList { get; set; }
|
||||||
|
|
||||||
public InterjectionsEditList(List<string> interjections)
|
public InterjectionsEditList(List<string> interjections, List<string> skipList)
|
||||||
{
|
{
|
||||||
UiUtil.PreInitialize(this);
|
UiUtil.PreInitialize(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
UiUtil.FixFonts(this);
|
UiUtil.FixFonts(this);
|
||||||
|
|
||||||
|
SkipList = skipList;
|
||||||
TextBoxInterjections.Text = string.Join(Environment.NewLine, interjections);
|
TextBoxInterjections.Text = string.Join(Environment.NewLine, interjections);
|
||||||
Text = LanguageSettings.Current.Interjections.Title;
|
Text = LanguageSettings.Current.Interjections.Title;
|
||||||
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||||
@ -65,5 +68,19 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
TextBoxInterjections.SelectionLength = 0;
|
TextBoxInterjections.SelectionLength = 0;
|
||||||
TextBoxInterjections.Focus();
|
TextBoxInterjections.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditSkipListStartsWithToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var form = new InterjectionsEditSkipList(SkipList))
|
||||||
|
{
|
||||||
|
var dr = form.ShowDialog(this);
|
||||||
|
if (dr != DialogResult.OK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkipList = form.SkipList;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
111
src/ui/Forms/InterjectionsEditSkipList.Designer.cs
generated
Normal file
111
src/ui/Forms/InterjectionsEditSkipList.Designer.cs
generated
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
|
{
|
||||||
|
partial class InterjectionsEditSkipList
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonOK = new System.Windows.Forms.Button();
|
||||||
|
this.TextBoxInterjections = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||||
|
this.labelInfo = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(339, 460);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.buttonCancel.TabIndex = 5;
|
||||||
|
this.buttonCancel.Text = "C&ancel";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonOK
|
||||||
|
//
|
||||||
|
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
|
this.buttonOK.Location = new System.Drawing.Point(260, 460);
|
||||||
|
this.buttonOK.Name = "buttonOK";
|
||||||
|
this.buttonOK.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.buttonOK.TabIndex = 4;
|
||||||
|
this.buttonOK.Text = "&OK";
|
||||||
|
this.buttonOK.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||||
|
//
|
||||||
|
// TextBoxInterjections
|
||||||
|
//
|
||||||
|
this.TextBoxInterjections.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.TextBoxInterjections.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||||
|
this.TextBoxInterjections.Location = new System.Drawing.Point(23, 42);
|
||||||
|
this.TextBoxInterjections.Multiline = true;
|
||||||
|
this.TextBoxInterjections.Name = "TextBoxInterjections";
|
||||||
|
this.TextBoxInterjections.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
|
this.TextBoxInterjections.Size = new System.Drawing.Size(391, 406);
|
||||||
|
this.TextBoxInterjections.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// labelInfo
|
||||||
|
//
|
||||||
|
this.labelInfo.AutoSize = true;
|
||||||
|
this.labelInfo.Location = new System.Drawing.Point(23, 18);
|
||||||
|
this.labelInfo.Name = "labelInfo";
|
||||||
|
this.labelInfo.Size = new System.Drawing.Size(177, 13);
|
||||||
|
this.labelInfo.TabIndex = 24;
|
||||||
|
this.labelInfo.Text = "Edit interjections skip list (starts with)";
|
||||||
|
//
|
||||||
|
// InterjectionsEditSkipList
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(429, 494);
|
||||||
|
this.Controls.Add(this.labelInfo);
|
||||||
|
this.Controls.Add(this.TextBoxInterjections);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
|
this.Controls.Add(this.buttonOK);
|
||||||
|
this.KeyPreview = true;
|
||||||
|
this.MinimumSize = new System.Drawing.Size(445, 533);
|
||||||
|
this.Name = "InterjectionsEditSkipList";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "Interjections";
|
||||||
|
this.Shown += new System.EventHandler(this.InterjectionsEditList_Shown);
|
||||||
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Interjections_KeyDown);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
|
private System.Windows.Forms.Button buttonOK;
|
||||||
|
private Controls.NikseTextBox TextBoxInterjections;
|
||||||
|
private System.Windows.Forms.Label labelInfo;
|
||||||
|
}
|
||||||
|
}
|
54
src/ui/Forms/InterjectionsEditSkipList.cs
Normal file
54
src/ui/Forms/InterjectionsEditSkipList.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using Nikse.SubtitleEdit.Logic;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Nikse.SubtitleEdit.Core.Common;
|
||||||
|
using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox;
|
||||||
|
|
||||||
|
namespace Nikse.SubtitleEdit.Forms
|
||||||
|
{
|
||||||
|
public sealed partial class InterjectionsEditSkipList : Form
|
||||||
|
{
|
||||||
|
public List<string> SkipList { get; set; }
|
||||||
|
|
||||||
|
public InterjectionsEditSkipList(List<string> skipList)
|
||||||
|
{
|
||||||
|
UiUtil.PreInitialize(this);
|
||||||
|
InitializeComponent();
|
||||||
|
UiUtil.FixFonts(this);
|
||||||
|
TextBoxInterjections.Text = string.Join(Environment.NewLine, skipList);
|
||||||
|
Text = LanguageSettings.Current.Interjections.EditSkipList.Trim('.');
|
||||||
|
labelInfo.Text = LanguageSettings.Current.Interjections.EditSkipListInfo;
|
||||||
|
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
|
||||||
|
buttonOK.Text = LanguageSettings.Current.General.Ok;
|
||||||
|
UiUtil.FixLargeFonts(this, buttonOK);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Interjections_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Escape)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
else if (e.KeyData == UiUtil.HelpKeys)
|
||||||
|
{
|
||||||
|
UiUtil.ShowHelp("#remove_text_for_hi");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonOK_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var lines = TextBoxInterjections.Lines.ToList();
|
||||||
|
SkipList = lines.Select(p => p.Trim().ToLowerInvariant().CapitalizeFirstLetter()).Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InterjectionsEditList_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TextBoxInterjections.SelectionStart = 0;
|
||||||
|
TextBoxInterjections.SelectionLength = 0;
|
||||||
|
TextBoxInterjections.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
src/ui/Forms/InterjectionsEditSkipList.resx
Normal file
120
src/ui/Forms/InterjectionsEditSkipList.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -313,11 +313,12 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
lang = l.Code.TwoLetterISOLanguageName;
|
lang = l.Code.TwoLetterISOLanguageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var editInterjections = new InterjectionsEditList(InterjectionsRepository.LoadInterjections(lang).Interjections))
|
var interjections = InterjectionsRepository.LoadInterjections(lang);
|
||||||
|
using (var editInterjections = new InterjectionsEditList(interjections.Interjections, interjections.SkipIfStartsWith))
|
||||||
{
|
{
|
||||||
if (editInterjections.ShowDialog(this) == DialogResult.OK)
|
if (editInterjections.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
SaveInterjections(editInterjections.Interjections);
|
SaveInterjections(editInterjections.Interjections, editInterjections.SkipList);
|
||||||
if (checkBoxRemoveInterjections.Checked)
|
if (checkBoxRemoveInterjections.Checked)
|
||||||
{
|
{
|
||||||
GeneratePreview();
|
GeneratePreview();
|
||||||
@ -326,7 +327,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveInterjections(List<string> interjections)
|
private void SaveInterjections(List<string> interjections, List<string> skipList)
|
||||||
{
|
{
|
||||||
var lang = "en";
|
var lang = "en";
|
||||||
if (comboBoxLanguage.SelectedIndex >= 0 && comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex] is LanguageItem l)
|
if (comboBoxLanguage.SelectedIndex >= 0 && comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex] is LanguageItem l)
|
||||||
@ -334,7 +335,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
lang = l.Code.TwoLetterISOLanguageName;
|
lang = l.Code.TwoLetterISOLanguageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
InterjectionsRepository.SaveInterjections(lang, interjections);
|
InterjectionsRepository.SaveInterjections(lang, interjections, skipList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
|
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
|
||||||
|
@ -1409,6 +1409,8 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
Interjections = new LanguageStructure.Interjections
|
Interjections = new LanguageStructure.Interjections
|
||||||
{
|
{
|
||||||
Title = "Interjections",
|
Title = "Interjections",
|
||||||
|
EditSkipList = "Edit skip list...",
|
||||||
|
EditSkipListInfo = "Interjections will be skipped if source text starts with these:",
|
||||||
};
|
};
|
||||||
|
|
||||||
JoinSubtitles = new LanguageStructure.JoinSubtitles
|
JoinSubtitles = new LanguageStructure.JoinSubtitles
|
||||||
|
@ -2989,6 +2989,12 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
case "Interjections/Title":
|
case "Interjections/Title":
|
||||||
language.Interjections.Title = reader.Value;
|
language.Interjections.Title = reader.Value;
|
||||||
break;
|
break;
|
||||||
|
case "Interjections/EditSkipList":
|
||||||
|
language.Interjections.EditSkipList = reader.Value;
|
||||||
|
break;
|
||||||
|
case "Interjections/EditSkipListInfo":
|
||||||
|
language.Interjections.EditSkipListInfo = reader.Value;
|
||||||
|
break;
|
||||||
case "JoinSubtitles/Title":
|
case "JoinSubtitles/Title":
|
||||||
language.JoinSubtitles.Title = reader.Value;
|
language.JoinSubtitles.Title = reader.Value;
|
||||||
break;
|
break;
|
||||||
|
@ -1231,6 +1231,8 @@
|
|||||||
public class Interjections
|
public class Interjections
|
||||||
{
|
{
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
public string EditSkipList { get; set; }
|
||||||
|
public string EditSkipListInfo { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JoinSubtitles
|
public class JoinSubtitles
|
||||||
|
@ -406,6 +406,12 @@
|
|||||||
<Compile Include="Forms\GenerateVideoWithSoftSubs.Designer.cs">
|
<Compile Include="Forms\GenerateVideoWithSoftSubs.Designer.cs">
|
||||||
<DependentUpon>GenerateVideoWithSoftSubs.cs</DependentUpon>
|
<DependentUpon>GenerateVideoWithSoftSubs.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Forms\InterjectionsEditSkipList.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\InterjectionsEditSkipList.Designer.cs">
|
||||||
|
<DependentUpon>InterjectionsEditSkipList.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Forms\InterjectionsEditList.cs">
|
<Compile Include="Forms\InterjectionsEditList.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -1757,6 +1763,9 @@
|
|||||||
<EmbeddedResource Include="Forms\GetVideoPosition.resx">
|
<EmbeddedResource Include="Forms\GetVideoPosition.resx">
|
||||||
<DependentUpon>GetVideoPosition.cs</DependentUpon>
|
<DependentUpon>GetVideoPosition.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Forms\InterjectionsEditSkipList.resx">
|
||||||
|
<DependentUpon>InterjectionsEditSkipList.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\InterjectionsEditList.resx">
|
<EmbeddedResource Include="Forms\InterjectionsEditList.resx">
|
||||||
<DependentUpon>InterjectionsEditList.cs</DependentUpon>
|
<DependentUpon>InterjectionsEditList.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
Loading…
Reference in New Issue
Block a user