Added setting to allow for edit dual sami as translation/original + plugin downloader + changed title to Beta 1

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1368 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-09-17 17:33:21 +00:00
parent a1ffed3633
commit f18d592dc8
14 changed files with 726 additions and 23 deletions

View File

@ -1,6 +1,6 @@
Subtitle Edit Changelog
3.3 Beta 1 (x September 2012)
3.3 Beta 1 (17th September 2012)
* NEW:
* Edit -> Reverse RTL start/end (fix punctuations)
* Easy import of auto backed up files (File -> Restore auto-backup...)
@ -55,6 +55,7 @@ Subtitle Edit Changelog
* Possible crash when importing vobsub from mkv files - thx Ile
* Can now read SCC with ";" in time code - thx Thane
* Crash when splitting an empty line - thx Pimmetje
* Fixed "Timed Text" time codes with comma in seconds - thx Steffan
3.2.8 (3rd June 2012)

View File

@ -312,24 +312,26 @@ namespace Nikse.SubtitleEdit.Controls
if (pos < lastCurrentEnd)
return true;
if (_selectedIndices == null)
if (_selectedIndices == null || _subtitle == null)
return false;
foreach (int index in _selectedIndices)
{
var p = _subtitle.GetParagraphOrDefault(index);
if (p == null)
return false;
try
{
var p = _subtitle.Paragraphs[index];
int start = (int)Math.Round(p.StartTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
int end = (int)Math.Round(p.EndTime.TotalSeconds * _wavePeaks.Header.SampleRate * _zoomFactor);
if (pos >= start && pos <= end)
{
lastCurrentEnd = end;
return true;
}
}
catch
{
return false;
}
}
return false;
}

View File

@ -48,6 +48,7 @@
this.buttonOK.TabIndex = 20;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// labelDescription2
//
@ -77,6 +78,7 @@
this.labelDescription1.Size = new System.Drawing.Size(316, 13);
this.labelDescription1.TabIndex = 8;
this.labelDescription1.Text = "Subtitle Edit\'s spell check is based on the NHunspell engine which";
this.labelDescription1.Click += new System.EventHandler(this.labelDescription1_Click);
//
// comboBoxDictionaries
//
@ -109,6 +111,7 @@
this.labelChooseLanguageAndClickDownload.Size = new System.Drawing.Size(201, 13);
this.labelChooseLanguageAndClickDownload.TabIndex = 11;
this.labelChooseLanguageAndClickDownload.Text = "Choose your languge and click download";
this.labelChooseLanguageAndClickDownload.Click += new System.EventHandler(this.labelChooseLanguageAndClickDownload_Click);
//
// labelPleaseWait
//
@ -118,6 +121,7 @@
this.labelPleaseWait.Size = new System.Drawing.Size(73, 13);
this.labelPleaseWait.TabIndex = 12;
this.labelPleaseWait.Text = "Please wait...";
this.labelPleaseWait.Click += new System.EventHandler(this.labelPleaseWait_Click);
//
// GetDictionaries
//

View File

