From a657db1569ff41e989e532be4d1edd9612f07541 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 22 Sep 2013 06:04:31 +0000 Subject: [PATCH] ran tabspace git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2106 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Forms/ExportPngXml.cs | 4 ++-- src/Forms/Main.cs | 2 +- src/Forms/TimedTextStyles.cs | 2 +- src/Forms/VobSubOcr.cs | 26 ++++++++++++------------- src/Logic/BluRaySup/BluRaySupPicture.cs | 2 +- src/Logic/BmpReader.cs | 4 ++-- src/Logic/ImageSplitter.cs | 2 +- src/Logic/LanguageStructure.cs | 2 +- src/Logic/ManagedBitmap.cs | 10 +++++----- src/Logic/NikseBitmap.cs | 1 - src/Logic/NikseBitmapImageSplitter.cs | 4 ++-- src/Logic/SubtitleFormats/Cavena890.cs | 8 ++++---- src/Logic/SubtitleFormats/Pac.cs | 2 +- src/Logic/SubtitleFormats/Titra.cs | 21 ++++++++++---------- src/Logic/UknownFormatImporter.cs | 2 +- src/Logic/VobSub/Mpeg2Header.cs | 2 +- 16 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs index bf330bb86..399d14b3c 100644 --- a/src/Forms/ExportPngXml.cs +++ b/src/Forms/ExportPngXml.cs @@ -1294,7 +1294,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + var fontStyle = FontStyle.Regular; if (parameter.SubtitleFontBold) fontStyle = FontStyle.Bold; - font = new Font(parameter.SubtitleFontName, parameter.SubtitleFontSize, fontStyle); + font = new Font(parameter.SubtitleFontName, parameter.SubtitleFontSize, fontStyle); } catch (Exception exception) { @@ -1317,7 +1317,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + font = new Font(FontFamily.Families[2].Name, parameter.SubtitleFontSize); else font = new Font("Arial", parameter.SubtitleFontSize); - } + } } SizeF textSize = g.MeasureString("Hj!", font); diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 5abf0d792..951ade896 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -9482,7 +9482,7 @@ namespace Nikse.SubtitleEdit.Forms vobSubOcr.ShowIcon = true; } _formPositionsAndSizes.SetPositionAndSize(vobSubOcr); - if (vobSubOcr.Initialize(fileName, Configuration.Settings.VobSubOcr, true, this)) + if (vobSubOcr.Initialize(fileName, Configuration.Settings.VobSubOcr, true, this)) { if (vobSubOcr.ShowDialog(this) == DialogResult.OK) { diff --git a/src/Forms/TimedTextStyles.cs b/src/Forms/TimedTextStyles.cs index bd183db47..8de1bf778 100644 --- a/src/Forms/TimedTextStyles.cs +++ b/src/Forms/TimedTextStyles.cs @@ -34,7 +34,7 @@ namespace Nikse.SubtitleEdit.Forms _xml.LoadXml(subtitle.Header); var xnsmgr = new XmlNamespaceManager(_xml.NameTable); xnsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml"); - if (_xml.DocumentElement.SelectSingleNode("ttml:head", xnsmgr) == null) + if (_xml.DocumentElement.SelectSingleNode("ttml:head", xnsmgr) == null) _xml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt")); // load default xml } catch diff --git a/src/Forms/VobSubOcr.cs b/src/Forms/VobSubOcr.cs index 1bae66e32..5304b7787 100644 --- a/src/Forms/VobSubOcr.cs +++ b/src/Forms/VobSubOcr.cs @@ -754,7 +754,7 @@ namespace Nikse.SubtitleEdit.Forms } if (comboBoxCharacterDatabase.SelectedIndex < 0) comboBoxCharacterDatabase.SelectedIndex = 0; - comboBoxCharacterDatabase.SelectedIndexChanged += ComboBoxCharacterDatabaseSelectedIndexChanged; + comboBoxCharacterDatabase.SelectedIndexChanged += ComboBoxCharacterDatabaseSelectedIndexChanged; } catch (Exception ex) @@ -773,7 +773,7 @@ namespace Nikse.SubtitleEdit.Forms _compareDoc.LoadXml(""); else _compareDoc.Load(path + "CompareDescription.xml"); - + string databaseName = path + "Images.db"; if (!File.Exists(databaseName)) { @@ -786,11 +786,11 @@ namespace Nikse.SubtitleEdit.Forms XmlNode node = _compareDoc.DocumentElement.SelectSingleNode("FileName[.='" + name + "']"); if (node != null) { - node.InnerText = f.Position.ToString(CultureInfo.InvariantCulture); + node.InnerText = f.Position.ToString(CultureInfo.InvariantCulture); var b = new Bitmap(bmpFileName); var m = new ManagedBitmap(b); b.Dispose(); - m.AppendToStream(f); + m.AppendToStream(f); } } f.Close(); @@ -2223,7 +2223,7 @@ namespace Nikse.SubtitleEdit.Forms foreach (CompareItem compareItem in _compareBitmaps) { // check for expand match! - if (compareItem.ExpandCount > 0 && compareItem.Bitmap.Width > target.Width && + if (compareItem.ExpandCount > 0 && compareItem.Bitmap.Width > target.Width && parentBitmap.Width >= compareItem.Bitmap.Width + targetItem.X && parentBitmap.Height >= compareItem.Bitmap.Height + targetItem.Y) { @@ -2238,7 +2238,7 @@ namespace Nikse.SubtitleEdit.Forms } } index++; - } + } // Search images with minor location changes FindBestMatch(ref index, ref smallestDifference, ref smallestIndex, target); @@ -2289,13 +2289,13 @@ namespace Nikse.SubtitleEdit.Forms var cutBitmap2 = NikseBitmapImageSplitter.CropTopAndBottom(cutBitmap, out topCrop); if (cutBitmap2.Height != target.Height) FindBestMatch(ref index, ref smallestDifference, ref smallestIndex, cutBitmap2); - } + } } if (smallestIndex >= 0) { double differencePercentage = smallestDifference * 100.0 / (target.Width * target.Height); - double maxDiff = (double)numericUpDownMaxErrorPct.Value; + double maxDiff = (double)numericUpDownMaxErrorPct.Value; //_vobSubOcrSettings.AllowDifferenceInPercent; // should be around 1.0 for vob/sub... //if (_bluRaySubtitlesOriginal != null) // maxDiff = 12.9; // let bluray sup have a 12.9% diff @@ -3830,7 +3830,7 @@ namespace Nikse.SubtitleEdit.Forms int smallestDifference = 10000; int smallestIndex = -1; - + if (smallestDifference > 0) { index = 0; @@ -3952,7 +3952,7 @@ namespace Nikse.SubtitleEdit.Forms } bitmap.Dispose(); p.Result = GetStringWithItalicTags(matches); - + } void ImageCompareThreadRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) @@ -4069,7 +4069,7 @@ namespace Nikse.SubtitleEdit.Forms int index2 = 0; int topMargin = item.Y - item.ParentY; foreach (NOcrChar oc in _nocrChars) - { + { if (Math.Abs(oc.Width - nbmp.Width) < 3 && Math.Abs(oc.Height - nbmp.Height) < 4 && Math.Abs(oc.MarginTop - topMargin) < 4) { // only very accurate matches @@ -4149,7 +4149,7 @@ namespace Nikse.SubtitleEdit.Forms } index++; } - return GetStringWithItalicTags(matches); + return GetStringWithItalicTags(matches); } static void NOcrThreadDoWork(object sender, DoWorkEventArgs e) @@ -5047,7 +5047,7 @@ namespace Nikse.SubtitleEdit.Forms line = line.Replace(" ", " "); } } - + if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2) { diff --git a/src/Logic/BluRaySup/BluRaySupPicture.cs b/src/Logic/BluRaySup/BluRaySupPicture.cs index 1e34362cb..382a2d8bb 100644 --- a/src/Logic/BluRaySup/BluRaySupPicture.cs +++ b/src/Logic/BluRaySup/BluRaySupPicture.cs @@ -540,7 +540,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup // write PCS end PacketHeader[10] = 0x16; // ID - ToolBox.SetDWord(PacketHeader, 2, pic.EndTimeForWrite); // PTS + ToolBox.SetDWord(PacketHeader, 2, pic.EndTimeForWrite); // PTS dts = pic.EndTimeForWrite - 1; //dts = pic.StartTimeForWrite - 1; ToolBox.SetDWord(PacketHeader, 6, dts); // DTS ToolBox.SetWord(PacketHeader, 11, HeaderPCSEnd.Length); // size diff --git a/src/Logic/BmpReader.cs b/src/Logic/BmpReader.cs index 0e54d7096..82b423acb 100644 --- a/src/Logic/BmpReader.cs +++ b/src/Logic/BmpReader.cs @@ -10,7 +10,7 @@ namespace Nikse.SubtitleEdit.Logic public string HeaderId { get; private set; } public UInt32 HeaderFileSize { get; private set; } public UInt32 OffsetToPixelArray { get; private set; } - + public BmpReader(string fileName) { byte[] buffer = System.IO.File.ReadAllBytes(fileName); @@ -21,5 +21,5 @@ namespace Nikse.SubtitleEdit.Logic } - + } diff --git a/src/Logic/ImageSplitter.cs b/src/Logic/ImageSplitter.cs index b110662f7..cb052888c 100644 --- a/src/Logic/ImageSplitter.cs +++ b/src/Logic/ImageSplitter.cs @@ -664,7 +664,7 @@ // } // if (different > maxDiff) // return different + 10; -// } +// } // return different; // } diff --git a/src/Logic/LanguageStructure.cs b/src/Logic/LanguageStructure.cs index d8e2911bd..3795ca723 100644 --- a/src/Logic/LanguageStructure.cs +++ b/src/Logic/LanguageStructure.cs @@ -1567,7 +1567,7 @@ public string WaveFormGridColor { get; set; } public string WaveFormShowGridLines { get; set; } public string ReverseMouseWheelScrollDirection { get; set; } - public string WaveFormAllowOverlap { get; set; } + public string WaveFormAllowOverlap { get; set; } public string WaveFormColor { get; set; } public string WaveFormSelectedColor { get; set; } public string WaveFormBackgroundColor { get; set; } diff --git a/src/Logic/ManagedBitmap.cs b/src/Logic/ManagedBitmap.cs index 79f3fbe9f..012d9c46a 100644 --- a/src/Logic/ManagedBitmap.cs +++ b/src/Logic/ManagedBitmap.cs @@ -17,7 +17,7 @@ namespace Nikse.SubtitleEdit.Logic using (MemoryStream fd = new MemoryStream()) using (Stream fs = File.OpenRead(fileName)) using (Stream csStream = new GZipStream(fs, CompressionMode.Decompress)) - { + { int nRead; while ((nRead = csStream.Read(buffer, 0, buffer.Length)) > 0) { @@ -27,7 +27,7 @@ namespace Nikse.SubtitleEdit.Logic csStream.Close(); buffer = fd.ToArray(); } - + Width = buffer[4] << 8 | buffer[5]; Height = buffer[6] << 8 | buffer[7]; _colors = new Color[Width * Height]; @@ -126,7 +126,7 @@ namespace Nikse.SubtitleEdit.Logic } private int ReadInt16(Stream stream) - { + { byte b0 = (byte)stream.ReadByte(); byte b1 = (byte)stream.ReadByte(); return b0 << 8 | b1; @@ -178,9 +178,9 @@ namespace Nikse.SubtitleEdit.Logic /// Source rectangle /// Rectangle from current image as new bitmap public ManagedBitmap GetRectangle(Rectangle section) - { + { ManagedBitmap newRectangle = new ManagedBitmap(section.Width, section.Height); - + int recty = 0; for (int y=section.Top; y < section.Top + section.Height; y++) { diff --git a/src/Logic/NikseBitmap.cs b/src/Logic/NikseBitmap.cs index a17bde83d..9fc0d0bc8 100644 --- a/src/Logic/NikseBitmap.cs +++ b/src/Logic/NikseBitmap.cs @@ -918,6 +918,5 @@ namespace Nikse.SubtitleEdit.Logic } - } } diff --git a/src/Logic/NikseBitmapImageSplitter.cs b/src/Logic/NikseBitmapImageSplitter.cs index 903ed4bdc..36d11982d 100644 --- a/src/Logic/NikseBitmapImageSplitter.cs +++ b/src/Logic/NikseBitmapImageSplitter.cs @@ -592,7 +592,7 @@ namespace Nikse.SubtitleEdit.Logic return different + 10; } return different; - } + } internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2) { @@ -610,7 +610,7 @@ namespace Nikse.SubtitleEdit.Logic return different + 10; } return different; - } + } } } diff --git a/src/Logic/SubtitleFormats/Cavena890.cs b/src/Logic/SubtitleFormats/Cavena890.cs index ec75be1e6..8240c973f 100644 --- a/src/Logic/SubtitleFormats/Cavena890.cs +++ b/src/Logic/SubtitleFormats/Cavena890.cs @@ -62,7 +62,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats 0x71, // я 0x6E, // н 0x74, // т - 0x5C, // Э + 0x5C, // Э 0x77, // ю 0x46, // Ф 0x5E, // Ч @@ -131,7 +131,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats "п", "в", "У", - "щ", + "щ", "ф", "э", "ш", @@ -713,7 +713,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats text = text.Replace(encoding.GetString(new byte[] { 0x7F }), string.Empty); // Used to fill empty space upto 51 bytes text = text.Replace(encoding.GetString(new byte[] { 0xBE }), string.Empty); // Unknown? - + if (text.Contains("")) text = text.Replace("", ""); if (text.Contains("") && !text.Contains("")) @@ -748,7 +748,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats while (textLength >= 1 && index + textLength < buffer.Length && (buffer[index + textLength-1] == 0)) textLength--; if (textLength > 0) - { + { text = Encoding.GetEncoding(1201).GetString(buffer, index, textLength).Replace("\0", string.Empty); } else diff --git a/src/Logic/SubtitleFormats/Pac.cs b/src/Logic/SubtitleFormats/Pac.cs index 56a4fa015..f5cbeb5b4 100644 --- a/src/Logic/SubtitleFormats/Pac.cs +++ b/src/Logic/SubtitleFormats/Pac.cs @@ -856,7 +856,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats public override bool IsMine(List lines, string fileName) { - if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName)) + if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName)) { try { diff --git a/src/Logic/SubtitleFormats/Titra.cs b/src/Logic/SubtitleFormats/Titra.cs index 8d73a7abd..05f4b5ed3 100644 --- a/src/Logic/SubtitleFormats/Titra.cs +++ b/src/Logic/SubtitleFormats/Titra.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats { public class Titra : SubtitleFormat { - //* 1 : 01:01:31:19 01:01:33:04 22c + //* 1 : 01:01:31:19 01:01:33:04 22c static Regex regexTimeCodes = new Regex(@"^\* \d+ :\t\d\d:\d\d:\d\d:\d\d\t\d\d:\d\d:\d\d:\d\d\t\d+c", RegexOptions.Compiled); private int _maxMsDiv10 = 0; @@ -35,7 +35,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats private int GetMaxCharsForDuration(double durationSeconds) { - return (int)Math.Round(15.7 * durationSeconds); + return (int)Math.Round(15.7 * durationSeconds); } public override string ToText(Subtitle subtitle, string title) @@ -43,14 +43,13 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats var sb = new StringBuilder(); sb.AppendLine(@"TVS - TITRA FILM -Titre VO : L'heure d'été -Titre VST : -Création : 23/10/2009 - 16:31 -Révision : 26/10/2009 - 17:48 -Langue VO : Français -Langue VST : Espagnol -Bobine : e01 - +Titre VO : L'heure d'été +Titre VST : +Création : 23/10/2009 - 16:31 +Révision : 26/10/2009 - 17:48 +Langue VO : Français +Langue VST : Espagnol +Bobine : e01 BEWARE : No more than 40 characters ON A LINE @@ -107,7 +106,7 @@ ATTENTION : Pas plus de 40 caractères PAR LIGNE { _errorCount += 10; } - } + } else if (line.Trim().Length == 0) { // skip these lines diff --git a/src/Logic/UknownFormatImporter.cs b/src/Logic/UknownFormatImporter.cs index fb1045ab9..8605092ad 100644 --- a/src/Logic/UknownFormatImporter.cs +++ b/src/Logic/UknownFormatImporter.cs @@ -629,7 +629,7 @@ namespace Nikse.SubtitleEdit.Logic { p.Text = sb.ToString().Trim(); subtitle.Paragraphs.Add(p); - } + } subtitle.Renumber(1); return subtitle; diff --git a/src/Logic/VobSub/Mpeg2Header.cs b/src/Logic/VobSub/Mpeg2Header.cs index 22b713d20..588a4efc7 100644 --- a/src/Logic/VobSub/Mpeg2Header.cs +++ b/src/Logic/VobSub/Mpeg2Header.cs @@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Logic.VobSub //b4To9AsBinary = b4To9AsBinary.Substring(2,3) + b4To9AsBinary.Substring(6,15) + b4To9AsBinary.Substring(22,15); //SystemClockReferenceQuotient = Helper.GetUInt32FromBinaryString(b4To9AsBinary); - //SystemClockReferenceRemainder = (ulong)(((buffer[8] & Helper.B00000011) << 8) + buffer[9]) + //SystemClockReferenceRemainder = (ulong)(((buffer[8] & Helper.B00000011) << 8) + buffer[9]) ProgramMuxRate = Helper.GetEndian(buffer, 10, 3) >> 2;