Working on "Remove text for HI" - interjections (SE 3.1 beta 11)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@283 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-01-25 12:42:08 +00:00
parent 889a638f56
commit d9be2dcf15
16 changed files with 645 additions and 58 deletions

View File

@ -265,9 +265,9 @@ namespace Nikse.SubtitleEdit.Controls
subItem = new ListViewItem.ListViewSubItem(item, paragraph.Text.Replace(Environment.NewLine, _lineSeparatorString));
if (SubtitleFontBold)
subItem.Font = new Font(SubtitleFontName, subItem.Font.Size, FontStyle.Bold);
subItem.Font = new Font(SubtitleFontName, SubtitleFontSize , FontStyle.Bold);
else
subItem.Font = new Font(SubtitleFontName, subItem.Font.Size);
subItem.Font = new Font(SubtitleFontName, SubtitleFontSize);
item.UseItemStyleForSubItems = false;
item.SubItems.Add(subItem);

142
src/Forms/Interjections.Designer.cs generated Normal file
View File

@ -0,0 +1,142 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class Interjections
{
/// <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.groupBoxNamesIgonoreLists = new System.Windows.Forms.GroupBox();
this.buttonRemove = new System.Windows.Forms.Button();
this.listBoxInterjections = new System.Windows.Forms.ListBox();
this.textBoxInterjection = new System.Windows.Forms.TextBox();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.groupBoxNamesIgonoreLists.SuspendLayout();
this.SuspendLayout();
//
// groupBoxNamesIgonoreLists
//
this.groupBoxNamesIgonoreLists.Controls.Add(this.buttonRemove);
this.groupBoxNamesIgonoreLists.Controls.Add(this.listBoxInterjections);
this.groupBoxNamesIgonoreLists.Controls.Add(this.textBoxInterjection);
this.groupBoxNamesIgonoreLists.Controls.Add(this.buttonAdd);
this.groupBoxNamesIgonoreLists.Location = new System.Drawing.Point(12, 12);
this.groupBoxNamesIgonoreLists.Name = "groupBoxNamesIgonoreLists";
this.groupBoxNamesIgonoreLists.Size = new System.Drawing.Size(241, 250);
this.groupBoxNamesIgonoreLists.TabIndex = 3;
this.groupBoxNamesIgonoreLists.TabStop = false;
//
// buttonRemove
//
this.buttonRemove.Location = new System.Drawing.Point(159, 16);
this.buttonRemove.Name = "buttonRemove";
this.buttonRemove.Size = new System.Drawing.Size(75, 23);
this.buttonRemove.TabIndex = 22;
this.buttonRemove.Text = "Remove";
this.buttonRemove.UseVisualStyleBackColor = true;
this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
//
// listBoxInterjections
//
this.listBoxInterjections.FormattingEnabled = true;
this.listBoxInterjections.Location = new System.Drawing.Point(3, 16);
this.listBoxInterjections.Name = "listBoxInterjections";
this.listBoxInterjections.Size = new System.Drawing.Size(150, 199);
this.listBoxInterjections.TabIndex = 20;
this.listBoxInterjections.SelectedIndexChanged += new System.EventHandler(this.listBoxInterjections_SelectedIndexChanged);
//
// textBoxInterjection
//
this.textBoxInterjection.Location = new System.Drawing.Point(2, 220);
this.textBoxInterjection.Name = "textBoxInterjection";
this.textBoxInterjection.Size = new System.Drawing.Size(151, 20);
this.textBoxInterjection.TabIndex = 24;
this.textBoxInterjection.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxInterjection_KeyDown);
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(159, 217);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(75, 23);
this.buttonAdd.TabIndex = 26;
this.buttonAdd.Text = "Add";
this.buttonAdd.UseVisualStyleBackColor = true;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(178, 281);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 5;
this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// buttonOK
//
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(99, 281);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 4;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
//
// Interjections
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(268, 315);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.groupBoxNamesIgonoreLists);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Interjections";
this.ShowIcon = false;
this.Text = "Interjections";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Interjections_KeyDown);
this.groupBoxNamesIgonoreLists.ResumeLayout(false);
this.groupBoxNamesIgonoreLists.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBoxNamesIgonoreLists;
private System.Windows.Forms.Button buttonRemove;
private System.Windows.Forms.ListBox listBoxInterjections;
private System.Windows.Forms.TextBox textBoxInterjection;
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonOK;
}
}