@ -209,5 +209,25 @@ namespace Nikse.SubtitleEdit.Forms
labelPleaseWait.Text = _descriptions[index];
}
private void buttonOK_Click(object sender, EventArgs e)
{
}
private void labelPleaseWait_Click(object sender, EventArgs e)
{
}
private void labelChooseLanguageAndClickDownload_Click(object sender, EventArgs e)
{
}
private void labelDescription1_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -81,6 +81,7 @@
this.toolStripMenuItemOpenContainingFolder = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemCompare = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemStatistics = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemPlugins = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItemImportDvdSubtitles = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemSubIdx = new System.Windows.Forms.ToolStripMenuItem();
@ -800,6 +801,7 @@
this.toolStripMenuItemOpenContainingFolder,
this.toolStripMenuItemCompare,
this.toolStripMenuItemStatistics,
this.toolStripMenuItemPlugins,
this.toolStripSeparator1,
this.toolStripMenuItemImportDvdSubtitles,
this.toolStripMenuItemSubIdx,
@ -941,6 +943,13 @@
this.toolStripMenuItemStatistics.Text = "Statistics...";
this.toolStripMenuItemStatistics.Click += new System.EventHandler(this.toolStripMenuItemStatistics_Click);
//
// toolStripMenuItemPlugins
//
this.toolStripMenuItemPlugins.Name = "toolStripMenuItemPlugins";
this.toolStripMenuItemPlugins.Size = new System.Drawing.Size(334, 22);
this.toolStripMenuItemPlugins.Text = "Plugins...";
this.toolStripMenuItemPlugins.Click += new System.EventHandler(this.toolStripMenuItemPlugins_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -1170,12 +1179,14 @@
this.toolStripMenuItemUndo.Name = "toolStripMenuItemUndo";
this.toolStripMenuItemUndo.Size = new System.Drawing.Size(305, 22);
this.toolStripMenuItemUndo.Text = "Undo";
this.toolStripMenuItemUndo.Click += new System.EventHandler(this.toolStripMenuItemUndo_Click);
//
// toolStripMenuItemRedo
//
this.toolStripMenuItemRedo.Name = "toolStripMenuItemRedo";
this.toolStripMenuItemRedo.Size = new System.Drawing.Size(305, 22);
this.toolStripMenuItemRedo.Text = "Redo";
this.toolStripMenuItemRedo.Click += new System.EventHandler(this.toolStripMenuItemRedo_Click);
//
// showHistoryforUndoToolStripMenuItem
//
@ -4317,6 +4328,7 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemUndo;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemRedo;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemShowOriginalInPreview;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemPlugins;
}
}

View File

