git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@384 99eadd0c-20b8-1223-b5c4-2a2b2df33de2

This commit is contained in:
niksedk 2011-04-04 16:17:33 +00:00
parent 26ac3eddb6
commit 773e807f57
10 changed files with 200 additions and 9 deletions

View File

@ -1,5 +1,24 @@
Subtitle Edit Changelog
3.2 (net yet released)
* NEW:
* Subtitle formats: D-Cinema, Cavena890
* Most important shortcuts in Options -> Settings
* Command line conversion between subtitle formats (example: subtitleedit /convert *.srt microdvd)
* Subtitle preview font size (below video player) is now available in Options -> Settings
* Edit -> Select all
* List view context menu: Copy as text to clipboard
* Transscript importer...???
* Plug-ins...???
* IMPROVED:
* Can now read Adobe Encore files starting with line numbers
* Merge short lines can now also merge lines ending with ".", "?", or "!"
* FIXED:
* Adjust all times did not work for MicroDvd
* Remove empty white spaces from Google translate
3.1 (3rd March 2011)
* NEW:
* Collaboration via the internet ("Networking", also has chat)

View File

@ -100,6 +100,8 @@
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.multipleReplaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.gotoLineNumberToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator21 = new System.Windows.Forms.ToolStripSeparator();
this.editSelectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.adjustDisplayTimeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -912,7 +914,9 @@
this.findNextToolStripMenuItem,
this.replaceToolStripMenuItem,
this.multipleReplaceToolStripMenuItem,
this.gotoLineNumberToolStripMenuItem});
this.gotoLineNumberToolStripMenuItem,
this.toolStripSeparator21,
this.editSelectAllToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(40, 20);
this.editToolStripMenuItem.Text = "Edit";
@ -1013,6 +1017,18 @@
this.gotoLineNumberToolStripMenuItem.Text = "Goto line number...";
this.gotoLineNumberToolStripMenuItem.Click += new System.EventHandler(this.GotoLineNumberToolStripMenuItemClick);
//
// toolStripSeparator21
//
this.toolStripSeparator21.Name = "toolStripSeparator21";
this.toolStripSeparator21.Size = new System.Drawing.Size(219, 6);
//
// editSelectAllToolStripMenuItem
//
this.editSelectAllToolStripMenuItem.Name = "editSelectAllToolStripMenuItem";
this.editSelectAllToolStripMenuItem.Size = new System.Drawing.Size(222, 22);
this.editSelectAllToolStripMenuItem.Text = "Select all";
this.editSelectAllToolStripMenuItem.Click += new System.EventHandler(this.editSelectAllToolStripMenuItem_Click);
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -3745,6 +3761,8 @@
private System.Windows.Forms.Button buttonSplitLine;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemChangeFrameRate2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCopySourceText;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator21;
private System.Windows.Forms.ToolStripMenuItem editSelectAllToolStripMenuItem;
}
}

View File

@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Forms
if (versionInfo.Length >= 3 && versionInfo[2] != "0")
_title += "." + versionInfo[2];
}
return _title;
return _title + " Alpha";
}
}
@ -713,6 +713,7 @@ namespace Nikse.SubtitleEdit.Forms
replaceToolStripMenuItem.Text = _language.Menu.Edit.Replace;
multipleReplaceToolStripMenuItem.Text = _language.Menu.Edit.MultipleReplace;
gotoLineNumberToolStripMenuItem.Text = _language.Menu.Edit.GoToSubtitleNumber;
editSelectAllToolStripMenuItem.Text = _language.Menu.ContextMenu.SelectAll;
toolsToolStripMenuItem.Text = _language.Menu.Tools.Title;
adjustDisplayTimeToolStripMenuItem.Text = _language.Menu.Tools.AdjustDisplayDuration;
@ -7836,13 +7837,15 @@ namespace Nikse.SubtitleEdit.Forms
findNextToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainEditFindNext);
replaceToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainEditReplace);
gotoLineNumberToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainEditGoToLineNumber);
fixToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainToolsFixCommonErrors);
showhideVideoToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainVideoShowHideVideo);
toolStripMenuItemAdjustAllTimes.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationAdjustTimes);
italicToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainListViewItalic);
italicToolStripMenuItem1.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainTextBoxItalic);
}
//testing PLUGINS!
private void LoadPlugins()
{
string path = Path.Combine(Configuration.BaseDirectory, "Plugins");
@ -9726,6 +9729,11 @@ namespace Nikse.SubtitleEdit.Forms
ShowStatus(string.Format(_language.VideoControls.NewTextInsertAtX, newParagraph.StartTime.ToShortString()));
}
private void editSelectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
for (int i = 0; i < SubtitleListview1.Items.Count; i++)
SubtitleListview1.Items[i].Selected = true;
}
}
}

