Added export to plain text + a setting for mouse wheel scroll direction in waveform

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@730 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-10-17 18:53:29 +00:00
parent 246a1dd090
commit 37a4290a54
9 changed files with 495 additions and 406 deletions

View File

@ -1220,6 +1220,5 @@ namespace Nikse.SubtitleEdit.Controls
bmpDestination.Dispose();
}
}
}

View File

@ -90,6 +90,8 @@
this.toolStripMenuItemCavena890 = new System.Windows.Forms.ToolStripMenuItem();
this.eBUSTLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pACScreenElectronicsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.plainTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.plainTextWithoutLineBreaksToolStripMenuItem = 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();
@ -929,7 +931,9 @@
this.toolStripMenuItemExportPngXml,
this.toolStripMenuItemCavena890,
this.eBUSTLToolStripMenuItem,
this.pACScreenElectronicsToolStripMenuItem});
this.pACScreenElectronicsToolStripMenuItem,
this.plainTextToolStripMenuItem,
this.plainTextWithoutLineBreaksToolStripMenuItem});
this.toolStripMenuItemExport.Name = "toolStripMenuItemExport";
this.toolStripMenuItemExport.Size = new System.Drawing.Size(334, 22);
this.toolStripMenuItemExport.Text = "Export";
@ -937,31 +941,45 @@
// toolStripMenuItemExportPngXml
//
this.toolStripMenuItemExportPngXml.Name = "toolStripMenuItemExportPngXml";
this.toolStripMenuItemExportPngXml.Size = new System.Drawing.Size(222, 22);
this.toolStripMenuItemExportPngXml.Size = new System.Drawing.Size(245, 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.Size = new System.Drawing.Size(245, 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.Size = new System.Drawing.Size(245, 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.Size = new System.Drawing.Size(245, 22);
this.pACScreenElectronicsToolStripMenuItem.Text = "PAC (Screen Electronics)...";
this.pACScreenElectronicsToolStripMenuItem.Click += new System.EventHandler(this.pACScreenElectronicsToolStripMenuItem_Click);
//
// plainTextToolStripMenuItem
//
this.plainTextToolStripMenuItem.Name = "plainTextToolStripMenuItem";
this.plainTextToolStripMenuItem.Size = new System.Drawing.Size(245, 22);
this.plainTextToolStripMenuItem.Text = "Plain text...";
this.plainTextToolStripMenuItem.Click += new System.EventHandler(this.plainTextToolStripMenuItem_Click);
//
// plainTextWithoutLineBreaksToolStripMenuItem
//
this.plainTextWithoutLineBreaksToolStripMenuItem.Name = "plainTextWithoutLineBreaksToolStripMenuItem";
this.plainTextWithoutLineBreaksToolStripMenuItem.Size = new System.Drawing.Size(245, 22);
this.plainTextWithoutLineBreaksToolStripMenuItem.Text = "Plain text without line breaks...";
this.plainTextWithoutLineBreaksToolStripMenuItem.Click += new System.EventHandler(this.plainTextWithoutLineBreaksToolStripMenuItem_Click);
//
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
@ -2099,6 +2117,7 @@
this.audioVisualizer.StartPositionSeconds = 0D;
this.audioVisualizer.TabIndex = 6;
this.audioVisualizer.TextColor = System.Drawing.Color.Gray;
this.audioVisualizer.VerticalZoomPercent = 1D;
this.audioVisualizer.WaveFormNotLoadedText = "Click to add wave form";
this.audioVisualizer.WavePeaks = null;
this.audioVisualizer.ZoomFactor = 1D;
@ -3121,6 +3140,7 @@
//
// textBoxListViewTextAlternate
//
this.textBoxListViewTextAlternate.AllowDrop = true;
this.textBoxListViewTextAlternate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxListViewTextAlternate.ContextMenuStrip = this.contextMenuStripTextBoxListView;
@ -3459,6 +3479,7 @@
//
// textBoxListViewText
//
this.textBoxListViewText.AllowDrop = true;
this.textBoxListViewText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxListViewText.ContextMenuStrip = this.contextMenuStripTextBoxListView;
@ -4016,6 +4037,8 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCavena890;
private Controls.SETextBox textBoxListViewTextAlternate;
private System.Windows.Forms.ToolStripMenuItem textCharssecToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem plainTextToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem plainTextWithoutLineBreaksToolStripMenuItem;
}
}

View File

@ -891,6 +891,10 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemCavena890.Text = _language.Menu.File.ExportCavena890;
eBUSTLToolStripMenuItem.Text = _language.Menu.File.ExportEbu;
pACScreenElectronicsToolStripMenuItem.Text = _language.Menu.File.ExportPac;
plainTextToolStripMenuItem.Text = _language.Menu.File.ExportPlainText;
plainTextToolStripMenuItem.Visible = !string.IsNullOrEmpty(_language.Menu.File.ExportPlainText); //TODO: Remove in 3.3
plainTextWithoutLineBreaksToolStripMenuItem.Text = _language.Menu.File.ExportPlainTextWithoutLineBreaks;
plainTextWithoutLineBreaksToolStripMenuItem.Visible = !string.IsNullOrEmpty(_language.Menu.File.ExportPlainTextWithoutLineBreaks); //TODO: Remove in 3.3
exitToolStripMenuItem.Text = _language.Menu.File.Exit;
editToolStripMenuItem.Text = _language.Menu.Edit.Title;
@ -2274,6 +2278,7 @@ namespace Nikse.SubtitleEdit.Forms
audioVisualizer.Color = Configuration.Settings.VideoControls.WaveFormColor;
audioVisualizer.BackgroundColor = Configuration.Settings.VideoControls.WaveFormBackgroundColor;
audioVisualizer.TextColor = Configuration.Settings.VideoControls.WaveFormTextColor;
audioVisualizer.MouseWheelScrollUpIsForward = Configuration.Settings.VideoControls.WaveFormMouseWheelScrollUpIsForward;
if (oldSubtitleFontSettings != Configuration.Settings.General.SubtitleFontName +
Configuration.Settings.General.SubtitleFontBold +
@ -11505,5 +11510,42 @@ namespace Nikse.SubtitleEdit.Forms
_findHelper.MatchInOriginal = true;
}
private void plainTextToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportTextOnly(false);
}
private void plainTextWithoutLineBreaksToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportTextOnly(true);
}
private void ExportTextOnly(bool removeLineBreaks)
{
if (SubtitleListview1.Items.Count > 0)
{
if (!string.IsNullOrEmpty(openFileDialog1.InitialDirectory))
saveFileDialog1.InitialDirectory = openFileDialog1.InitialDirectory;
saveFileDialog1.Title = _language.ExportPlainTextAs;
saveFileDialog1.Filter = _language.TextFiles + "|*.txt";
if (saveFileDialog1.ShowDialog(this) == DialogResult.OK)
{
var sb = new StringBuilder();
foreach (Paragraph p in _subtitle.Paragraphs)
{
sb.AppendLine(Utilities.RemoveHtmlTags(p.Text));
}
string text = sb.ToString().Trim();
if (removeLineBreaks)
{
text = text.Replace(Environment.NewLine, " ");
text = text.Replace(" ", " ").Replace(" ", " ");
}
File.WriteAllText(saveFileDialog1.FileName, text);
}
}
}
}
}