117
src/Forms/Interjections.cs Normal file
View File

@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic;
namespace Nikse.SubtitleEdit.Forms
{
public sealed partial class Interjections : Form
{
private List<string> _interjections;
public Interjections()
{
InitializeComponent();
}
public string GetInterjectionsSemiColonSeperatedString()
{
StringBuilder sb = new StringBuilder();
foreach (string s in _interjections)
sb.Append(";" + s.Trim());
return sb.ToString().Trim(';');
}
private void Interjections_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
}
public void Initialize(string semiColonSeperatedList)
{
_interjections = new List<string>();
string[] arr = semiColonSeperatedList.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string s in arr)
{
_interjections.Add(s.Trim());
}
FillListBox();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
string text = textBoxInterjection.Text.Trim();
if (text.Length > 1 && !_interjections.Contains(text))
{
_interjections.Add(text);
FillListBox();
textBoxInterjection.Text = string.Empty;
textBoxInterjection.Focus();
for (int i = 0; i < listBoxInterjections.Items.Count; i++)
{
if (listBoxInterjections.Items[i].ToString() == text)
{
listBoxInterjections.SelectedIndex = i;
int top = i - 5;
if (top < 0)
top = 0;
listBoxInterjections.TopIndex = top;
break;
}
}
}
else
{
MessageBox.Show(Configuration.Settings.Language.Settings.WordAlreadyExists);
}
}
private void FillListBox()
{
_interjections.Sort();
listBoxInterjections.BeginUpdate();
listBoxInterjections.Items.Clear();
foreach (string s in _interjections)
{
listBoxInterjections.Items.Add(s);
}
listBoxInterjections.EndUpdate();
}
private void buttonRemove_Click(object sender, EventArgs e)
{
int index = listBoxInterjections.SelectedIndex;
string text = listBoxInterjections.Items[index].ToString();
if (index >= 0)
{
if (MessageBox.Show(string.Format(Configuration.Settings.Language.Settings.RemoveX, text), null, MessageBoxButtons.YesNo) == DialogResult.Yes)
{
_interjections.Remove(text);
listBoxInterjections.Items.RemoveAt(index);
if (index < listBoxInterjections.Items.Count)
listBoxInterjections.SelectedIndex = index;
else if (listBoxInterjections.Items.Count > 0)
listBoxInterjections.SelectedIndex = index - 1;
listBoxInterjections.Focus();
return;
}
MessageBox.Show(Configuration.Settings.Language.Settings.WordNotFound);
}
}
private void listBoxInterjections_SelectedIndexChanged(object sender, EventArgs e)
{
buttonRemove.Enabled = listBoxInterjections.SelectedIndex >= 0;
}
private void textBoxInterjection_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
buttonAdd_Click(null, null);
}
}
}

