Working on no-break-after list

This commit is contained in:
niksedk 2014-04-10 20:09:26 +02:00
parent 52700a1d82
commit cbe7bfaaf6
3 changed files with 19 additions and 2 deletions

View File

@ -115,6 +115,7 @@
this.textBoxNoBreakAfter.Name = "textBoxNoBreakAfter"; this.textBoxNoBreakAfter.Name = "textBoxNoBreakAfter";
this.textBoxNoBreakAfter.Size = new System.Drawing.Size(218, 20); this.textBoxNoBreakAfter.Size = new System.Drawing.Size(218, 20);
this.textBoxNoBreakAfter.TabIndex = 24; this.textBoxNoBreakAfter.TabIndex = 24;
this.textBoxNoBreakAfter.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxNoBreakAfter_KeyDown);
// //
// buttonAddNoBreakAfter // buttonAddNoBreakAfter
// //

View File

@ -101,6 +101,7 @@ namespace Nikse.SubtitleEdit
{ {
listBoxNoBreakAfter.SelectedIndex = first; listBoxNoBreakAfter.SelectedIndex = first;
} }
comboBoxDictionaries.Enabled = false;
} }
private void buttonOK_Click(object sender, System.EventArgs e) private void buttonOK_Click(object sender, System.EventArgs e)
@ -155,6 +156,17 @@ namespace Nikse.SubtitleEdit
} }
} }
_noBreakAfterList.Add(item); _noBreakAfterList.Add(item);
comboBoxDictionaries.Enabled = false;
ShowBreakAfterList(_noBreakAfterList);
for (int i = 0; i < listBoxNoBreakAfter.Items.Count; i++ )
{
if (listBoxNoBreakAfter.Items[i].ToString() == item.Text)
{
listBoxNoBreakAfter.SelectedIndex = i;
return;
}
}
textBoxNoBreakAfter.Text = string.Empty;
} }
private void RadioButtonCheckedChanged(object sender, EventArgs e) private void RadioButtonCheckedChanged(object sender, EventArgs e)
@ -185,5 +197,11 @@ namespace Nikse.SubtitleEdit
} }
} }
private void textBoxNoBreakAfter_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
buttonAddNamesEtc_Click(sender, e);
}
} }
} }

View File

@ -358,12 +358,10 @@ namespace Nikse.SubtitleEdit.Logic
string s2 = s.Substring(0, index); string s2 = s.Substring(0, index);
if (Configuration.Settings.Tools.UseNoLineBreakAfter) if (Configuration.Settings.Tools.UseNoLineBreakAfter)
{ {
foreach (NoBreakAfterItem ending in NoBreakAfterList(language)) foreach (NoBreakAfterItem ending in NoBreakAfterList(language))
{ {
if (ending.IsMatch(s2)) if (ending.IsMatch(s2))
return false; return false;
} }
} }