This commit is contained in:
Nikolaj Olsson 2021-01-23 07:34:44 +01:00
commit ebd06515b4
70 changed files with 299 additions and 74 deletions

View File

@ -2878,6 +2878,7 @@ namespace Nikse.SubtitleEdit.Core.Common
{
return text;
}
return sb.ToString().Replace(" ", " ").Replace(Environment.NewLine + " ", Environment.NewLine);
}
@ -2891,16 +2892,14 @@ namespace Nikse.SubtitleEdit.Core.Common
public static string RemoveUnicodeControlChars(string input)
{
input = input.Replace("\u200E", string.Empty);
input = input.Replace("\u200F", string.Empty);
input = input.Replace("\u202A", string.Empty);
input = input.Replace("\u202B", string.Empty);
input = input.Replace("\u202C", string.Empty);
input = input.Replace("\u202D", string.Empty);
input = input.Replace("\u202E", string.Empty);
input = input.Replace("\u00C2", " "); // no break space
input = input.Replace("\u00A0", " "); // no break space
return input;
return input.Replace("\u200E", string.Empty)
.Replace("\u200F", string.Empty)
.Replace("\u202A", string.Empty)
.Replace("\u202B", string.Empty)
.Replace("\u202C", string.Empty)
.Replace("\u202D", string.Empty)
.Replace("\u202E", string.Empty)
.Replace("\u00A0", " "); // no break space
}
}
}

View File

@ -267,6 +267,8 @@
this.ShowInTaskbar = false;
this.Text = "AddWaveformBatch";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AddWaveformBatch_KeyDown);
this.ResizeEnd += new System.EventHandler(this.AddWaveformBatch_ResizeEnd);
this.Shown += new System.EventHandler(this.AddWaveformBatch_Shown);
this.groupBoxInput.ResumeLayout(false);
this.groupBoxInput.PerformLayout();
this.contextMenuStripFiles.ResumeLayout(false);

View File

@ -429,6 +429,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void AddWaveformBatch_ResizeEnd(object sender, EventArgs e)
{
listViewInputFiles.Columns[listViewInputFiles.Columns.Count - 1].Width = -2;
}
private void AddWaveformBatch_Shown(object sender, EventArgs e)
{
AddWaveformBatch_ResizeEnd(sender, e);
}
private void contextMenuStripFiles_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
if (listViewInputFiles.Items.Count == 0)

View File

@ -320,8 +320,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Apply duration limits";
this.Shown += new System.EventHandler(this.ApplyDurationLimits_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ApplyDurationLimits_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ApplyDurationLimits_ResizeEnd);
this.Shown += new System.EventHandler(this.ApplyDurationLimits_Shown);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).EndInit();
this.groupBoxFixesAvailable.ResumeLayout(false);

View File

@ -260,8 +260,14 @@ namespace Nikse.SubtitleEdit.Forms
GeneratePreview();
}
private void ApplyDurationLimits_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
}
private void ApplyDurationLimits_Shown(object sender, EventArgs e)
{
ApplyDurationLimits_ResizeEnd(sender, e);
listViewFixes.Focus();
}

View File

@ -184,6 +184,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "AutoBreakUnbreakLines";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AutoBreakUnbreakLinesKeyDown);
this.ResizeEnd += new System.EventHandler(this.AutoBreakUnbreakLines_ResizeEnd);
this.Shown += new System.EventHandler(this.AutoBreakUnbreakLines_Shown);
this.groupBoxLinesFound.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);

View File

@ -175,6 +175,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void AutoBreakUnbreakLines_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
}
private void AutoBreakUnbreakLines_Shown(object sender, EventArgs e)
{
AutoBreakUnbreakLines_ResizeEnd(sender, e);
}
private void AddToListView(Paragraph p, string newText)
{
var item = new ListViewItem(string.Empty) { Tag = p, Checked = true };

View File

@ -2690,7 +2690,7 @@ namespace Nikse.SubtitleEdit.Forms
private void BatchConvert_Shown(object sender, EventArgs e)
{
BatchConvert_ResizeEnd(this, EventArgs.Empty);
BatchConvert_ResizeEnd(sender, e);
}
private void BatchConvert_ResizeEnd(object sender, EventArgs e)

View File

@ -110,6 +110,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "BookmarksGoTo";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BookmarksGoTo_KeyDown);
this.ResizeEnd += new System.EventHandler(this.BookmarksGoTo_ResizeEnd);
this.Shown += new System.EventHandler(this.BookmarksGoTo_Shown);
this.ResumeLayout(false);
}

