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
This commit is contained in:
niksedk 2011-01-25 18:47:14 +00:00
parent d9be2dcf15
commit 974714faa8
15 changed files with 35 additions and 15 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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()

View File

@ -684,7 +684,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAfABAAHwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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();
}

View File

@ -167,6 +167,9 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxTesseractLanguages.Left = labelTesseractLanguage.Left + labelTesseractLanguage.Width;
Utilities.InitializeSubtitleFont(subtitleListView1);
subtitleListView1.AutoSizeAllColumns(this);
FixLargeFonts();
}

View File

@ -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;

View File

@ -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;
}
}
}