Updated language tags + settings

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1726 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-03-12 18:08:38 +00:00
parent 8060676bc3
commit d25baf9f2c
7 changed files with 43 additions and 23 deletions

View File

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

View File

@ -1278,7 +1278,7 @@ namespace Nikse.SubtitleEdit.Forms
bool ok = true;
foreach (NOcrPoint op in oc.LinesForeground)
{
foreach (Point point in NOcrPoint.GetPoints(MakePointItalic(op.GetStart(bmp.Width, bmp.Height), bmp.Height), MakePointItalic(op.GetEnd(bmp.Width, bmp.Height), bmp.Height)))
foreach (Point point in NOcrPoint.GetPoints(MakePointItalic(op.Start, bmp.Height), MakePointItalic(op.End, bmp.Height)))
{
if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
{
@ -1296,7 +1296,7 @@ namespace Nikse.SubtitleEdit.Forms
}
foreach (NOcrPoint op in oc.LinesBackground)
{
foreach (Point point in NOcrPoint.GetPoints(MakePointItalic(op.GetStart(bmp.Width, bmp.Height), bmp.Height), MakePointItalic(op.GetEnd(bmp.Width, bmp.Height), bmp.Height)))
foreach (Point point in NOcrPoint.GetPoints(MakePointItalic(op.Start, bmp.Height), MakePointItalic(op.End, bmp.Height)))
{
if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
{
@ -2097,9 +2097,7 @@ namespace Nikse.SubtitleEdit.Forms
oc.Height = Convert.ToInt32(node.Attributes["Height"].Value, CultureInfo.InvariantCulture);
foreach (XmlNode pointNode in node.SelectNodes("Point"))
{
var op = new NOcrPoint();
op.Start = DecodePoint(pointNode.Attributes["Start"].Value);
op.End = DecodePoint(pointNode.Attributes["End"].Value);
var op = new NOcrPoint(DecodePoint(pointNode.Attributes["Start"].Value), DecodePoint(pointNode.Attributes["End"].Value));
if (Convert.ToBoolean(pointNode.Attributes["On"].Value))
oc.LinesForeground.Add(op);
else
@ -2115,10 +2113,10 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private PointF DecodePoint(string text)
private Point DecodePoint(string text)
{
var arr = text.Split(',');
return new PointF((float)(Convert.ToDouble(arr[0], CultureInfo.InvariantCulture)), (float)Convert.ToDouble(Convert.ToDouble(arr[1], CultureInfo.InvariantCulture)));
return new Point(Convert.ToInt32(arr[0], CultureInfo.InvariantCulture), Convert.ToInt32(arr[1], CultureInfo.InvariantCulture));
}
private string OcrViaNOCR(Bitmap bitmap, int listViewIndex)

View File

@ -190,11 +190,11 @@ namespace Nikse.SubtitleEdit.Forms
{
foreach (NOcrPoint op in _nocrChar.LinesForeground)
{
e.Graphics.DrawLine(foreground, op.GetStart(pictureBoxCharacter.Width, pictureBoxCharacter.Height), op.GetEnd(pictureBoxCharacter.Width, pictureBoxCharacter.Height));
e.Graphics.DrawLine(foreground, op.GetScaledStart(_nocrChar, pictureBoxCharacter.Width, pictureBoxCharacter.Height), op.GetScaledEnd(_nocrChar, pictureBoxCharacter.Width, pictureBoxCharacter.Height));
}
foreach (NOcrPoint op in _nocrChar.LinesBackground)
{
e.Graphics.DrawLine(background, op.GetStart(pictureBoxCharacter.Width, pictureBoxCharacter.Height), op.GetEnd(pictureBoxCharacter.Width, pictureBoxCharacter.Height));
e.Graphics.DrawLine(background, op.GetScaledStart(_nocrChar, pictureBoxCharacter.Width, pictureBoxCharacter.Height), op.GetScaledEnd(_nocrChar, pictureBoxCharacter.Width, pictureBoxCharacter.Height));
}
}
@ -261,9 +261,9 @@ namespace Nikse.SubtitleEdit.Forms
_nocrChar.Width = pictureBoxCharacter.Image.Width;
_nocrChar.Height = pictureBoxCharacter.Image.Height;
if (radioButtonHot.Checked)
_nocrChar.LinesForeground.Add(new NOcrPoint(_start, _end, _imageWidth, _imageHeight));
_nocrChar.LinesForeground.Add(new NOcrPoint(_start, _end));
else
_nocrChar.LinesBackground.Add(new NOcrPoint(_start, _end, _imageWidth, _imageHeight));
_nocrChar.LinesBackground.Add(new NOcrPoint(_start, _end));
_drawLineOn = false;
pictureBoxCharacter.Invalidate();
ShowOcrPoints();

View File

@ -264,6 +264,9 @@ namespace Nikse.SubtitleEdit.Logic
ConvertedX = "Converted ({0})",
Settings = "Settings",
AutoBalance = "Auto balance lines",
OverwriteOriginalFiles = "Overwrite original files (new extension if format is changed)",
ScanFolder = "Scan folder...",
ScanningFolder = "Scanning {0} and subfolders for subtitle files..."
};
Beamer = new LanguageStructure.Beamer

View File

@ -158,6 +158,7 @@
public string ConvertOptions { get; set; }
public string RemoveFormatting { get; set; }
public string RemoveTextForHI { get; set; }
public string OverwriteOriginalFiles { get; set; }
public string ReDoCasing { get; set; }
public string Convert { get; set; }
public string NothingToConvert { get; set; }
@ -166,6 +167,8 @@
public string ConvertedX { get; set; }
public string Settings { get; set; }
public string AutoBalance { get; set; }
public string ScanFolder { get; set; }
public string ScanningFolder { get; set; }
}
public class Beamer

View File

@ -7,8 +7,8 @@ namespace Nikse.SubtitleEdit.Logic.OCR
{
public class NOcrPoint
{
public PointF Start { get; set; }
public PointF End { get; set; }
public Point Start { get; set; }
public Point End { get; set; }
public string Id { get; set; }
public NOcrPoint()
@ -18,10 +18,11 @@ namespace Nikse.SubtitleEdit.Logic.OCR
End = new Point();
}
public NOcrPoint(Point start, Point end, int pixelWidth, int pixelHeight) : this()
public NOcrPoint(Point start, Point end)
{
Start = PointPixelsToPercent(start, pixelWidth, pixelHeight);
End = PointPixelsToPercent(end, pixelWidth, pixelHeight);
Id = Guid.NewGuid().ToString();
Start = new Point(start.X, start.Y);
End = new Point(end.X, end.Y);
}
public PointF PointPixelsToPercent(Point p, int pixelWidth, int pixelHeight)
@ -36,22 +37,22 @@ namespace Nikse.SubtitleEdit.Logic.OCR
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "{0:0.#},{1:0.#} -> {2:0.#},{3:0.#} ", Start.X, Start.Y, End.X, End.Y);
return string.Format(CultureInfo.InvariantCulture, "{0},{1} -> {2},{3} ", Start.X, Start.Y, End.X, End.Y);
}
public Point GetStart(int width, int height)
public PointF GetStartPercent(int width, int height)
{
return PointPercentToPixels(Start, width, height);
return PointPixelsToPercent(Start, width, height);
}
public Point GetEnd(int width, int height)
public PointF GetEnd(int width, int height)
{
return PointPercentToPixels(End, width, height);
return PointPixelsToPercent(End, width, height);
}
public List<Point> GetPoints(int width, int height)
{
return GetPoints(GetStart(width, height), GetEnd(width, height));
return GetPoints(Start, End);
}
public static List<Point> GetPoints(Point start, Point end)
@ -90,5 +91,15 @@ namespace Nikse.SubtitleEdit.Logic.OCR
return list;
}
internal Point GetScaledStart(NOcrChar ocrChar, int width, int height)
{
return new Point((int)Math.Round(Start.X * 100.0 / ocrChar.Width * width / 100.0), (int)Math.Round(Start.Y * 100.0 / ocrChar.Height * height / 100.0));
}
internal Point GetScaledEnd(NOcrChar ocrChar, int width, int height)
{
return new Point((int)Math.Round(End.X * 100.0 / ocrChar.Width * width / 100.0), (int)Math.Round(End.Y * 100.0 / ocrChar.Height * height / 100.0));
}
}
}

