Add more image based formats to batch/cmd-line convert

This commit is contained in:
Nikolaj Olsson 2017-10-22 22:27:11 +02:00
parent 041bb43b72
commit fa1ccdc641
5 changed files with 769 additions and 556 deletions

View File

@ -2,6 +2,7 @@
using Nikse.SubtitleEdit.Logic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
@ -16,6 +17,8 @@ namespace Nikse.SubtitleEdit.Controls
HHMMSSFF
}
private bool _designMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime;
private const int NumericUpDownValue = 50;
public EventHandler TimeCodeChanged;
@ -142,6 +145,9 @@ namespace Nikse.SubtitleEdit.Controls
{
get
{
if (_designMode)
return new TimeCode();
if (string.IsNullOrWhiteSpace(maskedTextBox1.Text.Replace(".", string.Empty).Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, string.Empty).Replace(",", string.Empty).Replace(":", string.Empty)))
return TimeCode.MaxTime;
@ -225,6 +231,9 @@ namespace Nikse.SubtitleEdit.Controls
}
set
{
if (_designMode)
return;
if (value == null || value.TotalMilliseconds >= TimeCode.MaxTime.TotalMilliseconds - 0.1)
{
maskedTextBox1.Text = string.Empty;

View File

@ -69,6 +69,9 @@ namespace Nikse.SubtitleEdit.Forms
private Ebu.EbuGeneralSubtitleInformation _ebuGeneralInformation;
public const string BluRaySubtitle = "Blu-ray sup";
public const string VobSubSubtitle = "VobSub";
public const string DostImageSubtitle = "Dost-image";
public const string BdnXmlSubtitle = "BDN-XML";
public const string FcpImageSubtitle = "FCP-image";
private string _customTextTemplate;
private readonly DurationsBridgeGaps _bridgeGaps;
private const int ConvertMaxFileSize = 1024 * 1024 * 10; // 10 MB
@ -164,6 +167,9 @@ namespace Nikse.SubtitleEdit.Forms
formatNames.Add(l.PlainText);
formatNames.Add(BluRaySubtitle);
formatNames.Add(VobSubSubtitle);
formatNames.Add(DostImageSubtitle);
formatNames.Add(BdnXmlSubtitle);
formatNames.Add(FcpImageSubtitle);
formatNames.Add(Configuration.Settings.Language.ExportCustomText.Title);
UiUtil.InitializeSubtitleFormatComboBox(comboBoxSubtitleFormats, formatNames, Configuration.Settings.Tools.BatchConvertFormat);
@ -1236,19 +1242,12 @@ namespace Nikse.SubtitleEdit.Forms
_ebuGeneralInformation = new Ebu.EbuGeneralSubtitleInformation();
comboBoxEncoding.Enabled = true;
}
else if (comboBoxSubtitleFormats.Text == BluRaySubtitle)
{
buttonStyles.Text = Configuration.Settings.Language.BatchConvert.Settings;
buttonStyles.Visible = true;
comboBoxEncoding.Enabled = false;
}
else if (comboBoxSubtitleFormats.Text == VobSubSubtitle)
{
buttonStyles.Text = Configuration.Settings.Language.BatchConvert.Settings;
buttonStyles.Visible = true;
comboBoxEncoding.Enabled = false;
}
else if (comboBoxSubtitleFormats.Text == Configuration.Settings.Language.ExportCustomText.Title)
else if (comboBoxSubtitleFormats.Text == BluRaySubtitle ||
comboBoxSubtitleFormats.Text == VobSubSubtitle ||
comboBoxSubtitleFormats.Text == DostImageSubtitle ||
comboBoxSubtitleFormats.Text == BdnXmlSubtitle ||
comboBoxSubtitleFormats.Text == FcpImageSubtitle ||
comboBoxSubtitleFormats.Text == Configuration.Settings.Language.ExportCustomText.Title)
{
buttonStyles.Text = Configuration.Settings.Language.BatchConvert.Settings;
buttonStyles.Visible = true;
@ -1279,11 +1278,23 @@ namespace Nikse.SubtitleEdit.Forms
}
else if (comboBoxSubtitleFormats.Text == BluRaySubtitle)
{
ShowBluraySettings();
ImageExportSettings(ExportPngXml.ExportFormats.BluraySup);
}
else if (comboBoxSubtitleFormats.Text == VobSubSubtitle)
{
VobSubSettings();
ImageExportSettings(ExportPngXml.ExportFormats.VobSub);
}
else if (comboBoxSubtitleFormats.Text == DostImageSubtitle)
{
ImageExportSettings(ExportPngXml.ExportFormats.Dost);
}
else if (comboBoxSubtitleFormats.Text == BdnXmlSubtitle)
{
ImageExportSettings(ExportPngXml.ExportFormats.BdnXml);
}
else if (comboBoxSubtitleFormats.Text == FcpImageSubtitle)
{
ImageExportSettings(ExportPngXml.ExportFormats.Fcp);
}
else if (comboBoxSubtitleFormats.Text == Configuration.Settings.Language.BatchConvert.PlainText)
{
@ -1316,25 +1327,13 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ShowBluraySettings()
private void ImageExportSettings(string format)
{
using (var properties = new ExportPngXml())
{
var s = new Subtitle();
s.Paragraphs.Add(new Paragraph("Test 123." + Environment.NewLine + "Test 456.", 0, 4000));
properties.Initialize(s, new SubRip(), ExportPngXml.ExportFormats.BluraySup, null, null, null);
properties.DisableSaveButtonAndCheckBoxes();
properties.ShowDialog(this);
}
}
private void VobSubSettings()
{
using (var properties = new ExportPngXml())
{
var s = new Subtitle();
s.Paragraphs.Add(new Paragraph("Test 123." + Environment.NewLine + "Test 456.", 0, 4000));
properties.Initialize(s, new SubRip(), ExportPngXml.ExportFormats.VobSub, null, null, null);
properties.Initialize(s, new SubRip(), format, null, null, null);
properties.DisableSaveButtonAndCheckBoxes();
properties.ShowDialog(this);
}

View File

@ -96,6 +96,7 @@
this.boxSingleLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.boxMultiLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparatorAdjust = new System.Windows.Forms.ToolStripSeparator();
this.adjustDisplayTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.adjustTimeCodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.subtitleListView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -103,7 +104,6 @@
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.adjustDisplayTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.groupBoxImageSettings.SuspendLayout();
@ -141,7 +141,7 @@
//
this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonExport.Location = new System.Drawing.Point(740, 602);
this.buttonExport.Location = new System.Drawing.Point(749, 602);
this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(126, 21);
this.buttonExport.TabIndex = 6;
@ -154,7 +154,7 @@
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(872, 602);
this.buttonCancel.Location = new System.Drawing.Point(881, 602);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 0;
@ -167,7 +167,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 602);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(722, 21);
this.progressBar1.Size = new System.Drawing.Size(731, 21);
this.progressBar1.TabIndex = 5;
this.progressBar1.Visible = false;
//
@ -225,7 +225,7 @@
this.groupBoxImageSettings.Controls.Add(this.checkBoxSkipEmptyFrameAtStart);
this.groupBoxImageSettings.Location = new System.Drawing.Point(12, 218);
this.groupBoxImageSettings.Name = "groupBoxImageSettings";
this.groupBoxImageSettings.Size = new System.Drawing.Size(935, 191);
this.groupBoxImageSettings.Size = new System.Drawing.Size(944, 191);
this.groupBoxImageSettings.TabIndex = 3;
this.groupBoxImageSettings.TabStop = false;
this.groupBoxImageSettings.Text = "Image settings";
@ -233,7 +233,7 @@
// labelResize
//
this.labelResize.AutoSize = true;
this.labelResize.Location = new System.Drawing.Point(251, 8);
this.labelResize.Location = new System.Drawing.Point(259, 8);
this.labelResize.Name = "labelResize";
this.labelResize.Size = new System.Drawing.Size(39, 13);
this.labelResize.TabIndex = 61;
@ -244,7 +244,7 @@
//
this.comboBoxResizePercentage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxResizePercentage.FormattingEnabled = true;
this.comboBoxResizePercentage.Location = new System.Drawing.Point(296, 5);
this.comboBoxResizePercentage.Location = new System.Drawing.Point(304, 5);
this.comboBoxResizePercentage.Name = "comboBoxResizePercentage";
this.comboBoxResizePercentage.Size = new System.Drawing.Size(77, 21);
this.comboBoxResizePercentage.TabIndex = 18;
@ -258,7 +258,7 @@
this.comboBoxBottomMarginUnit.Items.AddRange(new object[] {
"%",
"px"});
this.comboBoxBottomMarginUnit.Location = new System.Drawing.Point(169, 132);
this.comboBoxBottomMarginUnit.Location = new System.Drawing.Point(177, 132);
this.comboBoxBottomMarginUnit.Name = "comboBoxBottomMarginUnit";
this.comboBoxBottomMarginUnit.Size = new System.Drawing.Size(52, 21);
this.comboBoxBottomMarginUnit.TabIndex = 14;
@ -271,7 +271,7 @@
this.comboBoxLeftRightMarginUnit.Items.AddRange(new object[] {
"%",
"px"});
this.comboBoxLeftRightMarginUnit.Location = new System.Drawing.Point(169, 159);
this.comboBoxLeftRightMarginUnit.Location = new System.Drawing.Point(177, 159);
this.comboBoxLeftRightMarginUnit.Name = "comboBoxLeftRightMarginUnit";
this.comboBoxLeftRightMarginUnit.Size = new System.Drawing.Size(52, 21);
this.comboBoxLeftRightMarginUnit.TabIndex = 17;
@ -280,7 +280,7 @@
// labelLineHeightStyle
//
this.labelLineHeightStyle.AutoSize = true;
this.labelLineHeightStyle.Location = new System.Drawing.Point(774, 153);
this.labelLineHeightStyle.Location = new System.Drawing.Point(782, 153);
this.labelLineHeightStyle.Name = "labelLineHeightStyle";
this.labelLineHeightStyle.Size = new System.Drawing.Size(103, 13);
this.labelLineHeightStyle.TabIndex = 59;
@ -290,7 +290,7 @@
//
this.panelFullFrameBackground.BackColor = System.Drawing.Color.Transparent;
this.panelFullFrameBackground.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelFullFrameBackground.Location = new System.Drawing.Point(658, 104);
this.panelFullFrameBackground.Location = new System.Drawing.Point(666, 104);
this.panelFullFrameBackground.Name = "panelFullFrameBackground";
this.panelFullFrameBackground.Size = new System.Drawing.Size(21, 20);
this.panelFullFrameBackground.TabIndex = 36;
@ -301,7 +301,7 @@
//
this.comboBoxLeftRightMargin.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxLeftRightMargin.FormattingEnabled = true;
this.comboBoxLeftRightMargin.Location = new System.Drawing.Point(100, 159);
this.comboBoxLeftRightMargin.Location = new System.Drawing.Point(108, 159);
this.comboBoxLeftRightMargin.Name = "comboBoxLeftRightMargin";
this.comboBoxLeftRightMargin.Size = new System.Drawing.Size(63, 21);
this.comboBoxLeftRightMargin.TabIndex = 16;
@ -319,7 +319,7 @@
// checkBoxFullFrameImage
//
this.checkBoxFullFrameImage.AutoSize = true;
this.checkBoxFullFrameImage.Location = new System.Drawing.Point(531, 104);
this.checkBoxFullFrameImage.Location = new System.Drawing.Point(539, 104);
this.checkBoxFullFrameImage.Name = "checkBoxFullFrameImage";
this.checkBoxFullFrameImage.Size = new System.Drawing.Size(102, 17);
this.checkBoxFullFrameImage.TabIndex = 34;
@ -330,7 +330,7 @@
// checkBoxTransAntiAliase
//
this.checkBoxTransAntiAliase.AutoSize = true;
this.checkBoxTransAntiAliase.Location = new System.Drawing.Point(275, 92);
this.checkBoxTransAntiAliase.Location = new System.Drawing.Point(283, 92);
this.checkBoxTransAntiAliase.Name = "checkBoxTransAntiAliase";
this.checkBoxTransAntiAliase.Size = new System.Drawing.Size(162, 17);
this.checkBoxTransAntiAliase.TabIndex = 21;
@ -340,7 +340,7 @@
//
// labelLineHeight
//
this.labelLineHeight.Location = new System.Drawing.Point(661, 132);
this.labelLineHeight.Location = new System.Drawing.Point(669, 132);
this.labelLineHeight.Name = "labelLineHeight";
this.labelLineHeight.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelLineHeight.Size = new System.Drawing.Size(110, 13);
@ -350,7 +350,7 @@
//
// numericUpDownLineSpacing
//
this.numericUpDownLineSpacing.Location = new System.Drawing.Point(777, 130);
this.numericUpDownLineSpacing.Location = new System.Drawing.Point(785, 130);
this.numericUpDownLineSpacing.Maximum = new decimal(new int[] {
500,
0,
@ -369,7 +369,7 @@
//
// numericUpDownShadowTransparency
//
this.numericUpDownShadowTransparency.Location = new System.Drawing.Point(777, 81);
this.numericUpDownShadowTransparency.Location = new System.Drawing.Point(785, 81);
this.numericUpDownShadowTransparency.Maximum = new decimal(new int[] {
255,
0,
@ -392,7 +392,7 @@
//
// labelShadowTransparency
//
this.labelShadowTransparency.Location = new System.Drawing.Point(661, 83);
this.labelShadowTransparency.Location = new System.Drawing.Point(669, 83);
this.labelShadowTransparency.Name = "labelShadowTransparency";
this.labelShadowTransparency.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelShadowTransparency.Size = new System.Drawing.Size(110, 13);
@ -402,7 +402,7 @@
//
// labelShadowWidth
//
this.labelShadowWidth.Location = new System.Drawing.Point(661, 55);
this.labelShadowWidth.Location = new System.Drawing.Point(669, 55);
this.labelShadowWidth.Name = "labelShadowWidth";
this.labelShadowWidth.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelShadowWidth.Size = new System.Drawing.Size(110, 13);
@ -431,7 +431,7 @@
"13",
"14",
"15"});
this.comboBoxShadowWidth.Location = new System.Drawing.Point(777, 52);
this.comboBoxShadowWidth.Location = new System.Drawing.Point(785, 52);
this.comboBoxShadowWidth.Name = "comboBoxShadowWidth";
this.comboBoxShadowWidth.Size = new System.Drawing.Size(121, 21);
this.comboBoxShadowWidth.TabIndex = 42;
@ -440,7 +440,7 @@
// panelShadowColor
//
this.panelShadowColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelShadowColor.Location = new System.Drawing.Point(904, 26);
this.panelShadowColor.Location = new System.Drawing.Point(912, 26);
this.panelShadowColor.Name = "panelShadowColor";
this.panelShadowColor.Size = new System.Drawing.Size(21, 20);
this.panelShadowColor.TabIndex = 41;
@ -448,7 +448,7 @@
//
// buttonShadowColor
//
this.buttonShadowColor.Location = new System.Drawing.Point(777, 25);
this.buttonShadowColor.Location = new System.Drawing.Point(785, 25);
this.buttonShadowColor.Name = "buttonShadowColor";
this.buttonShadowColor.Size = new System.Drawing.Size(121, 21);
this.buttonShadowColor.TabIndex = 40;
@ -458,7 +458,7 @@
//
// labelDepth
//
this.labelDepth.Location = new System.Drawing.Point(235, 134);
this.labelDepth.Location = new System.Drawing.Point(243, 134);
this.labelDepth.Name = "labelDepth";
this.labelDepth.Size = new System.Drawing.Size(100, 18);
this.labelDepth.TabIndex = 18;
@ -468,7 +468,7 @@
// label3D
//
this.label3D.AutoSize = true;
this.label3D.Location = new System.Drawing.Point(272, 113);
this.label3D.Location = new System.Drawing.Point(280, 113);
this.label3D.Name = "label3D";
this.label3D.Size = new System.Drawing.Size(21, 13);
this.label3D.TabIndex = 16;
@ -478,7 +478,7 @@
//
this.comboBox3D.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox3D.FormattingEnabled = true;
this.comboBox3D.Location = new System.Drawing.Point(297, 110);
this.comboBox3D.Location = new System.Drawing.Point(305, 110);
this.comboBox3D.Name = "comboBox3D";
this.comboBox3D.Size = new System.Drawing.Size(121, 21);
this.comboBox3D.TabIndex = 22;
@ -486,7 +486,7 @@
//
// numericUpDownDepth3D
//
this.numericUpDownDepth3D.Location = new System.Drawing.Point(341, 135);
this.numericUpDownDepth3D.Location = new System.Drawing.Point(349, 135);
this.numericUpDownDepth3D.Minimum = new decimal(new int[] {
100,
0,
@ -500,7 +500,7 @@
// buttonCustomResolution
//
this.buttonCustomResolution.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCustomResolution.Location = new System.Drawing.Point(224, 78);
this.buttonCustomResolution.Location = new System.Drawing.Point(232, 78);
this.buttonCustomResolution.Name = "buttonCustomResolution";
this.buttonCustomResolution.Size = new System.Drawing.Size(24, 21);
this.buttonCustomResolution.TabIndex = 6;
@ -512,7 +512,7 @@
//
this.comboBoxBottomMargin.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxBottomMargin.FormattingEnabled = true;
this.comboBoxBottomMargin.Location = new System.Drawing.Point(100, 132);
this.comboBoxBottomMargin.Location = new System.Drawing.Point(108, 132);
this.comboBoxBottomMargin.Name = "comboBoxBottomMargin";
this.comboBoxBottomMargin.Size = new System.Drawing.Size(63, 21);
this.comboBoxBottomMargin.TabIndex = 10;
@ -529,7 +529,7 @@
//
// labelFrameRate
//
this.labelFrameRate.Location = new System.Drawing.Point(415, 137);
this.labelFrameRate.Location = new System.Drawing.Point(423, 137);
this.labelFrameRate.Name = "labelFrameRate";
this.labelFrameRate.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelFrameRate.Size = new System.Drawing.Size(110, 13);
@ -541,14 +541,14 @@
// comboBoxFrameRate
//
this.comboBoxFrameRate.FormattingEnabled = true;
this.comboBoxFrameRate.Location = new System.Drawing.Point(531, 134);
this.comboBoxFrameRate.Location = new System.Drawing.Point(539, 134);
this.comboBoxFrameRate.Name = "comboBoxFrameRate";
this.comboBoxFrameRate.Size = new System.Drawing.Size(121, 21);
this.comboBoxFrameRate.TabIndex = 37;
//
// labelLanguage
//
this.labelLanguage.Location = new System.Drawing.Point(415, 108);
this.labelLanguage.Location = new System.Drawing.Point(423, 108);
this.labelLanguage.Name = "labelLanguage";
this.labelLanguage.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelLanguage.Size = new System.Drawing.Size(110, 13);
@ -568,7 +568,7 @@
"Jpg",
"Png",
"Tiff"});
this.comboBoxLanguage.Location = new System.Drawing.Point(531, 105);
this.comboBoxLanguage.Location = new System.Drawing.Point(539, 105);
this.comboBoxLanguage.Name = "comboBoxLanguage";
this.comboBoxLanguage.Size = new System.Drawing.Size(121, 21);
this.comboBoxLanguage.TabIndex = 35;
@ -576,7 +576,7 @@
//
// labelImageFormat
//
this.labelImageFormat.Location = new System.Drawing.Point(415, 81);
this.labelImageFormat.Location = new System.Drawing.Point(423, 81);
this.labelImageFormat.Name = "labelImageFormat";
this.labelImageFormat.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelImageFormat.Size = new System.Drawing.Size(110, 13);
@ -596,7 +596,7 @@
"Png",
"Tiff",
"Tga"});
this.comboBoxImageFormat.Location = new System.Drawing.Point(531, 78);
this.comboBoxImageFormat.Location = new System.Drawing.Point(539, 78);
this.comboBoxImageFormat.Name = "comboBoxImageFormat";
this.comboBoxImageFormat.Size = new System.Drawing.Size(121, 21);
this.comboBoxImageFormat.TabIndex = 33;
@ -604,7 +604,7 @@
// checkBoxBold
//
this.checkBoxBold.AutoSize = true;
this.checkBoxBold.Location = new System.Drawing.Point(275, 50);
this.checkBoxBold.Location = new System.Drawing.Point(283, 50);
this.checkBoxBold.Name = "checkBoxBold";
this.checkBoxBold.Size = new System.Drawing.Size(47, 17);
this.checkBoxBold.TabIndex = 19;
@ -640,7 +640,7 @@
"NTSC (720x480)",
"640x352",
"640x272"});
this.comboBoxResolution.Location = new System.Drawing.Point(100, 78);
this.comboBoxResolution.Location = new System.Drawing.Point(108, 78);
this.comboBoxResolution.Name = "comboBoxResolution";
this.comboBoxResolution.Size = new System.Drawing.Size(121, 21);
this.comboBoxResolution.TabIndex = 5;
@ -654,7 +654,7 @@
"Left",
"Center",
"Right"});
this.comboBoxHAlign.Location = new System.Drawing.Point(100, 105);
this.comboBoxHAlign.Location = new System.Drawing.Point(108, 105);
this.comboBoxHAlign.Name = "comboBoxHAlign";
this.comboBoxHAlign.Size = new System.Drawing.Size(121, 21);
this.comboBoxHAlign.TabIndex = 8;
@ -672,7 +672,7 @@
// checkBoxSimpleRender
//
this.checkBoxSimpleRender.AutoSize = true;
this.checkBoxSimpleRender.Location = new System.Drawing.Point(275, 71);
this.checkBoxSimpleRender.Location = new System.Drawing.Point(283, 71);
this.checkBoxSimpleRender.Name = "checkBoxSimpleRender";
this.checkBoxSimpleRender.Size = new System.Drawing.Size(104, 17);
this.checkBoxSimpleRender.TabIndex = 20;
@ -693,7 +693,7 @@
//
this.comboBoxSubtitleFont.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSubtitleFont.FormattingEnabled = true;
this.comboBoxSubtitleFont.Location = new System.Drawing.Point(100, 24);
this.comboBoxSubtitleFont.Location = new System.Drawing.Point(108, 24);
this.comboBoxSubtitleFont.Name = "comboBoxSubtitleFont";
this.comboBoxSubtitleFont.Size = new System.Drawing.Size(121, 21);
this.comboBoxSubtitleFont.TabIndex = 1;
@ -813,7 +813,7 @@
"450",
"475",
"500"});
this.comboBoxSubtitleFontSize.Location = new System.Drawing.Point(100, 51);
this.comboBoxSubtitleFontSize.Location = new System.Drawing.Point(108, 51);
this.comboBoxSubtitleFontSize.Name = "comboBoxSubtitleFontSize";
this.comboBoxSubtitleFontSize.Size = new System.Drawing.Size(121, 21);
this.comboBoxSubtitleFontSize.TabIndex = 3;
@ -830,7 +830,7 @@
//
// labelBorderWidth
//
this.labelBorderWidth.Location = new System.Drawing.Point(415, 54);
this.labelBorderWidth.Location = new System.Drawing.Point(423, 54);
this.labelBorderWidth.Name = "labelBorderWidth";
this.labelBorderWidth.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.labelBorderWidth.Size = new System.Drawing.Size(110, 13);
@ -859,7 +859,7 @@
"13",
"14",
"15"});
this.comboBoxBorderWidth.Location = new System.Drawing.Point(531, 51);
this.comboBoxBorderWidth.Location = new System.Drawing.Point(539, 51);
this.comboBoxBorderWidth.Name = "comboBoxBorderWidth";
this.comboBoxBorderWidth.Size = new System.Drawing.Size(121, 21);
this.comboBoxBorderWidth.TabIndex = 32;
@ -868,7 +868,7 @@
// panelBorderColor
//
this.panelBorderColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelBorderColor.Location = new System.Drawing.Point(658, 25);
this.panelBorderColor.Location = new System.Drawing.Point(666, 25);
this.panelBorderColor.Name = "panelBorderColor";
this.panelBorderColor.Size = new System.Drawing.Size(21, 20);
this.panelBorderColor.TabIndex = 31;
@ -876,7 +876,7 @@
//
// buttonBorderColor
//
this.buttonBorderColor.Location = new System.Drawing.Point(531, 24);
this.buttonBorderColor.Location = new System.Drawing.Point(539, 24);
this.buttonBorderColor.Name = "buttonBorderColor";
this.buttonBorderColor.Size = new System.Drawing.Size(121, 21);
this.buttonBorderColor.TabIndex = 30;
@ -887,7 +887,7 @@
// panelColor
//
this.panelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelColor.Location = new System.Drawing.Point(402, 25);
this.panelColor.Location = new System.Drawing.Point(410, 25);
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(21, 20);
this.panelColor.TabIndex = 12;
@ -895,7 +895,7 @@
//
// buttonColor
//
this.buttonColor.Location = new System.Drawing.Point(275, 24);
this.buttonColor.Location = new System.Drawing.Point(283, 24);
this.buttonColor.Name = "buttonColor";
this.buttonColor.Size = new System.Drawing.Size(121, 21);
this.buttonColor.TabIndex = 18;
@ -908,7 +908,7 @@
this.checkBoxSkipEmptyFrameAtStart.AutoSize = true;
this.checkBoxSkipEmptyFrameAtStart.Checked = true;
this.checkBoxSkipEmptyFrameAtStart.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxSkipEmptyFrameAtStart.Location = new System.Drawing.Point(275, 92);
this.checkBoxSkipEmptyFrameAtStart.Location = new System.Drawing.Point(283, 92);
this.checkBoxSkipEmptyFrameAtStart.Name = "checkBoxSkipEmptyFrameAtStart";
this.checkBoxSkipEmptyFrameAtStart.Size = new System.Drawing.Size(147, 17);
this.checkBoxSkipEmptyFrameAtStart.TabIndex = 15;
@ -925,7 +925,7 @@
this.groupBoxExportImage.Controls.Add(this.pictureBox1);
this.groupBoxExportImage.Location = new System.Drawing.Point(13, 415);
this.groupBoxExportImage.Name = "groupBoxExportImage";
this.groupBoxExportImage.Size = new System.Drawing.Size(934, 181);
this.groupBoxExportImage.Size = new System.Drawing.Size(943, 181);
this.groupBoxExportImage.TabIndex = 1;
this.groupBoxExportImage.TabStop = false;
//
@ -933,7 +933,7 @@
//
this.linkLabelPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.linkLabelPreview.AutoSize = true;
this.linkLabelPreview.Location = new System.Drawing.Point(878, 16);
this.linkLabelPreview.Location = new System.Drawing.Point(887, 16);
this.linkLabelPreview.Name = "linkLabelPreview";
this.linkLabelPreview.Size = new System.Drawing.Size(45, 13);
this.linkLabelPreview.TabIndex = 9;
@ -966,7 +966,7 @@
this.adjustDisplayTimeToolStripMenuItem,
this.adjustTimeCodesToolStripMenuItem});
this.contextMenuStripListView.Name = "contextMenuStripListView";
this.contextMenuStripListView.Size = new System.Drawing.Size(185, 164);
this.contextMenuStripListView.Size = new System.Drawing.Size(185, 142);
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripListView_Opening);
//
// normalToolStripMenuItem
@ -1002,6 +1002,13 @@
this.toolStripSeparatorAdjust.Name = "toolStripSeparatorAdjust";
this.toolStripSeparatorAdjust.Size = new System.Drawing.Size(181, 6);
//
// adjustDisplayTimeToolStripMenuItem
//
this.adjustDisplayTimeToolStripMenuItem.Name = "adjustDisplayTimeToolStripMenuItem";
this.adjustDisplayTimeToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.adjustDisplayTimeToolStripMenuItem.Text = "Adjust display time...";
this.adjustDisplayTimeToolStripMenuItem.Click += new System.EventHandler(this.adjustDisplayTimeToolStripMenuItem_Click);
//
// adjustTimeCodesToolStripMenuItem
//
this.adjustTimeCodesToolStripMenuItem.Name = "adjustTimeCodesToolStripMenuItem";
@ -1025,25 +1032,18 @@
this.subtitleListView1.HideSelection = false;
this.subtitleListView1.Location = new System.Drawing.Point(13, 13);
this.subtitleListView1.Name = "subtitleListView1";
this.subtitleListView1.Size = new System.Drawing.Size(934, 199);
this.subtitleListView1.Size = new System.Drawing.Size(943, 199);
this.subtitleListView1.TabIndex = 7;
this.subtitleListView1.UseCompatibleStateImageBehavior = false;
this.subtitleListView1.View = System.Windows.Forms.View.Details;
this.subtitleListView1.SelectedIndexChanged += new System.EventHandler(this.subtitleListView1_SelectedIndexChanged);
this.subtitleListView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.subtitleListView1_KeyDown);
//
// adjustDisplayTimeToolStripMenuItem
//
this.adjustDisplayTimeToolStripMenuItem.Name = "adjustDisplayTimeToolStripMenuItem";
this.adjustDisplayTimeToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
this.adjustDisplayTimeToolStripMenuItem.Text = "Adjust display time...";
this.adjustDisplayTimeToolStripMenuItem.Click += new System.EventHandler(this.adjustDisplayTimeToolStripMenuItem_Click);
//
// ExportPngXml
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(953, 628);
this.ClientSize = new System.Drawing.Size(962, 628);
this.Controls.Add(this.subtitleListView1);
this.Controls.Add(this.groupBoxExportImage);
this.Controls.Add(this.groupBoxImageSettings);