@ -158,6 +158,7 @@ namespace Nikse.SubtitleEdit.Forms
private Paragraph _mainAdjustStartDownEndUpAndGoToNextParagraph;
private string _lastDoNotPrompt = string.Empty;
private VideoInfo _videoInfo = null;
bool _splitDualSami = false;
private bool AutoRepeatContinueOn
{
@ -178,7 +179,7 @@ namespace Nikse.SubtitleEdit.Forms
if (versionInfo.Length >= 3 && versionInfo[2] != "0")
_title += "." + versionInfo[2];
}
return _title + " preview";
return _title + " ßeta 1";
}
}
@ -2261,6 +2262,36 @@ namespace Nikse.SubtitleEdit.Forms
if (LoadAlternateSubtitleFile(originalFileName))
_subtitleAlternateFileName = originalFileName;
// Seungki begin
_splitDualSami = false;
if (Configuration.Settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles && format.GetType() == typeof(Sami) && Sami.GetStylesFromHeader(_subtitle.Header).Count == 2)
{
List<string> classes = Sami.GetStylesFromHeader(_subtitle.Header);
var s1 = new Subtitle(_subtitle);
var s2 = new Subtitle(_subtitle);
s1.Paragraphs.Clear();
s2.Paragraphs.Clear();
foreach (Paragraph p in _subtitle.Paragraphs)
{
if (p.Extra.ToLower() == classes[0].ToLower())
s1.Paragraphs.Add(p);
else
s2.Paragraphs.Add(p);
}
if (s1.Paragraphs.Count == 0 || s2.Paragraphs.Count == 0)
return;
_subtitle = s1;
_subtitleAlternate = s2;
_subtitleAlternateFileName = _fileName;
SubtitleListview1.HideExtraColumn();
SubtitleListview1.ShowAlternateTextColumn(classes[1]);
_splitDualSami = true;
}
// Seungki end
textBoxSource.Text = _subtitle.ToText(format);
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
if (SubtitleListview1.Items.Count > 0)
@ -2688,8 +2719,19 @@ namespace Nikse.SubtitleEdit.Forms
try
{
string allText = _subtitle.ToText(format);
// Seungki begin
if (_splitDualSami && _subtitleAlternate != null)
{
var s = new Subtitle(_subtitle);
foreach (Paragraph p in _subtitleAlternate.Paragraphs)
s.Paragraphs.Add(p);
allText = s.ToText(format);
}
// Seungki end
var currentEncoding = GetCurrentEncoding();
if (currentEncoding == Encoding.Default && (allText.Contains("♪") || allText.Contains("♫") | allText.Contains("♥"))) // ANSI & music/unicode symbols
if (currentEncoding == Encoding.Default && (allText.Contains("♪") || allText.Contains("♫") || allText.Contains("♥") || allText.Contains("—") || allText.Contains("…"))) // ANSI & music/unicode symbols
{
if (MessageBox.Show(string.Format(_language.UnicodeMusicSymbolsAnsiWarning), Title, MessageBoxButtons.YesNo) == DialogResult.No)
return DialogResult.No;
@ -2801,6 +2843,7 @@ namespace Nikse.SubtitleEdit.Forms
_oldSubtitleFormat = null;
labelSingleLine.Text = string.Empty;
RemoveAlternate(true);
_splitDualSami = false;
SubtitleListview1.HideExtraColumn();
SubtitleListview1.DisplayExtraFromExtra = false;
@ -3110,6 +3153,8 @@ namespace Nikse.SubtitleEdit.Forms
private int ShowSubtitle()
{
if (_splitDualSami)
return Utilities.ShowSubtitle(_subtitle.Paragraphs, _subtitleAlternate, mediaPlayer);
if (SubtitleListview1.IsAlternateTextColumnVisible && Configuration.Settings.General.ShowOriginalAsPreviewIfAvailable)
return Utilities.ShowSubtitle(_subtitleAlternate.Paragraphs, mediaPlayer);
return Utilities.ShowSubtitle(_subtitle.Paragraphs, mediaPlayer);
@ -9735,10 +9780,10 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemInsertUnicodeCharacter.Visible = toolStripMenuItemInsertUnicodeCharacter.DropDownItems.Count > 0;
toolStripSeparatorInsertUnicodeCharacter.Visible = toolStripMenuItemInsertUnicodeCharacter.DropDownItems.Count > 0;
}
toolStripMenuItemUndo.Enabled = _subtitle.CanUndo;
toolStripMenuItemRedo.Enabled = _subtitle.CanUndo;
toolStripMenuItemUndo.Enabled = _subtitle != null && _subtitle.CanUndo && _undoIndex >= 0;
toolStripMenuItemRedo.Enabled = _subtitle != null && _subtitle.CanUndo && _undoIndex < _subtitle.HistoryItems.Count - 1;
showHistoryforUndoToolStripMenuItem.Enabled = _subtitle != null && _subtitle.CanUndo;
toolStripMenuItemShowOriginalInPreview.Visible = SubtitleListview1.IsAlternateTextColumnVisible;
}
private void InsertUnicodeGlyph(object sender, EventArgs e)
@ -11536,6 +11581,8 @@ namespace Nikse.SubtitleEdit.Forms
saveAsToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileSaveAs);
eBUSTLToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainFileExportEbu);
toolStripMenuItemUndo.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditUndo);
toolStripMenuItemRedo.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditRedo);
findToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditFind);
findNextToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditFindNext);
replaceToolStripMenuItem.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditReplace);
@ -11624,6 +11671,38 @@ namespace Nikse.SubtitleEdit.Forms
int filePluginCount = 0;
int toolsPluginCount = 0;
int syncPluginCount = 0;
for (int k = fileToolStripMenuItem.DropDownItems.Count - 1; k > 0; k--)
{
ToolStripItem x = fileToolStripMenuItem.DropDownItems[k];
if (x.Name.StartsWith("Plugin"))
fileToolStripMenuItem.DropDownItems.Remove(x);
}
for (int k = toolsToolStripMenuItem.DropDownItems.Count - 1; k > 0; k--)
{
ToolStripItem x = toolsToolStripMenuItem.DropDownItems[k];
if (x.Name.StartsWith("Plugin"))
toolsToolStripMenuItem.DropDownItems.Remove(x);
}
for (int k = toolStripMenuItemSpellCheckMain.DropDownItems.Count - 1; k > 0; k--)
{
ToolStripItem x = toolStripMenuItemSpellCheckMain.DropDownItems[k];
if (x.Name.StartsWith("Plugin"))
toolStripMenuItemSpellCheckMain.DropDownItems.Remove(x);
}
for (int k = toolStripMenuItemSyncronization.DropDownItems.Count - 1; k > 0; k--)
{
ToolStripItem x = toolStripMenuItemSyncronization.DropDownItems[k];
if (x.Name.StartsWith("Plugin"))
toolStripMenuItemSyncronization.DropDownItems.Remove(x);
}
for (int k = toolStripMenuItemAutoTranslate.DropDownItems.Count - 1; k > 0; k--)
{
ToolStripItem x = toolStripMenuItemAutoTranslate.DropDownItems[k];
if (x.Name.StartsWith("Plugin"))
toolStripMenuItemAutoTranslate.DropDownItems.Remove(x);
}
foreach (string pluginFileName in pluginFiles)
{
Type pluginType = null;
@ -11657,7 +11736,11 @@ namespace Nikse.SubtitleEdit.Forms
if (string.Compare(actionType, "File", true) == 0)
{
if (filePluginCount == 0)
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, new ToolStripSeparator());
{
var tss = new ToolStripSeparator();
tss.Name = "PluginSepFile";
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, tss);
}
item.Click += PluginToolClick;
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, item);
filePluginCount++;
@ -11665,7 +11748,11 @@ namespace Nikse.SubtitleEdit.Forms
else if (string.Compare(actionType, "Tool", true) == 0)
{
if (toolsPluginCount == 0)
toolsToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
{
var tss = new ToolStripSeparator();
tss.Name = "PluginSepTool";
toolsToolStripMenuItem.DropDownItems.Add(tss);
}
item.Click += PluginToolClick;
toolsToolStripMenuItem.DropDownItems.Add(item);
toolsPluginCount++;
@ -11673,11 +11760,40 @@ namespace Nikse.SubtitleEdit.Forms
else if (string.Compare(actionType, "Sync", true) == 0)
{
if (syncPluginCount == 0)
toolStripMenuItemSyncronization.DropDownItems.Add(new ToolStripSeparator());
{
var tss = new ToolStripSeparator();
tss.Name = "PluginSepSync";
toolStripMenuItemSyncronization.DropDownItems.Add(tss);
}
item.Click += PluginToolClick;
toolStripMenuItemSyncronization.DropDownItems.Add(item);
syncPluginCount++;
}
else if (string.Compare(actionType, "Translate", true) == 0)
{
if (syncPluginCount == 0)
{
var tss = new ToolStripSeparator();
tss.Name = "PluginSepTranslate";
toolStripMenuItemAutoTranslate.DropDownItems.Add(tss);
}
item.Click += PluginToolClick;
toolStripMenuItemAutoTranslate.DropDownItems.Add(item);
syncPluginCount++;
}
else if (string.Compare(actionType, "SpellCheck", true) == 0)
{
if (syncPluginCount == 0)
{
var tss = new ToolStripSeparator();
tss.Name = "PluginSepSpellCheck";
toolStripMenuItemSpellCheckMain.DropDownItems.Add(tss);
}
item.Click += PluginToolClick;
toolStripMenuItemSpellCheckMain.DropDownItems.Add(item);
syncPluginCount++;
}
}
}
@ -15066,5 +15182,22 @@ namespace Nikse.SubtitleEdit.Forms
exportBdnXmlPng.ShowDialog(this);
}
private void toolStripMenuItemPlugins_Click(object sender, EventArgs e)
{
var form = new PluginsGet();
form.ShowDialog(this);
LoadPlugins();
}
private void toolStripMenuItemUndo_Click(object sender, EventArgs e)
{
UndoLastAction();
}
private void toolStripMenuItemRedo_Click(object sender, EventArgs e)
{
RedoLastAction();
}
}
}