View 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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -5,7 +5,6 @@ using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Controls;
using Nikse.SubtitleEdit.Logic;
@ -197,7 +196,7 @@ namespace Nikse.SubtitleEdit.Forms
InitializeToolbar();
Utilities.InitializeSubtitleFont(textBoxSource);
Utilities.InitializeSubtitleFont(textBoxListViewText);
Utilities.InitializeSubtitleFont(SubtitleListview1);
tabControlSubtitle.SelectTab(TabControlSourceView); // AC
ShowSourceLineNumber(); // AC
@ -1619,6 +1618,7 @@ namespace Nikse.SubtitleEdit.Forms
UpdateRecentFilesUI();
Utilities.InitializeSubtitleFont(textBoxSource);
Utilities.InitializeSubtitleFont(textBoxListViewText);
Utilities.InitializeSubtitleFont(SubtitleListview1);
buttonCustomUrl.Text = Configuration.Settings.VideoControls.CustomSearchText;
buttonCustomUrl.Enabled = Configuration.Settings.VideoControls.CustomSearchUrl.Length > 1;
@ -1637,6 +1637,7 @@ namespace Nikse.SubtitleEdit.Forms
{
Utilities.InitializeSubtitleFont(textBoxListViewText);
Utilities.InitializeSubtitleFont(textBoxSource);
Utilities.InitializeSubtitleFont(SubtitleListview1);
SubtitleListview1.SubtitleFontName = Configuration.Settings.General.SubtitleFontName;
SubtitleListview1.SubtitleFontBold = Configuration.Settings.General.SubtitleFontBold;
SubtitleListview1.SubtitleFontSize = Configuration.Settings.General.SubtitleFontSize;
@ -6245,6 +6246,9 @@ namespace Nikse.SubtitleEdit.Forms
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate.Paragraphs.Count > 1)
{
InsertMissingParagraphs(_subtitle, _subtitleAlternate);
InsertMissingParagraphs(_subtitleAlternate, _subtitle);
buttonUnBreak.Visible = false;
buttonUndoListViewChanges.Visible = false;
@ -6274,6 +6278,24 @@ namespace Nikse.SubtitleEdit.Forms
return true;
}
private void InsertMissingParagraphs(Subtitle masterSubtitle, Subtitle insertIntoSubtitle)
{
int index = 0;
foreach (Paragraph p in masterSubtitle.Paragraphs)
{
Paragraph insertParagraph = Utilities.GetOriginalParagraph(index, p, insertIntoSubtitle.Paragraphs);
if (insertParagraph == null)
{
insertParagraph = new Paragraph(p);
insertParagraph.Text = string.Empty;
insertIntoSubtitle.InsertParagraphInCorrectTimeOrder(insertParagraph);
}
index++;
}
insertIntoSubtitle.Renumber(1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -7203,7 +7225,9 @@ namespace Nikse.SubtitleEdit.Forms
{
toolStripMenuItemOpenContainingFolder.Visible = !string.IsNullOrEmpty(_fileName) && File.Exists(_fileName);
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
bool subtitleLoaded = _subtitle != null && _subtitle.Paragraphs.Count > 0;
openOriginalToolStripMenuItem.Visible = subtitleLoaded;
if (subtitleLoaded && Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
{
saveOriginalToolStripMenuItem.Visible = true;
saveOriginalAstoolStripMenuItem.Visible = true;
@ -7214,14 +7238,8 @@ namespace Nikse.SubtitleEdit.Forms
saveOriginalToolStripMenuItem.Visible = false;
saveOriginalAstoolStripMenuItem.Visible = false;
removeOriginalToolStripMenuItem.Visible = false;
if (_subtitle == null || _subtitle.Paragraphs.Count < 1)
{
openOriginalToolStripMenuItem.Visible = false;
toolStripSeparator20.Visible = false;
}
}
toolStripSeparator20.Visible = subtitleLoaded;
}
private void toolStripMenuItemOpenContainingFolder_Click(object sender, EventArgs e)
@ -8809,7 +8827,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
//NIO:TODO: TextBoxListViewToogleTag("i");
TextBoxListViewToogleTag("i");
}
}
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.D)

View File