File diff suppressed because it is too large Load Diff

View File

@ -87,6 +87,9 @@ namespace Nikse.SubtitleEdit.Logic
WriteLine(" " + Ultech130.NameOfFormat);
WriteLine("- For Blu-ray .sup output use: '" + BatchConvert.BluRaySubtitle.Replace(" ", string.Empty) + "'");
WriteLine("- For VobSub .sub output use: '" + BatchConvert.VobSubSubtitle.Replace(" ", string.Empty) + "'");
WriteLine("- For DOST/image .dost/image output use: '" + BatchConvert.DostImageSubtitle.Replace(" ", string.Empty) + "'");
WriteLine("- For BDN/XML .xml/image output use: '" + BatchConvert.BdnXmlSubtitle.Replace(" ", string.Empty) + "'");
WriteLine("- For FCP/image .xml/image output use: '" + BatchConvert.FcpImageSubtitle.Replace(" ", string.Empty) + "'");
}
else
{
@ -1101,16 +1104,19 @@ namespace Nikse.SubtitleEdit.Logic
form.Initialize(sub, format, ExportPngXml.ExportFormats.BluraySup, fileName, null, null);
int width = 1920;
int height = 1080;
var parts = Configuration.Settings.Tools.ExportBluRayVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportBluRayVideoResolution))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
if (res != null)
{
width = res.Value.X;
height = res.Value.Y;
var parts = Configuration.Settings.Tools.ExportBluRayVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
if (res != null)
{
width = res.Value.X;
height = res.Value.Y;
}
}
using (var binarySubtitleFile = new FileStream(outputFileName, FileMode.Create))
@ -1157,11 +1163,15 @@ namespace Nikse.SubtitleEdit.Logic
form.Initialize(sub, format, ExportPngXml.ExportFormats.VobSub, fileName, null, null);
int width = 720;
int height = 576;
var parts = Configuration.Settings.Tools.ExportVobSubVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportVobSubVideoResolution))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
var parts = Configuration.Settings.Tools.ExportVobSubVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
}
var cfg = Configuration.Settings.Tools;
@ -1204,6 +1214,169 @@ namespace Nikse.SubtitleEdit.Logic
}
WriteLine(" done.");
}
else if (BatchConvert.DostImageSubtitle.Replace(" ", string.Empty).Equals(targetFormat.Replace(" ", string.Empty), StringComparison.OrdinalIgnoreCase))
{
targetFormatFound = true;
outputFileName = FormatOutputFileNameForBatchConvert(fileName, ".dost", outputFolder, overwrite);
Write($"{count}: {Path.GetFileName(fileName)} -> {outputFileName}...");
using (var form = new ExportPngXml())
{
form.Initialize(sub, format, ExportPngXml.ExportFormats.Dost, fileName, null, null);
int width = 1920;
int height = 1080;
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportBluRayVideoResolution))
{
var parts = Configuration.Settings.Tools.ExportBluRayVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
}
if (res != null)
{
width = res.Value.X;
height = res.Value.Y;
}
var sb = new StringBuilder();
var imagesSavedCount = 0;
var isImageBased = IsImageBased(format);
for (int index = 0; index < sub.Paragraphs.Count; index++)
{
var mp = form.MakeMakeBitmapParameter(index, width, height);
mp.LineJoin = Configuration.Settings.Tools.ExportPenLineJoin;
if (isImageBased)
{
using (var ms = new MemoryStream(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(fileName), sub.Paragraphs[index].Text))))
{
mp.Bitmap = (Bitmap)Image.FromStream(ms);
}
}
else
{
mp.Bitmap = ExportPngXml.GenerateImageFromTextWithStyle(mp);
}
form.WriteParagraphDost(sb, imagesSavedCount, mp, index, outputFileName);
if (index % 50 == 0)
{
System.Windows.Forms.Application.DoEvents();
}
}
form.WriteDostFile(outputFileName, sb.ToString());
}
WriteLine(" done.");
}
else if (BatchConvert.BdnXmlSubtitle.Replace(" ", string.Empty).Equals(targetFormat.Replace(" ", string.Empty), StringComparison.OrdinalIgnoreCase))
{
targetFormatFound = true;
outputFileName = FormatOutputFileNameForBatchConvert(fileName, ".xml", outputFolder, overwrite);
Write($"{count}: {Path.GetFileName(fileName)} -> {outputFileName}...");
using (var form = new ExportPngXml())
{
form.Initialize(sub, format, ExportPngXml.ExportFormats.BdnXml, fileName, null, null);
int width = 1920;
int height = 1080;
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportBluRayVideoResolution))
{
var parts = Configuration.Settings.Tools.ExportBluRayVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
}
if (res != null)
{
width = res.Value.X;
height = res.Value.Y;
}
var sb = new StringBuilder();
var imagesSavedCount = 0;
var isImageBased = IsImageBased(format);
for (int index = 0; index < sub.Paragraphs.Count; index++)
{
var mp = form.MakeMakeBitmapParameter(index, width, height);
mp.LineJoin = Configuration.Settings.Tools.ExportPenLineJoin;
if (isImageBased)
{
using (var ms = new MemoryStream(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(fileName), sub.Paragraphs[index].Text))))
{
mp.Bitmap = (Bitmap)Image.FromStream(ms);
}
}
else
{
mp.Bitmap = ExportPngXml.GenerateImageFromTextWithStyle(mp);
}
imagesSavedCount = form.WriteBdnXmlParagraph(width, sb, form.GetBottomMarginInPixels(sub.Paragraphs[index]), height, imagesSavedCount, mp, index, Path.GetDirectoryName(outputFileName));
if (index % 50 == 0)
{
System.Windows.Forms.Application.DoEvents();
}
}
form.WriteBdnXmlFile(imagesSavedCount, sb, outputFileName);
}
WriteLine(" done.");
}
else if (BatchConvert.FcpImageSubtitle.Replace(" ", string.Empty).Equals(targetFormat.Replace(" ", string.Empty), StringComparison.OrdinalIgnoreCase))
{
targetFormatFound = true;
outputFileName = FormatOutputFileNameForBatchConvert(fileName, ".xml", outputFolder, overwrite);
Write($"{count}: {Path.GetFileName(fileName)} -> {outputFileName}...");
using (var form = new ExportPngXml())
{
form.Initialize(sub, format, ExportPngXml.ExportFormats.Fcp, fileName, null, null);
int width = 1920;
int height = 1080;
var parts = Configuration.Settings.Tools.ExportFcpVideoResolution.Split('x');
if (parts.Length == 2 && Utilities.IsInteger(parts[0]) && Utilities.IsInteger(parts[1]))
{
width = int.Parse(parts[0]);
height = int.Parse(parts[1]);
}
if (res != null)
{
width = res.Value.X;
height = res.Value.Y;
}
var sb = new StringBuilder();
var imagesSavedCount = 0;
var isImageBased = IsImageBased(format);
for (int index = 0; index < sub.Paragraphs.Count; index++)
{
var mp = form.MakeMakeBitmapParameter(index, width, height);
mp.LineJoin = Configuration.Settings.Tools.ExportPenLineJoin;
if (isImageBased)
{
using (var ms = new MemoryStream(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(fileName), sub.Paragraphs[index].Text))))
{
mp.Bitmap = (Bitmap)Image.FromStream(ms);
}
}
else
{
mp.Bitmap = ExportPngXml.GenerateImageFromTextWithStyle(mp);
}
form.WriteFcpParagraph(sb, imagesSavedCount, mp, index, outputFileName);
if (index % 50 == 0)
{
System.Windows.Forms.Application.DoEvents();
}
}
form.WriteFcpFile(width, height, sb, outputFileName);
}
WriteLine(" done.");
}
else if (!targetFormatFound && targetFormat.StartsWith("CustomText:", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportCustomTemplates))