From 974714faa884cc4d1e716562cbd6e661967ead17 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 25 Jan 2011 18:47:14 +0000 Subject: [PATCH] Fixed a bug in subtitle list view sizing + added more auto resizing git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@284 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Controls/SubtitleListView.cs | 2 +- src/Forms/FixCommonErrors.cs | 1 + src/Forms/GoogleTranslate.cs | 4 ++++ src/Forms/ImportText.cs | 3 ++- src/Forms/Main.cs | 7 +++++-- src/Forms/Main.resx | 2 +- src/Forms/MergeShortLines.cs | 3 ++- src/Forms/RemoveTextFromHearImpaired.cs | 2 +- src/Forms/Settings.cs | 2 +- src/Forms/SplitLongLines.cs | 3 ++- src/Forms/SplitSubtitle.Designer.cs | 10 +++++----- src/Forms/SyncPointsSync.cs | 2 ++ src/Forms/VobSubOcr.cs | 3 +++ src/Logic/Settings.cs | 2 +- src/Logic/Utilities.cs | 4 ++++ 15 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/Controls/SubtitleListView.cs b/src/Controls/SubtitleListView.cs index 515a87a51..0c63514a1 100644 --- a/src/Controls/SubtitleListView.cs +++ b/src/Controls/SubtitleListView.cs @@ -56,7 +56,7 @@ namespace Nikse.SubtitleEdit.Controls Columns[ColumnIndexStart].Width = timeStampWidth; Columns[ColumnIndexEnd].Width = timeStampWidth; - Columns[ColumnIndexDuration].Width = Columns[ColumnIndexDuration].Width+12; + Columns[ColumnIndexDuration].Width = (int) (timeStampWidth * 0.8); SubtitleListView_Resize(this, null); } diff --git a/src/Forms/FixCommonErrors.cs b/src/Forms/FixCommonErrors.cs index 425c66889..ca9dcd311 100644 --- a/src/Forms/FixCommonErrors.cs +++ b/src/Forms/FixCommonErrors.cs @@ -183,6 +183,7 @@ namespace Nikse.SubtitleEdit.Forms listView1.Columns[2].Width = 400; Utilities.InitializeSubtitleFont(textBoxListViewText); + Utilities.InitializeSubtitleFont(subtitleListView1); listViewFixes.ListViewItemSorter = new ListViewSorter { ColumnNumber = 1, IsNumber = true }; if (Screen.PrimaryScreen.WorkingArea.Width <= 124) diff --git a/src/Forms/GoogleTranslate.cs b/src/Forms/GoogleTranslate.cs index c66ce81c1..482fa1307 100644 --- a/src/Forms/GoogleTranslate.cs +++ b/src/Forms/GoogleTranslate.cs @@ -64,6 +64,10 @@ namespace Nikse.SubtitleEdit.Forms subtitleListViewFrom.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); subtitleListViewTo.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); + Utilities.InitializeSubtitleFont(subtitleListViewFrom); + Utilities.InitializeSubtitleFont(subtitleListViewTo); + subtitleListViewFrom.AutoSizeAllColumns(this); + subtitleListViewTo.AutoSizeAllColumns(this); FixLargeFonts(); } diff --git a/src/Forms/ImportText.cs b/src/Forms/ImportText.cs index 3a6fea30c..c081f384a 100644 --- a/src/Forms/ImportText.cs +++ b/src/Forms/ImportText.cs @@ -41,6 +41,8 @@ namespace Nikse.SubtitleEdit.Forms buttonOK.Text = Configuration.Settings.Language.ImportText.Next; buttonCancel.Text = Configuration.Settings.Language.General.Cancel; SubtitleListview1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); + Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); numericUpDownDurationFixed.Enabled = radioButtonDurationFixed.Checked; FixLargeFonts(); @@ -52,7 +54,6 @@ namespace Nikse.SubtitleEdit.Forms SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font); if (textSize.Height > buttonOK.Height - 4) { - SubtitleListview1.InitializeTimeStampColumWidths(this); int newButtonHeight = (int)(textSize.Height + 7 + 0.5); Utilities.SetButtonHeight(this, newButtonHeight, 1); } diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index de8d43f62..eefa06a7b 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -197,6 +197,7 @@ namespace Nikse.SubtitleEdit.Forms Utilities.InitializeSubtitleFont(textBoxSource); Utilities.InitializeSubtitleFont(textBoxListViewText); Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); tabControlSubtitle.SelectTab(TabControlSourceView); // AC ShowSourceLineNumber(); // AC @@ -485,7 +486,7 @@ namespace Nikse.SubtitleEdit.Forms if (Environment.OSVersion.Version.Major < 6) // 6 == Vista/Win2008Server/Win7 { - string unicodeFontName = "Times New Roman"; + string unicodeFontName = Utilities.WinXp2kUnicodeFontName; Configuration.Settings.General.SubtitleFontName = unicodeFontName; float fontSize = toolStripMenuItemSingleNote.Font.Size; toolStripMenuItemSingleNote.Font = new System.Drawing.Font(unicodeFontName, fontSize); @@ -1637,13 +1638,14 @@ 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; SubtitleListview1.ForeColor = Configuration.Settings.General.SubtitleFontColor; SubtitleListview1.BackColor = Configuration.Settings.General.SubtitleBackgroundColor; SaveSubtitleListviewIndexes(); + Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); SubtitleListview1.Fill(_subtitle, _subtitleAlternate); RestoreSubtitleListviewIndexes(); } @@ -6663,6 +6665,7 @@ namespace Nikse.SubtitleEdit.Forms labelCharactersPerSecond.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelCharactersPerSecond.Width); labelTextLineTotal.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelTextLineTotal.Width); + SubtitleListview1.AutoSizeAllColumns(this); } private void PlayCurrent() diff --git a/src/Forms/Main.resx b/src/Forms/Main.resx index d5f535fd5..da9cb9d2e 100644 --- a/src/Forms/Main.resx +++ b/src/Forms/Main.resx @@ -684,7 +684,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 - CAAAAk1TRnQBSQFMAgEBAgEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAfABAAHwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/Forms/MergeShortLines.cs b/src/Forms/MergeShortLines.cs index 6f11602a9..f01402b5e 100644 --- a/src/Forms/MergeShortLines.cs +++ b/src/Forms/MergeShortLines.cs @@ -58,7 +58,8 @@ namespace Nikse.SubtitleEdit.Forms buttonOK.Text = Configuration.Settings.Language.General.OK; buttonCancel.Text = Configuration.Settings.Language.General.Cancel; SubtitleListview1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); - SubtitleListview1.InitializeTimeStampColumWidths(this); + Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); NumberOfMerges = 0; numericUpDownMaxCharacters.Value = Configuration.Settings.General.SubtitleLineMaximumLength; _subtitle = subtitle; diff --git a/src/Forms/RemoveTextFromHearImpaired.cs b/src/Forms/RemoveTextFromHearImpaired.cs index 819811eff..3e5b71eeb 100644 --- a/src/Forms/RemoveTextFromHearImpaired.cs +++ b/src/Forms/RemoveTextFromHearImpaired.cs @@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Forms { if (Environment.OSVersion.Version.Major < 6) // 6 == Vista/Win2008Server/Win7 { - string unicodeFontName = "Times New Roman"; + string unicodeFontName = Utilities.WinXp2kUnicodeFontName; float fontSize = comboBoxCustomStart.Font.Size; comboBoxCustomStart.Font = new System.Drawing.Font(unicodeFontName, fontSize); comboBoxCustomEnd.Font = new System.Drawing.Font(unicodeFontName, fontSize); diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 7ae8caba0..2ca0ba7f2 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -332,7 +332,7 @@ namespace Nikse.SubtitleEdit.Forms if (!Utilities.IsRunningOnMono() && Environment.OSVersion.Version.Major < 6) // 6 == Vista/Win2008Server/Win7 { float fontSize = comboBoxToolsMusicSymbol.Font.Size; - string unicodeFontName = "Times New Roman"; + string unicodeFontName = Utilities.WinXp2kUnicodeFontName; listBoxNamesEtc.Font = new System.Drawing.Font(unicodeFontName, fontSize); listBoxUserWordLists.Font = new System.Drawing.Font(unicodeFontName, fontSize); listBoxOcrFixList.Font = new System.Drawing.Font(unicodeFontName, fontSize); diff --git a/src/Forms/SplitLongLines.cs b/src/Forms/SplitLongLines.cs index 081047f47..f03c22a53 100644 --- a/src/Forms/SplitLongLines.cs +++ b/src/Forms/SplitLongLines.cs @@ -60,7 +60,8 @@ namespace Nikse.SubtitleEdit.Forms buttonOK.Text = Configuration.Settings.Language.General.OK; buttonCancel.Text = Configuration.Settings.Language.General.Cancel; SubtitleListview1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); - SubtitleListview1.InitializeTimeStampColumWidths(this); + Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); NumberOfSplits = 0; numericUpDownSingleLineMaxCharacters.Value = Configuration.Settings.General.SubtitleLineMaximumLength; _subtitle = subtitle; diff --git a/src/Forms/SplitSubtitle.Designer.cs b/src/Forms/SplitSubtitle.Designer.cs index ae0bf3a1b..9989a9384 100644 --- a/src/Forms/SplitSubtitle.Designer.cs +++ b/src/Forms/SplitSubtitle.Designer.cs @@ -76,7 +76,7 @@ this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(39, 30); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(331, 21); + this.label1.Size = new System.Drawing.Size(217, 13); this.label1.TabIndex = 19; this.label1.Text = "Enter length of first part of video or browse"; // @@ -85,7 +85,7 @@ this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(39, 45); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(233, 21); + this.label2.Size = new System.Drawing.Size(152, 13); this.label2.TabIndex = 20; this.label2.Text = "and get length from video file:"; // @@ -98,7 +98,7 @@ this.labelHoursMinSecsMilliSecs.AutoSize = true; this.labelHoursMinSecsMilliSecs.Location = new System.Drawing.Point(41, 79); this.labelHoursMinSecsMilliSecs.Name = "labelHoursMinSecsMilliSecs"; - this.labelHoursMinSecsMilliSecs.Size = new System.Drawing.Size(169, 21); + this.labelHoursMinSecsMilliSecs.Size = new System.Drawing.Size(108, 13); this.labelHoursMinSecsMilliSecs.TabIndex = 22; this.labelHoursMinSecsMilliSecs.Text = "Hours:min:sec.msecs"; // @@ -109,12 +109,12 @@ this.splitTimeUpDownAdjust.Location = new System.Drawing.Point(42, 97); this.splitTimeUpDownAdjust.Margin = new System.Windows.Forms.Padding(4); this.splitTimeUpDownAdjust.Name = "splitTimeUpDownAdjust"; - this.splitTimeUpDownAdjust.Size = new System.Drawing.Size(137, 34); + this.splitTimeUpDownAdjust.Size = new System.Drawing.Size(92, 25); this.splitTimeUpDownAdjust.TabIndex = 21; // // SplitSubtitle // - 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(325, 182); this.Controls.Add(this.buttonGetFrameRate); diff --git a/src/Forms/SyncPointsSync.cs b/src/Forms/SyncPointsSync.cs index e0174a4bc..a4e6d4ba3 100644 --- a/src/Forms/SyncPointsSync.cs +++ b/src/Forms/SyncPointsSync.cs @@ -49,6 +49,8 @@ namespace Nikse.SubtitleEdit.Forms labelSyncHelp.Text = Configuration.Settings.Language.PointSync.Description; SubtitleListview1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings); SubtitleListview1.InitializeTimeStampColumWidths(this); + Utilities.InitializeSubtitleFont(SubtitleListview1); + SubtitleListview1.AutoSizeAllColumns(this); FixLargeFonts(); } diff --git a/src/Forms/VobSubOcr.cs b/src/Forms/VobSubOcr.cs index a392b3469..882389fe0 100644 --- a/src/Forms/VobSubOcr.cs +++ b/src/Forms/VobSubOcr.cs @@ -167,6 +167,9 @@ namespace Nikse.SubtitleEdit.Forms comboBoxTesseractLanguages.Left = labelTesseractLanguage.Left + labelTesseractLanguage.Width; + Utilities.InitializeSubtitleFont(subtitleListView1); + subtitleListView1.AutoSizeAllColumns(this); + FixLargeFonts(); } diff --git a/src/Logic/Settings.cs b/src/Logic/Settings.cs index b3290574a..0e2abe630 100644 --- a/src/Logic/Settings.cs +++ b/src/Logic/Settings.cs @@ -264,7 +264,7 @@ namespace Nikse.SubtitleEdit.Logic DefaultFrameRate = 23.976; SubtitleFontName = "Tahoma"; if (Environment.OSVersion.Version.Major < 6) // 6 == Vista/Win2008Server/Win7 - SubtitleFontName = "Courier New"; + SubtitleFontName = Utilities.WinXp2kUnicodeFontName; SubtitleFontSize = 8; SubtitleFontBold = false; diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index 2f747557a..ac255b234 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -18,6 +18,8 @@ namespace Nikse.SubtitleEdit.Logic { public static class Utilities { + internal const string WinXp2kUnicodeFontName = "Times New Roman"; + public static VideoInfo GetVideoInfo(string fileName, EventHandler event1) { VideoInfo info = TryReadVideoInfoViaAviHeader(fileName); @@ -2068,5 +2070,7 @@ namespace Nikse.SubtitleEdit.Logic } return false; } + + } } \ No newline at end of file