View File

@ -72,5 +72,15 @@ namespace Nikse.SubtitleEdit.Forms
e.SuppressKeyPress = true;
}
}
private void BookmarksGoTo_ResizeEnd(object sender, EventArgs e)
{
listViewBookmarks.Columns[listViewBookmarks.Columns.Count - 1].Width = -2;
}
private void BookmarksGoTo_Shown(object sender, EventArgs e)
{
BookmarksGoTo_ResizeEnd(sender, e);
}
}
}

View File

@ -310,8 +310,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Change casing - Names";
this.Shown += new System.EventHandler(this.ChangeCasingNames_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ChangeCasingNames_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ChangeCasingNames_ResizeEnd);
this.Shown += new System.EventHandler(this.ChangeCasingNames_Shown);
this.groupBoxNames.ResumeLayout(false);
this.groupBoxNames.PerformLayout();
this.groupBoxLinesFound.ResumeLayout(false);

View File

@ -253,8 +253,15 @@ namespace Nikse.SubtitleEdit.Forms
GeneratePreview();
}
private void ChangeCasingNames_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
listViewNames.Columns[listViewNames.Columns.Count - 1].Width = -2;
}
private void ChangeCasingNames_Shown(object sender, EventArgs e)
{
ChangeCasingNames_ResizeEnd(sender, e);
listViewNames.ItemChecked += ListViewNamesItemChecked;
}

View File

@ -170,8 +170,10 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose encoding";
this.Load += new System.EventHandler(this.ChooseEncoding_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormChooseEncoding_KeyDown);
this.Load += new System.EventHandler(this.ChooseEncoding_Load);
this.ResizeEnd += new System.EventHandler(this.ChooseEncoding_ResizeEnd);
this.Shown += new System.EventHandler(this.ChooseEncoding_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -73,6 +73,14 @@ namespace Nikse.SubtitleEdit.Forms
listView1.EndUpdate();
}
private void ChooseEncoding_Load(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count >= 1)
{
listView1.EnsureVisible(listView1.SelectedItems[0].Index);
}
}
private void FormChooseEncoding_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
@ -81,6 +89,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ChooseEncoding_ResizeEnd(object sender, EventArgs e)
{
listView1.Columns[listView1.Columns.Count - 1].Width = -2;
}
private void ChooseEncoding_Shown(object sender, EventArgs e)
{
ChooseEncoding_ResizeEnd(sender, e);
}
internal Encoding GetEncoding()
{
return _encoding;
@ -114,14 +132,6 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ChooseEncoding_Load(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count >= 1)
{
listView1.EnsureVisible(listView1.SelectedItems[0].Index);
}
}
private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
ListViewSorter sorter = (ListViewSorter)listView1.ListViewItemSorter;

View File

@ -146,6 +146,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose style";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ChooseStyle_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ChooseStyle_ResizeEnd);
this.Shown += new System.EventHandler(this.ChooseStyle_Shown);
this.groupBoxStyles.ResumeLayout(false);
this.ResumeLayout(false);

View File

