3.1 Final... perhaps ;)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@358 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-03-03 19:27:24 +00:00
parent 6a77bb3f45
commit bb1a497d3e
10 changed files with 678 additions and 959 deletions

View File

@ -1,6 +1,6 @@
Subtitle Edit Changelog
3.1 (Not released yet)
3.1 (3rd March 2011)
* NEW:
* Collaboration via the internet ("Networking", also has chat)
* Auto-backup (never, every minute, every 5th minute, or every 15th minute - thx swedelandster)
@ -21,7 +21,7 @@ Subtitle Edit Changelog
* Auto-wrap text while typing (option, thx swedelandster)
* Video menu will now have a "Choose audio track" if more than one audio track exists
(only when using VLC as video player)
* Bulgarian translation
* Bulgarian translation (thx Ivo Ivanov)
* IMPROVED:
* Main window: Video player will now automatically move up beside subtitle if waveform is
displayed + some resizing of controls allowed via splitters

View File

@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Controls
{
Graphics graphics = parentForm.CreateGraphics();
SizeF timestampSizeF = graphics.MeasureString("00:00:33,527", Font);
int timeStampWidth = (int)(timestampSizeF.Width + 0.5) + 10;
int timeStampWidth = (int)(timestampSizeF.Width + 0.5) + 11;
Columns[ColumnIndexStart].Width = timeStampWidth;
Columns[ColumnIndexEnd].Width = timeStampWidth;

View File

@ -70,7 +70,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
}
public void Initialize(Subtitle subtitle1, string subtitleFileName1, Subtitle subtitle2, string subtitleFileName2)
@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Forms
if (string.IsNullOrEmpty(subtitleFileName1))
openFileDialog1.InitialDirectory = Path.GetDirectoryName(subtitleFileName1);
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
}

View File

@ -2819,7 +2819,7 @@
this.toolStripSeparator11,
this.toolStripMenuItemWaveFormPlaySelection});
this.contextMenuStripWaveForm.Name = "contextMenuStripWaveForm";
this.contextMenuStripWaveForm.Size = new System.Drawing.Size(183, 142);
this.contextMenuStripWaveForm.Size = new System.Drawing.Size(183, 164);
//
// addParagraphHereToolStripMenuItem
//

View File

