Extra options for teletext in "EBU STL"

(use box + use double height)
This commit is contained in:
niksedk 2015-12-05 09:13:55 +01:00
parent 86f3969c08
commit b221ad388f
8 changed files with 123 additions and 11 deletions

View File

@ -371,6 +371,9 @@ Note: Do check free disk space.</WaveFileMalformed>
<Import>Import...</Import>
<TextAndTimingInformation>Text and timing information</TextAndTimingInformation>
<JustificationCode>Justification code</JustificationCode>
<Teletext>Teletext</Teletext>
<UseBox>Use box around text</UseBox>
<DoubleHeight>Use double height for text</DoubleHeight>
<Errors>Errors</Errors>
<ErrorsX>Errors: {0}</ErrorsX>
<MaxLengthError>Line {0} exceeds max length ({1}) by {2}: {3}</MaxLengthError>

View File

@ -534,6 +534,9 @@ namespace Nikse.SubtitleEdit.Core
Import = "Import...",
TextAndTimingInformation = "Text and timing information",
JustificationCode = "Justification code",
Teletext = "Teletext",
UseBox = "Use box around text",
DoubleHeight = "Use double height for text",
Errors = "Errors",
ErrorsX = "Errors: {0}",
MaxLengthError = "Line {0} exceeds max length ({1}) by {2}: {3}",

View File

@ -952,6 +952,15 @@ namespace Nikse.SubtitleEdit.Core
case "EbuSaveOptions/JustificationCode":
language.EbuSaveOptions.JustificationCode = reader.Value;
break;
case "EbuSaveOptions/Teletext":
language.EbuSaveOptions.Teletext = reader.Value;
break;
case "EbuSaveOptions/UseBox":
language.EbuSaveOptions.UseBox = reader.Value;
break;
case "EbuSaveOptions/DoubleHeight":
language.EbuSaveOptions.DoubleHeight = reader.Value;
break;
case "EbuSaveOptions/Errors":
language.EbuSaveOptions.Errors = reader.Value;
break;

View File

@ -413,6 +413,9 @@
public string Import { get; set; }
public string TextAndTimingInformation { get; set; }
public string JustificationCode { get; set; }
public string Teletext { get; set; }
public string UseBox { get; set; }
public string DoubleHeight { get; set; }
public string Errors { get; set; }
public string ErrorsX { get; set; }
public string MaxLengthError { get; set; }

View File