@ -47,6 +47,15 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = DialogResult.Cancel;
}
}
private void ChooseStyle_ResizeEnd(object sender, EventArgs e)
{
listViewStyles.Columns[listViewStyles.Columns.Count - 1].Width = -2;
}
private void ChooseStyle_Shown(object sender, EventArgs e)
{
ChooseStyle_ResizeEnd(sender, e);
}
private void buttonOK_Click(object sender, EventArgs e)
{

View File

@ -262,6 +262,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Export custom text format";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExportCustomText_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ExportCustomText_ResizeEnd);
this.Shown += new System.EventHandler(this.ExportCustomText_Shown);
this.contextMenuStrip1.ResumeLayout(false);
this.groupBoxFormats.ResumeLayout(false);
this.groupBoxPreview.ResumeLayout(false);

View File

@ -337,6 +337,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ExportCustomText_ResizeEnd(object sender, EventArgs e)
{
listViewTemplates.Columns[listViewTemplates.Columns.Count - 1].Width = -2;
}
private void ExportCustomText_Shown(object sender, EventArgs e)
{
ExportCustomText_ResizeEnd(sender, e);
}
private void buttonDelete_Click(object sender, EventArgs e)
{
Delete();

View File

@ -1075,10 +1075,10 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ExportPngXml";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ExportPngXml_FormClosing);
this.Shown += new System.EventHandler(this.ExportPngXml_Shown);
this.ResizeEnd += new System.EventHandler(this.ExportPngXml_ResizeEnd);
this.SizeChanged += new System.EventHandler(this.ExportPngXml_SizeChanged);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExportPngXml_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ExportPngXml_ResizeEnd);
this.Shown += new System.EventHandler(this.ExportPngXml_Shown);
this.SizeChanged += new System.EventHandler(this.ExportPngXml_SizeChanged);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.groupBoxImageSettings.ResumeLayout(false);

View File

@ -4898,7 +4898,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
private void ExportPngXml_Shown(object sender, EventArgs e)
{
_isLoading = false;
subtitleListView1_SelectedIndexChanged(null, null);
ExportPngXml_ResizeEnd(sender, e);
}
private void comboBoxHAlign_SelectedIndexChanged(object sender, EventArgs e)

View File

@ -308,7 +308,7 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxStep1.Visible = true;
listView1.Columns[0].Width = 50;
listView1.Columns[1].Width = 310;
listView1.Columns[2].Width = 400;
listView1.Columns[2].Width = -2;
UiUtil.InitializeSubtitleFont(textBoxListViewText);
UiUtil.InitializeSubtitleFont(subtitleListView1);
@ -1781,6 +1781,8 @@ namespace Nikse.SubtitleEdit.Forms
public void ListViewFixesAutoSizeAllColumns()
{
listView1.Columns[listView1.Columns.Count - 1].Width = -2;
using (var graphics = CreateGraphics())
{
var timestampSizeF = graphics.MeasureString(listViewFixes.Columns[0].Text, Font); // Apply

View File

@ -197,6 +197,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ImportImages";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ImportImages_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ImportImages_ResizeEnd);
this.Shown += new System.EventHandler(this.ImportImages_Shown);
this.groupBoxInput.ResumeLayout(false);
this.groupBoxInput.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);

View File

@ -165,6 +165,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ImportImages_ResizeEnd(object sender, EventArgs e)
{
listViewInputFiles.Columns[listViewInputFiles.Columns.Count - 1].Width = -2;
}
private void ImportImages_Shown(object sender, EventArgs e)
{
ImportImages_ResizeEnd(sender, e);
}
private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
if (listViewInputFiles.Items.Count == 0)

View File

@ -714,8 +714,9 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Import text";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ImportText_FormClosing);
this.Shown += new System.EventHandler(this.ImportText_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ImportTextKeyDown);
this.ResizeEnd += new System.EventHandler(this.ImportText_ResizeEnd);
this.Shown += new System.EventHandler(this.ImportText_Shown);
this.groupBoxImportText.ResumeLayout(false);
this.groupBoxImportText.PerformLayout();
this.contextMenuStripListView.ResumeLayout(false);

View File

@ -1323,8 +1323,15 @@ namespace Nikse.SubtitleEdit.Forms
listViewInputFiles.Items.Clear();
}
private void ImportText_ResizeEnd(object sender, EventArgs e)
{
listViewInputFiles.Columns[listViewInputFiles.Columns.Count - 1].Width = -2;
}
private void ImportText_Shown(object sender, EventArgs e)
{
ImportText_ResizeEnd(sender, e);
if (textBoxText.Visible && textBoxText.Text.Length > 20)
{
buttonOK.Focus();

View File

@ -250,9 +250,9 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Join subtitles";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.JoinSubtitles_FormClosing);
this.Shown += new System.EventHandler(this.JoinSubtitles_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.JoinSubtitles_KeyDown);
this.Resize += new System.EventHandler(this.JoinSubtitles_Resize);
this.Shown += new System.EventHandler(this.JoinSubtitles_Shown);
this.groupBoxPreview.ResumeLayout(false);
this.groupBoxPreview.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownAddMs)).EndInit();

View File

@ -259,7 +259,7 @@ namespace Nikse.SubtitleEdit.Forms
private void JoinSubtitles_Resize(object sender, EventArgs e)
{
columnHeaderFileName.Width = -2;
JoinSubtitles_Resize(this, EventArgs.Empty);
}
private void ButtonAddSubtitleClick(object sender, EventArgs e)

View File

@ -1089,7 +1089,7 @@ namespace Nikse.SubtitleEdit.Forms
// }
//}
if (index == _subtitleListViewIndex)
if (index == _subtitleListViewIndex && _subtitleListViewIndex != -1)
{
// Make history item for rollback (change paragraph back for history + change again)
_subtitle.Paragraphs[index] = new Paragraph(beforeParagraph);
@ -7511,14 +7511,14 @@ namespace Nikse.SubtitleEdit.Forms
while (startIndex >= 0 && startIndex < p.Text.Length && p.Text.Substring(startIndex).Contains(oldWord))
{
bool startOk = startIndex == 0 ||
"«»“” <>-—+/'\"[](){}¿¡….,;:!?%&$£\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00C2\u00A0".Contains(p.Text[startIndex - 1]) ||
"«»“” <>-—+/'\"[](){}¿¡….,;:!?%&$£\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00A0".Contains(p.Text[startIndex - 1]) ||
char.IsPunctuation(p.Text[startIndex - 1]) ||
startIndex == p.Text.Length - oldWord.Length;
if (startOk)
{
int end = startIndex + oldWord.Length;
if (end <= p.Text.Length && end == p.Text.Length ||
"«»“” ,.!?:;'()<>\"-—+/[]{}%&$£…\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00C2\u00A0".Contains(p.Text[end]) ||
"«»“” ,.!?:;'()<>\"-—+/[]{}%&$£…\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00A0".Contains(p.Text[end]) ||
char.IsPunctuation(p.Text[end]))
{
var lengthBefore = p.Text.Length;

View File

@ -160,6 +160,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Choose subtitle from Matroska file";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMatroskaSubtitleChooser_KeyDown);
this.ResizeEnd += new System.EventHandler(this.FormMatroskaSubtitleChooser_ResizeEnd);
this.Shown += new System.EventHandler(this.FormMatroskaSubtitleChooser_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -77,6 +77,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void FormMatroskaSubtitleChooser_ResizeEnd(object sender, EventArgs e)
{
listView1.Columns[listView1.Columns.Count - 1].Width = -2;
}
private void FormMatroskaSubtitleChooser_Shown(object sender, EventArgs e)
{
FormMatroskaSubtitleChooser_ResizeEnd(sender, e);
}
private void ButtonOkClick(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;

View File

@ -227,9 +227,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Merge lines with same text";
this.Shown += new System.EventHandler(this.MergeDoubleLines_Shown);
this.ResizeEnd += new System.EventHandler(this.MergeDoubleLines_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MergeDoubleLines_KeyDown);
this.ResizeEnd += new System.EventHandler(this.MergeDoubleLines_ResizeEnd);
this.Shown += new System.EventHandler(this.MergeDoubleLines_Shown);
this.groupBoxLinesFound.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxMillisecondsBetweenLines)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);

View File

@ -55,7 +55,6 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.AutoSizeAllColumns(this);
NumberOfMerges = 0;
_subtitle = subtitle;
MergeDoubleLines_ResizeEnd(null, null);
}
private void AddToListView(Paragraph p, string lineNumbers, string newText)
@ -292,6 +291,8 @@ namespace Nikse.SubtitleEdit.Forms
private void MergeDoubleLines_Shown(object sender, EventArgs e)
{
MergeDoubleLines_ResizeEnd(sender, e);
GeneratePreview();
listViewFixes.Focus();
if (listViewFixes.Items.Count > 0)

View File

@ -272,8 +272,9 @@ namespace Nikse.SubtitleEdit.Forms
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "MergeShortLines";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MergeShortLines_FormClosing);
this.Shown += new System.EventHandler(this.MergeShortLines_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MergeShortLines_KeyDown);
this.ResizeEnd += new System.EventHandler(this.MergeShortLines_ResizeEnd);
this.Shown += new System.EventHandler(this.MergeShortLines_Shown);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharacters)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxMillisecondsBetweenLines)).EndInit();
this.groupBoxLinesFound.ResumeLayout(false);

View File

@ -285,8 +285,15 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxLinesFound.Text = string.Format(LanguageSettings.Current.MergedShortLines.NumberOfMergesX, NumberOfMerges);
}
private void MergeShortLines_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
}
private void MergeShortLines_Shown(object sender, EventArgs e)
{
MergeShortLines_ResizeEnd(sender, e);
GeneratePreview();
listViewFixes.Focus();
if (listViewFixes.Items.Count > 0)

View File

@ -224,9 +224,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "MergeTextWithSameTimeCodes";
this.Shown += new System.EventHandler(this.MergeTextWithSameTimeCodes_Shown);
this.ResizeEnd += new System.EventHandler(this.MergeTextWithSameTimeCodes_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MergeTextWithSameTimeCodes_KeyDown);
this.ResizeEnd += new System.EventHandler(this.MergeTextWithSameTimeCodes_ResizeEnd);
this.Shown += new System.EventHandler(this.MergeTextWithSameTimeCodes_Shown);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxMillisecondsBetweenLines)).EndInit();
this.groupBoxLinesFound.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);

