Working on export custom text format

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2021 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-08-23 21:28:06 +00:00
parent 71f31f5aed
commit e02f74965c
8 changed files with 61 additions and 24 deletions

View File

@ -18,6 +18,8 @@
* Allow ebu stl with 23/29 fps - thx Raul/Antonio
* Minor improvements to WebVTT + added WebVTT with line# - thx Benoît
* Loading unknown subtitles now might work via generic parser
* Ctrl+v now allows import of up to 2000 lines (old limit was 500) - thx Leon
* EBU: Added 'Standard Display Code' ('Open subtitling' or 'Level 1/2 teletext')
* FIXED:
* Fix common errors: Fixed two bugs regarding Spanish "¿¡ !?" - thx Mike
* Bug in getting result from plugin - thx Herman
@ -28,9 +30,10 @@
before/after text was switched - thx Andreas
* Fixed some language tags - thx Marco/Leon
* Fixed problem in 'Fix italic tags' - thx Mike
* Fixed bug in 'Apply duration limits' - thx Mike
* Fixed bugs in 'Apply duration limits' - thx Mike
* When typing "&" SE would show "_" in the list view - thx XhmikosR
* Allow regex search in empty string - thx vmb
* Fixed crash when loading sub from dvd - thx Cristiano
3.3.7 (3rd August 2013)

View File

@ -63,7 +63,7 @@
this.listViewTemplates.Location = new System.Drawing.Point(6, 23);
this.listViewTemplates.MultiSelect = false;
this.listViewTemplates.Name = "listViewTemplates";
this.listViewTemplates.Size = new System.Drawing.Size(450, 178);
this.listViewTemplates.Size = new System.Drawing.Size(450, 280);
this.listViewTemplates.TabIndex = 0;
this.listViewTemplates.UseCompatibleStateImageBehavior = false;
this.listViewTemplates.View = System.Windows.Forms.View.Details;
@ -102,7 +102,7 @@
this.groupBoxFormats.Controls.Add(this.listViewTemplates);
this.groupBoxFormats.Location = new System.Drawing.Point(12, 12);
this.groupBoxFormats.Name = "groupBoxFormats";
this.groupBoxFormats.Size = new System.Drawing.Size(462, 234);
this.groupBoxFormats.Size = new System.Drawing.Size(462, 336);
this.groupBoxFormats.TabIndex = 0;
this.groupBoxFormats.TabStop = false;
this.groupBoxFormats.Text = "Formats";
@ -111,7 +111,7 @@
//
this.buttonEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonEdit.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonEdit.Location = new System.Drawing.Point(216, 207);
this.buttonEdit.Location = new System.Drawing.Point(216, 309);
this.buttonEdit.Name = "buttonEdit";
this.buttonEdit.Size = new System.Drawing.Size(117, 22);
this.buttonEdit.TabIndex = 1;
@ -123,7 +123,7 @@
//
this.buttonNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonNew.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonNew.Location = new System.Drawing.Point(339, 206);
this.buttonNew.Location = new System.Drawing.Point(339, 308);
this.buttonNew.Name = "buttonNew";
this.buttonNew.Size = new System.Drawing.Size(117, 22);
this.buttonNew.TabIndex = 2;
@ -139,7 +139,7 @@
this.textBoxPreview.Name = "textBoxPreview";
this.textBoxPreview.ReadOnly = true;
this.textBoxPreview.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxPreview.Size = new System.Drawing.Size(331, 214);
this.textBoxPreview.Size = new System.Drawing.Size(380, 316);
this.textBoxPreview.TabIndex = 0;
//
// groupBoxPreview
@ -150,7 +150,7 @@
this.groupBoxPreview.Controls.Add(this.textBoxPreview);
this.groupBoxPreview.Location = new System.Drawing.Point(480, 13);
this.groupBoxPreview.Name = "groupBoxPreview";
this.groupBoxPreview.Size = new System.Drawing.Size(337, 233);
this.groupBoxPreview.Size = new System.Drawing.Size(386, 335);
this.groupBoxPreview.TabIndex = 1;
this.groupBoxPreview.TabStop = false;
this.groupBoxPreview.Text = "Preview";
@ -159,7 +159,7 @@
//
this.labelEncoding.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelEncoding.AutoSize = true;
this.labelEncoding.Location = new System.Drawing.Point(368, 283);
this.labelEncoding.Location = new System.Drawing.Point(417, 385);
this.labelEncoding.Name = "labelEncoding";
this.labelEncoding.Size = new System.Drawing.Size(52, 13);
this.labelEncoding.TabIndex = 2;
@ -170,7 +170,7 @@
this.comboBoxEncoding.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxEncoding.FormattingEnabled = true;
this.comboBoxEncoding.Location = new System.Drawing.Point(426, 279);
this.comboBoxEncoding.Location = new System.Drawing.Point(475, 381);
this.comboBoxEncoding.Name = "comboBoxEncoding";
this.comboBoxEncoding.Size = new System.Drawing.Size(183, 21);
this.comboBoxEncoding.TabIndex = 3;
@ -179,7 +179,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(738, 278);
this.buttonCancel.Location = new System.Drawing.Point(787, 380);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 22);
this.buttonCancel.TabIndex = 5;
@ -191,7 +191,7 @@
//
this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSave.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonSave.Location = new System.Drawing.Point(615, 278);
this.buttonSave.Location = new System.Drawing.Point(664, 380);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(117, 22);
this.buttonSave.TabIndex = 4;
@ -203,7 +203,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(825, 312);
this.ClientSize = new System.Drawing.Size(874, 414);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.labelEncoding);
@ -219,6 +219,7 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Export custom text format";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ExportCustomText_KeyDown);
this.contextMenuStrip1.ResumeLayout(false);
this.groupBoxFormats.ResumeLayout(false);
this.groupBoxPreview.ResumeLayout(false);

