mpv preview now uses setting from "Video player preview font size"

This commit is contained in:
Nikolaj Olsson 2017-02-27 18:47:58 +01:00
parent 1207c4e222
commit 82112f7616
5 changed files with 147 additions and 128 deletions

View File

@ -662,7 +662,7 @@ namespace Nikse.SubtitleEdit.Core
SpellCheckLanguage = null;
VideoPlayer = string.Empty;
VideoPlayerDefaultVolume = 75;
VideoPlayerPreviewFontSize = 10;
VideoPlayerPreviewFontSize = 12;
VideoPlayerPreviewFontBold = true;
VideoPlayerShowStopButton = true;
VideoPlayerShowMuteButton = true;

View File

@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var ssa = Configuration.Settings.SubtitleSettings;
return "Style: Default," + ssa.SsaFontName + "," +
((int)ssa.SsaFontSize) + "," +
(int)ssa.SsaFontSize + "," +
GetSsaColorString(Color.FromArgb(ssa.SsaFontColorArgb)) + "," +
"&H0300FFFF,&H00000000,&H02000000," + boldStyle + ",0,0,0,100,100,0,0," + borderStyle + "," + ssa.SsaOutline.ToString(CultureInfo.InvariantCulture) + "," +
Configuration.Settings.SubtitleSettings.SsaShadow.ToString(CultureInfo.InvariantCulture) + ",2," + ssa.SsaMarginLeft + "," + ssa.SsaMarginRight + "," + ssa.SsaMarginTopBottom + ",1";

View File