View File

@ -55,7 +55,6 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.AutoSizeAllColumns(this);
NumberOfMerges = 0;
_subtitle = subtitle;
MergeTextWithSameTimeCodes_ResizeEnd(null, null);
_language = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle);
}
@ -200,6 +199,8 @@ namespace Nikse.SubtitleEdit.Forms
private void MergeTextWithSameTimeCodes_Shown(object sender, EventArgs e)
{
MergeTextWithSameTimeCodes_ResizeEnd(sender, e);
GeneratePreview();
listViewFixes.Focus();
if (listViewFixes.Items.Count > 0)

View File

@ -342,6 +342,7 @@
this.Text = "Create/modify selection";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ModifySelection_KeyDown);
this.Resize += new System.EventHandler(this.ModifySelection_Resize);
this.Shown += new System.EventHandler(this.ModifySelection_Shown);
this.groupBoxWhatToDo.ResumeLayout(false);
this.groupBoxWhatToDo.PerformLayout();
this.groupBoxRule.ResumeLayout(false);

View File

@ -136,7 +136,6 @@ namespace Nikse.SubtitleEdit.Forms
{
listViewFixes.Columns.Remove(columnHeaderStyle);
}
ModifySelection_Resize(null, null);
_loading = false;
Preview();
@ -545,6 +544,12 @@ namespace Nikse.SubtitleEdit.Forms
private void ModifySelection_Resize(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
listViewStyles.Columns[listViewStyles.Columns.Count - 1].Width = -2;
}
private void ModifySelection_Shown(object sender, EventArgs e)
{
ModifySelection_Resize(sender, e);
}
private void listViewStyles_ItemChecked(object sender, ItemCheckedEventArgs e)