View File

@ -12,6 +12,7 @@ namespace Nikse.SubtitleEdit.Forms
Subtitle _subtitle;
Subtitle _translated;
string _title;
public string LogMessage { get; set; }
public ExportCustomText(Subtitle subtitle, Subtitle original, string title)
{
@ -59,6 +60,11 @@ namespace Nikse.SubtitleEdit.Forms
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
groupBoxPreview.Text = Configuration.Settings.Language.General.Preview;
labelEncoding.Text = Configuration.Settings.Language.Main.Controls.FileEncoding;
columnHeader1.Text = Configuration.Settings.Language.General.Name;
columnHeader2.Text = Configuration.Settings.Language.General.Text;
buttonNew.Text = l.New;
buttonEdit.Text = l.Edit;
deleteToolStripMenuItem.Text = l.Delete;
}
private void ShowTemplates(List<string> templates)
@ -142,7 +148,7 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonSave_Click(object sender, EventArgs e)
{
saveFileDialog1.Title = "Save subtitle as...";
saveFileDialog1.Title = Configuration.Settings.Language.ExportCustomText.SaveSubtitleAs;
if (!string.IsNullOrEmpty(_title))
saveFileDialog1.FileName = System.IO.Path.GetFileNameWithoutExtension(_title) + ".txt";
saveFileDialog1.Filter = Configuration.Settings.Language.General.AllFiles + "|*.*";
@ -151,6 +157,7 @@ namespace Nikse.SubtitleEdit.Forms
try
{
System.IO.File.WriteAllText(saveFileDialog1.FileName, GenerateText(_subtitle, _translated, _title), GetCurrentEncoding());
LogMessage = string.Format(Configuration.Settings.Language.ExportCustomText.SubtitleExportedInCustomFormatToX, saveFileDialog1.FileName);
DialogResult = DialogResult.OK;
}
catch (Exception exception)
@ -231,5 +238,11 @@ namespace Nikse.SubtitleEdit.Forms
SaveTemplates();
}
private void ExportCustomText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
}
}
}