View File

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

184
src/Forms/PluginsGet.Designer.cs generated Normal file
View File

@ -0,0 +1,184 @@
namespace Nikse.SubtitleEdit.Forms
{
partial class PluginsGet
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.labelPleaseWait = new System.Windows.Forms.Label();
this.labelChooseLanguageAndClickDownload = new System.Windows.Forms.Label();
this.buttonDownload = new System.Windows.Forms.Button();
this.labelDescription1 = new System.Windows.Forms.Label();
this.linkLabelOpenDictionaryFolder = new System.Windows.Forms.LinkLabel();
this.buttonOK = new System.Windows.Forms.Button();
this.listViewPlugins = new System.Windows.Forms.ListView();
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderVersion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderDate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.SuspendLayout();
//
// labelPleaseWait
//
this.labelPleaseWait.AutoSize = true;
this.labelPleaseWait.Location = new System.Drawing.Point(12, 239);
this.labelPleaseWait.Name = "labelPleaseWait";
this.labelPleaseWait.Size = new System.Drawing.Size(70, 13);
this.labelPleaseWait.TabIndex = 24;
this.labelPleaseWait.Text = "Please wait...";
//
// labelChooseLanguageAndClickDownload
//
this.labelChooseLanguageAndClickDownload.AutoSize = true;
this.labelChooseLanguageAndClickDownload.Location = new System.Drawing.Point(9, 41);
this.labelChooseLanguageAndClickDownload.Name = "labelChooseLanguageAndClickDownload";
this.labelChooseLanguageAndClickDownload.Size = new System.Drawing.Size(181, 13);
this.labelChooseLanguageAndClickDownload.TabIndex = 23;
this.labelChooseLanguageAndClickDownload.Text = "Choose plugin and click \"Download\"";
//
// buttonDownload
//
this.buttonDownload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDownload.Location = new System.Drawing.Point(474, 270);
this.buttonDownload.Name = "buttonDownload";
this.buttonDownload.Size = new System.Drawing.Size(104, 25);
this.buttonDownload.TabIndex = 22;
this.buttonDownload.Text = "&Download";
this.buttonDownload.UseVisualStyleBackColor = true;
this.buttonDownload.Click += new System.EventHandler(this.buttonDownload_Click);
//
// labelDescription1
//
this.labelDescription1.AutoSize = true;
this.labelDescription1.Location = new System.Drawing.Point(9, 9);
this.labelDescription1.Name = "labelDescription1";
this.labelDescription1.Size = new System.Drawing.Size(306, 13);
this.labelDescription1.TabIndex = 21;
this.labelDescription1.Text = "Subtitle Edit plugins must be downloaded to the \"Plugins\" folder";
//
// linkLabelOpenDictionaryFolder
//
this.linkLabelOpenDictionaryFolder.AutoSize = true;
this.linkLabelOpenDictionaryFolder.Location = new System.Drawing.Point(9, 306);
this.linkLabelOpenDictionaryFolder.Name = "linkLabelOpenDictionaryFolder";
this.linkLabelOpenDictionaryFolder.Size = new System.Drawing.Size(106, 13);
this.linkLabelOpenDictionaryFolder.TabIndex = 25;
this.linkLabelOpenDictionaryFolder.TabStop = true;
this.linkLabelOpenDictionaryFolder.Text = "Open \'Plug-ins\' folder";
this.linkLabelOpenDictionaryFolder.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelOpenDictionaryFolder_LinkClicked);
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(474, 301);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(104, 23);
this.buttonOK.TabIndex = 26;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
//
// listViewPlugins
//
this.listViewPlugins.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.listViewPlugins.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderName,
this.columnHeaderDescription,
this.columnHeaderVersion,
this.columnHeaderDate});
this.listViewPlugins.FullRowSelect = true;
this.listViewPlugins.HideSelection = false;
this.listViewPlugins.Location = new System.Drawing.Point(12, 57);
this.listViewPlugins.MultiSelect = false;
this.listViewPlugins.Name = "listViewPlugins";
this.listViewPlugins.Size = new System.Drawing.Size(566, 207);
this.listViewPlugins.TabIndex = 27;
this.listViewPlugins.UseCompatibleStateImageBehavior = false;
this.listViewPlugins.View = System.Windows.Forms.View.Details;
//
// columnHeaderName
//
this.columnHeaderName.Text = "Name";
this.columnHeaderName.Width = 140;
//
// columnHeaderVersion
//
this.columnHeaderVersion.Text = "Version";
this.columnHeaderVersion.Width = 80;
//
// columnHeaderDescription
//
this.columnHeaderDescription.Text = "Description";
this.columnHeaderDescription.Width = 280;
//
// columnHeaderDate
//
this.columnHeaderDate.Text = "Date";
//
// PluginsGet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(590, 333);
this.Controls.Add(this.listViewPlugins);
this.Controls.Add(this.labelPleaseWait);
this.Controls.Add(this.labelChooseLanguageAndClickDownload);
this.Controls.Add(this.buttonDownload);
this.Controls.Add(this.labelDescription1);
this.Controls.Add(this.linkLabelOpenDictionaryFolder);
this.Controls.Add(this.buttonOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "PluginsGet";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Plugins";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PluginsGet_KeyDown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label labelPleaseWait;
private System.Windows.Forms.Label labelChooseLanguageAndClickDownload;
private System.Windows.Forms.Button buttonDownload;
private System.Windows.Forms.Label labelDescription1;
private System.Windows.Forms.LinkLabel linkLabelOpenDictionaryFolder;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.ListView listViewPlugins;
private System.Windows.Forms.ColumnHeader columnHeaderName;
private System.Windows.Forms.ColumnHeader columnHeaderVersion;
private System.Windows.Forms.ColumnHeader columnHeaderDescription;
private System.Windows.Forms.ColumnHeader columnHeaderDate;
}
}