View File

@ -109,6 +109,7 @@ namespace Nikse.SubtitleEdit.Logic
public bool BatchConvertFixCommonErrors { get; set; }
public bool BatchConvertMultipleReplace { get; set; }
public bool BatchConvertAutoBalance { get; set; }
public bool BatchConvertSetMinDisplayTimeBetweenSubtitles { get; set; }
public string BatchConvertLanguage { get; set; }
public string ModifySelectionText { get; set; }
public string ModifySelectionRule { get; set; }
@ -1344,6 +1345,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("BatchConvertAutoBalance");
if (subNode != null)
settings.Tools.BatchConvertAutoBalance = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("BatchConvertSetMinDisplayTimeBetweenSubtitles");
if (subNode != null)
settings.Tools.BatchConvertSetMinDisplayTimeBetweenSubtitles = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("BatchConvertLanguage");
if (subNode != null)
settings.Tools.BatchConvertLanguage = subNode.InnerText;
@ -2218,6 +2222,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("BatchConvertFixCommonErrors", settings.Tools.BatchConvertFixCommonErrors.ToString());
textWriter.WriteElementString("BatchConvertMultipleReplace", settings.Tools.BatchConvertMultipleReplace.ToString());
textWriter.WriteElementString("BatchConvertAutoBalance", settings.Tools.BatchConvertAutoBalance.ToString());
textWriter.WriteElementString("BatchConvertSetMinDisplayTimeBetweenSubtitles", settings.Tools.BatchConvertSetMinDisplayTimeBetweenSubtitles.ToString());
textWriter.WriteElementString("BatchConvertLanguage", settings.Tools.BatchConvertLanguage);
textWriter.WriteElementString("ModifySelectionRule", settings.Tools.ModifySelectionRule);
textWriter.WriteElementString("ModifySelectionText", settings.Tools.ModifySelectionText);