@ -984,7 +984,7 @@ namespace Nikse.SubtitleEdit.Forms
{
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK) // sometimes crashes... why??
{
OpenSubtitle(openFileDialog1.FileName, null);
@ -1028,6 +1028,12 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
if (Path.GetExtension(fileName).ToLower() == ".sup" && IsBluRaySupFile(fileName))
{
ImportAndOcrBluRaySup(fileName);
return;
}
var fi = new FileInfo(fileName);
if (fi.Length > 1024 * 1024 * 10) // max 10 mb
{
@ -1601,9 +1607,7 @@ namespace Nikse.SubtitleEdit.Forms
else
{
_subtitle.MakeHistoryForUndo(string.Format(_language.BeforeConvertingToX, GetCurrentSubtitleFormat().FriendlyName), _oldSubtitleFormat, _fileDateTime);
_oldSubtitleFormat.RemoveNativeFormatting(_subtitle);
SaveSubtitleListviewIndexes();
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
RestoreSubtitleListviewIndexes();
@ -2718,7 +2722,7 @@ namespace Nikse.SubtitleEdit.Forms
{
openFileDialog1.Title = _language.OpenSubtitleToAppend;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
bool success = false;
@ -4382,6 +4386,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void ButtonUnBreakClick(object sender, EventArgs e)
{
textBoxListViewText.Text = Utilities.UnbreakLine(textBoxListViewText.Text);
@ -4665,7 +4670,7 @@ namespace Nikse.SubtitleEdit.Forms
if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_HDMV/PGS")
{
MessageBox.Show("Blu-ray subtitles inside Matroska not supported - sorry!");
LoadBluRaySubFromMatroska(matroskaSubtitleInfo, fileName);
//LoadBluRaySubFromMatroska(matroskaSubtitleInfo, fileName);
return;
}
else if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[script info]"))
@ -5033,7 +5038,7 @@ namespace Nikse.SubtitleEdit.Forms
ReloadFromSourceView();
openFileDialog1.Title = _language.OpenAnsiSubtitle;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
var chooseEncoding = new ChooseEncoding();
@ -5212,6 +5217,15 @@ namespace Nikse.SubtitleEdit.Forms
return false;
}
private bool IsBluRaySupFile(string subFileName)
{
var buffer = new byte[4];
var fs = new FileStream(subFileName, FileMode.Open, FileAccess.Read, FileShare.Read) {Position = 0};
fs.Read(buffer, 0, 4);
fs.Close();
return (buffer[0] == 0x50 && buffer[1] == 0x47); // 80 + 71 - P G
}
private void ImportAndOcrVobSubSubtitleNew(string fileName)
{
if (IsVobSubFile(fileName, true))
@ -6304,7 +6318,7 @@ namespace Nikse.SubtitleEdit.Forms
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
Encoding encoding = null;
@ -6384,7 +6398,7 @@ namespace Nikse.SubtitleEdit.Forms
SaveSubtitleListviewIndexes();
openFileDialog1.Title = Configuration.Settings.Language.General.OpenOriginalSubtitleFile;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (!(openFileDialog1.ShowDialog(this) == DialogResult.OK))
return;
@ -7591,6 +7605,134 @@ namespace Nikse.SubtitleEdit.Forms
toolStripMenuItemAdjustAllTimes.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainSynchronizationAdjustTimes);
italicToolStripMenuItem.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainListViewItalic);
italicToolStripMenuItem1.ShortcutKeys = GetKeys(Configuration.Settings.Shortcuts.MainTextBoxItalic);
LoadPlugins();
}
//testing PLUGINS!
private void LoadPlugins()
{
string path = Path.Combine(Configuration.BaseDirectory, "Plugins");
if (!Directory.Exists(path))
return;
string[] pluginFiles = Directory.GetFiles(path, "*.DLL");
int filePluginCount = 0;
int toolsPluginCount = 0;
int syncPluginCount = 0;
foreach (string pluginFileName in pluginFiles)
{
Type pluginType = null;
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(pluginFileName);
string objectName = Path.GetFileNameWithoutExtension(pluginFileName);
if (assembly != null)
{
try
{
pluginType = assembly.GetType("SubtitleEdit." + objectName);
object pluginObject = Activator.CreateInstance(pluginType);
System.Reflection.PropertyInfo pi = pluginType.GetProperty("Name");
string name = (string)pi.GetValue(pluginObject, null);
pi = pluginType.GetProperty("Version");
string version = (string)pi.GetValue(pluginObject, null);
pi = pluginType.GetProperty("ActionType");
string actionType = (string)pi.GetValue(pluginObject, null);
System.Reflection.MethodInfo mi = pluginType.GetMethod("DoAction");
if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(version) && !string.IsNullOrEmpty(actionType) && mi != null)
{
ToolStripMenuItem item = new ToolStripMenuItem();
item.Name = "Plugin" + toolsPluginCount.ToString();
item.Text = name;
item.Tag = pluginFileName;
pi = pluginType.GetProperty("ShortCut");
if (pi != null)
item.ShortcutKeys = GetKeys((string)pi.GetValue(pluginObject, null));
if (string.Compare(actionType, "File", true) == 0)
{
if (filePluginCount == 0)
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, new ToolStripSeparator());
item.Click += PluginToolClick;
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, item);
filePluginCount++;
}
else if (string.Compare(actionType, "Tool", true) == 0)
{
if (toolsPluginCount == 0)
toolsToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
item.Click += PluginToolClick;
toolsToolStripMenuItem.DropDownItems.Add(item);
toolsPluginCount++;
}
else if (string.Compare(actionType, "Sync", true) == 0)
{
if (syncPluginCount == 0)
toolStripMenuItemSyncronization.DropDownItems.Add(new ToolStripSeparator());
item.Click += PluginToolClick;
toolStripMenuItemSyncronization.DropDownItems.Add(item);
syncPluginCount++;
}
}
}
catch (Exception exception)
{
MessageBox.Show("Error loading plugin:" + pluginFileName + ": " + exception.Message);
}
finally
{
assembly = null;
}
}
}
}
void PluginToolClick(object sender, EventArgs e)
{
try
{
ToolStripItem item = (ToolStripItem) sender;
Type pluginType = null;
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(item.Tag.ToString());
if (assembly != null)
{
string objectName = Path.GetFileNameWithoutExtension(item.Tag.ToString());
pluginType = assembly.GetType("SubtitleEdit." + objectName);
object pluginObject = Activator.CreateInstance(pluginType);
System.Reflection.MethodInfo mi = pluginType.GetMethod("DoAction");
System.Reflection.PropertyInfo pi = pluginType.GetProperty("Name");
string name = (string)pi.GetValue(pluginObject, null);
pi = pluginType.GetProperty("Version");
string version = (string)pi.GetValue(pluginObject, null);
Subtitle temp = new Subtitle(_subtitle);
string text = temp.ToText(new SubRip());
string pluginResult = (string)mi.Invoke(pluginObject, new object[] { this, text, 25.0, _fileName, "", "" });
if (!string.IsNullOrEmpty(pluginResult) && pluginResult.Length > 10 && text != pluginResult)
{
_subtitle.MakeHistoryForUndo(string.Format("Before running plugin: {0} {1}", name, version), GetCurrentSubtitleFormat(), _fileDateTime);
string[] lineArray = pluginResult.Split(Environment.NewLine.ToCharArray());
List<string> lines = new List<string>();
foreach (string line in lineArray)
lines.Add(line);
new SubRip().LoadSubtitle(_subtitle, lines, _fileName);
SaveSubtitleListviewIndexes();
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
RestoreSubtitleListviewIndexes();
ShowSource();
_change = true;
}
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
private Keys GetKeys(string keysInString)
@ -7811,6 +7953,7 @@ namespace Nikse.SubtitleEdit.Forms
newParagraph.CalculateTimeCodesFromFrameNumbers(CurrentFrameRate);
}
_subtitle.Paragraphs.Insert(index, newParagraph);
_change = true;
_subtitleListViewIndex = -1;
_subtitle.Renumber(startNumber);
@ -8908,7 +9051,7 @@ namespace Nikse.SubtitleEdit.Forms
{
openFileDialog1.Title = _languageGeneral.OpenSubtitle;
openFileDialog1.FileName = string.Empty;
openFileDialog1.Filter = Utilities.GetOpenDialogFiler();
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
if (!File.Exists(openFileDialog1.FileName))

View File

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

View File

@ -92,6 +92,13 @@ namespace Nikse.SubtitleEdit.Forms
private static void HighLightWord(RichTextBox richTextBoxParagraph, string word)
{
bool startApos = false;
if (word.StartsWith("'") && word.Length > 1)
{
startApos = true;
word = word.Substring(1);
}
Regex regex = Utilities.MakeWordSearchRegex(word);
Match match = regex.Match(richTextBoxParagraph.Text);
if (!match.Success)
@ -99,14 +106,28 @@ namespace Nikse.SubtitleEdit.Forms
regex = Utilities.MakeWordSearchRegexWithNumbers(word);
match = regex.Match(richTextBoxParagraph.Text);
}
while (match.Success)
{
richTextBoxParagraph.SelectionStart = match.Index+1;
richTextBoxParagraph.SelectionLength = match.Length;
while (richTextBoxParagraph.SelectedText != match.Value && richTextBoxParagraph.SelectionStart > 0)
if (startApos)
{
richTextBoxParagraph.SelectionStart = richTextBoxParagraph.SelectionStart - 1;
richTextBoxParagraph.SelectionStart = match.Index-1;
richTextBoxParagraph.SelectionLength = match.Length+1;
while (richTextBoxParagraph.SelectedText != "'" + match.Value && richTextBoxParagraph.SelectionStart > 0)
{
richTextBoxParagraph.SelectionStart = richTextBoxParagraph.SelectionStart - 1;
richTextBoxParagraph.SelectionLength = match.Length+1;
}
}
else
{
richTextBoxParagraph.SelectionStart = match.Index + 1;
richTextBoxParagraph.SelectionLength = match.Length;
while (richTextBoxParagraph.SelectedText != match.Value && richTextBoxParagraph.SelectionStart > 0)
{
richTextBoxParagraph.SelectionStart = richTextBoxParagraph.SelectionStart - 1;
richTextBoxParagraph.SelectionLength = match.Length;
}
}
richTextBoxParagraph.SelectionColor = Color.Red;
match = match.NextMatch();

View File

@ -2042,7 +2042,7 @@ namespace Nikse.SubtitleEdit.Forms
private void comboBoxDictionaries_SelectedIndexChanged(object sender, EventArgs e)
{
Configuration.Settings.General.SpellCheckLanguage = LanguageString;
if (_ocrFixEngine != null)
if (_ocrFixEngine != null && LanguageString != null)
_ocrFixEngine.SpellCheckDictionaryName = LanguageString;
}

View File

@ -1047,7 +1047,7 @@ namespace Nikse.SubtitleEdit.Logic
}
}
public static string GetOpenDialogFiler()
public static string GetOpenDialogFilter()
{
StringBuilder sb = new StringBuilder();
sb.Append(Configuration.Settings.Language.General.SubtitleFiles + "|");
@ -1061,7 +1061,8 @@ namespace Nikse.SubtitleEdit.Logic
sb.Append("*" + ext + ";");
}
}
sb.Append("*" + new Pac().Extension);
sb.Append("*" + new Pac().Extension + ";");
sb.Append("*.sup");
sb.Append("|" + Configuration.Settings.Language.General.AllFiles + "|*.*");
return sb.ToString();
}

File diff suppressed because it is too large Load Diff