170
src/Forms/PluginsGet.cs Normal file
View File

@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Windows.Forms;
using System.Xml;
using Nikse.SubtitleEdit.Logic;
namespace Nikse.SubtitleEdit.Forms
{
public partial class PluginsGet : Form
{
private XmlDocument _pluginDoc = new XmlDocument();
private string _downloadedPluginName;
public PluginsGet()
{
InitializeComponent();
try
{
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
this.Refresh();
string url = "http://www.nikse.dk/Content/SubtitleEdit/Plugins/Index.xml";
var wc = new WebClient { Proxy = Utilities.GetProxy() };
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(PluginListDownloadDataCompleted);
wc.DownloadDataAsync(new Uri(url));
}
catch (Exception exception)
{
labelPleaseWait.Text = string.Empty;
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewPlugins.Enabled = true;
MessageBox.Show(exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
}
}
void PluginListDownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Download failed: " + e.Error.Message);
DialogResult = DialogResult.Cancel;
return;
}
try
{
_pluginDoc.LoadXml(System.Text.Encoding.UTF8.GetString(e.Result));
foreach (XmlNode node in _pluginDoc.DocumentElement.SelectNodes("Plugin"))
{
ListViewItem item = new ListViewItem(node.SelectSingleNode("Name").InnerText);
item.SubItems.Add(node.SelectSingleNode("Description").InnerText);
item.SubItems.Add(node.SelectSingleNode("Version").InnerText);
item.SubItems.Add(node.SelectSingleNode("Date").InnerText);
listViewPlugins.Items.Add(item);
}
}
catch
{
MessageBox.Show("Load of downloaded xml plugin-list faild!");
}
}
private void buttonDownload_Click(object sender, EventArgs e)
{
if (listViewPlugins.SelectedItems.Count == 0)
return;
try
{
labelPleaseWait.Text = Configuration.Settings.Language.General.PleaseWait;
buttonOK.Enabled = false;
buttonDownload.Enabled = false;
listViewPlugins.Enabled = false;
this.Refresh();
Cursor = Cursors.WaitCursor;
int index = listViewPlugins.SelectedItems[0].Index;
string url = _pluginDoc.DocumentElement.SelectNodes("Plugin")[index].SelectSingleNode("Url").InnerText;
_downloadedPluginName = _pluginDoc.DocumentElement.SelectNodes("Plugin")[index].SelectSingleNode("Name").InnerText;
var wc = new WebClient { Proxy = Utilities.GetProxy() };
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
wc.DownloadDataAsync(new Uri(url));
Cursor = Cursors.Default;
}
catch (Exception exception)
{
labelPleaseWait.Text = string.Empty;
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewPlugins.Enabled = true;
Cursor = Cursors.Default;
MessageBox.Show(exception.Message + Environment.NewLine + Environment.NewLine + exception.StackTrace);
}
}
void wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("Download failed!");
DialogResult = DialogResult.Cancel;
return;
}
string pluginsFolder = Path.Combine(Configuration.DataDirectory, "Plugins");
if (!Directory.Exists(pluginsFolder))
Directory.CreateDirectory(pluginsFolder);
var ms = new MemoryStream(e.Result);
ZipExtractor zip = ZipExtractor.Open(ms);
List<ZipExtractor.ZipFileEntry> dir = zip.ReadCentralDir();
// Extract dic/aff files in dictionary folder
foreach (ZipExtractor.ZipFileEntry entry in dir)
{
string fileName = Path.GetFileName(entry.FilenameInZip);
string fullPath = Path.Combine(pluginsFolder, fileName);
if (File.Exists(fullPath))
{
try
{
File.Delete(fullPath);
}
catch
{
MessageBox.Show(string.Format("{0} already exists - unable to overwrite it", fullPath));
Cursor = Cursors.Default;
labelPleaseWait.Text = string.Empty;
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewPlugins.Enabled = true;
return;
}
}
zip.ExtractFile(entry, fullPath);
}
zip.Close();
ms.Close();
Cursor = Cursors.Default;
labelPleaseWait.Text = string.Empty;
buttonOK.Enabled = true;
buttonDownload.Enabled = true;
listViewPlugins.Enabled = true;
MessageBox.Show(string.Format("Plugin '{0}' downloaded", _downloadedPluginName));
}
private void linkLabelOpenDictionaryFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
string pluginsFolder = Path.Combine(Configuration.DataDirectory, "Plugins");
if (!Directory.Exists(pluginsFolder))
Directory.CreateDirectory(pluginsFolder);
System.Diagnostics.Process.Start(pluginsFolder);
}
private void PluginsGet_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
}
}
}