View File

@ -684,7 +684,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAASABBAEgAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAATgBBAE4AQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -431,6 +431,10 @@ namespace Nikse.SubtitleEdit.Forms
editNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Edit.GoToSubtitleNumber + GetShortcutText(Configuration.Settings.Shortcuts.MainEditGoToLineNumber));
treeViewShortcuts.Nodes.Add(editNode);
TreeNode toolsNode = new TreeNode(Configuration.Settings.Language.Main.Menu.Tools.Title);
toolsNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Tools.FixCommonErrors + GetShortcutText(Configuration.Settings.Shortcuts.MainToolsFixCommonErrors));
treeViewShortcuts.Nodes.Add(toolsNode);
//<MainVideoShowHideVideo>Control+Q</MainVideoShowHideVideo>
TreeNode videoNode = new TreeNode(Configuration.Settings.Language.Main.Menu.Video.Title);
videoNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.Video.ShowHideVideo + GetShortcutText(Configuration.Settings.Shortcuts.MainVideoShowHideVideo));
@ -772,9 +776,19 @@ namespace Nikse.SubtitleEdit.Forms
}
}
//Main Tools
foreach (TreeNode node in treeViewShortcuts.Nodes[2].Nodes)
{
if (node.Text.Contains("["))
{
string text = node.Text.Substring(0, node.Text.IndexOf("[")).Trim();
if (text == Configuration.Settings.Language.Main.Menu.Tools.FixCommonErrors.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainToolsFixCommonErrors = GetShortcut(node.Text);
}
}
//Main Video
foreach (TreeNode node in treeViewShortcuts.Nodes[2].Nodes)
foreach (TreeNode node in treeViewShortcuts.Nodes[3].Nodes)
{
if (node.Text.Contains("["))
{
@ -785,7 +799,7 @@ namespace Nikse.SubtitleEdit.Forms
}
//Main Sync
foreach (TreeNode node in treeViewShortcuts.Nodes[3].Nodes)
foreach (TreeNode node in treeViewShortcuts.Nodes[4].Nodes)
{
if (node.Text.Contains("["))
{
@ -796,7 +810,7 @@ namespace Nikse.SubtitleEdit.Forms
}
//Main List view
foreach (TreeNode node in treeViewShortcuts.Nodes[4].Nodes)
foreach (TreeNode node in treeViewShortcuts.Nodes[5].Nodes)
{
if (node.Text.Contains("["))
{
@ -807,7 +821,7 @@ namespace Nikse.SubtitleEdit.Forms
}
//Main text box
foreach (TreeNode node in treeViewShortcuts.Nodes[5].Nodes)
foreach (TreeNode node in treeViewShortcuts.Nodes[6].Nodes)
{
if (node.Text.Contains("["))
{

View File

@ -393,6 +393,7 @@ namespace Nikse.SubtitleEdit.Logic
public string MainEditFindNext { get; set; }
public string MainEditReplace { get; set; }
public string MainEditGoToLineNumber { get; set; }
public string MainToolsFixCommonErrors { get; set; }
public string MainVideoShowHideVideo { get; set; }
public string MainSynchronizationAdjustTimes { get; set; }
public string MainListViewItalic { get; set; }
@ -408,6 +409,7 @@ namespace Nikse.SubtitleEdit.Logic
MainEditFindNext = "F3";
MainEditReplace = "Control+H";
MainEditGoToLineNumber = "Control+G";
MainToolsFixCommonErrors = "Control+Shift+F";
MainVideoShowHideVideo = "Control+Q";
MainSynchronizationAdjustTimes = "Control+Shift+A";
MainListViewItalic = "Control+I";
@ -997,6 +999,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("MainEditGoToLineNumber");
if (subNode != null)
settings.Shortcuts.MainEditGoToLineNumber = subNode.InnerText;
subNode = node.SelectSingleNode("MainToolsFixCommonErrors");
if (subNode != null)
settings.Shortcuts.MainToolsFixCommonErrors = subNode.InnerText;
subNode = node.SelectSingleNode("MainVideoShowHideVideo");
if (subNode != null)
settings.Shortcuts.MainVideoShowHideVideo = subNode.InnerText;
@ -1207,6 +1212,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("MainEditFindNext", settings.Shortcuts.MainEditFindNext);
textWriter.WriteElementString("MainEditReplace", settings.Shortcuts.MainEditReplace);
textWriter.WriteElementString("MainEditGoToLineNumber", settings.Shortcuts.MainEditGoToLineNumber);
textWriter.WriteElementString("MainToolsFixCommonErrors", settings.Shortcuts.MainToolsFixCommonErrors);
textWriter.WriteElementString("MainVideoShowHideVideo", settings.Shortcuts.MainVideoShowHideVideo);
textWriter.WriteElementString("MainSynchronizationAdjustTimes", settings.Shortcuts.MainSynchronizationAdjustTimes);
textWriter.WriteElementString("MainListViewItalic", settings.Shortcuts.MainEditGoToLineNumber);

View File

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
class AdobeEncoreWithLineNumbers : SubtitleFormat
{
public override string Extension
{
get { return ".txt"; }
}
public override string Name
{
get { return "Adobe Encore w. line#"; }
}
public override bool HasLineNumber
{
get { return false; }
}
public override bool IsTimeBased
{
get { return true; }
}
public override bool IsMine(List<string> lines, string fileName)
{
var subtitle = new Subtitle();
StringBuilder sb = new StringBuilder();
foreach (string line in lines)
sb.AppendLine(line);
if (sb.ToString().Contains("#INPOINT OUTPOINT PATH"))
return false; // Pinnacle Impression
LoadSubtitle(subtitle, lines, fileName);
return subtitle.Paragraphs.Count > _errorCount;
}
public override string ToText(Subtitle subtitle, string title)
{
StringBuilder sb = new StringBuilder();
int index = 0;
foreach (Paragraph p in subtitle.Paragraphs)
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2} {3}", index+1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text)));
index++;
}
return sb.ToString();
}
private string EncodeTimeCode(TimeCode time)
{
//00:03:15:22 (last is frame)
int frames = time.Milliseconds / (1000 / 30);
return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
}
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
Paragraph p = null;
subtitle.Paragraphs.Clear();
var regexTimeCodes = new Regex(@"^\d+ \d\d:\d\d:\d\d:\d\d \d\d:\d\d:\d\d:\d\d ", RegexOptions.Compiled);
foreach (string line in lines)
{
if (regexTimeCodes.IsMatch(line))
{
string temp = line.Substring(0, regexTimeCodes.Match(line).Length);
temp = line.Substring(line.IndexOf(" ")).Trim();
string start = temp.Substring(0, 11);
string end = temp.Substring(12, 11);
string[] startParts = start.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
string[] endParts = end.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (startParts.Length == 4 && endParts.Length == 4)
{
string text = line.Remove(0, regexTimeCodes.Match(line).Length - 1).Trim();
p = new Paragraph(DecodeTimeCode(startParts), DecodeTimeCode(endParts), text);
subtitle.Paragraphs.Add(p);
}
}
else if (line.Trim().Length == 0)
{
// skip these lines
}
else if (line.Trim().Length > 0 && p != null)
{
if (string.IsNullOrEmpty(p.Text))
p.Text = line;
else
p.Text = p.Text + Environment.NewLine + line;
}
}
subtitle.Renumber(1);
}
private TimeCode DecodeTimeCode(string[] parts)
{
//00:00:07:12
string hour = parts[0];
string minutes = parts[1];
string seconds = parts[2];
string frames = parts[3];
int milliseconds = (int)((1000 / 30.0) * int.Parse(frames));
if (milliseconds > 999)
milliseconds = 999;
TimeCode tc = new TimeCode(int.Parse(hour), int.Parse(minutes), int.Parse(seconds), milliseconds);
return tc;
}
}
}

View File

@ -17,6 +17,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
new SubRip(),
new AdobeEncore(),
new AdobeEncoreTab(),
new AdobeEncoreWithLineNumbers(),
new DCSubtitle(),
new DvdStudioPro(),
new DvdSubtitle(),

View File

@ -31,4 +31,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.1.0.*")]
[assembly: AssemblyVersion("3.2.0.*")]

View File

@ -517,6 +517,7 @@
<Compile Include="Logic\StripableText.cs" />
<Compile Include="Logic\SubtitleFormats\AdobeEncore.cs" />
<Compile Include="Logic\SubtitleFormats\AdobeEncoreTabs.cs" />
<Compile Include="Logic\SubtitleFormats\AdobeEncoreWithLineNumbers.cs" />
<Compile Include="Logic\SubtitleFormats\Cavena890.cs" />
<Compile Include="Logic\SubtitleFormats\DCSubtitle.cs" />
<Compile Include="Logic\SubtitleFormats\FinalCutProTextXml.cs" />