View File

@ -17,6 +17,7 @@ namespace Nikse.SubtitleEdit.Forms
public MultipleReplaceExportImport(List<MultipleSearchAndReplaceGroup> groups, bool export)
{
InitializeComponent();
UiUtil.FixFonts(this);
_groups = groups;
_export = export;

View File

@ -324,7 +324,7 @@ namespace Nikse.SubtitleEdit.Forms
private void NetflixFixErrors_Shown(object sender, EventArgs e)
{
NetflixFixErrors_ResizeEnd(this, EventArgs.Empty);
NetflixFixErrors_ResizeEnd(sender, e);
}
}
}

View File

@ -143,6 +143,8 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "NetworkChat";
this.ResizeEnd += new System.EventHandler(this.NetworkChat_ResizeEnd);
this.Shown += new System.EventHandler(this.NetworkChat_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Forms.Networking
{
public sealed partial class NetworkChat : Form
{
private Logic.Networking.NikseWebServiceSession _networkSession;
private NikseWebServiceSession _networkSession;
protected override bool ShowWithoutActivation => true;
@ -119,5 +119,16 @@ namespace Nikse.SubtitleEdit.Forms.Networking
listViewUsers.Items.Remove(removeItem);
}
}
private void NetworkChat_ResizeEnd(object sender, EventArgs e)
{
listViewChat.Columns[listViewChat.Columns.Count - 1].Width = -2;
listViewUsers.Columns[listViewUsers.Columns.Count - 1].Width = -2;
}
private void NetworkChat_Shown(object sender, EventArgs e)
{
NetworkChat_ResizeEnd(sender, e);
}
}
}

View File

@ -483,6 +483,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Binary image compare - train";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BinaryOcrTrain_FormClosing);
this.ResizeEnd += new System.EventHandler(this.BinaryOcrTrain_ResizeEnd);
this.Shown += new System.EventHandler(this.BinaryOcrTrain_Shown);
this.groupBoxTrainingOptions.ResumeLayout(false);
this.groupBoxTrainingOptions.PerformLayout();