120
src/Forms/PluginsGet.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1429,7 +1429,7 @@ can edit in same subtitle file (collaboration)",
GoToNext = "Go to next line",
GoToPrevious = "Go to previous line",
ToggleFocus = "Toggle focus between list view and subtitle text box",
ToggleDialogueDashes = "Toogle dialogue dashes",
ToggleDialogueDashes = "Toggle dialogue dashes",
Alignment = "Alignment (selected lines)",
CopyTextOnly = "Copy text only to clip board (selected lines)",
AutoDurationSelectedLines = "Auto-duration (selected lines)",

View File

@ -167,6 +167,8 @@ namespace Nikse.SubtitleEdit.Logic
public Color CurrentDCinemaFontEffectColor { get; set; }
public int CurrentDCinemaFontSize { get; set; }
public bool SamiDisplayTwoClassesAsTwoSubtitles { get; set; }
public SubtitleSettings()
{
SsaFontName = "Arial";
@ -177,6 +179,8 @@ namespace Nikse.SubtitleEdit.Logic
DCinemaFontSize = 42;
DCinemaBottomMargin = 8;
DCinemaFadeUpDownTime = 5;
SamiDisplayTwoClassesAsTwoSubtitles = true;
}
public void InitializeDCinameSettings(bool smpte)
@ -1261,6 +1265,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("DCinemaFadeUpDownTime");
if (subNode != null)
settings.SubtitleSettings.DCinemaFadeUpDownTime = Convert.ToInt32(subNode.InnerText);
subNode = node.SelectSingleNode("SamiDisplayTwoClassesAsTwoSubtitles");
if (subNode != null)
settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles = Convert.ToBoolean(subNode.InnerText);
}
settings.Proxy = new Nikse.SubtitleEdit.Logic.ProxySettings();
@ -2022,6 +2029,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("DCinemaFontSize", settings.SubtitleSettings.DCinemaFontSize.ToString());
textWriter.WriteElementString("DCinemaBottomMargin", settings.SubtitleSettings.DCinemaBottomMargin.ToString());
textWriter.WriteElementString("DCinemaFadeUpDownTime", settings.SubtitleSettings.DCinemaFadeUpDownTime.ToString());
textWriter.WriteElementString("SamiDisplayTwoClassesAsTwoSubtitles", settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles.ToString());
textWriter.WriteEndElement();
textWriter.WriteStartElement("Proxy", "");

