diff --git a/src/Forms/EbuSaveOptions.Designer.cs b/src/Forms/EbuSaveOptions.Designer.cs index 7fc688a6b..4a7197979 100644 --- a/src/Forms/EbuSaveOptions.Designer.cs +++ b/src/Forms/EbuSaveOptions.Designer.cs @@ -62,6 +62,8 @@ this.tabPageErrors = new System.Windows.Forms.TabPage(); this.textBoxErrors = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); + this.textBoxLanguageCode = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPageHeader.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMaxCharacters)).BeginInit(); @@ -79,7 +81,7 @@ this.buttonOK.Location = new System.Drawing.Point(513, 428); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 21); - this.buttonOK.TabIndex = 19; + this.buttonOK.TabIndex = 0; this.buttonOK.Text = "Save"; this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); @@ -92,7 +94,7 @@ this.buttonCancel.Location = new System.Drawing.Point(594, 428); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 21); - this.buttonCancel.TabIndex = 18; + this.buttonCancel.TabIndex = 1; this.buttonCancel.Text = "C&ancel"; this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); @@ -117,6 +119,8 @@ // // tabPageHeader // + this.tabPageHeader.Controls.Add(this.textBoxLanguageCode); + this.tabPageHeader.Controls.Add(this.label14); this.tabPageHeader.Controls.Add(this.numericUpDownMaxCharacters); this.tabPageHeader.Controls.Add(this.label12); this.tabPageHeader.Controls.Add(this.numericUpDownDiskSequenceNumber); @@ -150,7 +154,7 @@ // // numericUpDownMaxCharacters // - this.numericUpDownMaxCharacters.Location = new System.Drawing.Point(147, 228); + this.numericUpDownMaxCharacters.Location = new System.Drawing.Point(147, 252); this.numericUpDownMaxCharacters.Maximum = new decimal(new int[] { 99, 0, @@ -158,13 +162,13 @@ 0}); this.numericUpDownMaxCharacters.Name = "numericUpDownMaxCharacters"; this.numericUpDownMaxCharacters.Size = new System.Drawing.Size(120, 20); - this.numericUpDownMaxCharacters.TabIndex = 52; + this.numericUpDownMaxCharacters.TabIndex = 9; this.numericUpDownMaxCharacters.ValueChanged += new System.EventHandler(this.numericUpDownMaxCharacters_ValueChanged); // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(7, 230); + this.label12.Location = new System.Drawing.Point(7, 254); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(133, 13); this.label12.TabIndex = 51; @@ -172,7 +176,7 @@ // // numericUpDownDiskSequenceNumber // - this.numericUpDownDiskSequenceNumber.Location = new System.Drawing.Point(147, 254); + this.numericUpDownDiskSequenceNumber.Location = new System.Drawing.Point(147, 278); this.numericUpDownDiskSequenceNumber.Maximum = new decimal(new int[] { 9, 0, @@ -180,11 +184,11 @@ 0}); this.numericUpDownDiskSequenceNumber.Name = "numericUpDownDiskSequenceNumber"; this.numericUpDownDiskSequenceNumber.Size = new System.Drawing.Size(120, 20); - this.numericUpDownDiskSequenceNumber.TabIndex = 9; + this.numericUpDownDiskSequenceNumber.TabIndex = 10; // // numericUpDownTotalNumberOfDiscs // - this.numericUpDownTotalNumberOfDiscs.Location = new System.Drawing.Point(147, 280); + this.numericUpDownTotalNumberOfDiscs.Location = new System.Drawing.Point(147, 304); this.numericUpDownTotalNumberOfDiscs.Maximum = new decimal(new int[] { 9, 0, @@ -192,11 +196,11 @@ 0}); this.numericUpDownTotalNumberOfDiscs.Name = "numericUpDownTotalNumberOfDiscs"; this.numericUpDownTotalNumberOfDiscs.Size = new System.Drawing.Size(120, 20); - this.numericUpDownTotalNumberOfDiscs.TabIndex = 8; + this.numericUpDownTotalNumberOfDiscs.TabIndex = 11; // // numericUpDownRevisionNumber // - this.numericUpDownRevisionNumber.Location = new System.Drawing.Point(147, 202); + this.numericUpDownRevisionNumber.Location = new System.Drawing.Point(147, 226); this.numericUpDownRevisionNumber.Maximum = new decimal(new int[] { 99, 0, @@ -204,12 +208,12 @@ 0}); this.numericUpDownRevisionNumber.Name = "numericUpDownRevisionNumber"; this.numericUpDownRevisionNumber.Size = new System.Drawing.Size(120, 20); - this.numericUpDownRevisionNumber.TabIndex = 50; + this.numericUpDownRevisionNumber.TabIndex = 8; // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(7, 256); + this.label11.Location = new System.Drawing.Point(7, 280); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(116, 13); this.label11.TabIndex = 49; @@ -218,7 +222,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(7, 282); + this.label10.Location = new System.Drawing.Point(7, 306); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(108, 13); this.label10.TabIndex = 48; @@ -227,7 +231,7 @@ // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(7, 204); + this.label9.Location = new System.Drawing.Point(7, 228); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(86, 13); this.label9.TabIndex = 47; @@ -235,7 +239,7 @@ // // textBoxTranslatorsName // - this.textBoxTranslatorsName.Location = new System.Drawing.Point(147, 146); + this.textBoxTranslatorsName.Location = new System.Drawing.Point(147, 170); this.textBoxTranslatorsName.MaxLength = 32; this.textBoxTranslatorsName.Name = "textBoxTranslatorsName"; this.textBoxTranslatorsName.Size = new System.Drawing.Size(219, 20); @@ -244,7 +248,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 149); + this.label8.Location = new System.Drawing.Point(6, 173); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(90, 13); this.label8.TabIndex = 45; @@ -252,7 +256,7 @@ // // textBoxSubtitleListReferenceCode // - this.textBoxSubtitleListReferenceCode.Location = new System.Drawing.Point(147, 176); + this.textBoxSubtitleListReferenceCode.Location = new System.Drawing.Point(147, 200); this.textBoxSubtitleListReferenceCode.MaxLength = 16; this.textBoxSubtitleListReferenceCode.Name = "textBoxSubtitleListReferenceCode"; this.textBoxSubtitleListReferenceCode.Size = new System.Drawing.Size(219, 20); @@ -261,7 +265,7 @@ // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 179); + this.label7.Location = new System.Drawing.Point(6, 203); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(132, 13); this.label7.TabIndex = 43; @@ -288,7 +292,7 @@ this.buttonImport.Location = new System.Drawing.Point(411, 14); this.buttonImport.Name = "buttonImport"; this.buttonImport.Size = new System.Drawing.Size(134, 21); - this.buttonImport.TabIndex = 1; + this.buttonImport.TabIndex = 12; this.buttonImport.Text = "Import..."; this.buttonImport.UseVisualStyleBackColor = true; this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click); @@ -304,7 +308,7 @@ // // textBoxTranslatedProgramTitle // - this.textBoxTranslatedProgramTitle.Location = new System.Drawing.Point(147, 94); + this.textBoxTranslatedProgramTitle.Location = new System.Drawing.Point(147, 118); this.textBoxTranslatedProgramTitle.MaxLength = 32; this.textBoxTranslatedProgramTitle.Name = "textBoxTranslatedProgramTitle"; this.textBoxTranslatedProgramTitle.Size = new System.Drawing.Size(219, 20); @@ -312,7 +316,7 @@ // // textBoxTranslatedEpisodeTitle // - this.textBoxTranslatedEpisodeTitle.Location = new System.Drawing.Point(147, 120); + this.textBoxTranslatedEpisodeTitle.Location = new System.Drawing.Point(147, 144); this.textBoxTranslatedEpisodeTitle.MaxLength = 32; this.textBoxTranslatedEpisodeTitle.Name = "textBoxTranslatedEpisodeTitle"; this.textBoxTranslatedEpisodeTitle.Size = new System.Drawing.Size(219, 20); @@ -320,7 +324,7 @@ // // textBoxOriginalEpisodeTitle // - this.textBoxOriginalEpisodeTitle.Location = new System.Drawing.Point(147, 68); + this.textBoxOriginalEpisodeTitle.Location = new System.Drawing.Point(147, 92); this.textBoxOriginalEpisodeTitle.MaxLength = 32; this.textBoxOriginalEpisodeTitle.Name = "textBoxOriginalEpisodeTitle"; this.textBoxOriginalEpisodeTitle.Size = new System.Drawing.Size(219, 20); @@ -329,7 +333,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 123); + this.label4.Location = new System.Drawing.Point(6, 147); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(116, 13); this.label4.TabIndex = 36; @@ -338,7 +342,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 97); + this.label3.Location = new System.Drawing.Point(6, 121); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(117, 13); this.label3.TabIndex = 35; @@ -347,7 +351,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 71); + this.label2.Location = new System.Drawing.Point(6, 95); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(101, 13); this.label2.TabIndex = 34; @@ -355,7 +359,7 @@ // // textBoxOriginalProgramTitle // - this.textBoxOriginalProgramTitle.Location = new System.Drawing.Point(147, 42); + this.textBoxOriginalProgramTitle.Location = new System.Drawing.Point(147, 66); this.textBoxOriginalProgramTitle.MaxLength = 32; this.textBoxOriginalProgramTitle.Name = "textBoxOriginalProgramTitle"; this.textBoxOriginalProgramTitle.Size = new System.Drawing.Size(219, 20); @@ -364,7 +368,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 45); + this.label1.Location = new System.Drawing.Point(6, 69); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(102, 13); this.label1.TabIndex = 32; @@ -376,7 +380,7 @@ this.tabPageTextAndTiming.Controls.Add(this.label13); this.tabPageTextAndTiming.Location = new System.Drawing.Point(4, 22); this.tabPageTextAndTiming.Name = "tabPageTextAndTiming"; - this.tabPageTextAndTiming.Size = new System.Drawing.Size(827, 405); + this.tabPageTextAndTiming.Size = new System.Drawing.Size(656, 379); this.tabPageTextAndTiming.TabIndex = 2; this.tabPageTextAndTiming.Text = "Text and timing information"; this.tabPageTextAndTiming.UseVisualStyleBackColor = true; @@ -411,7 +415,7 @@ this.tabPageErrors.Location = new System.Drawing.Point(4, 22); this.tabPageErrors.Name = "tabPageErrors"; this.tabPageErrors.Padding = new System.Windows.Forms.Padding(3); - this.tabPageErrors.Size = new System.Drawing.Size(827, 405); + this.tabPageErrors.Size = new System.Drawing.Size(656, 379); this.tabPageErrors.TabIndex = 1; this.tabPageErrors.Text = "Errors"; this.tabPageErrors.UseVisualStyleBackColor = true; @@ -437,6 +441,23 @@ this.label6.TabIndex = 12; this.label6.Text = "Errors"; // + // textBoxLanguageCode + // + this.textBoxLanguageCode.Location = new System.Drawing.Point(147, 40); + this.textBoxLanguageCode.MaxLength = 32; + this.textBoxLanguageCode.Name = "textBoxLanguageCode"; + this.textBoxLanguageCode.Size = new System.Drawing.Size(219, 20); + this.textBoxLanguageCode.TabIndex = 1; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(6, 43); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(82, 13); + this.label14.TabIndex = 54; + this.label14.Text = "Language code"; + // // EbuSaveOptions // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -499,5 +520,7 @@ private System.Windows.Forms.Label label13; private System.Windows.Forms.NumericUpDown numericUpDownMaxCharacters; private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox textBoxLanguageCode; + private System.Windows.Forms.Label label14; } } \ No newline at end of file diff --git a/src/Forms/EbuSaveOptions.cs b/src/Forms/EbuSaveOptions.cs index 789b51287..eff178630 100644 --- a/src/Forms/EbuSaveOptions.cs +++ b/src/Forms/EbuSaveOptions.cs @@ -69,18 +69,23 @@ namespace Nikse.SubtitleEdit.Forms private void FillFromHeader(Ebu.EbuGeneralSubtitleInformation header) { comboBoxCharacterCodeTable.SelectedIndex = int.Parse(header.CharacterCodeTableNumber); + textBoxLanguageCode.Text = header.LanguageCode; textBoxOriginalProgramTitle.Text = header.OriginalProgrammeTitle.TrimEnd(); textBoxOriginalEpisodeTitle.Text = header.OriginalEpisodeTitle.TrimEnd(); textBoxTranslatedProgramTitle.Text = header.TranslatedProgrammeTitle.TrimEnd(); textBoxTranslatedEpisodeTitle.Text = header.TranslatedEpisodeTitle.TrimEnd(); textBoxTranslatorsName.Text = header.TranslatorsName.TrimEnd(); textBoxSubtitleListReferenceCode.Text = header.SubtitleListReferenceCode.TrimEnd(); + int number; if (int.TryParse(header.RevisionNumber, out number)) numericUpDownRevisionNumber.Value = number; else numericUpDownRevisionNumber.Value = 1; - numericUpDownMaxCharacters.Value = int.Parse(header.MaximumNumberOfDisplayableCharactersInAnyTextRow); + + if (int.TryParse(header.MaximumNumberOfDisplayableCharactersInAnyTextRow, out number)) + numericUpDownMaxCharacters.Value = number; + if (int.TryParse(header.DiskSequenceNumber, out number)) numericUpDownDiskSequenceNumber.Value = number; else diff --git a/src/Forms/Main.Designer.cs b/src/Forms/Main.Designer.cs index 318acd489..7283ee794 100644 --- a/src/Forms/Main.Designer.cs +++ b/src/Forms/Main.Designer.cs @@ -87,6 +87,9 @@ this.toolStripSeparator22 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemExport = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemExportPngXml = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemCavena890 = new System.Windows.Forms.ToolStripMenuItem(); + this.eBUSTLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pACScreenElectronicsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -923,7 +926,10 @@ // toolStripMenuItemExport // this.toolStripMenuItemExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItemExportPngXml}); + this.toolStripMenuItemExportPngXml, + this.toolStripMenuItemCavena890, + this.eBUSTLToolStripMenuItem, + this.pACScreenElectronicsToolStripMenuItem}); this.toolStripMenuItemExport.Name = "toolStripMenuItemExport"; this.toolStripMenuItemExport.Size = new System.Drawing.Size(334, 22); this.toolStripMenuItemExport.Text = "Export"; @@ -931,10 +937,31 @@ // toolStripMenuItemExportPngXml // this.toolStripMenuItemExportPngXml.Name = "toolStripMenuItemExportPngXml"; - this.toolStripMenuItemExportPngXml.Size = new System.Drawing.Size(157, 22); + this.toolStripMenuItemExportPngXml.Size = new System.Drawing.Size(222, 22); this.toolStripMenuItemExportPngXml.Text = "BDN xml/png..."; this.toolStripMenuItemExportPngXml.Click += new System.EventHandler(this.toolStripMenuItemExportPngXml_Click); // + // toolStripMenuItemCavena890 + // + this.toolStripMenuItemCavena890.Name = "toolStripMenuItemCavena890"; + this.toolStripMenuItemCavena890.Size = new System.Drawing.Size(222, 22); + this.toolStripMenuItemCavena890.Text = "Cavena 890..."; + this.toolStripMenuItemCavena890.Click += new System.EventHandler(this.toolStripMenuItemCavena890_Click); + // + // eBUSTLToolStripMenuItem + // + this.eBUSTLToolStripMenuItem.Name = "eBUSTLToolStripMenuItem"; + this.eBUSTLToolStripMenuItem.Size = new System.Drawing.Size(222, 22); + this.eBUSTLToolStripMenuItem.Text = "EBU STL..."; + this.eBUSTLToolStripMenuItem.Click += new System.EventHandler(this.eBUSTLToolStripMenuItem_Click); + // + // pACScreenElectronicsToolStripMenuItem + // + this.pACScreenElectronicsToolStripMenuItem.Name = "pACScreenElectronicsToolStripMenuItem"; + this.pACScreenElectronicsToolStripMenuItem.Size = new System.Drawing.Size(222, 22); + this.pACScreenElectronicsToolStripMenuItem.Text = "PAC (Screen Electronics)..."; + this.pACScreenElectronicsToolStripMenuItem.Click += new System.EventHandler(this.pACScreenElectronicsToolStripMenuItem_Click); + // // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; @@ -3983,6 +4010,9 @@ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem6; private System.Windows.Forms.ToolStripMenuItem setStylesForSelectedLinesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem FindDoubleLinesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem eBUSTLToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pACScreenElectronicsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCavena890; } } diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 391905d84..e18478146 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -754,6 +754,11 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemManualAnsi.Text = _language.Menu.File.ImportSubtitleWithManualChosenEncoding; toolStripMenuItemImportText.Text = _language.Menu.File.ImportText; toolStripMenuItemImportTimeCodes.Text = _language.Menu.File.ImportTimecodes; + toolStripMenuItemExport.Text = _language.Menu.File.Export; + toolStripMenuItemExportPngXml.Text = _language.Menu.File.ExportBdnXml; + toolStripMenuItemCavena890.Text = _language.Menu.File.ExportCavena890; + eBUSTLToolStripMenuItem.Text = _language.Menu.File.ExportEbu; + pACScreenElectronicsToolStripMenuItem.Text = _language.Menu.File.ExportPac; exitToolStripMenuItem.Text = _language.Menu.File.Exit; editToolStripMenuItem.Text = _language.Menu.Edit.Title; @@ -1666,15 +1671,6 @@ namespace Nikse.SubtitleEdit.Forms SubtitleFormat currentFormat = GetCurrentSubtitleFormat(); Utilities.SetSaveDialogFilter(saveFileDialog1, currentFormat); - var ebu = new Ebu(); - saveFileDialog1.Filter += "| " + ebu.FriendlyName + "|*" + ebu.Extension; - - var pac = new Pac(); - saveFileDialog1.Filter += "| " + pac.FriendlyName + "|*" + pac.Extension; - - var cavena890 = new Cavena890(); - saveFileDialog1.Filter += "| " + cavena890.FriendlyName + "|*" + cavena890.Extension; - saveFileDialog1.Title = _language.SaveSubtitleAs; saveFileDialog1.DefaultExt = "*" + currentFormat.Extension; saveFileDialog1.AddExtension = true; @@ -1691,49 +1687,6 @@ namespace Nikse.SubtitleEdit.Forms if (result == DialogResult.OK) { openFileDialog1.InitialDirectory = saveFileDialog1.InitialDirectory; - if (saveFileDialog1.FilterIndex == SubtitleFormat.AllSubtitleFormats.Count + 1) - { - string fileName = saveFileDialog1.FileName; - string ext = Path.GetExtension(fileName).ToLower(); - bool extOk = ext == ebu.Extension.ToLower(); - if (!extOk) - { - if (fileName.EndsWith(".")) - fileName = fileName.Substring(0, fileName.Length - 1); - fileName += ebu.Extension; - } - ebu.Save(fileName, _subtitle); - return DialogResult.OK; - } - else if (saveFileDialog1.FilterIndex == SubtitleFormat.AllSubtitleFormats.Count + 2) - { - string fileName = saveFileDialog1.FileName; - string ext = Path.GetExtension(fileName).ToLower(); - bool extOk = ext == pac.Extension.ToLower(); - if (!extOk) - { - if (fileName.EndsWith(".")) - fileName = fileName.Substring(0, fileName.Length - 1); - fileName += pac.Extension; - } - pac.Save(fileName, _subtitle); - return DialogResult.OK; - } - else if (saveFileDialog1.FilterIndex == SubtitleFormat.AllSubtitleFormats.Count + 3) - { - string fileName = saveFileDialog1.FileName; - string ext = Path.GetExtension(fileName).ToLower(); - bool extOk = ext == cavena890.Extension.ToLower(); - if (!extOk) - { - if (fileName.EndsWith(".")) - fileName = fileName.Substring(0, fileName.Length - 1); - fileName += cavena890.Extension; - } - cavena890.Save(fileName, _subtitle); - return DialogResult.OK; - } - _converted = false; _fileName = saveFileDialog1.FileName; @@ -8266,6 +8219,8 @@ namespace Nikse.SubtitleEdit.Forms openToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileOpen); saveToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileSave); saveAsToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileSaveAs); + eBUSTLToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileExportEbu); + findToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditFind); findNextToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditFindNext); replaceToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditReplace); @@ -10503,5 +10458,104 @@ namespace Nikse.SubtitleEdit.Forms textBoxListViewText_MouseDoubleClick(sender, e); } + private void eBUSTLToolStripMenuItem_Click(object sender, EventArgs e) + { + var ebu = new Ebu(); + saveFileDialog1.Filter = ebu.Name + "|*" + ebu.Extension; + saveFileDialog1.Title = _language.SaveSubtitleAs; + saveFileDialog1.DefaultExt = "*" + ebu.Extension; + saveFileDialog1.AddExtension = true; + + if (!string.IsNullOrEmpty(_videoFileName)) + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_videoFileName); + else + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_fileName); + + if (!string.IsNullOrEmpty(openFileDialog1.InitialDirectory)) + saveFileDialog1.InitialDirectory = openFileDialog1.InitialDirectory; + + DialogResult result = saveFileDialog1.ShowDialog(this); + if (result == DialogResult.OK) + { + openFileDialog1.InitialDirectory = saveFileDialog1.InitialDirectory; + string fileName = saveFileDialog1.FileName; + string ext = Path.GetExtension(fileName).ToLower(); + bool extOk = ext == ebu.Extension.ToLower(); + if (!extOk) + { + if (fileName.EndsWith(".")) + fileName = fileName.Substring(0, fileName.Length - 1); + fileName += ebu.Extension; + } + ebu.Save(fileName, _subtitle); + } + } + + private void toolStripMenuItemCavena890_Click(object sender, EventArgs e) + { + var cavena890 = new Cavena890(); + saveFileDialog1.Filter = cavena890.Name + "|*" + cavena890.Extension; + saveFileDialog1.Title = _language.SaveSubtitleAs; + saveFileDialog1.DefaultExt = "*" + cavena890.Extension; + saveFileDialog1.AddExtension = true; + + if (!string.IsNullOrEmpty(_videoFileName)) + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_videoFileName); + else + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_fileName); + + if (!string.IsNullOrEmpty(openFileDialog1.InitialDirectory)) + saveFileDialog1.InitialDirectory = openFileDialog1.InitialDirectory; + + DialogResult result = saveFileDialog1.ShowDialog(this); + if (result == DialogResult.OK) + { + openFileDialog1.InitialDirectory = saveFileDialog1.InitialDirectory; + string fileName = saveFileDialog1.FileName; + string ext = Path.GetExtension(fileName).ToLower(); + bool extOk = ext == cavena890.Extension.ToLower(); + if (!extOk) + { + if (fileName.EndsWith(".")) + fileName = fileName.Substring(0, fileName.Length - 1); + fileName += cavena890.Extension; + } + cavena890.Save(fileName, _subtitle); + } + } + + private void pACScreenElectronicsToolStripMenuItem_Click(object sender, EventArgs e) + { + var pac = new Pac(); + saveFileDialog1.Filter = pac.Name + "|*" + pac.Extension; + saveFileDialog1.Title = _language.Menu.File.ExportEbu; + saveFileDialog1.DefaultExt = "*" + pac.Extension; + saveFileDialog1.AddExtension = true; + + if (!string.IsNullOrEmpty(_videoFileName)) + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_videoFileName); + else + saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(_fileName); + + if (!string.IsNullOrEmpty(openFileDialog1.InitialDirectory)) + saveFileDialog1.InitialDirectory = openFileDialog1.InitialDirectory; + + DialogResult result = saveFileDialog1.ShowDialog(this); + if (result == DialogResult.OK) + { + openFileDialog1.InitialDirectory = saveFileDialog1.InitialDirectory; + string fileName = saveFileDialog1.FileName; + string ext = Path.GetExtension(fileName).ToLower(); + bool extOk = ext == pac.Extension.ToLower(); + if (!extOk) + { + if (fileName.EndsWith(".")) + fileName = fileName.Substring(0, fileName.Length - 1); + fileName += pac.Extension; + } + pac.Save(fileName, _subtitle); + } + } + } } \ No newline at end of file diff --git a/src/Forms/Main.resx b/src/Forms/Main.resx index 9cdea9d6b..8395cc0eb 100644 --- a/src/Forms/Main.resx +++ b/src/Forms/Main.resx @@ -684,7 +684,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 - CAAAAk1TRnQBSQFMAgEBAgEAAbgBCAG4AQgBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAdgBCAHYAQgBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs index 6c680c48d..de464af95 100644 --- a/src/Forms/Settings.cs +++ b/src/Forms/Settings.cs @@ -426,6 +426,7 @@ namespace Nikse.SubtitleEdit.Forms fileNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.File.Open + GetShortcutText(Configuration.Settings.Shortcuts.MainFileOpen)); fileNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.File.Save + GetShortcutText(Configuration.Settings.Shortcuts.MainFileSave)); fileNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.File.SaveAs + GetShortcutText(Configuration.Settings.Shortcuts.MainFileSaveAs)); + fileNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.File.Export + " -> " + Configuration.Settings.Language.Main.Menu.File.ExportEbu + GetShortcutText(Configuration.Settings.Shortcuts.MainFileExportEbu)); treeViewShortcuts.Nodes.Add(fileNode); //Control+F @@ -810,6 +811,8 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.Shortcuts.MainFileSave = GetShortcut(node.Text); else if (text == Configuration.Settings.Language.Main.Menu.File.SaveAs.Replace("&", string.Empty)) Configuration.Settings.Shortcuts.MainFileSaveAs = GetShortcut(node.Text); + else if (text == Configuration.Settings.Language.Main.Menu.File.ExportEbu.Replace("&", string.Empty)) + Configuration.Settings.Shortcuts.MainFileExportEbu = GetShortcut(node.Text); } } diff --git a/src/Logic/Language.cs b/src/Logic/Language.cs index c5a1f8608..0c87d0ead 100644 --- a/src/Logic/Language.cs +++ b/src/Logic/Language.cs @@ -751,6 +751,11 @@ namespace Nikse.SubtitleEdit.Logic ImportSubtitleWithManualChosenEncoding = "Import subtitle with manual chosen encoding...", ImportText = "Import plain text...", ImportTimecodes = "Import time codes...", + Export = "Export", + ExportBdnXml = "BDN xml/png...", + ExportCavena890 = "Cavena 890...", + ExportEbu = "EBU stl...", + ExportPac = "PAC (Screen Electronics)...", Exit = "E&xit" }, diff --git a/src/Logic/LanguageStructure.cs b/src/Logic/LanguageStructure.cs index c7eced75e..368e6d5b3 100644 --- a/src/Logic/LanguageStructure.cs +++ b/src/Logic/LanguageStructure.cs @@ -678,6 +678,11 @@ public string ImportSubtitleWithManualChosenEncoding { get; set; } public string ImportText { get; set; } public string ImportTimecodes { get; set; } + public string Export { get; set; } + public string ExportBdnXml { get; set; } + public string ExportCavena890 { get; set; } + public string ExportEbu { get; set; } + public string ExportPac { get; set; } public string Exit { get; set; } } public class EditMenu diff --git a/src/Logic/Settings.cs b/src/Logic/Settings.cs index 046c76eda..39ec06049 100644 --- a/src/Logic/Settings.cs +++ b/src/Logic/Settings.cs @@ -413,6 +413,7 @@ namespace Nikse.SubtitleEdit.Logic public string MainFileOpen { get; set; } public string MainFileSave { get; set; } public string MainFileSaveAs { get; set; } + public string MainFileExportEbu { get; set; } public string MainEditFind { get; set; } public string MainEditFindNext { get; set; } public string MainEditReplace { get; set; } @@ -431,6 +432,7 @@ namespace Nikse.SubtitleEdit.Logic MainFileOpen = "Control+O"; MainFileSave = "Control+S"; MainFileSaveAs = "Control+Shift+S"; + MainFileExportEbu = string.Empty; MainEditFind = "Control+F"; MainEditFindNext = "F3"; MainEditReplace = "Control+H"; @@ -1073,6 +1075,9 @@ namespace Nikse.SubtitleEdit.Logic subNode = node.SelectSingleNode("MainFileSaveAs"); if (subNode != null) settings.Shortcuts.MainFileSaveAs = subNode.InnerText; + subNode = node.SelectSingleNode("MainFileExportEbu"); + if (subNode != null) + settings.Shortcuts.MainFileExportEbu = subNode.InnerText; subNode = node.SelectSingleNode("MainEditFind"); if (subNode != null) settings.Shortcuts.MainEditFind = subNode.InnerText; @@ -1333,6 +1338,7 @@ namespace Nikse.SubtitleEdit.Logic textWriter.WriteElementString("MainFileOpen", settings.Shortcuts.MainFileOpen); textWriter.WriteElementString("MainFileSave", settings.Shortcuts.MainFileSave); textWriter.WriteElementString("MainFileSaveAs", settings.Shortcuts.MainFileSaveAs); + textWriter.WriteElementString("MainFileExportEbu", settings.Shortcuts.MainFileSaveAs); textWriter.WriteElementString("MainEditFind", settings.Shortcuts.MainEditFind); textWriter.WriteElementString("MainEditFindNext", settings.Shortcuts.MainEditFindNext); textWriter.WriteElementString("MainEditReplace", settings.Shortcuts.MainEditReplace); diff --git a/src/Logic/SubtitleFormats/Ebu.cs b/src/Logic/SubtitleFormats/Ebu.cs index 211671173..74f4281cd 100644 --- a/src/Logic/SubtitleFormats/Ebu.cs +++ b/src/Logic/SubtitleFormats/Ebu.cs @@ -412,6 +412,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats public void Save(string fileName, Subtitle subtitle) { EbuGeneralSubtitleInformation header = new EbuGeneralSubtitleInformation(); + if (subtitle.Header != null && subtitle.Header.Length > 1024 && (subtitle.Header.Contains("STL25") || subtitle.Header.Contains("STL30"))) + header = ReadHeader(Encoding.UTF8.GetBytes(subtitle.Header)); + EbuSaveOptions saveOptions = new EbuSaveOptions(); saveOptions.Initialize(header, 0, fileName, subtitle); if (saveOptions.ShowDialog() != DialogResult.OK) @@ -493,6 +496,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats subtitle.Paragraphs.Clear(); byte[] buffer = File.ReadAllBytes(fileName); EbuGeneralSubtitleInformation header = ReadHeader(buffer); + subtitle.Header = Encoding.UTF8.GetString(buffer); foreach (EbuTextTimingInformation tti in ReadTTI(buffer, header)) { Paragraph p = new Paragraph(); diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index 62066fb19..8fa7658f3 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -34,9 +34,6 @@ namespace Nikse.SubtitleEdit.Logic if (info.Success) return info; - //if (IsWmpAvailable) - // return TryReadVideoInfoViaMediaPlayer(fileName, event1); - return new VideoInfo { VideoCodec = "Unknown" }; } @@ -80,42 +77,6 @@ namespace Nikse.SubtitleEdit.Logic return info; } - //private static VideoInfo TryReadVideoInfoViaMediaPlayer(string fileName, EventHandler doEvents) - //{ - // var info = new VideoInfo { Success = false }; - - // try - // { - // var player = new WMPLib.WindowsMediaPlayer { URL = fileName }; - - // player.controls.play(); - - // int i = 0; - // while (i < 100 && player.openState != WMPLib.WMPOpenState.wmposMediaOpen) - // { - // i++; - // System.Threading.Thread.Sleep(100); - // if (doEvents != null) - // doEvents.Invoke(null, null); - // } - - // info.TotalSeconds = player.currentMedia.duration; - // info.TotalMilliseconds = player.currentMedia.duration * 1000; - - // info.Width = player.currentMedia.imageSourceWidth; - // info.Height = player.currentMedia.imageSourceHeight; - // info.FramesPerSecond = player.network.encodedFrameRate; - - // player.controls.stop(); - // player.close(); - // info.Success = true; - // } - // catch - // { - // } - // return info; - //} - private static VideoInfo TryReadVideoInfoViaAviHeader(string fileName) { var info = new VideoInfo { Success = false }; @@ -1104,8 +1065,8 @@ namespace Nikse.SubtitleEdit.Logic int index = 0; foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats) { - sb.Append(format.FriendlyName + "|*" + format.Extension + "|"); - if (currentFormat.FriendlyName == format.FriendlyName) + sb.Append(format.Name + "|*" + format.Extension + "|"); + if (currentFormat.Name == format.Name) saveFileDialog.FilterIndex = index + 1; index++; }