@ -580,9 +580,6 @@
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value>
</metadata>
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value>
</metadata>
<data name="toolStripButtonWaveFormZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -687,7 +684,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -38,6 +38,8 @@
this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.checkBoxRemoveTextBeforeColon = new System.Windows.Forms.CheckBox();
this.groupBoxRemoveTextConditions = new System.Windows.Forms.GroupBox();
this.buttonEditInterjections = new System.Windows.Forms.Button();
this.checkBoxRemoveInterjections = new System.Windows.Forms.CheckBox();
this.labelRemoveTextBetween = new System.Windows.Forms.Label();
this.comboBoxRemoveIfTextContains = new System.Windows.Forms.ComboBox();
this.checkBoxRemoveWhereContains = new System.Windows.Forms.CheckBox();
@ -136,8 +138,8 @@
this.checkBoxRemoveTextBeforeColon.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBeforeColon.Location = new System.Drawing.Point(241, 26);
this.checkBoxRemoveTextBeforeColon.Name = "checkBoxRemoveTextBeforeColon";
this.checkBoxRemoveTextBeforeColon.Size = new System.Drawing.Size(265, 25);
this.checkBoxRemoveTextBeforeColon.TabIndex = 9;
this.checkBoxRemoveTextBeforeColon.Size = new System.Drawing.Size(175, 17);
this.checkBoxRemoveTextBeforeColon.TabIndex = 10;
this.checkBoxRemoveTextBeforeColon.Text = "Remove text before a colon (:)";
this.checkBoxRemoveTextBeforeColon.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBeforeColon.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -146,6 +148,8 @@
//
this.groupBoxRemoveTextConditions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxRemoveTextConditions.Controls.Add(this.buttonEditInterjections);
this.groupBoxRemoveTextConditions.Controls.Add(this.checkBoxRemoveInterjections);
this.groupBoxRemoveTextConditions.Controls.Add(this.labelRemoveTextBetween);
this.groupBoxRemoveTextConditions.Controls.Add(this.comboBoxRemoveIfTextContains);
this.groupBoxRemoveTextConditions.Controls.Add(this.checkBoxRemoveWhereContains);
@ -167,13 +171,34 @@
this.groupBoxRemoveTextConditions.TabStop = false;
this.groupBoxRemoveTextConditions.Text = "Remove text conditions";
//
// buttonEditInterjections
//
this.buttonEditInterjections.Location = new System.Drawing.Point(377, 137);
this.buttonEditInterjections.Name = "buttonEditInterjections";
this.buttonEditInterjections.Size = new System.Drawing.Size(103, 23);
this.buttonEditInterjections.TabIndex = 15;
this.buttonEditInterjections.Text = "Edit...";
this.buttonEditInterjections.UseVisualStyleBackColor = true;
this.buttonEditInterjections.Click += new System.EventHandler(this.buttonEditInterjections_Click);
//
// checkBoxRemoveInterjections
//
this.checkBoxRemoveInterjections.AutoSize = true;
this.checkBoxRemoveInterjections.Location = new System.Drawing.Point(241, 141);
this.checkBoxRemoveInterjections.Name = "checkBoxRemoveInterjections";
this.checkBoxRemoveInterjections.Size = new System.Drawing.Size(130, 17);
this.checkBoxRemoveInterjections.TabIndex = 14;
this.checkBoxRemoveInterjections.Text = "Remove interjections ";
this.checkBoxRemoveInterjections.UseVisualStyleBackColor = true;
this.checkBoxRemoveInterjections.CheckedChanged += new System.EventHandler(this.checkBoxRemoveInterjections_CheckedChanged);
//
// labelRemoveTextBetween
//
this.labelRemoveTextBetween.AutoSize = true;
this.labelRemoveTextBetween.Location = new System.Drawing.Point(8, 26);
this.labelRemoveTextBetween.Name = "labelRemoveTextBetween";
this.labelRemoveTextBetween.Size = new System.Drawing.Size(173, 21);
this.labelRemoveTextBetween.TabIndex = 13;
this.labelRemoveTextBetween.Size = new System.Drawing.Size(114, 13);
this.labelRemoveTextBetween.TabIndex = 0;
this.labelRemoveTextBetween.Text = "Remove text between";
//
// comboBoxRemoveIfTextContains
@ -183,21 +208,21 @@
"¶",
"♪",
"♫"});
this.comboBoxRemoveIfTextContains.Location = new System.Drawing.Point(427, 133);
this.comboBoxRemoveIfTextContains.Location = new System.Drawing.Point(427, 88);
this.comboBoxRemoveIfTextContains.MaxLength = 10;
this.comboBoxRemoveIfTextContains.Name = "comboBoxRemoveIfTextContains";
this.comboBoxRemoveIfTextContains.Size = new System.Drawing.Size(100, 29);
this.comboBoxRemoveIfTextContains.TabIndex = 12;
this.comboBoxRemoveIfTextContains.Size = new System.Drawing.Size(100, 21);
this.comboBoxRemoveIfTextContains.TabIndex = 13;
this.comboBoxRemoveIfTextContains.Text = "¶";
this.comboBoxRemoveIfTextContains.TextChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
//
// checkBoxRemoveWhereContains
//
this.checkBoxRemoveWhereContains.AutoSize = true;
this.checkBoxRemoveWhereContains.Location = new System.Drawing.Point(241, 137);
this.checkBoxRemoveWhereContains.Location = new System.Drawing.Point(241, 92);
this.checkBoxRemoveWhereContains.Name = "checkBoxRemoveWhereContains";
this.checkBoxRemoveWhereContains.Size = new System.Drawing.Size(232, 25);
this.checkBoxRemoveWhereContains.TabIndex = 11;
this.checkBoxRemoveWhereContains.Size = new System.Drawing.Size(153, 17);
this.checkBoxRemoveWhereContains.TabIndex = 12;
this.checkBoxRemoveWhereContains.Text = "Remove text if it contains:";
this.checkBoxRemoveWhereContains.UseVisualStyleBackColor = true;
this.checkBoxRemoveWhereContains.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -212,8 +237,8 @@
this.comboBoxCustomEnd.Location = new System.Drawing.Point(116, 135);
this.comboBoxCustomEnd.MaxLength = 2;
this.comboBoxCustomEnd.Name = "comboBoxCustomEnd";
this.comboBoxCustomEnd.Size = new System.Drawing.Size(38, 29);
this.comboBoxCustomEnd.TabIndex = 7;
this.comboBoxCustomEnd.Size = new System.Drawing.Size(38, 21);
this.comboBoxCustomEnd.TabIndex = 8;
this.comboBoxCustomEnd.Text = "¶";
this.comboBoxCustomEnd.TextChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
//
@ -227,8 +252,8 @@
this.comboBoxCustomStart.Location = new System.Drawing.Point(41, 135);
this.comboBoxCustomStart.MaxLength = 2;
this.comboBoxCustomStart.Name = "comboBoxCustomStart";
this.comboBoxCustomStart.Size = new System.Drawing.Size(38, 29);
this.comboBoxCustomStart.TabIndex = 5;
this.comboBoxCustomStart.Size = new System.Drawing.Size(38, 21);
this.comboBoxCustomStart.TabIndex = 6;
this.comboBoxCustomStart.Text = "¶";
this.comboBoxCustomStart.TextChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
//
@ -237,8 +262,8 @@
this.checkBoxRemoveTextBeforeColonOnlyUppercase.AutoSize = true;
this.checkBoxRemoveTextBeforeColonOnlyUppercase.Location = new System.Drawing.Point(261, 46);
this.checkBoxRemoveTextBeforeColonOnlyUppercase.Name = "checkBoxRemoveTextBeforeColonOnlyUppercase";
this.checkBoxRemoveTextBeforeColonOnlyUppercase.Size = new System.Drawing.Size(229, 25);
this.checkBoxRemoveTextBeforeColonOnlyUppercase.TabIndex = 10;
this.checkBoxRemoveTextBeforeColonOnlyUppercase.Size = new System.Drawing.Size(151, 17);
this.checkBoxRemoveTextBeforeColonOnlyUppercase.TabIndex = 11;
this.checkBoxRemoveTextBeforeColonOnlyUppercase.Text = "Only if text is UPPERCASE";
this.checkBoxRemoveTextBeforeColonOnlyUppercase.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBeforeColonOnlyUppercase.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -248,8 +273,8 @@
this.checkBoxOnlyIfInSeparateLine.AutoSize = true;
this.checkBoxOnlyIfInSeparateLine.Location = new System.Drawing.Point(11, 169);
this.checkBoxOnlyIfInSeparateLine.Name = "checkBoxOnlyIfInSeparateLine";
this.checkBoxOnlyIfInSeparateLine.Size = new System.Drawing.Size(207, 25);
this.checkBoxOnlyIfInSeparateLine.TabIndex = 8;
this.checkBoxOnlyIfInSeparateLine.Size = new System.Drawing.Size(137, 17);
this.checkBoxOnlyIfInSeparateLine.TabIndex = 9;
this.checkBoxOnlyIfInSeparateLine.Text = "Only if on separate line";
this.checkBoxOnlyIfInSeparateLine.UseVisualStyleBackColor = true;
this.checkBoxOnlyIfInSeparateLine.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -261,8 +286,8 @@
this.checkBoxRemoveTextBetweenCustomTags.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBetweenCustomTags.Location = new System.Drawing.Point(20, 138);
this.checkBoxRemoveTextBetweenCustomTags.Name = "checkBoxRemoveTextBetweenCustomTags";
this.checkBoxRemoveTextBetweenCustomTags.Size = new System.Drawing.Size(22, 21);
this.checkBoxRemoveTextBetweenCustomTags.TabIndex = 4;
this.checkBoxRemoveTextBetweenCustomTags.Size = new System.Drawing.Size(15, 14);
this.checkBoxRemoveTextBetweenCustomTags.TabIndex = 5;
this.checkBoxRemoveTextBetweenCustomTags.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBetweenCustomTags.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
//
@ -273,8 +298,8 @@
this.checkBoxRemoveTextBetweenQuestionMarks.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBetweenQuestionMarks.Location = new System.Drawing.Point(20, 115);
this.checkBoxRemoveTextBetweenQuestionMarks.Name = "checkBoxRemoveTextBetweenQuestionMarks";
this.checkBoxRemoveTextBetweenQuestionMarks.Size = new System.Drawing.Size(117, 25);
this.checkBoxRemoveTextBetweenQuestionMarks.TabIndex = 3;
this.checkBoxRemoveTextBetweenQuestionMarks.Size = new System.Drawing.Size(76, 17);
this.checkBoxRemoveTextBetweenQuestionMarks.TabIndex = 4;
this.checkBoxRemoveTextBetweenQuestionMarks.Text = "\"?\" and \"?\"";
this.checkBoxRemoveTextBetweenQuestionMarks.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBetweenQuestionMarks.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -286,8 +311,8 @@
this.checkBoxRemoveTextBetweenParentheses.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBetweenParentheses.Location = new System.Drawing.Point(20, 69);
this.checkBoxRemoveTextBetweenParentheses.Name = "checkBoxRemoveTextBetweenParentheses";
this.checkBoxRemoveTextBetweenParentheses.Size = new System.Drawing.Size(115, 25);
this.checkBoxRemoveTextBetweenParentheses.TabIndex = 1;
this.checkBoxRemoveTextBetweenParentheses.Size = new System.Drawing.Size(74, 17);
this.checkBoxRemoveTextBetweenParentheses.TabIndex = 2;
this.checkBoxRemoveTextBetweenParentheses.Text = "\"(\" and \")\"";
this.checkBoxRemoveTextBetweenParentheses.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBetweenParentheses.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -299,8 +324,8 @@
this.checkBoxRemoveTextBetweenBrackets.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBetweenBrackets.Location = new System.Drawing.Point(20, 92);
this.checkBoxRemoveTextBetweenBrackets.Name = "checkBoxRemoveTextBetweenBrackets";
this.checkBoxRemoveTextBetweenBrackets.Size = new System.Drawing.Size(117, 25);
this.checkBoxRemoveTextBetweenBrackets.TabIndex = 2;
this.checkBoxRemoveTextBetweenBrackets.Size = new System.Drawing.Size(76, 17);
this.checkBoxRemoveTextBetweenBrackets.TabIndex = 3;
this.checkBoxRemoveTextBetweenBrackets.Text = "\"{\" and \"}\"";
this.checkBoxRemoveTextBetweenBrackets.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBetweenBrackets.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -312,8 +337,8 @@
this.checkBoxRemoveTextBetweenSquares.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxRemoveTextBetweenSquares.Location = new System.Drawing.Point(20, 45);
this.checkBoxRemoveTextBetweenSquares.Name = "checkBoxRemoveTextBetweenSquares";
this.checkBoxRemoveTextBetweenSquares.Size = new System.Drawing.Size(115, 25);
this.checkBoxRemoveTextBetweenSquares.TabIndex = 0;
this.checkBoxRemoveTextBetweenSquares.Size = new System.Drawing.Size(74, 17);
this.checkBoxRemoveTextBetweenSquares.TabIndex = 1;
this.checkBoxRemoveTextBetweenSquares.Text = "\"[\" and \"]\"";
this.checkBoxRemoveTextBetweenSquares.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBetweenSquares.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
@ -323,13 +348,13 @@
this.labelAnd.AutoSize = true;
this.labelAnd.Location = new System.Drawing.Point(85, 141);
this.labelAnd.Name = "labelAnd";
this.labelAnd.Size = new System.Drawing.Size(37, 21);
this.labelAnd.TabIndex = 6;
this.labelAnd.Size = new System.Drawing.Size(25, 13);
this.labelAnd.TabIndex = 7;
this.labelAnd.Text = "and";
//
// FormRemoveTextForHearImpaired
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(697, 507);
this.Controls.Add(this.groupBoxRemoveTextConditions);
@ -377,5 +402,7 @@
private System.Windows.Forms.ComboBox comboBoxRemoveIfTextContains;
private System.Windows.Forms.CheckBox checkBoxRemoveWhereContains;
private System.Windows.Forms.Label labelRemoveTextBetween;
private System.Windows.Forms.CheckBox checkBoxRemoveInterjections;
private System.Windows.Forms.Button buttonEditInterjections;
}
}

View File

@ -1,9 +1,10 @@
using System;
using System.Text;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic;
namespace Nikse.SubtitleEdit.Forms
{
@ -29,7 +30,10 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxRemoveTextBetweenParentheses.Text = _language.Parentheses;
checkBoxRemoveTextBetweenQuestionMarks.Text = _language.QuestionMarks;
checkBoxRemoveTextBetweenSquares.Text = _language.SquareBrackets;
checkBoxRemoveWhereContains.Text = _language.RemoveTextIfContains;
checkBoxRemoveWhereContains.Text = _language.RemoveTextIfContains;
checkBoxRemoveInterjections.Text = _language.RemoveInterjections;
buttonEditInterjections.Text = _language.EditInterjections;
buttonEditInterjections.Left = checkBoxRemoveInterjections.Left + checkBoxRemoveInterjections.Width;
listViewFixes.Columns[0].Text = Configuration.Settings.Language.General.Apply;
listViewFixes.Columns[1].Text = _language.LineNumber;
listViewFixes.Columns[2].Text = _language.Before;
@ -180,6 +184,11 @@ namespace Nikse.SubtitleEdit.Forms
hit = true;
}
if (checkBoxRemoveInterjections.Checked && RemoveInterjections(p.Text) != p.Text.Trim())
{
hit = true;
}
if (!hit)
{
string[] parts = p.Text.Trim().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
@ -286,8 +295,8 @@ namespace Nikse.SubtitleEdit.Forms
int index = s2.LastIndexOf("!");
if (index == -1 || s2.LastIndexOf("?") > index)
index = s2.LastIndexOf("?");
if (index == -1 || s2.LastIndexOf(".") > index)
index = s2.LastIndexOf(".");
if (index == -1 || s2.LastIndexOf(". ") > index)
index = s2.LastIndexOf(". ");
if (index > 3)
sb.AppendLine(s2.Substring(0, index+1));
}
@ -359,7 +368,6 @@ namespace Nikse.SubtitleEdit.Forms
if (HasHearImpariedTagsAtEnd(newText))
newText = RemoveEndTags(newText);
sb.AppendLine(stSub.Pre + newText + stSub.Post);
}
else
{
@ -377,6 +385,8 @@ namespace Nikse.SubtitleEdit.Forms
text = st.Pre + sb.ToString().Trim() + st.Post;
text = RemoveColon(text);
if (checkBoxRemoveInterjections.Checked)
text = RemoveInterjections(text);
st = new StripableText(text, " >-\"'`´♪¿¡.…—", " -\"'`´♪.!?:…—");
text = st.StrippedText;
@ -397,6 +407,38 @@ namespace Nikse.SubtitleEdit.Forms
return text;
}
private string RemoveInterjections(string text)
{
string[] arr = Configuration.Settings.Tools.Interjections.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string s in arr)
{
if (text.Contains(s))
{
Regex regex = new Regex(s);
Match match = regex.Match(text);
if (match.Success)
{
int index = match.Index;
string temp = text.Remove(index, s.Length);
while (temp.Length > 0 && (temp.StartsWith(" ") || temp.StartsWith(",")))
{
temp = temp.Remove(0, 1);
}
if (temp.Length > 0 && s[0].ToString() != s[0].ToString().ToLower())
{
temp = temp.Remove(0,1).Insert(0, temp[0].ToString().ToUpper());
}
StripableText st = new StripableText(temp);
if (st.StrippedText.Length == 0)
return string.Empty;
return temp;
}
}
}
return text;
}
private string RemoveEndTags(string newText)
{
string s = newText;
@ -514,5 +556,28 @@ namespace Nikse.SubtitleEdit.Forms
Cursor = Cursors.Default;
}
private void checkBoxRemoveInterjections_CheckedChanged(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
GeneratePreview();
Cursor = Cursors.Default;
}
private void buttonEditInterjections_Click(object sender, EventArgs e)
{
Interjections editInterjections = new Interjections();
editInterjections.Initialize(Configuration.Settings.Tools.Interjections);
if (editInterjections.ShowDialog(this) == DialogResult.OK)
{
Configuration.Settings.Tools.Interjections = editInterjections.GetInterjectionsSemiColonSeperatedString();
if (checkBoxRemoveInterjections.Checked)
{
Cursor = Cursors.WaitCursor;
GeneratePreview();
Cursor = Cursors.Default;
}
}
}
}
}