View File

@ -350,6 +350,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
_autoDetectFontText = text;
}
private void BinaryOcrTrain_ResizeEnd(object sender, EventArgs e)
{
listViewFonts.Columns[listViewFonts.Columns.Count - 1].Width = -2;
}
private void BinaryOcrTrain_Shown(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(_autoDetectFontText))
@ -357,7 +362,8 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
return;
}
SelectAll_Click(null, null);
BinaryOcrTrain_ResizeEnd(sender, e);
SelectAll_Click(this, EventArgs.Empty);
int numberOfCharactersLearned = 0;
int numberOfCharactersSkipped = 0;
foreach (ListViewItem fontItem in listViewFonts.CheckedItems)

View File

@ -112,7 +112,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (word != null && richTextBoxParagraph.Text.Contains(word))
{
const string expectedWordBoundaryChars = " <>-\"”„“«»[]'`´¶()♪¿¡.…—!?,:;/\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00C2\u00A0";
const string expectedWordBoundaryChars = " <>-\"”„“«»[]'`´¶()♪¿¡.…—!?,:;/\r\n؛،؟\u200E\u200F\u202A\u202B\u202C\u202D\u202E\u00A0";
for (int i = 0; i < richTextBoxParagraph.Text.Length; i++)
{
if (richTextBoxParagraph.Text.Substring(i).StartsWith(word, StringComparison.Ordinal))

View File

@ -207,6 +207,7 @@
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.ResizeEnd += new System.EventHandler(this.VobSubCharactersImport_ResizeEnd);
this.Shown += new System.EventHandler(this.VobSubCharactersImport_Shown);
this.groupBoxCurrentImage.ResumeLayout(false);
this.groupBoxCurrentImage.PerformLayout();

View File

@ -37,8 +37,15 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
}
private void VobSubCharactersImport_ResizeEnd(object sender, EventArgs e)
{
listView1.Columns[listView1.Columns.Count - 1].Width = -2;
}
private void VobSubCharactersImport_Shown(object sender, EventArgs e)
{
VobSubCharactersImport_ResizeEnd(sender, e);
openFileDialog1.Filter = "Binary OCR db files|*.db";
openFileDialog1.FileName = string.Empty;
openFileDialog1.InitialDirectory = Configuration.OcrDirectory;

View File

@ -385,6 +385,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "nOCR Train";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VobSubNOcrTrain_FormClosing);
this.ResizeEnd += new System.EventHandler(this.VobSubNOcrTrain_ResizeEnd);
this.Shown += new System.EventHandler(this.VobSubNOcrTrain_Shown);
this.groupBoxTrainingOptions.ResumeLayout(false);
this.groupBoxTrainingOptions.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSegmentsPerCharacter)).EndInit();

View File

@ -404,5 +404,15 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
Configuration.Settings.Tools.OcrTrainSrtFile = textBoxInputFile.Text;
Configuration.Settings.Tools.OcrTrainMergedLetters = textBoxMerged.Text;
}
private void VobSubNOcrTrain_ResizeEnd(object sender, EventArgs e)
{
listViewFonts.Columns[listViewFonts.Columns.Count - 1].Width = -2;
}
private void VobSubNOcrTrain_Shown(object sender, EventArgs e)
{
VobSubNOcrTrain_ResizeEnd(sender, e);
}
}
}

View File

@ -650,6 +650,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Profiles";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SettingsProfile_KeyDown);
this.ResizeEnd += new System.EventHandler(this.SettingsProfile_ResizeEnd);
this.Shown += new System.EventHandler(this.SettingsProfile_Shown);
this.groupBoxStyles.ResumeLayout(false);
this.groupBoxStyles.PerformLayout();
this.groupBoxGeneralRules.ResumeLayout(false);

View File