View File

@ -681,7 +681,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAagBCwGoAQsBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAQgBDAEIAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -214,6 +214,7 @@
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
this.fontDialogSSAStyle = new System.Windows.Forms.FontDialog();
this.labelStatus = new System.Windows.Forms.Label();
this.checkBoxReverseMouseWheelScrollDirection = new System.Windows.Forms.CheckBox();
this.tabControlSettings.SuspendLayout();
this.tabPageGenerel.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
@ -1391,6 +1392,7 @@
//
// groupBoxWaveFormAppearence
//
this.groupBoxWaveFormAppearence.Controls.Add(this.checkBoxReverseMouseWheelScrollDirection);
this.groupBoxWaveFormAppearence.Controls.Add(this.panelWaveFormTextColor);
this.groupBoxWaveFormAppearence.Controls.Add(this.buttonWaveFormTextColor);
this.groupBoxWaveFormAppearence.Controls.Add(this.panelWaveFormGridColor);
@ -2298,6 +2300,16 @@
this.labelStatus.TabIndex = 3;
this.labelStatus.Text = "labelStatus";
//
// checkBoxReverseMouseWheelScrollDirection
//
this.checkBoxReverseMouseWheelScrollDirection.AutoSize = true;
this.checkBoxReverseMouseWheelScrollDirection.Location = new System.Drawing.Point(262, 31);
this.checkBoxReverseMouseWheelScrollDirection.Name = "checkBoxReverseMouseWheelScrollDirection";
this.checkBoxReverseMouseWheelScrollDirection.Size = new System.Drawing.Size(202, 17);
this.checkBoxReverseMouseWheelScrollDirection.TabIndex = 11;
this.checkBoxReverseMouseWheelScrollDirection.Text = "Reverse mouse wheel scroll direction";
this.checkBoxReverseMouseWheelScrollDirection.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2570,5 +2582,6 @@
private System.Windows.Forms.CheckBox checkBoxGenerateSpectrogram;
private System.Windows.Forms.Label labelSpectrogramAppearance;
private System.Windows.Forms.ComboBox comboBoxSpectrogramAppearance;
private System.Windows.Forms.CheckBox checkBoxReverseMouseWheelScrollDirection;
}
}