View File

@ -31,7 +31,7 @@
this.components = new System.ComponentModel.Container();
this.groupBoxTemplate = new System.Windows.Forms.GroupBox();
this.textBoxName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.labelName = new System.Windows.Forms.Label();
this.comboBoxNewLine = new System.Windows.Forms.ComboBox();
this.comboBoxTimeCode = new System.Windows.Forms.ComboBox();
this.labelNewLine = new System.Windows.Forms.Label();
@ -74,7 +74,7 @@
this.groupBoxTemplate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBoxTemplate.Controls.Add(this.textBoxName);
this.groupBoxTemplate.Controls.Add(this.label1);
this.groupBoxTemplate.Controls.Add(this.labelName);
this.groupBoxTemplate.Controls.Add(this.comboBoxNewLine);
this.groupBoxTemplate.Controls.Add(this.comboBoxTimeCode);
this.groupBoxTemplate.Controls.Add(this.labelNewLine);
@ -99,14 +99,14 @@
this.textBoxName.Size = new System.Drawing.Size(275, 20);
this.textBoxName.TabIndex = 1;
//
// label1
// labelName
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Name";
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(8, 33);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(35, 13);
this.labelName.TabIndex = 0;
this.labelName.Text = "Name";
//
// comboBoxNewLine
//
@ -448,7 +448,7 @@
private System.Windows.Forms.GroupBox groupBoxPreview;
private System.Windows.Forms.TextBox textBoxPreview;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label labelName;
private System.Windows.Forms.ToolStripMenuItem translationToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStripHeader;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;

View File

@ -33,7 +33,10 @@ namespace Nikse.SubtitleEdit.Forms
var l = Configuration.Settings.Language.ExportCustomTextFormat;
Text = l.Title;
labelName.Text = Configuration.Settings.Language.General.Name;
groupBoxTemplate.Text = l.Template;
labelTimeCode.Text = l.TimeCode;
labelNewLine.Text = l.NewLine;
labelHeader.Text = l.Header;
labelTextLine.Text = l.TextLine;
labelFooter.Text = l.Footer;

View File

@ -17602,7 +17602,10 @@ namespace Nikse.SubtitleEdit.Forms
{
var form = new ExportCustomText( _subtitle, _subtitleAlternate, _fileName);
_formPositionsAndSizes.SetPositionAndSize(form);
form.ShowDialog(this);
if (form.ShowDialog(this) == DialogResult.OK)
{
ShowStatus(form.LogMessage);
}
_formPositionsAndSizes.SavePositionAndSize(form);
}

View File

@ -481,7 +481,12 @@ namespace Nikse.SubtitleEdit.Logic
{
Title = "Export custom text format",
Formats = "Formats",
New = "New",
Edit = "Edit",
Delete = "Delete",
SaveAs = "S&ave as...",
SaveSubtitleAs = "Save subtitle as...",
SubtitleExportedInCustomFormatToX = "Subtitle exported in custom format to: {0}",
};
ExportCustomTextFormat = new LanguageStructure.ExportCustomTextFormat
@ -490,6 +495,8 @@ namespace Nikse.SubtitleEdit.Logic
Template = "Template",
Header = "Header",
TextLine = "Text line (paragraph)",
TimeCode = "Time code",
NewLine = "New line",
Footer = "Footer",
};

View File

@ -374,7 +374,12 @@
{
public string Title { get; set; }
public string Formats { get; set; }
public string New { get; set; }
public string Edit { get; set; }
public string Delete { get; set; }
public string SaveAs { get; set; }
public string SaveSubtitleAs { get; set; }
public string SubtitleExportedInCustomFormatToX { get; set; }
}
public class ExportCustomTextFormat
@ -383,6 +388,8 @@
public string Template { get; set; }
public string Header { get; set; }
public string TextLine { get; set; }
public string TimeCode { get; set; }
public string NewLine { get; set; }
public string Footer { get; set; }
}