@ -287,7 +287,7 @@ namespace Nikse.SubtitleEdit.Controls
TogglePlayPause();
}
public Paragraph LastParagraph { get; private set; }
public Paragraph LastParagraph { get; set; }
public void SetSubtitleText(string text, Paragraph p, Subtitle subtitle)
{
@ -315,16 +315,24 @@ namespace Nikse.SubtitleEdit.Controls
return;
try
{
SubtitleFormat format;
if (subtitle.Header != null && subtitle.Header.Contains("[V4+ Styles]"))
format = new AdvancedSubStationAlpha();
else
format = new SubRip();
{
SubtitleFormat format = new AdvancedSubStationAlpha();
if (subtitle.Header == null || !subtitle.Header.Contains("[V4+ Styles]"))
{
subtitle = new Subtitle(subtitle);
var oldFontSize = Configuration.Settings.SubtitleSettings.SsaFontSize;
var oldFontBold = Configuration.Settings.SubtitleSettings.SsaFontBold;
Configuration.Settings.SubtitleSettings.SsaFontSize = Configuration.Settings.General.VideoPlayerPreviewFontSize;
Configuration.Settings.SubtitleSettings.SsaFontBold = Configuration.Settings.General.VideoPlayerPreviewFontBold;
subtitle.Header = AdvancedSubStationAlpha.DefaultHeader;
Configuration.Settings.SubtitleSettings.SsaFontSize = oldFontSize;
Configuration.Settings.SubtitleSettings.SsaFontBold = oldFontBold;
}
string text = subtitle.ToText(format);
if (text != _mpvTextOld || _mpvTextFileName == null)
{
if (string.IsNullOrEmpty(_mpvTextFileName) || _subtitlePrev != subtitle)
if (string.IsNullOrEmpty(_mpvTextFileName) || _subtitlePrev != subtitle || !_mpvTextFileName.EndsWith(format.Extension))
{
DeleteTempMpvFileName();
_mpvTextFileName = Path.GetTempFileName() + format.Extension;

View File

@ -4091,6 +4091,8 @@ namespace Nikse.SubtitleEdit.Forms
RefreshTimeCodeMode();
SubtitleListview1.SyntaxColorAllLines(_subtitle);
mediaPlayer.LastParagraph = null;
UiUtil.ShowSubtitle(_subtitle, mediaPlayer);
}
private void CheckAndGetNewlyDownloadedMpvDlls()
@ -19160,10 +19162,9 @@ namespace Nikse.SubtitleEdit.Forms
}
finally
{
if (styles != null)
{
styles.Dispose();
}
mediaPlayer.LastParagraph = null;
UiUtil.ShowSubtitle(_subtitle, mediaPlayer);
styles?.Dispose();
}
}

View File

@ -89,15 +89,6 @@
this.labelDefaultFileEncoding = new System.Windows.Forms.Label();
this.comboBoxFrameRate = new System.Windows.Forms.ComboBox();
this.labelDefaultFrameRate = new System.Windows.Forms.Label();
this.tabPageSyntaxColoring = new System.Windows.Forms.TabPage();
this.groupBoxListViewSyntaxColoring = new System.Windows.Forms.GroupBox();
this.checkBoxSyntaxColorTextMoreThanTwoLines = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxOverlap = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxColorDurationTooSmall = new System.Windows.Forms.CheckBox();
this.buttonListViewSyntaxColorError = new System.Windows.Forms.Button();
this.checkBoxSyntaxColorTextTooLong = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxColorDurationTooLarge = new System.Windows.Forms.CheckBox();
this.panelListViewSyntaxColorError = new System.Windows.Forms.Panel();
this.tabPageShortcuts = new System.Windows.Forms.TabPage();
this.groupBoxShortcuts = new System.Windows.Forms.GroupBox();
this.comboBoxShortcutKey = new System.Windows.Forms.ComboBox();
@ -108,6 +99,15 @@
this.buttonUpdateShortcut = new System.Windows.Forms.Button();
this.treeViewShortcuts = new System.Windows.Forms.TreeView();
this.labelShortcut = new System.Windows.Forms.Label();
this.tabPageSyntaxColoring = new System.Windows.Forms.TabPage();
this.groupBoxListViewSyntaxColoring = new System.Windows.Forms.GroupBox();
this.checkBoxSyntaxColorTextMoreThanTwoLines = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxOverlap = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxColorDurationTooSmall = new System.Windows.Forms.CheckBox();
this.buttonListViewSyntaxColorError = new System.Windows.Forms.Button();
this.checkBoxSyntaxColorTextTooLong = new System.Windows.Forms.CheckBox();
this.checkBoxSyntaxColorDurationTooLarge = new System.Windows.Forms.CheckBox();
this.panelListViewSyntaxColorError = new System.Windows.Forms.Panel();
this.tabPageVideoPlayer = new System.Windows.Forms.TabPage();
this.groupBoxMainWindowVideoControls = new System.Windows.Forms.GroupBox();
this.labelCustomSearch6 = new System.Windows.Forms.Label();
@ -338,10 +338,10 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharsSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).BeginInit();
this.tabPageSyntaxColoring.SuspendLayout();
this.groupBoxListViewSyntaxColoring.SuspendLayout();
this.tabPageShortcuts.SuspendLayout();
this.groupBoxShortcuts.SuspendLayout();
this.tabPageSyntaxColoring.SuspendLayout();
this.groupBoxListViewSyntaxColoring.SuspendLayout();
this.tabPageVideoPlayer.SuspendLayout();
this.groupBoxMainWindowVideoControls.SuspendLayout();
this.groupBoxVideoPlayerDefault.SuspendLayout();
@ -1169,105 +1169,6 @@
this.labelDefaultFrameRate.TabIndex = 0;
this.labelDefaultFrameRate.Text = "Default frame rate";
//
// tabPageSyntaxColoring
//
this.tabPageSyntaxColoring.Controls.Add(this.groupBoxListViewSyntaxColoring);
this.tabPageSyntaxColoring.Location = new System.Drawing.Point(4, 22);
this.tabPageSyntaxColoring.Name = "tabPageSyntaxColoring";
this.tabPageSyntaxColoring.Padding = new System.Windows.Forms.Padding(3);
this.tabPageSyntaxColoring.Size = new System.Drawing.Size(832, 474);
this.tabPageSyntaxColoring.TabIndex = 9;
this.tabPageSyntaxColoring.Text = "Syntax coloring";
this.tabPageSyntaxColoring.UseVisualStyleBackColor = true;
//
// groupBoxListViewSyntaxColoring
//
this.groupBoxListViewSyntaxColoring.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextMoreThanTwoLines);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxOverlap);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooSmall);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.buttonListViewSyntaxColorError);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextTooLong);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooLarge);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.panelListViewSyntaxColorError);
this.groupBoxListViewSyntaxColoring.Location = new System.Drawing.Point(6, 6);
this.groupBoxListViewSyntaxColoring.Name = "groupBoxListViewSyntaxColoring";
this.groupBoxListViewSyntaxColoring.Size = new System.Drawing.Size(820, 456);
this.groupBoxListViewSyntaxColoring.TabIndex = 0;
this.groupBoxListViewSyntaxColoring.TabStop = false;
this.groupBoxListViewSyntaxColoring.Text = "List view syntax coloring";
//
// checkBoxSyntaxColorTextMoreThanTwoLines
//
this.checkBoxSyntaxColorTextMoreThanTwoLines.AutoSize = true;
this.checkBoxSyntaxColorTextMoreThanTwoLines.Location = new System.Drawing.Point(20, 116);
this.checkBoxSyntaxColorTextMoreThanTwoLines.Name = "checkBoxSyntaxColorTextMoreThanTwoLines";
this.checkBoxSyntaxColorTextMoreThanTwoLines.Size = new System.Drawing.Size(170, 17);
this.checkBoxSyntaxColorTextMoreThanTwoLines.TabIndex = 3;
this.checkBoxSyntaxColorTextMoreThanTwoLines.Text = "Text - color if more than lines:";
this.checkBoxSyntaxColorTextMoreThanTwoLines.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxOverlap
//
this.checkBoxSyntaxOverlap.AutoSize = true;
this.checkBoxSyntaxOverlap.Location = new System.Drawing.Point(20, 154);
this.checkBoxSyntaxOverlap.Name = "checkBoxSyntaxOverlap";
this.checkBoxSyntaxOverlap.Size = new System.Drawing.Size(129, 17);
this.checkBoxSyntaxOverlap.TabIndex = 5;
this.checkBoxSyntaxOverlap.Text = "Time - color if overlap";
this.checkBoxSyntaxOverlap.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxColorDurationTooSmall
//
this.checkBoxSyntaxColorDurationTooSmall.AutoSize = true;
this.checkBoxSyntaxColorDurationTooSmall.Location = new System.Drawing.Point(20, 35);
this.checkBoxSyntaxColorDurationTooSmall.Name = "checkBoxSyntaxColorDurationTooSmall";
this.checkBoxSyntaxColorDurationTooSmall.Size = new System.Drawing.Size(154, 17);
this.checkBoxSyntaxColorDurationTooSmall.TabIndex = 0;
this.checkBoxSyntaxColorDurationTooSmall.Text = "Duration - color if too small";
this.checkBoxSyntaxColorDurationTooSmall.UseVisualStyleBackColor = true;
//
// buttonListViewSyntaxColorError
//
this.buttonListViewSyntaxColorError.Location = new System.Drawing.Point(20, 192);
this.buttonListViewSyntaxColorError.Name = "buttonListViewSyntaxColorError";
this.buttonListViewSyntaxColorError.Size = new System.Drawing.Size(112, 21);
this.buttonListViewSyntaxColorError.TabIndex = 6;
this.buttonListViewSyntaxColorError.Text = "Error color";
this.buttonListViewSyntaxColorError.UseVisualStyleBackColor = true;
this.buttonListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click);
//
// checkBoxSyntaxColorTextTooLong
//
this.checkBoxSyntaxColorTextTooLong.AutoSize = true;
this.checkBoxSyntaxColorTextTooLong.Location = new System.Drawing.Point(20, 93);
this.checkBoxSyntaxColorTextTooLong.Name = "checkBoxSyntaxColorTextTooLong";
this.checkBoxSyntaxColorTextTooLong.Size = new System.Drawing.Size(132, 17);
this.checkBoxSyntaxColorTextTooLong.TabIndex = 2;
this.checkBoxSyntaxColorTextTooLong.Text = "Text - color if too long";
this.checkBoxSyntaxColorTextTooLong.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxColorDurationTooLarge
//
this.checkBoxSyntaxColorDurationTooLarge.AutoSize = true;
this.checkBoxSyntaxColorDurationTooLarge.Location = new System.Drawing.Point(20, 58);
this.checkBoxSyntaxColorDurationTooLarge.Name = "checkBoxSyntaxColorDurationTooLarge";
this.checkBoxSyntaxColorDurationTooLarge.Size = new System.Drawing.Size(155, 17);
this.checkBoxSyntaxColorDurationTooLarge.TabIndex = 1;
this.checkBoxSyntaxColorDurationTooLarge.Text = "Duration - color if too large";
this.checkBoxSyntaxColorDurationTooLarge.UseVisualStyleBackColor = true;
//
// panelListViewSyntaxColorError
//
this.panelListViewSyntaxColorError.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelListViewSyntaxColorError.Location = new System.Drawing.Point(142, 192);
this.panelListViewSyntaxColorError.Name = "panelListViewSyntaxColorError";
this.panelListViewSyntaxColorError.Size = new System.Drawing.Size(21, 20);
this.panelListViewSyntaxColorError.TabIndex = 7;
this.panelListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click);
//
// tabPageShortcuts
//
this.tabPageShortcuts.Controls.Add(this.groupBoxShortcuts);
@ -1522,6 +1423,105 @@
this.labelShortcut.TabIndex = 3;
this.labelShortcut.Text = "Shortcut:";
//
// tabPageSyntaxColoring
//
this.tabPageSyntaxColoring.Controls.Add(this.groupBoxListViewSyntaxColoring);
this.tabPageSyntaxColoring.Location = new System.Drawing.Point(4, 22);
this.tabPageSyntaxColoring.Name = "tabPageSyntaxColoring";
this.tabPageSyntaxColoring.Padding = new System.Windows.Forms.Padding(3);
this.tabPageSyntaxColoring.Size = new System.Drawing.Size(832, 474);
this.tabPageSyntaxColoring.TabIndex = 9;
this.tabPageSyntaxColoring.Text = "Syntax coloring";
this.tabPageSyntaxColoring.UseVisualStyleBackColor = true;
//
// groupBoxListViewSyntaxColoring
//
this.groupBoxListViewSyntaxColoring.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextMoreThanTwoLines);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxOverlap);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooSmall);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.buttonListViewSyntaxColorError);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorTextTooLong);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.checkBoxSyntaxColorDurationTooLarge);
this.groupBoxListViewSyntaxColoring.Controls.Add(this.panelListViewSyntaxColorError);
this.groupBoxListViewSyntaxColoring.Location = new System.Drawing.Point(6, 6);
this.groupBoxListViewSyntaxColoring.Name = "groupBoxListViewSyntaxColoring";
this.groupBoxListViewSyntaxColoring.Size = new System.Drawing.Size(820, 456);
this.groupBoxListViewSyntaxColoring.TabIndex = 0;
this.groupBoxListViewSyntaxColoring.TabStop = false;
this.groupBoxListViewSyntaxColoring.Text = "List view syntax coloring";
//
// checkBoxSyntaxColorTextMoreThanTwoLines
//
this.checkBoxSyntaxColorTextMoreThanTwoLines.AutoSize = true;
this.checkBoxSyntaxColorTextMoreThanTwoLines.Location = new System.Drawing.Point(20, 116);
this.checkBoxSyntaxColorTextMoreThanTwoLines.Name = "checkBoxSyntaxColorTextMoreThanTwoLines";
this.checkBoxSyntaxColorTextMoreThanTwoLines.Size = new System.Drawing.Size(170, 17);
this.checkBoxSyntaxColorTextMoreThanTwoLines.TabIndex = 3;
this.checkBoxSyntaxColorTextMoreThanTwoLines.Text = "Text - color if more than lines:";
this.checkBoxSyntaxColorTextMoreThanTwoLines.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxOverlap
//
this.checkBoxSyntaxOverlap.AutoSize = true;
this.checkBoxSyntaxOverlap.Location = new System.Drawing.Point(20, 154);
this.checkBoxSyntaxOverlap.Name = "checkBoxSyntaxOverlap";
this.checkBoxSyntaxOverlap.Size = new System.Drawing.Size(129, 17);
this.checkBoxSyntaxOverlap.TabIndex = 5;
this.checkBoxSyntaxOverlap.Text = "Time - color if overlap";
this.checkBoxSyntaxOverlap.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxColorDurationTooSmall
//
this.checkBoxSyntaxColorDurationTooSmall.AutoSize = true;
this.checkBoxSyntaxColorDurationTooSmall.Location = new System.Drawing.Point(20, 35);
this.checkBoxSyntaxColorDurationTooSmall.Name = "checkBoxSyntaxColorDurationTooSmall";
this.checkBoxSyntaxColorDurationTooSmall.Size = new System.Drawing.Size(154, 17);
this.checkBoxSyntaxColorDurationTooSmall.TabIndex = 0;
this.checkBoxSyntaxColorDurationTooSmall.Text = "Duration - color if too small";
this.checkBoxSyntaxColorDurationTooSmall.UseVisualStyleBackColor = true;
//
// buttonListViewSyntaxColorError
//
this.buttonListViewSyntaxColorError.Location = new System.Drawing.Point(20, 192);
this.buttonListViewSyntaxColorError.Name = "buttonListViewSyntaxColorError";
this.buttonListViewSyntaxColorError.Size = new System.Drawing.Size(112, 21);
this.buttonListViewSyntaxColorError.TabIndex = 6;
this.buttonListViewSyntaxColorError.Text = "Error color";
this.buttonListViewSyntaxColorError.UseVisualStyleBackColor = true;
this.buttonListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click);
//
// checkBoxSyntaxColorTextTooLong
//
this.checkBoxSyntaxColorTextTooLong.AutoSize = true;
this.checkBoxSyntaxColorTextTooLong.Location = new System.Drawing.Point(20, 93);
this.checkBoxSyntaxColorTextTooLong.Name = "checkBoxSyntaxColorTextTooLong";
this.checkBoxSyntaxColorTextTooLong.Size = new System.Drawing.Size(132, 17);
this.checkBoxSyntaxColorTextTooLong.TabIndex = 2;
this.checkBoxSyntaxColorTextTooLong.Text = "Text - color if too long";
this.checkBoxSyntaxColorTextTooLong.UseVisualStyleBackColor = true;
//
// checkBoxSyntaxColorDurationTooLarge
//
this.checkBoxSyntaxColorDurationTooLarge.AutoSize = true;
this.checkBoxSyntaxColorDurationTooLarge.Location = new System.Drawing.Point(20, 58);
this.checkBoxSyntaxColorDurationTooLarge.Name = "checkBoxSyntaxColorDurationTooLarge";
this.checkBoxSyntaxColorDurationTooLarge.Size = new System.Drawing.Size(155, 17);
this.checkBoxSyntaxColorDurationTooLarge.TabIndex = 1;
this.checkBoxSyntaxColorDurationTooLarge.Text = "Duration - color if too large";
this.checkBoxSyntaxColorDurationTooLarge.UseVisualStyleBackColor = true;
//
// panelListViewSyntaxColorError
//
this.panelListViewSyntaxColorError.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelListViewSyntaxColorError.Location = new System.Drawing.Point(142, 192);
this.panelListViewSyntaxColorError.Name = "panelListViewSyntaxColorError";
this.panelListViewSyntaxColorError.Size = new System.Drawing.Size(21, 20);
this.panelListViewSyntaxColorError.TabIndex = 7;
this.panelListViewSyntaxColorError.Click += new System.EventHandler(this.buttonListViewSyntaxColorError_Click);
//
// tabPageVideoPlayer
//
this.tabPageVideoPlayer.Controls.Add(this.groupBoxMainWindowVideoControls);
@ -1850,7 +1850,17 @@
"17",
"18",
"19",
"20"});
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30"});
this.comboBoxlVideoPlayerPreviewFontSize.Location = new System.Drawing.Point(465, 18);
this.comboBoxlVideoPlayerPreviewFontSize.Name = "comboBoxlVideoPlayerPreviewFontSize";
this.comboBoxlVideoPlayerPreviewFontSize.Size = new System.Drawing.Size(121, 21);
@ -3952,12 +3962,12 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharsSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDurationMin)).EndInit();
this.tabPageSyntaxColoring.ResumeLayout(false);
this.groupBoxListViewSyntaxColoring.ResumeLayout(false);
this.groupBoxListViewSyntaxColoring.PerformLayout();
this.tabPageShortcuts.ResumeLayout(false);
this.groupBoxShortcuts.ResumeLayout(false);
this.groupBoxShortcuts.PerformLayout();
this.tabPageSyntaxColoring.ResumeLayout(false);
this.groupBoxListViewSyntaxColoring.ResumeLayout(false);
this.groupBoxListViewSyntaxColoring.PerformLayout();
this.tabPageVideoPlayer.ResumeLayout(false);
this.groupBoxMainWindowVideoControls.ResumeLayout(false);
this.groupBoxMainWindowVideoControls.PerformLayout();