View File

@ -231,6 +231,8 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxWaveFormAppearence.Text = language.WaveFormAppearance;
checkBoxWaveFormShowGrid.Text = language.WaveFormShowGridLines;
checkBoxReverseMouseWheelScrollDirection.Text = language.ReverseMouseWheelScrollDirection;
checkBoxReverseMouseWheelScrollDirection.Visible = !string.IsNullOrEmpty(language.ReverseMouseWheelScrollDirection); // TODO: Remove in 3.3
buttonWaveFormGridColor.Text = language.WaveFormGridColor;
buttonWaveFormColor.Text = language.WaveFormColor;
buttonWaveFormSelectedColor.Text = language.WaveFormSelectedColor;
@ -421,7 +423,7 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxSpectrogramAppearance.SelectedIndex = 0;
else
comboBoxSpectrogramAppearance.SelectedIndex = 1;
checkBoxReverseMouseWheelScrollDirection.Checked = Configuration.Settings.VideoControls.WaveFormMouseWheelScrollUpIsForward;
TreeNode fileNode = new TreeNode(Configuration.Settings.Language.Main.Menu.File.Title);
fileNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.File.New + GetShortcutText(Configuration.Settings.Shortcuts.MainFileNew));
@ -810,11 +812,11 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.VideoControls.WaveFormBackgroundColor = panelWaveFormBackgroundColor.BackColor;
Configuration.Settings.VideoControls.WaveFormTextColor = panelWaveFormTextColor.BackColor;
Configuration.Settings.VideoControls.GenerateSpectrogram = checkBoxGenerateSpectrogram.Checked;
if (comboBoxSpectrogramAppearance.SelectedIndex == 0)
Configuration.Settings.VideoControls.SpectrogramAppearance = "OneColorGradient";
else
Configuration.Settings.VideoControls.SpectrogramAppearance = "Classic";
Configuration.Settings.VideoControls.WaveFormMouseWheelScrollUpIsForward = checkBoxReverseMouseWheelScrollDirection.Checked;
//Main File
foreach (TreeNode node in treeViewShortcuts.Nodes[0].Nodes)

View File

@ -758,6 +758,8 @@ namespace Nikse.SubtitleEdit.Logic
SpellCheckCompletedXCorrections = "Spell check completed. {0} lines were modified.",
OpenOtherSubtitle = "Open other subtitle",
BeforeToggleDialogueDashes = "Before toggle of dialogue dashes",
TextFiles = "Text files",
ExportPlainTextAs = "Export plain text as",
Menu = new LanguageStructure.Main.MainMenu
{
@ -786,6 +788,8 @@ namespace Nikse.SubtitleEdit.Logic
ExportCavena890 = "Cavena 890...",
ExportEbu = "EBU stl...",
ExportPac = "PAC (Screen Electronics)...",
ExportPlainText = "Export plain text...",
ExportPlainTextWithoutLineBreaks = "Export plain text without line breaks...",
Exit = "E&xit"
},
@ -1205,6 +1209,7 @@ can edit in same subtitle file (collaboration)",
WaveFormAppearance = "Wave form appearance",
WaveFormGridColor = "Grid color",
WaveFormShowGridLines = "Show grid lines",
ReverseMouseWheelScrollDirection = "Reverse mouse wheel scroll direction",
WaveFormColor = "Color",
WaveFormSelectedColor = "Selected color",
WaveFormBackgroundColor = "Back color",

View File

@ -680,6 +680,8 @@
public string SpellCheckCompletedXCorrections { get; set; }
public string OpenOtherSubtitle { get; set; }
public string BeforeToggleDialogueDashes { get; set; }
public string ExportPlainTextAs { get; set; }
public string TextFiles { get; set; }
public class MainMenu
{
@ -708,6 +710,8 @@
public string ExportCavena890 { get; set; }
public string ExportEbu { get; set; }
public string ExportPac { get; set; }
public string ExportPlainText { get; set; }
public string ExportPlainTextWithoutLineBreaks { get; set; }
public string Exit { get; set; }
}
public class EditMenu
@ -1134,6 +1138,7 @@
public string WaveFormAppearance { get; set; }
public string WaveFormGridColor { get; set; }
public string WaveFormShowGridLines { get; set; }
public string ReverseMouseWheelScrollDirection { get; set; }
public string WaveFormColor { get; set; }
public string WaveFormSelectedColor { get; set; }
public string WaveFormBackgroundColor { get; set; }