@ -119,6 +119,16 @@ namespace Nikse.SubtitleEdit.Forms.Options
}
}
private void SettingsProfile_ResizeEnd(object sender, EventArgs e)
{
listViewProfiles.Columns[listViewProfiles.Columns.Count - 1].Width = -2;
}
private void SettingsProfile_Shown(object sender, EventArgs e)
{
SettingsProfile_ResizeEnd(sender, e);
}
private void buttonRemoveAll_Click(object sender, EventArgs e)
{
RulesProfiles.Clear();

View File

@ -14,6 +14,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
public SettingsProfileExport(List<RulesProfile> profiles)
{
InitializeComponent();
UiUtil.FixFonts(this);
listViewExportStyles.Columns[0].Width = listViewExportStyles.Width - 20;
foreach (var profile in profiles)

View File

@ -411,7 +411,7 @@ namespace Nikse.SubtitleEdit.Forms
private void PluginsGet_Shown(object sender, EventArgs e)
{
PluginsGet_ResizeEnd(this, EventArgs.Empty);
PluginsGet_ResizeEnd(sender, e);
}
private void buttonRemove_Click(object sender, EventArgs e)

View File

@ -128,8 +128,9 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ProfileChoose";
this.Shown += new System.EventHandler(this.ProfileChoose_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ProfileChoose_KeyDown);
this.ResizeEnd += new System.EventHandler(this.ProfileChoose_ResizeEnd);
this.Shown += new System.EventHandler(this.ProfileChoose_Shown);
this.ResumeLayout(false);
}

View File

@ -119,8 +119,15 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ProfileChoose_ResizeEnd(object sender, EventArgs e)
{
listViewProfiles.Columns[listViewProfiles.Columns.Count - 1].Width = -2;
}
private void ProfileChoose_Shown(object sender, EventArgs e)
{
ProfileChoose_ResizeEnd(sender, e);
if (listViewProfiles.SelectedIndices.Count == 0)
{
return;

View File

@ -480,9 +480,10 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Remove text for hearing impaired";
this.Load += new System.EventHandler(this.FormRemoveTextForHearImpaired_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormRemoveTextForHearImpaired_KeyDown);
this.Load += new System.EventHandler(this.FormRemoveTextForHearImpaired_Load);
this.Resize += new System.EventHandler(this.FormRemoveTextForHearImpaired_Resize);
this.Shown += new System.EventHandler(this.FormRemoveTextForHearImpaired_Shown);
this.groupBoxLinesFound.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.groupBoxRemoveTextConditions.ResumeLayout(false);

View File

@ -271,9 +271,13 @@ namespace Nikse.SubtitleEdit.Forms
private void FormRemoveTextForHearImpaired_Resize(object sender, EventArgs e)
{
int availableWidth = (listViewFixes.Width - (columnHeaderApply.Width + columnHeaderLine.Width + 20)) / 2;
columnHeaderBefore.Width = availableWidth;
columnHeaderAfter.Width = availableWidth;
columnHeaderAfter.Width = -2;
}
private void FormRemoveTextForHearImpaired_Shown(object sender, EventArgs e)
{
FormRemoveTextForHearImpaired_Resize(sender, e);
}
private void checkBoxRemoveTextBeforeColon_CheckedChanged(object sender, EventArgs e)

View File

@ -155,10 +155,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Restore auto-backup";
this.Shown += new System.EventHandler(this.RestoreAutoBackup_Shown);
this.ResizeEnd += new System.EventHandler(this.RestoreAutoBackup_ResizeEnd);
this.SizeChanged += new System.EventHandler(this.RestoreAutoBackup_SizeChanged);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.RestoreAutoBackup_KeyDown);
this.ResizeEnd += new System.EventHandler(this.RestoreAutoBackup_ResizeEnd);
this.Shown += new System.EventHandler(this.RestoreAutoBackup_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -49,7 +49,7 @@ namespace Nikse.SubtitleEdit.Forms
private void RestoreAutoBackup_Shown(object sender, EventArgs e)
{
listViewBackups.Columns[2].Width = -2;
RestoreAutoBackup_ResizeEnd(sender, e);
if (Directory.Exists(Configuration.AutoBackupDirectory))
{
_files = Directory.GetFiles(Configuration.AutoBackupDirectory, "*.*");
@ -137,12 +137,7 @@ namespace Nikse.SubtitleEdit.Forms
private void RestoreAutoBackup_ResizeEnd(object sender, EventArgs e)
{
listViewBackups.Columns[2].Width = -2;
}
private void RestoreAutoBackup_SizeChanged(object sender, EventArgs e)
{
listViewBackups.Columns[2].Width = -2;
listViewBackups.Columns[listViewBackups.Columns.Count - 1].Width = -2;
}
private void linkLabelOpenContainingFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

View File

@ -139,6 +139,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "History (for undo)";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormShowHistory_KeyDown);
this.ResizeEnd += new System.EventHandler(this.FormShowHistory_ResizeEnd);
this.Shown += new System.EventHandler(this.FormShowHistory_Shown);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -74,6 +74,16 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void FormShowHistory_ResizeEnd(object sender, EventArgs e)
{
listViewHistory.Columns[listViewHistory.Columns.Count - 1].Width = -2;
}
private void FormShowHistory_Shown(object sender, EventArgs e)
{
FormShowHistory_ResizeEnd(sender, e);
}
private void ButtonOkClick(object sender, EventArgs e)
{
if (listViewHistory.SelectedItems.Count > 0)

View File

@ -373,10 +373,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Split";
this.Shown += new System.EventHandler(this.Split_Shown);
this.ResizeEnd += new System.EventHandler(this.Split_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Split_KeyDown);
this.Resize += new System.EventHandler(this.Split_Resize);
this.ResizeEnd += new System.EventHandler(this.Split_ResizeEnd);
this.Shown += new System.EventHandler(this.Split_Shown);
this.groupBoxSplitOptions.ResumeLayout(false);
this.groupBoxSplitOptions.PerformLayout();
this.groupBoxSubtitleInfo.ResumeLayout(false);

View File

@ -311,14 +311,10 @@ namespace Nikse.SubtitleEdit.Forms
private void Split_Shown(object sender, EventArgs e)
{
_loading = false;
Split_ResizeEnd(sender, e);
CalculateParts();
}
private void Split_Resize(object sender, EventArgs e)
{
columnHeaderFileName.Width = -2;
}
private void Split_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)

View File

@ -322,8 +322,9 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Split long lines";
this.Shown += new System.EventHandler(this.SplitLongLines_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SplitLongLines_KeyDown);
this.ResizeEnd += new System.EventHandler(this.SplitLongLines_ResizeEnd);
this.Shown += new System.EventHandler(this.SplitLongLines_Shown);
this.groupBoxLinesFound.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSingleLineMaxCharacters)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownLineMaxCharacters)).EndInit();

View File

@ -355,8 +355,15 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void SplitLongLines_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
}
private void SplitLongLines_Shown(object sender, EventArgs e)
{
SplitLongLines_ResizeEnd(sender, e);
GeneratePreview(true);
listViewFixes.Focus();
if (listViewFixes.Items.Count > 0)

View File

@ -20,6 +20,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
public SubStationAlphaStylesExport(string header, bool isSubStationAlpha, SubtitleFormat format)
{
InitializeComponent();
UiUtil.FixFonts(this);
_header = header;
_isSubStationAlpha = isSubStationAlpha;

View File

@ -109,6 +109,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "YouTubeAnnotationsImport";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.YouTubeAnnotationsImport_KeyDown);
this.ResizeEnd += new System.EventHandler(this.YouTubeAnnotationsImport_ResizeEnd);
this.Shown += new System.EventHandler(this.YouTubeAnnotationsImport_Shown);
this.ResumeLayout(false);
}