@ -278,6 +278,9 @@ namespace Nikse.SubtitleEdit.Core
public int CurrentCavena890LanguageIdLine1 { get; set; }
public int CurrentCavena890LanguageIdLine2 { get; set; }
public bool EbuStlTeletextUseBox { get; set; }
public bool EbuStlTeletextUseDoubleHeight { get; set; }
public bool CheetahCaptionAlwayWriteEndTime { get; set; }
public bool SamiDisplayTwoClassesAsTwoSubtitles { get; set; }
@ -312,6 +315,9 @@ namespace Nikse.SubtitleEdit.Core
DCinemaFadeUpTime = 5;
DCinemaFadeDownTime = 5;
EbuStlTeletextUseBox = true;
EbuStlTeletextUseDoubleHeight = true;
SamiDisplayTwoClassesAsTwoSubtitles = true;
SamiHtmlEncodeMode = 0;
@ -1869,6 +1875,12 @@ namespace Nikse.SubtitleEdit.Core
subNode = node.SelectSingleNode("FcpFontName");
if (subNode != null)
settings.SubtitleSettings.FcpFontName = subNode.InnerText;
subNode = node.SelectSingleNode("EbuStlTeletextUseBox");
if (subNode != null)
settings.SubtitleSettings.EbuStlTeletextUseBox = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("EbuStlTeletextUseDoubleHeight");
if (subNode != null)
settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("CheetahCaptionAlwayWriteEndTime");
if (subNode != null)
settings.SubtitleSettings.CheetahCaptionAlwayWriteEndTime = Convert.ToBoolean(subNode.InnerText);
@ -2950,6 +2962,8 @@ namespace Nikse.SubtitleEdit.Core
textWriter.WriteElementString("TimedText10ShowStyleAndLanguage", settings.SubtitleSettings.TimedText10ShowStyleAndLanguage.ToString());
textWriter.WriteElementString("FcpFontSize", settings.SubtitleSettings.FcpFontSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("FcpFontName", settings.SubtitleSettings.FcpFontName);
textWriter.WriteElementString("EbuStlTeletextUseBox", settings.SubtitleSettings.EbuStlTeletextUseBox.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("EbuStlTeletextUseDoubleHeight", settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("CheetahCaptionAlwayWriteEndTime", settings.SubtitleSettings.CheetahCaptionAlwayWriteEndTime.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("NuendoCharacterListFile", settings.SubtitleSettings.NuendoCharacterListFile);
textWriter.WriteEndElement();

View File

@ -99,7 +99,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
CodePageNumber = "437";
DiskFormatCode = "STL25.01";
DisplayStandardCode = "0";
DisplayStandardCode = "0"; // 0=Open subtitling
CharacterCodeTableNumber = "00";
LanguageCode = "0A";
OriginalProgrammeTitle = "No Title ";
@ -371,17 +371,28 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
// newline
string newline = encoding.GetString(new byte[] { 0x0a, 0x0a, 0x8a, 0x8a });
if (header.DisplayStandardCode == "0")
string newline = encoding.GetString(new byte[] { 0x8a, 0x8a });
if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox && Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight)
{
newline = encoding.GetString(new byte[] { 0x0a, 0x0a, 0x8a, 0x8a, 0x0d, 0x0b, 0x0b }); // 0a==end box, 0d==double height, 0b==start box
}
else if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox)
{
newline = encoding.GetString(new byte[] { 0x0a, 0x0a, 0x8a, 0x8a, 0x0b, 0x0b }); // 0a==end box, 0b==start box
}
else if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight)
{
newline = encoding.GetString(new byte[] {0x8a, 0x8a, 0x0d, 0x0d }); // 0d==double height
}
if (header.DisplayStandardCode == "0") // 0=Open subtitling
{
newline = encoding.GetString(new byte[] { 0x8A }); //8Ah=CR/LF
// newline = encoding.GetString(new byte[] { 0x85, 0x8A, 0x0D, 0x84, 0x80 }); //85h=boxing off, 8Ah=CR/LF, 84h=boxing on, 80h, Italics on
}
TextField = TextField.Replace(Environment.NewLine, newline);
string endOfLine = encoding.GetString(new byte[] { 0x0a, 0x0a, 0x8a });
if (header.DisplayStandardCode == "0")
string endOfLine = encoding.GetString(new byte[] { 0x0a, 0x0a }); //a=end box
if (!Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox || header.DisplayStandardCode == "0") // DisplayStandardCode 0==Open subtitling
{
endOfLine = string.Empty;
}
@ -395,6 +406,22 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
indexOfEmdash.Add(j);
}
if (header.DisplayStandardCode != "0") // 0=Open subtitling
{
if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox && Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight)
{
TextField = encoding.GetString(new byte[] { 0x0d, 0x0b, 0x0b }) + TextField; // d=double height, b=start box
}
else if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox)
{
TextField = encoding.GetString(new byte[] { 0x0b, 0x0b }) + TextField; // b=start box
}
else if (Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox && Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight)
{
TextField = encoding.GetString(new byte[] { 0x0d }) + TextField; // d=double height
}
}
// convert text to bytes
byte[] bytes = encoding.GetBytes(TextField);

View File

