mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
parent
d8a790c8bd
commit
d4b43edbb3
@ -80,7 +80,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
double currentWantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds);
|
||||
double prevOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(prev.Text);
|
||||
double currentOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text);
|
||||
bool canBeEqual = callbacks.Format != null && callbacks.Format.GetType() == typeof(AdvancedSubStationAlpha) || callbacks.Format.GetType() == typeof(SubStationAlpha);
|
||||
bool canBeEqual = callbacks != null && (callbacks.Format != null && callbacks.Format.GetType() == typeof(AdvancedSubStationAlpha) || callbacks.Format.GetType() == typeof(SubStationAlpha));
|
||||
if (!canBeEqual)
|
||||
canBeEqual = Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart;
|
||||
|
||||
|
@ -99,9 +99,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
{
|
||||
if (Helper.IsTurkishLittleI(firstLetter, encoding, language))
|
||||
p.Text = pre + Helper.GetTurkishUppercaseLetter(firstLetter, encoding) + text.Substring(1);
|
||||
else if (language == "en" && (text.StartsWith("l ", StringComparison.Ordinal) || text.StartsWith("l-I", StringComparison.Ordinal) || text.StartsWith("ls ", StringComparison.Ordinal) || text.StartsWith("lnterested") ||
|
||||
text.StartsWith("lsn't ", StringComparison.Ordinal) || text.StartsWith("ldiot", StringComparison.Ordinal) || text.StartsWith("ln", StringComparison.Ordinal) || text.StartsWith("lm", StringComparison.Ordinal) ||
|
||||
text.StartsWith("ls", StringComparison.Ordinal) || text.StartsWith("lt", StringComparison.Ordinal) || text.StartsWith("lf ", StringComparison.Ordinal) || text.StartsWith("lc", StringComparison.Ordinal) || text.StartsWith("l'm ", StringComparison.Ordinal)) || text.StartsWith("l am ", StringComparison.Ordinal)) // l > I
|
||||
else if (IsEnglishCandidateForLowercaseLtoUppercaseI(language, text)) // l > I
|
||||
p.Text = pre + "I" + text.Substring(1);
|
||||
else
|
||||
p.Text = pre + char.ToUpper(firstLetter) + text.Substring(1);
|
||||
@ -174,9 +172,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
{
|
||||
if (Helper.IsTurkishLittleI(firstLetter, encoding, language))
|
||||
text = pre + Helper.GetTurkishUppercaseLetter(firstLetter, encoding) + text.Substring(1);
|
||||
else if (language == "en" && (text.StartsWith("l ", StringComparison.Ordinal) || text.StartsWith("l-I", StringComparison.Ordinal) || text.StartsWith("ls ") || text.StartsWith("lnterested") ||
|
||||
text.StartsWith("lsn't ", StringComparison.Ordinal) || text.StartsWith("ldiot", StringComparison.Ordinal) || text.StartsWith("ln", StringComparison.Ordinal) || text.StartsWith("lm", StringComparison.Ordinal) ||
|
||||
text.StartsWith("ls", StringComparison.Ordinal) || text.StartsWith("lt", StringComparison.Ordinal) || text.StartsWith("lf ", StringComparison.Ordinal) || text.StartsWith("lc", StringComparison.Ordinal) || text.StartsWith("l'm ", StringComparison.Ordinal)) || text.StartsWith("l am ", StringComparison.Ordinal)) // l > I
|
||||
else if (IsEnglishCandidateForLowercaseLtoUppercaseI(language, text)) // l > I
|
||||
text = pre + "I" + text.Substring(1);
|
||||
else
|
||||
text = pre + char.ToUpper(firstLetter) + text.Substring(1);
|
||||
@ -276,5 +272,13 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
return p.Text;
|
||||
}
|
||||
|
||||
private static bool IsEnglishCandidateForLowercaseLtoUppercaseI(string language, string text)
|
||||
{
|
||||
return language == "en" && (text.StartsWith("l ", StringComparison.Ordinal) || text.StartsWith("l-I", StringComparison.Ordinal) ||
|
||||
text.StartsWith("ls") || text.StartsWith("ldiot", StringComparison.Ordinal) || text.StartsWith("ln", StringComparison.Ordinal) ||
|
||||
text.StartsWith("lm", StringComparison.Ordinal) || text.StartsWith("lt", StringComparison.Ordinal) ||
|
||||
text.StartsWith("lf ", StringComparison.Ordinal) || text.StartsWith("lc", StringComparison.Ordinal) ||
|
||||
text.StartsWith("l'm ", StringComparison.Ordinal)) || text.StartsWith("l've ", StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +139,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
|
||||
text = text.Remove(0, index + 1).TrimStart();
|
||||
text = FixEllipsesStartHelper(text);
|
||||
if (pre.Length > 0)
|
||||
pre += " ";
|
||||
pre += " ";
|
||||
}
|
||||
return pre + text;
|
||||
}
|
||||
|
@ -1824,7 +1824,8 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
}
|
||||
}
|
||||
if (styleName != null && style.Name != null && (styleName.Equals(style.Name, StringComparison.OrdinalIgnoreCase) ||
|
||||
styleName.Equals("*Default", StringComparison.OrdinalIgnoreCase) && style.Name.Equals("Default", StringComparison.OrdinalIgnoreCase)))
|
||||
styleName.Equals("*Default", StringComparison.OrdinalIgnoreCase) &&
|
||||
style.Name.Equals("Default", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
style.LoadedFromHeader = true;
|
||||
return style;
|
||||
|
@ -298,7 +298,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
|
||||
fontColors.Push(c);
|
||||
fontNo++;
|
||||
i += endOfFont - i;
|
||||
i = endOfFont;
|
||||
}
|
||||
else if (fontNo > 0 && line.Substring(i).StartsWith("</font>", StringComparison.Ordinal))
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
|
||||
fontColors.Push(c);
|
||||
fontNo++;
|
||||
i += endOfFont - i;
|
||||
i = endOfFont;
|
||||
}
|
||||
else if (fontNo > 0 && line.Substring(i).StartsWith("</font>"))
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
|
||||
fontColors.Push(c);
|
||||
fontNo++;
|
||||
i += endOfFont - i;
|
||||
i = endOfFont;
|
||||
}
|
||||
else if (fontNo > 0 && line.Substring(i).StartsWith("</font>", StringComparison.Ordinal))
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
int pos = SecondsToXPosition(time - _startPositionSeconds);
|
||||
if (pos > 0 && pos < Width)
|
||||
{
|
||||
if (Math.Abs(currentPositionPos - pos) < 0.01)
|
||||
if (currentPositionPos == pos)
|
||||
{ // scene change and current pos are the same - draw 2 pixels + current pos dotted
|
||||
currentPosDone = true;
|
||||
using (var p = new Pen(Color.AntiqueWhite, 2))
|
||||
@ -616,7 +616,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
if (Width > 90)
|
||||
{
|
||||
graphics.DrawString(WaveformNotLoadedText, textFont, textBrush, new PointF(Width / 2 - 65, Height / 2 - 10));
|
||||
graphics.DrawString(WaveformNotLoadedText, textFont, textBrush, new PointF(Width / 2.0f - 65, Height / 2.0f - 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user