diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index c1d25affd..9d2e9a391 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -650,6 +650,7 @@ Note: Do check free disk space. Simple rendering Anti-aliasing with transparency 3D + Image prefix Half-side-by-side Half-Top/Bottom Depth @@ -2411,6 +2412,7 @@ can edit in same subtitle file (collaboration) Merge dialog (insert dashes) Merge dialog with next (insert dashes) Merge dialog with previous (insert dashes) + Auto balance selected lines Go to next line Go to next line (and play in 'Translate mode') Go to next line and set cursor at end diff --git a/src/ui/Forms/ExportPngXml.Designer.cs b/src/ui/Forms/ExportPngXml.Designer.cs index 8c2e8bd15..ac43c01eb 100644 --- a/src/ui/Forms/ExportPngXml.Designer.cs +++ b/src/ui/Forms/ExportPngXml.Designer.cs @@ -37,6 +37,9 @@ this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.groupBoxImageSettings = new System.Windows.Forms.GroupBox(); + this.labelImagePrefix = new System.Windows.Forms.Label(); + this.textBoxImagePrefix = new System.Windows.Forms.TextBox(); + this.comboBoxResolution = new System.Windows.Forms.ComboBox(); this.labelResize = new System.Windows.Forms.Label(); this.comboBoxResizePercentage = new System.Windows.Forms.ComboBox(); this.comboBoxBottomMarginUnit = new System.Windows.Forms.ComboBox(); @@ -69,7 +72,6 @@ this.comboBoxImageFormat = new System.Windows.Forms.ComboBox(); this.checkBoxBold = new System.Windows.Forms.CheckBox(); this.labelResolution = new System.Windows.Forms.Label(); - this.comboBoxResolution = new System.Windows.Forms.ComboBox(); this.comboBoxHAlign = new System.Windows.Forms.ComboBox(); this.labelHorizontalAlign = new System.Windows.Forms.Label(); this.checkBoxSimpleRender = new System.Windows.Forms.CheckBox(); @@ -176,6 +178,8 @@ // this.groupBoxImageSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxImageSettings.Controls.Add(this.labelImagePrefix); + this.groupBoxImageSettings.Controls.Add(this.textBoxImagePrefix); this.groupBoxImageSettings.Controls.Add(this.comboBoxResolution); this.groupBoxImageSettings.Controls.Add(this.labelResize); this.groupBoxImageSettings.Controls.Add(this.comboBoxResizePercentage); @@ -232,6 +236,48 @@ this.groupBoxImageSettings.TabStop = false; this.groupBoxImageSettings.Text = "Image settings"; // + // labelImagePrefix + // + this.labelImagePrefix.AutoSize = true; + this.labelImagePrefix.Location = new System.Drawing.Point(284, 165); + this.labelImagePrefix.Name = "labelImagePrefix"; + this.labelImagePrefix.Size = new System.Drawing.Size(64, 13); + this.labelImagePrefix.TabIndex = 64; + this.labelImagePrefix.Text = "Image prefix"; + // + // textBoxImagePrefix + // + this.textBoxImagePrefix.Location = new System.Drawing.Point(354, 162); + this.textBoxImagePrefix.Name = "textBoxImagePrefix"; + this.textBoxImagePrefix.Size = new System.Drawing.Size(317, 20); + this.textBoxImagePrefix.TabIndex = 63; + // + // comboBoxResolution + // + this.comboBoxResolution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxResolution.DropDownWidth = 160; + this.comboBoxResolution.FormattingEnabled = true; + this.comboBoxResolution.Items.AddRange(new object[] { + "4K (4096x2160)", + "UHD (3840x2160)", + "2K (2048x1080)", + "DCI 2K Scope (2048x858)", + "DCI 2K Flat (1998x1080)", + "1080p (1920x1080)", + "1440x1080", + "720p (1280x720)", + "960x720", + "480p (848x480)", + "PAL (720x576)", + "NTSC (720x480)", + "640x352", + "640x272"}); + this.comboBoxResolution.Location = new System.Drawing.Point(112, 78); + this.comboBoxResolution.Name = "comboBoxResolution"; + this.comboBoxResolution.Size = new System.Drawing.Size(123, 21); + this.comboBoxResolution.TabIndex = 5; + this.comboBoxResolution.SelectedIndexChanged += new System.EventHandler(this.comboBoxResolution_SelectedIndexChanged); + // // labelResize // this.labelResize.AutoSize = true; @@ -615,32 +661,6 @@ this.labelResolution.TabIndex = 4; this.labelResolution.Text = "Video res"; // - // comboBoxResolution - // - this.comboBoxResolution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxResolution.DropDownWidth = 160; - this.comboBoxResolution.FormattingEnabled = true; - this.comboBoxResolution.Items.AddRange(new object[] { - "4K (4096x2160)", - "UHD (3840x2160)", - "2K (2048x1080)", - "DCI 2K Scope (2048x858)", - "DCI 2K Flat (1998x1080)", - "1080p (1920x1080)", - "1440x1080", - "720p (1280x720)", - "960x720", - "480p (848x480)", - "PAL (720x576)", - "NTSC (720x480)", - "640x352", - "640x272"}); - this.comboBoxResolution.Location = new System.Drawing.Point(112, 78); - this.comboBoxResolution.Name = "comboBoxResolution"; - this.comboBoxResolution.Size = new System.Drawing.Size(123, 21); - this.comboBoxResolution.TabIndex = 5; - this.comboBoxResolution.SelectedIndexChanged += new System.EventHandler(this.comboBoxResolution_SelectedIndexChanged); - // // comboBoxHAlign // this.comboBoxHAlign.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -1172,5 +1192,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparatorAdjust; private System.Windows.Forms.ToolStripMenuItem adjustDisplayTimeToolStripMenuItem; private System.Windows.Forms.CheckBox checkBoxFcpFullPathUrl; + private System.Windows.Forms.Label labelImagePrefix; + private System.Windows.Forms.TextBox textBoxImagePrefix; } } \ No newline at end of file diff --git a/src/ui/Forms/ExportPngXml.cs b/src/ui/Forms/ExportPngXml.cs index e10a3bc86..a28b78cd8 100644 --- a/src/ui/Forms/ExportPngXml.cs +++ b/src/ui/Forms/ExportPngXml.cs @@ -152,7 +152,7 @@ namespace Nikse.SubtitleEdit.Forms return 25; } - string s = comboBoxFrameRate.SelectedItem.ToString(); + var s = comboBoxFrameRate.SelectedItem.ToString(); s = s.Replace(",", ".").Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, ".").Trim(); if (double.TryParse(s, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var d)) { @@ -205,7 +205,7 @@ namespace Nikse.SubtitleEdit.Forms } } - string text = p.P.Text; + var text = p.P.Text; if (format.GetType() == typeof(SubStationAlpha) && text.Length > 5) { text = p.P.Text.Substring(0, 6); @@ -318,8 +318,8 @@ namespace Nikse.SubtitleEdit.Forms nbmp.ReplaceTransparentWith(param.FullFrameBackgroundColor); using (var bmp = nbmp.GetBitmap()) { - int top = param.ScreenHeight - (param.Bitmap.Height + param.BottomMargin); - int left = (param.ScreenWidth - param.Bitmap.Width) / 2; + var top = param.ScreenHeight - (param.Bitmap.Height + param.BottomMargin); + var left = (param.ScreenWidth - param.Bitmap.Width) / 2; var b = new NikseBitmap(param.ScreenWidth, param.ScreenHeight); { @@ -556,6 +556,7 @@ namespace Nikse.SubtitleEdit.Forms singleFile = true; } else if (_exportType == ExportFormats.Fcp) + { saveFileDialog1.Title = LanguageSettings.Current.ExportPngXml.SaveFcpAs; saveFileDialog1.DefaultExt = "*.xml"; @@ -940,21 +941,21 @@ namespace Nikse.SubtitleEdit.Forms internal void WriteFcpFile(int width, int height, StringBuilder sb, string fileName) { - string fileNameNoPath = Path.GetFileName(fileName); - string fileNameNoExt = Path.GetFileNameWithoutExtension(fileNameNoPath); + var fileNameNoPath = Path.GetFileName(fileName); + var fileNameNoExt = Path.GetFileNameWithoutExtension(fileNameNoPath); - int duration = 0; + var duration = 0; if (_subtitle.Paragraphs.Count > 0) { duration = (int)Math.Round(_subtitle.Paragraphs[_subtitle.Paragraphs.Count - 1].EndTime.TotalSeconds * 25.0); } - string s = "" + Environment.NewLine + + var s = "" + Environment.NewLine + "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " add" + Environment.NewLine + - " " + System.Security.SecurityElement.Escape(fileNameNoExt) + @" + " " + System.Security.SecurityElement.Escape(GetFcpPrefix()) + @" " + duration.ToString(CultureInfo.InvariantCulture) + @" FALSE @@ -1547,7 +1548,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + { if (!param.Saved) { - imagesSavedCount = WriteFcpParagraph(sb, imagesSavedCount, param, i, saveFileDialog1.FileName); + imagesSavedCount = WriteFcpParagraph(sb, imagesSavedCount, param, i, GetFcpPrefix(), saveFileDialog1.FileName); param.Saved = true; } @@ -1798,20 +1799,32 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + return imagesSavedCount; } - internal int WriteFcpParagraph(StringBuilder sb, int imagesSavedCount, MakeBitmapParameter param, int i, string fileName) + private string GetFcpPrefix() { - string numberString = string.Format(Path.GetFileNameWithoutExtension(Path.GetFileName(fileName)) + "{0:0000}", i).RemoveChar(' '); + var prefix = textBoxImagePrefix.Text.Trim(); + if (string.IsNullOrEmpty(prefix)) + { + prefix = Guid.NewGuid().ToString(); + textBoxImagePrefix.Text = prefix; + } + + return prefix; + } + + internal int WriteFcpParagraph(StringBuilder sb, int imagesSavedCount, MakeBitmapParameter param, int i, string imagePrefix, string fileName) + { + var numberString = string.Format(imagePrefix + "{0:0000}", i).RemoveChar(' '); var fileNameShort = numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant(); var targetImageFileName = Path.Combine(Path.GetDirectoryName(fileName), fileNameShort); - string fileNameNoPath = Path.GetFileName(fileNameShort); - string fileNameNoExt = Path.GetFileNameWithoutExtension(fileNameNoPath); - string pathUrl = "file://localhost/" + targetImageFileName.Replace("\\", "/").Replace(" ", "%20"); + var fileNameNoPath = Path.GetFileName(fileNameShort); + var fileNameNoExt = Path.GetFileNameWithoutExtension(fileNameNoPath); + var pathUrl = "file://localhost/" + targetImageFileName.Replace("\\", "/").Replace(" ", "%20"); if (!checkBoxFcpFullPathUrl.Checked) { pathUrl = fileNameShort; } - string template = " " + Environment.NewLine + + var template = " " + Environment.NewLine + @" " + System.Security.SecurityElement.Escape(fileNameNoPath) + @" [DURATION] @@ -1827,7 +1840,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + FALSE straight " + System.Security.SecurityElement.Escape(fileNameNoPath) + @"1" + Environment.NewLine + - " " + @" + " " + @" " + System.Security.SecurityElement.Escape(fileNameNoPath) + @" " + pathUrl + @" @@ -3967,6 +3980,10 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + _fileName = fileName; _format = format; _formatName = _format != null ? _format.Name : string.Empty; + + textBoxImagePrefix.Visible = false; + labelImagePrefix.Visible = false; + if (_formatName == AdvancedSubStationAlpha.NameOfFormat || _formatName == SubStationAlpha.NameOfFormat) { CalculateHeights(subtitle); @@ -3995,6 +4012,22 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + else if (exportType == ExportFormats.Fcp) { Text = "Final Cut Pro"; + textBoxImagePrefix.Visible = true; + labelImagePrefix.Visible = true; + var imagePrefix = Guid.NewGuid().ToString(); + if (!string.IsNullOrEmpty(_videoFileName)) + { + imagePrefix = _videoFileName; + } + else if (!string.IsNullOrEmpty(subtitle?.FileName)) + { + imagePrefix = subtitle.FileName; + } + + imagePrefix = Path.GetFileNameWithoutExtension(imagePrefix); + imagePrefix = Path.GetFileName(imagePrefix); + + textBoxImagePrefix.Text = imagePrefix; } else if (exportType == ExportFormats.Dost) { @@ -4146,13 +4179,15 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + comboBox3D.SelectedIndex = 0; labelDepth.Text = LanguageSettings.Current.ExportPngXml.Depth; - numericUpDownDepth3D.Left = labelDepth.Left + labelDepth.Width + 3; label3D.Text = LanguageSettings.Current.ExportPngXml.Text3D; - comboBox3D.Left = label3D.Left + label3D.Width + 3; + labelImagePrefix.Text = LanguageSettings.Current.ExportPngXml.ImagePrefix; + textBoxImagePrefix.Left = labelImagePrefix.Left + labelImagePrefix.Width + 3; + textBoxImagePrefix.Width = comboBoxFrameRate.Right - textBoxImagePrefix.Left; + buttonBorderColor.Text = LanguageSettings.Current.ExportPngXml.BorderColor; labelBorderWidth.Text = LanguageSettings.Current.ExportPngXml.BorderStyle; labelImageFormat.Text = LanguageSettings.Current.ExportPngXml.ImageFormat; diff --git a/src/ui/Forms/ExportPngXml.resx b/src/ui/Forms/ExportPngXml.resx index 044fc07f8..48e326adf 100644 --- a/src/ui/Forms/ExportPngXml.resx +++ b/src/ui/Forms/ExportPngXml.resx @@ -118,18 +118,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 565, 17 + 440, 24 17, 17 - 307, 17 + 189, 20 - 443, 17 + 316, 18 - 720, 17 + 587, 22 \ No newline at end of file diff --git a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs index f724a715a..b8c9a10ce 100644 --- a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs +++ b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs @@ -1828,7 +1828,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert { mp.Bitmap = ExportPngXml.GenerateImageFromTextWithStyle(mp); } - form.WriteFcpParagraph(sb, imagesSavedCount, mp, index, outputFileName); + form.WriteFcpParagraph(sb, imagesSavedCount, mp, index, Path.GetFileNameWithoutExtension(Path.GetFileName(outputFileName)), outputFileName); if (index % 50 == 0) { diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 19aac17fc..15e74791d 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -852,6 +852,7 @@ namespace Nikse.SubtitleEdit.Logic SimpleRendering = "Simple rendering", AntiAliasingWithTransparency = "Anti-aliasing with transparency", Text3D = "3D", + ImagePrefix = "Image prefix", SideBySide3D = "Half-side-by-side", HalfTopBottom3D = "Half-Top/Bottom", Depth = "Depth", diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs index c34d9b4d6..dd7d6dcc0 100644 --- a/src/ui/Logic/LanguageDeserializer.cs +++ b/src/ui/Logic/LanguageDeserializer.cs @@ -1696,6 +1696,9 @@ namespace Nikse.SubtitleEdit.Logic case "ExportPngXml/Text3D": language.ExportPngXml.Text3D = reader.Value; break; + case "ExportPngXml/ImagePrefix": + language.ExportPngXml.ImagePrefix = reader.Value; + break; case "ExportPngXml/SideBySide3D": language.ExportPngXml.SideBySide3D = reader.Value; break; @@ -6586,6 +6589,9 @@ namespace Nikse.SubtitleEdit.Logic case "Settings/MergeDialogWithPrevious": language.Settings.MergeDialogWithPrevious = reader.Value; break; + case "Settings/AutoBalanceSelectedLines": + language.Settings.AutoBalanceSelectedLines = reader.Value; + break; case "Settings/GoToNext": language.Settings.GoToNext = reader.Value; break; diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index 649bbf5e3..1fe34ef4c 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -724,6 +724,7 @@ public string SimpleRendering { get; set; } public string AntiAliasingWithTransparency { get; set; } public string Text3D { get; set; } + public string ImagePrefix { get; set; } public string SideBySide3D { get; set; } public string HalfTopBottom3D { get; set; } public string Depth { get; set; }