Some more remove HI fixes - thx sialivi

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@498 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-16 05:10:41 +00:00
parent fc09f286ec
commit 7cf31ed3f5
2 changed files with 35 additions and 7 deletions

View File

@ -59,7 +59,7 @@
//
// buttonOK
//
this.buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.Location = new System.Drawing.Point(523, 480);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
@ -70,7 +70,7 @@
//
// buttonCancel
//
this.buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
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(604, 480);
this.buttonCancel.Name = "buttonCancel";
@ -142,7 +142,7 @@
this.checkBoxRemoveTextBeforeColon.TabIndex = 10;
this.checkBoxRemoveTextBeforeColon.Text = "Remove text before a colon (:)";
this.checkBoxRemoveTextBeforeColon.UseVisualStyleBackColor = true;
this.checkBoxRemoveTextBeforeColon.CheckedChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
this.checkBoxRemoveTextBeforeColon.CheckedChanged += new System.EventHandler(this.checkBoxRemoveTextBeforeColon_CheckedChanged);
//
// groupBoxRemoveTextConditions
//
@ -363,7 +363,6 @@
this.Controls.Add(this.buttonCancel);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(705, 514);
this.Name = "FormRemoveTextForHearImpaired";
@ -371,6 +370,7 @@
this.Text = "Remove text for hearing impaired";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormRemoveTextForHearImpaired_FormClosing);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormRemoveTextForHearImpaired_KeyDown);
this.Resize += new System.EventHandler(this.FormRemoveTextForHearImpaired_Resize);
this.groupBoxLinesFound.ResumeLayout(false);
this.groupBoxRemoveTextConditions.ResumeLayout(false);
this.groupBoxRemoveTextConditions.PerformLayout();

View File

@ -320,6 +320,9 @@ namespace Nikse.SubtitleEdit.Forms
private string RemoveColon(string text)
{
if (!checkBoxRemoveTextBeforeColon.Checked)
return text;
if (text.IndexOf(":") < 0)
return text;
@ -357,7 +360,13 @@ namespace Nikse.SubtitleEdit.Forms
{
string content = s.Substring(indexOfColon + 1).Trim();
if (content != string.Empty)
newText = newText + Environment.NewLine + st.Pre + content + st.Post;
{
if (pre.Contains("<i>") && !content.Contains("</i>"))
newText = newText + Environment.NewLine + "<i>" + content;
else
newText = newText + Environment.NewLine + content;
}
// newText = newText + Environment.NewLine + st.Pre + content + st.Post;
newText = newText.Trim();
if (!IsHIDescription(st.StrippedText))
noOfNames++;
@ -420,8 +429,9 @@ namespace Nikse.SubtitleEdit.Forms
string[] arr = newText.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (arr.Length == 2 && arr[0].Length > 1 && arr[1].Length > 1)
{
string arr1 = arr[1].Replace("<i>", string.Empty).Trim();
if (arr1.Length > 1 && (Utilities.GetLetters(false, true, false) + ",").Contains(arr[0].Substring(arr[0].Length-1)) &&
string arr0 = new StripableText(arr[0]).StrippedText;
string arr1 = new StripableText(arr[1]).StrippedText;
if (arr0.Length > 0 && arr1.Length > 1 && (Utilities.GetLetters(false, true, false) + ",").Contains(arr0.Substring(arr0.Length-1)) &&
Utilities.GetLetters(false, true, false).Contains(arr1.Substring(0, 1)))
{
insertDash = false;
@ -539,6 +549,9 @@ namespace Nikse.SubtitleEdit.Forms
text = RemoveStartEndTags(text);
}
text = RemoveHearImpairedTags(text);
// fix 3 lines to two liners - if only two lines
if (noOfNamesRemoved >= 1 && Utilities.CountTagInText(text, Environment.NewLine) == 2)
{
@ -809,5 +822,20 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.RemoveTextForHearingImpaired.RemoveIfContainsText = comboBoxRemoveIfTextContains.Text;
}
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
{
int availableWidth = listViewFixes.Width - (listViewFixes.Columns[0].Width + listViewFixes.Columns[1].Width + 20);
listViewFixes.Columns[2].Width = availableWidth / 2;
listViewFixes.Columns[3].Width = availableWidth / 2;
}
private void checkBoxRemoveTextBeforeColon_CheckedChanged(object sender, EventArgs e)
{
checkBoxRemoveTextBeforeColonOnlyUppercase.Enabled = checkBoxRemoveTextBeforeColon.Checked;
Cursor = Cursors.WaitCursor;
GeneratePreview();
Cursor = Cursors.Default;
}
}
}