View File

@ -1,4 +1,5 @@
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
@ -51,5 +52,15 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = DialogResult.Cancel;
}
}
private void YouTubeAnnotationsImport_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
}
private void YouTubeAnnotationsImport_Shown(object sender, EventArgs e)
{
YouTubeAnnotationsImport_ResizeEnd(sender, e);
}
}
}

View File

@ -784,11 +784,11 @@
<Compile Include="Forms\Ocr\OCRSpellCheck.Designer.cs">
<DependentUpon>OCRSpellCheck.cs</DependentUpon>
</Compile>
<Compile Include="Forms\RemoveTextFromHearImpaired.cs">
<Compile Include="Forms\RemoveTextForHearImpaired.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\RemoveTextFromHearImpaired.Designer.cs">
<DependentUpon>RemoveTextFromHearImpaired.cs</DependentUpon>
<Compile Include="Forms\RemoveTextForHearImpaired.Designer.cs">
<DependentUpon>RemoveTextForHearImpaired.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ReplaceDialog.cs">
<SubType>Form</SubType>
@ -1529,8 +1529,8 @@
<EmbeddedResource Include="Forms\MergeShortLines.resx">
<DependentUpon>MergeShortLines.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RemoveTextFromHearImpaired.resx">
<DependentUpon>RemoveTextFromHearImpaired.cs</DependentUpon>
<EmbeddedResource Include="Forms\RemoveTextForHearImpaired.resx">
<DependentUpon>RemoveTextForHearImpaired.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ReplaceDialog.resx">