View File

@ -219,6 +219,46 @@ namespace Nikse.SubtitleEdit.Logic
return -1;
}
public static int ShowSubtitle(List<Paragraph> paragraphs, Subtitle original, VideoPlayerContainer videoPlayerContainer)
{
int index = 0;
if (videoPlayerContainer.VideoPlayer != null)
{
double positionInMilliseconds = (videoPlayerContainer.VideoPlayer.CurrentPosition * 1000.0) + 15;
foreach (Paragraph p in paragraphs)
{
if (p.StartTime.TotalMilliseconds <= positionInMilliseconds &&
p.EndTime.TotalMilliseconds > positionInMilliseconds)
{
var op = Utilities.GetOriginalParagraph(index, p, original.Paragraphs);
string text = p.Text.Replace("|", Environment.NewLine);
if (op != null)
text = text + Environment.NewLine + Environment.NewLine + op.Text.Replace("|", Environment.NewLine);
bool isInfo = p == paragraphs[0] && p.StartTime.TotalMilliseconds == 0 && positionInMilliseconds > 3000;
if (!isInfo)
{
if (videoPlayerContainer.LastParagraph != p)
{
videoPlayerContainer.SetSubtitleText(text, p);
return index;
}
else if (videoPlayerContainer.SubtitleText != text)
{
videoPlayerContainer.SetSubtitleText(text, p);
}
return -1;
}
}
index++;
}
}
if (!string.IsNullOrEmpty(videoPlayerContainer.SubtitleText))
videoPlayerContainer.SetSubtitleText(string.Empty, null);
return -1;
}
public static string ReadTextFileViaUrlAndProxyIfAvailable(string url)
{
var wc = new WebClient { Proxy = GetProxy() };

View File

@ -332,6 +332,12 @@
<Compile Include="Forms\PacEncoding.Designer.cs">
<DependentUpon>PacEncoding.cs</DependentUpon>
</Compile>
<Compile Include="Forms\PluginsGet.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\PluginsGet.Designer.cs">
<DependentUpon>PluginsGet.cs</DependentUpon>
</Compile>
<Compile Include="Forms\RestoreAutoBackup.cs">
<SubType>Form</SubType>
</Compile>
@ -993,6 +999,9 @@
<EmbeddedResource Include="Forms\PacEncoding.resx">
<DependentUpon>PacEncoding.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\PluginsGet.resx">
<DependentUpon>PluginsGet.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RestoreAutoBackup.resx">
<DependentUpon>RestoreAutoBackup.cs</DependentUpon>
</EmbeddedResource>