View File

@ -130,7 +130,7 @@ namespace Nikse.SubtitleEdit.Forms
this.Controls.Add(this.timeUpDownAdjust);
this.Controls.Add(this.labelHoursMinSecsMilliSecs);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;

View File

@ -993,6 +993,8 @@ can edit in same subtitle file (collaboration)",
After = "After",
LinesFoundX = "Lines found: {0}",
RemoveTextIfContains = "Remove text if it contains:",
RemoveInterjections = "Remove interjections (shh, hmm, etc.)",
EditInterjections = "Edit...",
};
ReplaceDialog = new LanguageStructure.ReplaceDialog

View File

@ -928,6 +928,8 @@
public string After { get; set; }
public string LinesFoundX { get; set; }
public string RemoveTextIfContains { get; set; }
public string RemoveInterjections { get; set; }
public string EditInterjections { get; set; }
}
public class ReplaceDialog

View File

@ -77,6 +77,7 @@ namespace Nikse.SubtitleEdit.Logic
public string MusicSymbol { get; set; }
public string MusicSymbolToReplace { get; set; }
public bool SpellCheckAutoChangeNames { get; set; }
public string Interjections { get; set; }
public ToolsSettings()
{
@ -87,6 +88,7 @@ namespace Nikse.SubtitleEdit.Logic
MusicSymbol = "♪";
MusicSymbolToReplace = "♪ ⶠ♪ âTª ã¢â™âª ?t×3 ?t¤3";
SpellCheckAutoChangeNames = true;
Interjections = "Ugh;Ughh;Hm;Hmm;Hmmm;Ahh;Whew;Phew;Gah;Oh;Ohh;Uh;Uhh;";
}
}
@ -672,6 +674,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("SpellCheckAutoChangeNames");
if (subNode != null)
settings.Tools.SpellCheckAutoChangeNames = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("Interjections");
if (subNode != null)
settings.Tools.Interjections = subNode.InnerText;
settings.SsaStyle = new Nikse.SubtitleEdit.Logic.SsaStyleSettings();
node = doc.DocumentElement.SelectSingleNode("SsaStyle");
@ -968,6 +973,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("MusicSymbol", settings.Tools.MusicSymbol);
textWriter.WriteElementString("MusicSymbolToReplace", settings.Tools.MusicSymbolToReplace);
textWriter.WriteElementString("SpellCheckAutoChangeNames", settings.Tools.SpellCheckAutoChangeNames.ToString());
textWriter.WriteElementString("Interjections", settings.Tools.Interjections);
textWriter.WriteEndElement();
textWriter.WriteStartElement("SsaStyle", "");