@ -82,6 +82,9 @@
this.textBoxOriginalProgramTitle = new System.Windows.Forms.TextBox();
this.labelOriginalProgramTitle = new System.Windows.Forms.Label();
this.tabPageTextAndTiming = new System.Windows.Forms.TabPage();
this.groupBoxTeletext = new System.Windows.Forms.GroupBox();
this.checkBoxTeletextDoubleHeight = new System.Windows.Forms.CheckBox();
this.checkBoxTeletextBox = new System.Windows.Forms.CheckBox();
this.comboBoxJustificationCode = new System.Windows.Forms.ComboBox();
this.labelJustificationCode = new System.Windows.Forms.Label();
this.tabPageErrors = new System.Windows.Forms.TabPage();
@ -96,6 +99,7 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTotalNumberOfDiscs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRevisionNumber)).BeginInit();
this.tabPageTextAndTiming.SuspendLayout();
this.groupBoxTeletext.SuspendLayout();
this.tabPageErrors.SuspendLayout();
this.SuspendLayout();
//
@ -642,6 +646,7 @@
//
// tabPageTextAndTiming
//
this.tabPageTextAndTiming.Controls.Add(this.groupBoxTeletext);
this.tabPageTextAndTiming.Controls.Add(this.comboBoxJustificationCode);
this.tabPageTextAndTiming.Controls.Add(this.labelJustificationCode);
this.tabPageTextAndTiming.Location = new System.Drawing.Point(4, 22);
@ -651,6 +656,40 @@
this.tabPageTextAndTiming.Text = "Text and timing information";
this.tabPageTextAndTiming.UseVisualStyleBackColor = true;
//
// groupBoxTeletext
//
this.groupBoxTeletext.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.groupBoxTeletext.Controls.Add(this.checkBoxTeletextDoubleHeight);
this.groupBoxTeletext.Controls.Add(this.checkBoxTeletextBox);
this.groupBoxTeletext.Location = new System.Drawing.Point(9, 54);
this.groupBoxTeletext.Name = "groupBoxTeletext";
this.groupBoxTeletext.Size = new System.Drawing.Size(727, 392);
this.groupBoxTeletext.TabIndex = 45;
this.groupBoxTeletext.TabStop = false;
this.groupBoxTeletext.Text = "Teletext";
//
// checkBoxTeletextDoubleHeight
//
this.checkBoxTeletextDoubleHeight.AutoSize = true;
this.checkBoxTeletextDoubleHeight.Location = new System.Drawing.Point(16, 57);
this.checkBoxTeletextDoubleHeight.Name = "checkBoxTeletextDoubleHeight";
this.checkBoxTeletextDoubleHeight.Size = new System.Drawing.Size(124, 17);
this.checkBoxTeletextDoubleHeight.TabIndex = 1;
this.checkBoxTeletextDoubleHeight.Text = "Text is double height";
this.checkBoxTeletextDoubleHeight.UseVisualStyleBackColor = true;
//
// checkBoxTeletextBox
//
this.checkBoxTeletextBox.AutoSize = true;
this.checkBoxTeletextBox.Location = new System.Drawing.Point(16, 34);
this.checkBoxTeletextBox.Name = "checkBoxTeletextBox";
this.checkBoxTeletextBox.Size = new System.Drawing.Size(121, 17);
this.checkBoxTeletextBox.TabIndex = 0;
this.checkBoxTeletextBox.Text = "Use box around text";
this.checkBoxTeletextBox.UseVisualStyleBackColor = true;
//
// comboBoxJustificationCode
//
this.comboBoxJustificationCode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -715,7 +754,7 @@
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonCancel);
this.MinimumSize = new System.Drawing.Size(648, 462);
this.MinimumSize = new System.Drawing.Size(785, 570);
this.Name = "EbuSaveOptions";
this.ShowIcon = false;
this.ShowInTaskbar = false;
@ -732,6 +771,8 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRevisionNumber)).EndInit();
this.tabPageTextAndTiming.ResumeLayout(false);
this.tabPageTextAndTiming.PerformLayout();
this.groupBoxTeletext.ResumeLayout(false);
this.groupBoxTeletext.PerformLayout();
this.tabPageErrors.ResumeLayout(false);
this.tabPageErrors.PerformLayout();
this.ResumeLayout(false);
@ -798,5 +839,8 @@
private Controls.TimeUpDown timeUpDownStartTime;
private System.Windows.Forms.Label labelFrameRate;
private System.Windows.Forms.ComboBox comboBoxFrameRate;
private System.Windows.Forms.GroupBox groupBoxTeletext;
private System.Windows.Forms.CheckBox checkBoxTeletextDoubleHeight;
private System.Windows.Forms.CheckBox checkBoxTeletextBox;
}
}

View File

@ -55,6 +55,9 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxJustificationCode.Items.Add(language.TextLeftJustifiedText);
comboBoxJustificationCode.Items.Add(language.TextCenteredText);
comboBoxJustificationCode.Items.Add(language.TextRightJustifiedText);
groupBoxTeletext.Text = language.Teletext;
checkBoxTeletextBox.Text = language.UseBox;
checkBoxTeletextDoubleHeight.Text = language.DoubleHeight;
labelErrors.Text = language.Errors;
@ -90,6 +93,8 @@ namespace Nikse.SubtitleEdit.Forms
}
comboBoxJustificationCode.SelectedIndex = justificationCode;
checkBoxTeletextBox.Checked = Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox;
checkBoxTeletextDoubleHeight.Checked = Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight;
Text = Configuration.Settings.Language.EbuSaveOptions.Title;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
@ -162,7 +167,7 @@ namespace Nikse.SubtitleEdit.Forms
if (header.FrameRateFromSaveDialog > 20 && header.FrameRateFromSaveDialog < 200)
{
comboBoxFrameRate.Text = header.FrameRateFromSaveDialog.ToString();
comboBoxFrameRate.Text = header.FrameRateFromSaveDialog.ToString(CultureInfo.CurrentCulture);
}
if (header.DisplayStandardCode == "0")
@ -244,7 +249,7 @@ namespace Nikse.SubtitleEdit.Forms
_header.DiskFormatCode = "STL30.01";
double d;
if (double.TryParse(comboBoxFrameRate.Text, out d) && d > 20 && d < 200)
if (double.TryParse(comboBoxFrameRate.Text.Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, "."), out d) && d > 20 && d < 200)
{
_header.FrameRateFromSaveDialog = d;
}
@ -279,7 +284,11 @@ namespace Nikse.SubtitleEdit.Forms
_header.MaximumNumberOfDisplayableRows = numericUpDownMaxRows.Value.ToString("00");
_header.DiskSequenceNumber = numericUpDownDiskSequenceNumber.Value.ToString(CultureInfo.InvariantCulture);
_header.TotalNumberOfDisks = numericUpDownTotalNumberOfDiscs.Value.ToString(CultureInfo.InvariantCulture);
JustificationCode = (byte)comboBoxJustificationCode.SelectedIndex;
Configuration.Settings.SubtitleSettings.EbuStlTeletextUseBox = checkBoxTeletextBox.Checked;
Configuration.Settings.SubtitleSettings.EbuStlTeletextUseDoubleHeight = checkBoxTeletextDoubleHeight.Checked;
DialogResult = DialogResult.OK;
}