View File

@ -35,7 +35,7 @@ namespace Nikse.SubtitleEdit.Logic
{
for (int i = 0; i < 5; i++)
{
while (text.Length > 1 && _stripStartCharacters.Contains(text.Substring(0, 1)))
while (text.Length > 0 && _stripStartCharacters.Contains(text.Substring(0, 1)))
{
Pre += text.Substring(0, 1);
text = text.Substring(1);
@ -56,7 +56,7 @@ namespace Nikse.SubtitleEdit.Logic
{
for (int i = 0; i < 5; i++)
{
while (text.Length > 1 && _stripEndCharacters.Contains(text.Substring(text.Length - 1, 1)))
while (text.Length > 0 && _stripEndCharacters.Contains(text.Substring(text.Length - 1, 1)))
{
Post = text.Substring(text.Length - 1, 1) + Post;
text = text.Substring(0, text.Length - 1);

View File

@ -225,6 +225,12 @@
<Compile Include="Forms\GetDictionaries.Designer.cs">
<DependentUpon>GetDictionaries.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Interjections.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Interjections.Designer.cs">
<DependentUpon>Interjections.cs</DependentUpon>
</Compile>
<Compile Include="Forms\NetworkChat.cs">
<SubType>Form</SubType>
</Compile>
@ -660,6 +666,9 @@
<DependentUpon>GetDictionaries.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Interjections.resx">
<DependentUpon>Interjections.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\NetworkChat.resx">
<DependentUpon>NetworkChat.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,81 @@
using Nikse.SubtitleEdit.Forms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace Test
{
/// <summary>
///This is a test class for FormRemoveTextForHearImpairedTest and is intended
///to contain all FormRemoveTextForHearImpairedTest Unit Tests
///</summary>
[TestClass()]
public class RemoveTextForHearImpairedTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for RemoveColon
///</summary>
[TestMethod()]
[DeploymentItem("SubtitleEdit.exe")]
public void RemoveColonTest()
{
FormRemoveTextForHearImpaired_Accessor target = new FormRemoveTextForHearImpaired_Accessor(); // TODO: Initialize to an appropriate value
string text = "Man over P.A.:\r\nGive back our homes.";
string expected = "Give back our homes.";
string actual = target.RemoveColon(text);
Assert.AreEqual(expected, actual);
}
}
}

View File

@ -69,6 +69,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="FixCommonErrorsTest.cs" />
<Compile Include="RemoveTextForHearImpairedTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>