mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
commit
b9dd160201
@ -741,7 +741,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
double diff = prev.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds;
|
||||
if (!prev.StartTime.IsMaxTime && !p.StartTime.IsMaxTime && diff >= 0 && !(canBeEqual && diff == 0))
|
||||
{
|
||||
|
||||
int diffHalf = (int)(diff / 2);
|
||||
if (!Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart && p.StartTime.TotalMilliseconds == prev.EndTime.TotalMilliseconds &&
|
||||
prev.Duration.TotalMilliseconds > 100)
|
||||
@ -1578,7 +1577,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AddFixToListView(p, fixAction, oldText, p.Text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (missingSpaces > 0)
|
||||
{
|
||||
@ -1771,7 +1769,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
p.Text = oldText;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
UpdateFixStatus(noOfFixes, fixAction, _language.XMissingQuotesAdded);
|
||||
@ -1899,7 +1896,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
match = match.NextMatch();
|
||||
@ -1985,7 +1981,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
missigPeriodsAtEndOfLine++;
|
||||
AddFixToListView(p, fixAction, oldText, p.Text);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3830,7 +3825,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
fixCount++;
|
||||
AddFixToListView(p, fixAction, oldText, p.Text);
|
||||
}
|
||||
|
||||
}
|
||||
UpdateFixStatus(fixCount, _language.FixSpanishInvertedQuestionAndExclamationMarks, fixCount.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
@ -3938,7 +3932,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
p.Text = p.Text.Remove(j, markIndex - j + 1).Insert(j, speaker + st.Pre + temp + st.StrippedText + st.Post);
|
||||
markIndex += addToIndex;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4052,7 +4045,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void Next()
|
||||
{
|
||||
|
||||
RunSelectedActions();
|
||||
|
||||
buttonBack.Enabled = true;
|
||||
@ -4139,7 +4131,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
GoToNextSynaxError();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void GoToNextSynaxError()
|
||||
@ -4203,7 +4194,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private static string[] MakeDiffHtml(string before, string after)
|
||||
{
|
||||
|
||||
before = before.Replace("<br />", "↲");
|
||||
after = after.Replace("<br />", "↲");
|
||||
before = before.Replace(Environment.NewLine, "↲");
|
||||
@ -4829,7 +4819,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (deSelectedFixes.Contains(item.SubItems[1].Text + item.SubItems[2].Text + item.SubItems[3].Text))
|
||||
item.Checked = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4898,7 +4887,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (subtitleListView1.SelectedItems.Count == 2 &&
|
||||
subtitleListView1.SelectedItems[0].Index == subtitleListView1.SelectedItems[1].Index - 1)
|
||||
{
|
||||
|
||||
mergeSelectedLinesToolStripMenuItem.Visible = true;
|
||||
toolStripSeparator1.Visible = true;
|
||||
}
|
||||
|
13
src/Forms/HardSubExtract.Designer.cs
generated
13
src/Forms/HardSubExtract.Designer.cs
generated
@ -7,19 +7,6 @@
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
|
@ -302,14 +302,22 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
new public void Dispose()
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
if (_libVlc != null)
|
||||
{
|
||||
_libVlc.Dispose();
|
||||
_libVlc = null;
|
||||
}
|
||||
base.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3068,22 +3068,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
fs = File.Open(_fileName, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
using (var fs = File.Open(_fileName, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
using (var sw = new StreamWriter(fs, currentEncoding))
|
||||
{
|
||||
fs = null;
|
||||
sw.Write(allText);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fs != null)
|
||||
fs.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
_fileDateTime = File.GetLastWriteTime(_fileName);
|
||||
ShowStatus(string.Format(_language.SavedSubtitleX, _fileName));
|
||||
@ -5971,7 +5961,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
{
|
||||
int indexOfEndBracket = original.Text.IndexOf('}');
|
||||
if (original.Text.StartsWith("{\\") && indexOfEndBracket > 1 && indexOfEndBracket < 6)
|
||||
if (original.Text.StartsWith("{\\", StringComparison.Ordinal) && indexOfEndBracket > 1 && indexOfEndBracket < 6)
|
||||
original.Text = string.Format("{2}<{0}>{1}</{0}>", tag, original.Text.Remove(0, indexOfEndBracket + 1), original.Text.Substring(0, indexOfEndBracket + 1));
|
||||
else
|
||||
original.Text = string.Format("<{0}>{1}</{0}>", tag, original.Text);
|
||||
@ -8514,8 +8504,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
{
|
||||
var typewriter = new EffectTypewriter();
|
||||
|
||||
using (var typewriter = new EffectTypewriter())
|
||||
{
|
||||
typewriter.Initialize(SubtitleListview1.GetSelectedParagraph(_subtitle));
|
||||
|
||||
if (typewriter.ShowDialog(this) == DialogResult.OK)
|
||||
@ -8541,7 +8531,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(lastSelectedIndex);
|
||||
}
|
||||
typewriter.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8549,8 +8539,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
{
|
||||
var karaoke = new EffectKaraoke();
|
||||
|
||||
using (var karaoke = new EffectKaraoke())
|
||||
{
|
||||
karaoke.Initialize(SubtitleListview1.GetSelectedParagraph(_subtitle));
|
||||
|
||||
if (karaoke.ShowDialog(this) == DialogResult.OK)
|
||||
@ -8588,7 +8578,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(lastSelectedIndex);
|
||||
}
|
||||
karaoke.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14582,7 +14572,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void mediaPlayer_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (files.Length == 1)
|
||||
{
|
||||
string fileName = files[0];
|
||||
@ -14604,9 +14594,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var fi = new FileInfo(fileName);
|
||||
if (fi.Length < 1024 * 500)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
foreach (string line in File.ReadAllLines(fileName))
|
||||
lines.Add(line);
|
||||
var lines = new List<string>(File.ReadAllLines(fileName));
|
||||
foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats)
|
||||
{
|
||||
if (format.IsMine(lines, fileName))
|
||||
@ -14664,20 +14652,22 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public static string Sha256Hash(string value)
|
||||
{
|
||||
System.Security.Cryptography.SHA256Managed hasher = new System.Security.Cryptography.SHA256Managed();
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(value);
|
||||
byte[] hash = hasher.ComputeHash(bytes);
|
||||
using (var hasher = new System.Security.Cryptography.SHA256Managed())
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(value);
|
||||
var hash = hasher.ComputeHash(bytes);
|
||||
return Convert.ToBase64String(hash, 0, hash.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetPeakWaveFileName(string videoFileName)
|
||||
{
|
||||
string dir = Configuration.WaveformsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
var dir = Configuration.WaveformsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
FileInfo fi = new FileInfo(videoFileName);
|
||||
string wavePeakName = Sha256Hash(Path.GetFileName(videoFileName) + fi.Length + fi.CreationTimeUtc.ToShortDateString()) + ".wav";
|
||||
var file = new FileInfo(videoFileName);
|
||||
var wavePeakName = Sha256Hash(file.Name + file.Length + file.CreationTimeUtc.ToShortDateString()) + ".wav";
|
||||
wavePeakName = wavePeakName.Replace("=", string.Empty).Replace("/", string.Empty).Replace(",", string.Empty).Replace("?", string.Empty).Replace("*", string.Empty).Replace("+", string.Empty).Replace("\\", string.Empty);
|
||||
wavePeakName = Path.Combine(dir, wavePeakName);
|
||||
return wavePeakName;
|
||||
@ -14685,12 +14675,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private static string GetSpectrogramFolder(string videoFileName)
|
||||
{
|
||||
string dir = Configuration.SpectrogramsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
var dir = Configuration.SpectrogramsFolder.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
FileInfo fi = new FileInfo(videoFileName);
|
||||
string name = Sha256Hash(Path.GetFileName(videoFileName) + fi.Length + fi.CreationTimeUtc.ToShortDateString());
|
||||
var file = new FileInfo(videoFileName);
|
||||
var name = Sha256Hash(file.Name + file.Length + file.CreationTimeUtc.ToShortDateString());
|
||||
name = name.Replace("=", string.Empty).Replace("/", string.Empty).Replace(",", string.Empty).Replace("?", string.Empty).Replace("*", string.Empty).Replace("+", string.Empty).Replace("\\", string.Empty);
|
||||
name = Path.Combine(dir, name);
|
||||
return name;
|
||||
@ -14710,8 +14700,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
mediaPlayer.Pause();
|
||||
using (var addWaveform = new AddWaveform())
|
||||
{
|
||||
string peakWaveFileName = GetPeakWaveFileName(_videoFileName);
|
||||
string spectrogramFolder = GetSpectrogramFolder(_videoFileName);
|
||||
var peakWaveFileName = GetPeakWaveFileName(_videoFileName);
|
||||
var spectrogramFolder = GetSpectrogramFolder(_videoFileName);
|
||||
addWaveform.Initialize(_videoFileName, spectrogramFolder, _videoAudioTrackNumber);
|
||||
if (addWaveform.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@ -14792,7 +14782,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int index = 0;
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
Paragraph p = _subtitle.Paragraphs[i];
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (p.StartTime.TotalMilliseconds > newParagraph.StartTime.TotalMilliseconds &&
|
||||
(!p.StartTime.IsMaxTime || !HasSmallerStartTimes(_subtitle, i + 1, newParagraph.StartTime.TotalMilliseconds)))
|
||||
{
|
||||
@ -14842,7 +14832,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
for (int i = startIndex; i < subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
Paragraph p = subtitle.Paragraphs[i];
|
||||
var p = subtitle.Paragraphs[i];
|
||||
if (startMs > p.StartTime.TotalMilliseconds && !p.StartTime.IsMaxTime)
|
||||
return true;
|
||||
}
|
||||
@ -14931,7 +14921,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (mediaPlayer.VideoPlayer != null)
|
||||
{
|
||||
Paragraph p = audioVisualizer.NewSelectionParagraph;
|
||||
var p = audioVisualizer.NewSelectionParagraph;
|
||||
if (p == null)
|
||||
p = audioVisualizer.RightClickedParagraph;
|
||||
|
||||
@ -14979,9 +14969,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void SelectZoomTextInComboBox()
|
||||
{
|
||||
int i = 0;
|
||||
foreach (object obj in toolStripComboBoxWaveform.Items)
|
||||
foreach (ComboBoxZoomItem item in toolStripComboBoxWaveform.Items)
|
||||
{
|
||||
ComboBoxZoomItem item = obj as ComboBoxZoomItem;
|
||||
if (Math.Abs(audioVisualizer.ZoomFactor - item.ZoomFactor) < 0.001)
|
||||
{
|
||||
toolStripComboBoxWaveform.SelectedIndex = i;
|
||||
@ -15037,14 +15026,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void AudioWaveformDragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
string fileName = files[0];
|
||||
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (files.Length != 1)
|
||||
{
|
||||
MessageBox.Show(_language.DropOnlyOneFile);
|
||||
return;
|
||||
}
|
||||
|
||||
string fileName = files[0];
|
||||
string ext = Path.GetExtension(fileName).ToLowerInvariant();
|
||||
if (ext != ".wav")
|
||||
{
|
||||
@ -15060,9 +15049,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var fi = new FileInfo(fileName);
|
||||
if (fi.Length < 1024 * 500)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
foreach (string line in File.ReadAllLines(fileName))
|
||||
lines.Add(line);
|
||||
var lines = new List<string>(File.ReadAllLines(fileName));
|
||||
foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats)
|
||||
{
|
||||
if (format.IsMine(lines, fileName))
|
||||
@ -15150,7 +15137,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
|
||||
_subtitle.WasLoadedWithFrameNumbers = false;
|
||||
_subtitle.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
|
||||
foreach (Paragraph p in vobSubOcr.SubtitleFromOcr.Paragraphs)
|
||||
foreach (var p in vobSubOcr.SubtitleFromOcr.Paragraphs)
|
||||
{
|
||||
_subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
@ -15252,7 +15239,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var lineSb = new StringBuilder();
|
||||
int tagLength = 0;
|
||||
// See if lines start with "-".
|
||||
foreach (string line in lines)
|
||||
foreach (var line in lines)
|
||||
{
|
||||
// Append line break in every line except the first one
|
||||
if (lineNumber > 0)
|
||||
@ -15765,7 +15752,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (update.Action == "INS")
|
||||
{
|
||||
doReFill = true;
|
||||
Paragraph p = new Paragraph(update.Text, update.StartMilliseconds, update.EndMilliseconds);
|
||||
var p = new Paragraph(update.Text, update.StartMilliseconds, update.EndMilliseconds);
|
||||
_subtitle.Paragraphs.Insert(update.Index, p);
|
||||
if (_networkSession.LastSubtitle != null)
|
||||
_networkSession.LastSubtitle.Paragraphs.Insert(update.Index, new Paragraph(p));
|
||||
@ -15791,7 +15778,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (update.Action == "UPD")
|
||||
{
|
||||
updateListViewStatus = true;
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(update.Index);
|
||||
var p = _subtitle.GetParagraphOrDefault(update.Index);
|
||||
if (p != null)
|
||||
{
|
||||
p.StartTime.TotalMilliseconds = update.StartMilliseconds;
|
||||
@ -15934,10 +15921,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (_oldSelectedParagraph != null)
|
||||
{
|
||||
Paragraph p = _subtitle.GetFirstAlike(_oldSelectedParagraph);
|
||||
var p = _subtitle.GetFirstAlike(_oldSelectedParagraph);
|
||||
if (p == null)
|
||||
{
|
||||
Paragraph tmp = new Paragraph(_oldSelectedParagraph);
|
||||
var tmp = new Paragraph(_oldSelectedParagraph);
|
||||
tmp.Text = textBoxListViewText.Text;
|
||||
p = _subtitle.GetFirstAlike(tmp);
|
||||
}
|
||||
@ -16306,10 +16293,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var fi = new FileInfo(openFileDialog1.FileName);
|
||||
if (fi.Length > 1024 * 1024 * 10) // max 10 mb
|
||||
{
|
||||
if (MessageBox.Show(string.Format(_language.FileXIsLargerThan10MB + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
_language.ContinueAnyway,
|
||||
openFileDialog1.FileName), Title, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
var text = string.Format(_language.FileXIsLargerThan10MB + Environment.NewLine + Environment.NewLine + _language.ContinueAnyway, openFileDialog1.FileName);
|
||||
if (MessageBox.Show(this, text, Title, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -16333,7 +16318,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int index = FirstSelectedIndex + 1;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
foreach (var p in subtitle.Paragraphs)
|
||||
{
|
||||
_subtitle.Paragraphs.Insert(index, new Paragraph(p));
|
||||
index++;
|
||||
@ -16344,14 +16329,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
index = FirstSelectedIndex;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
Paragraph current = _subtitle.GetParagraphOrDefault(index);
|
||||
var current = _subtitle.GetParagraphOrDefault(index);
|
||||
if (current != null)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(index, current, _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(index, current, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
index = _subtitleAlternate.GetIndex(original);
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
foreach (var p in subtitle.Paragraphs)
|
||||
{
|
||||
_subtitleAlternate.Paragraphs.Insert(index, new Paragraph(p));
|
||||
index++;
|
||||
@ -16471,7 +16456,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (_subtitleListViewIndex >= 0)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(_subtitleListViewIndex, _subtitle.Paragraphs[_subtitleListViewIndex], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(_subtitleListViewIndex, _subtitle.Paragraphs[_subtitleListViewIndex], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
string text = textBoxListViewTextAlternate.Text.TrimEnd();
|
||||
@ -16725,7 +16710,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void ToolStripMenuItemCopySourceTextClick(object sender, EventArgs e)
|
||||
{
|
||||
Subtitle selectedLines = new Subtitle(_subtitle);
|
||||
var selectedLines = new Subtitle(_subtitle);
|
||||
selectedLines.Paragraphs.Clear();
|
||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
||||
selectedLines.Paragraphs.Add(_subtitle.Paragraphs[index]);
|
||||
@ -16739,7 +16724,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public void SetCurrentViaEndPositionAndGotoNext(int index)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
var p = _subtitle.GetParagraphOrDefault(index);
|
||||
if (p == null)
|
||||
return;
|
||||
|
||||
@ -16787,8 +16772,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public void SetCurrentStartAutoDurationAndGotoNext(int index)
|
||||
{
|
||||
Paragraph prev = _subtitle.GetParagraphOrDefault(index - 1);
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
var prev = _subtitle.GetParagraphOrDefault(index - 1);
|
||||
var p = _subtitle.GetParagraphOrDefault(index);
|
||||
if (p == null)
|
||||
return;
|
||||
|
||||
@ -16830,8 +16815,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public void SetCurrentEndNextStartAndGoToNext(int index)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(index + 1);
|
||||
var p = _subtitle.GetParagraphOrDefault(index);
|
||||
var next = _subtitle.GetParagraphOrDefault(index + 1);
|
||||
if (p == null)
|
||||
return;
|
||||
|
||||
@ -16911,7 +16896,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (toolStripMenuItemInsertUnicodeSymbol.DropDownItems.Count == 0)
|
||||
{
|
||||
foreach (string s in Configuration.Settings.Tools.UnicodeSymbolsToInsert.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (var s in Configuration.Settings.Tools.UnicodeSymbolsToInsert.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
toolStripMenuItemInsertUnicodeSymbol.DropDownItems.Add(s, null, InsertUnicodeGlyph);
|
||||
if (Environment.OSVersion.Version.Major < 6 && Configuration.Settings.General.SubtitleFontName == Utilities.WinXP2KUnicodeFontName) // 6 == Vista/Win2008Server/Win7
|
||||
@ -16941,7 +16926,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
toolStripMenuItemWebVttVoice.Visible = true;
|
||||
var voices = WebVTT.GetVoices(_subtitle);
|
||||
toolStripMenuItemWebVttVoice.DropDownItems.Clear();
|
||||
foreach (string style in voices)
|
||||
foreach (var style in voices)
|
||||
{
|
||||
toolStripMenuItemWebVttVoice.DropDownItems.Add(style, null, WebVTTSetVoiceTextBox);
|
||||
}
|
||||
@ -16992,14 +16977,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int firstSelectedIndex = FirstSelectedIndex;
|
||||
if (firstSelectedIndex >= 0)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
var p = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (p != null)
|
||||
{
|
||||
string defaultFromLanguage = Utilities.AutoDetectGoogleLanguage(_subtitle);
|
||||
string defaultToLanguage = defaultFromLanguage;
|
||||
if (_subtitleAlternate != null)
|
||||
{
|
||||
Paragraph o = Utilities.GetOriginalParagraph(firstSelectedIndex, p, _subtitleAlternate.Paragraphs);
|
||||
var o = Utilities.GetOriginalParagraph(firstSelectedIndex, p, _subtitleAlternate.Paragraphs);
|
||||
if (o != null)
|
||||
{
|
||||
p = o;
|
||||
@ -17053,7 +17038,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (oldIndex < 0)
|
||||
oldIndex = 0;
|
||||
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
foreach (var p in _subtitle.Paragraphs)
|
||||
{
|
||||
if (Configuration.Settings.General.RemoveBlankLinesWhenOpening && string.IsNullOrEmpty(Configuration.Settings.Tools.NewEmptyTranslationText))
|
||||
p.Text = "-";
|
||||
@ -17506,7 +17491,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (mediaPlayer.VideoPlayer != null && _subtitle != null)
|
||||
{
|
||||
double ms = mediaPlayer.VideoPlayer.CurrentPosition * TimeCode.BaseUnit;
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
foreach (var p in _subtitle.Paragraphs)
|
||||
{
|
||||
if (p.EndTime.TotalMilliseconds > ms && p.StartTime.TotalMilliseconds < ms)
|
||||
{
|
||||
@ -17530,7 +17515,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int i = _subtitle.Paragraphs.Count - 1;
|
||||
while (i > 0)
|
||||
{
|
||||
Paragraph p = _subtitle.Paragraphs[i];
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (p.EndTime.TotalMilliseconds > ms && p.StartTime.TotalMilliseconds < ms)
|
||||
{
|
||||
// current sub
|
||||
@ -17591,16 +17576,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeAddingTagX, tag));
|
||||
|
||||
var indexes = new List<int>();
|
||||
var indices = new List<int>();
|
||||
foreach (ListViewItem item in SubtitleListview1.SelectedItems)
|
||||
indexes.Add(item.Index);
|
||||
indices.Add(item.Index);
|
||||
|
||||
SubtitleListview1.BeginUpdate();
|
||||
foreach (int i in indexes)
|
||||
foreach (int i in indices)
|
||||
{
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(i, _subtitle.Paragraphs[i], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(i, _subtitle.Paragraphs[i], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
if (original.Text.Contains(tag))
|
||||
@ -17691,7 +17676,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -17729,7 +17714,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
SaveSubtitleListviewIndices();
|
||||
_subtitle.Paragraphs.Clear();
|
||||
foreach (Paragraph p in applyDurationLimits.FixedSubtitle.Paragraphs)
|
||||
foreach (var p in applyDurationLimits.FixedSubtitle.Paragraphs)
|
||||
_subtitle.Paragraphs.Add(new Paragraph(p));
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
RestoreSubtitleListviewIndices();
|
||||
@ -17755,7 +17740,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
ResetSubtitle();
|
||||
_subtitle.Paragraphs.Clear();
|
||||
foreach (Paragraph p in extractDateTimeInfo.DateTimeSubtitle.Paragraphs)
|
||||
foreach (var p in extractDateTimeInfo.DateTimeSubtitle.Paragraphs)
|
||||
_subtitle.Paragraphs.Add(new Paragraph(p));
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0);
|
||||
@ -18122,16 +18107,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeAddingTagX, tag));
|
||||
|
||||
var indexes = new List<int>();
|
||||
var indices = new List<int>();
|
||||
foreach (ListViewItem item in SubtitleListview1.SelectedItems)
|
||||
indexes.Add(item.Index);
|
||||
indices.Add(item.Index);
|
||||
|
||||
SubtitleListview1.BeginUpdate();
|
||||
foreach (int i in indexes)
|
||||
foreach (int i in indices)
|
||||
{
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(i, _subtitle.Paragraphs[i], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(i, _subtitle.Paragraphs[i], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
SetAlignTag(original, tag);
|
||||
@ -18235,7 +18220,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var timeCodeLines = new StringBuilder();
|
||||
var textLines = new StringBuilder();
|
||||
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
foreach (var p in _subtitle.Paragraphs)
|
||||
{
|
||||
timeCodeLines.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds)));
|
||||
timeCodeLines.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds)));
|
||||
@ -18295,7 +18280,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
// only allow current extension or ".txt"
|
||||
string fileName = saveFileDialog1.FileName;
|
||||
string ext = Path.GetExtension(fileName).ToLower();
|
||||
string ext = Path.GetExtension(fileName).ToLowerInvariant();
|
||||
bool extOk = ext.Equals(format.Extension, StringComparison.OrdinalIgnoreCase) || format.AlternateExtensions.Contains(ext) || ext == ".txt";
|
||||
if (!extOk)
|
||||
{
|
||||
@ -18402,9 +18387,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string text = Clipboard.GetText();
|
||||
var tmp = new Subtitle();
|
||||
var format = new SubRip();
|
||||
var list = new List<string>();
|
||||
foreach (string line in text.SplitToLines())
|
||||
list.Add(line);
|
||||
var list = new List<string>(text.SplitToLines());
|
||||
format.LoadSubtitle(tmp, list, null);
|
||||
|
||||
if (SubtitleListview1.SelectedItems.Count == 1 && text.Length > 0)
|
||||
@ -18416,7 +18399,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (tmp.Paragraphs.Count == 0)
|
||||
{
|
||||
foreach (string line in text.SplitToLines())
|
||||
foreach (var line in text.SplitToLines())
|
||||
tmp.Paragraphs.Add(new Paragraph(0, 0, line));
|
||||
}
|
||||
|
||||
@ -18456,8 +18439,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
for (int k = _subtitle.Paragraphs.Count - 2; k > index; k--)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[k], _subtitleAlternate.Paragraphs);
|
||||
Paragraph originalNext = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[k + 1], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[k], _subtitleAlternate.Paragraphs);
|
||||
var originalNext = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[k + 1], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
originalNext.Text = original.Text;
|
||||
@ -18465,7 +18448,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
if (index + i < _subtitle.Paragraphs.Count)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index + i], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index + i], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
original.Text = string.Empty;
|
||||
}
|
||||
@ -18587,10 +18570,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var fi = new FileInfo(openFileDialog1.FileName);
|
||||
if (fi.Length > 1024 * 1024 * 10) // max 10 mb
|
||||
{
|
||||
if (MessageBox.Show(string.Format(_language.FileXIsLargerThan10MB + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
_language.ContinueAnyway,
|
||||
openFileDialog1.FileName), Title, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
var text = string.Format(_language.FileXIsLargerThan10MB + Environment.NewLine + Environment.NewLine + _language.ContinueAnyway, openFileDialog1.FileName);
|
||||
if (MessageBox.Show(this, text, Title, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18648,7 +18629,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18673,13 +18654,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(index);
|
||||
var p = _subtitle.GetParagraphOrDefault(index);
|
||||
if (p != null)
|
||||
{
|
||||
form.AdjustParagraph(p);
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle && SubtitleListview1.IsAlternateTextColumnVisible)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(index, p, _subtitle.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(index, p, _subtitle.Paragraphs);
|
||||
if (original != null)
|
||||
form.AdjustParagraph(original);
|
||||
}
|
||||
@ -18760,7 +18741,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
bool first = true;
|
||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index], _subtitleAlternate.Paragraphs);
|
||||
var original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
if (first)
|
||||
@ -18787,7 +18768,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18799,7 +18780,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
MakeHistoryForUndo(_language.BeforeMergeLinesWithSameText);
|
||||
_subtitle.Paragraphs.Clear();
|
||||
foreach (Paragraph p in form.MergedSubtitle.Paragraphs)
|
||||
foreach (var p in form.MergedSubtitle.Paragraphs)
|
||||
_subtitle.Paragraphs.Add(p);
|
||||
ShowStatus(string.Format(_language.MergedShortLinesX, form.NumberOfMerges));
|
||||
SaveSubtitleListviewIndices();
|
||||
@ -18814,7 +18795,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18826,7 +18807,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
MakeHistoryForUndo(_language.BeforeMergeLinesWithSameText);
|
||||
_subtitle.Paragraphs.Clear();
|
||||
foreach (Paragraph p in form.MergedSubtitle.Paragraphs)
|
||||
foreach (var p in form.MergedSubtitle.Paragraphs)
|
||||
_subtitle.Paragraphs.Add(p);
|
||||
ShowStatus(string.Format(_language.MergedShortLinesX, form.NumberOfMerges));
|
||||
SaveSubtitleListviewIndices();
|
||||
@ -18850,7 +18831,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18864,7 +18845,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
foreach (ListViewItem item in SubtitleListview1.Items)
|
||||
@ -18902,7 +18883,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void toolStripMenuItemImportOcrHardSub_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new HardSubExtract(_videoFileName);
|
||||
using (var form = new HardSubExtract(_videoFileName))
|
||||
{
|
||||
if (form.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(form.OcrFileName))
|
||||
@ -18911,7 +18893,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
OpenSubtitle(form.OcrFileName, null);
|
||||
}
|
||||
}
|
||||
form.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemExportFcpIImage_Click(object sender, EventArgs e)
|
||||
@ -18971,7 +18953,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
{
|
||||
MessageBox.Show(_language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, _language.NoSubtitleLoaded, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -18984,7 +18966,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
index = 0;
|
||||
MakeHistoryForUndo(_language.BeforeDurationsBridgeGap);
|
||||
_subtitle.Paragraphs.Clear();
|
||||
foreach (Paragraph p in form.FixedSubtitle.Paragraphs)
|
||||
foreach (var p in form.FixedSubtitle.Paragraphs)
|
||||
_subtitle.Paragraphs.Add(p);
|
||||
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
@ -19014,7 +18996,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_videoInfo.VideoCodec = "MPEG2";
|
||||
toolStripComboBoxFrameRate.Text = string.Format("{0:0.###}", _videoInfo.FramesPerSecond);
|
||||
|
||||
string oldVideoPlayer = Configuration.Settings.General.VideoPlayer;
|
||||
var oldVideoPlayer = Configuration.Settings.General.VideoPlayer;
|
||||
try
|
||||
{
|
||||
Configuration.Settings.General.VideoPlayer = "VLC";
|
||||
@ -19023,9 +19005,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
mediaPlayer.OnButtonClicked -= MediaPlayer_OnButtonClicked;
|
||||
mediaPlayer.OnButtonClicked += MediaPlayer_OnButtonClicked;
|
||||
mediaPlayer.Volume = 0;
|
||||
labelVideoInfo.Text = "DVD" + " " + _videoInfo.Width + "x" + _videoInfo.Height + " " + _videoInfo.VideoCodec.Trim();
|
||||
labelVideoInfo.Text = string.Format("DVD {0}x{1} {2}", _videoInfo.Width, _videoInfo.Height, _videoInfo.VideoCodec.Trim());
|
||||
if (_videoInfo.FramesPerSecond > 0)
|
||||
labelVideoInfo.Text = labelVideoInfo.Text + " " + string.Format("{0:0.0##}", _videoInfo.FramesPerSecond);
|
||||
labelVideoInfo.Text += string.Format(" {0:0.0##}", _videoInfo.FramesPerSecond);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -19107,7 +19089,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
foreach (ListViewItem item in SubtitleListview1.SelectedItems)
|
||||
{
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(item.Index);
|
||||
var p = _subtitle.GetParagraphOrDefault(item.Index);
|
||||
if (p == null)
|
||||
continue;
|
||||
p.Text = s + " " + p.Text;
|
||||
@ -19160,8 +19142,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int selectedIndex = FirstSelectedIndex;
|
||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
||||
{
|
||||
Paragraph p = _subtitle.Paragraphs[index];
|
||||
string text = p.Text.Replace(rtl, string.Empty);
|
||||
var p = _subtitle.Paragraphs[index];
|
||||
var text = p.Text.Replace(rtl, string.Empty);
|
||||
p.Text = rtl + text.Replace(Environment.NewLine, Environment.NewLine + rtl);
|
||||
SubtitleListview1.SetText(index, p.Text);
|
||||
if (index == selectedIndex)
|
||||
@ -19189,16 +19171,21 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void audioVisualizer_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
if (!textBoxListViewText.Focused && !textBoxListViewTextAlternate.Focused && Configuration.Settings.VideoControls.WaveformFocusOnMouseEnter && audioVisualizer.WavePeaks != null && !audioVisualizer.Focused && audioVisualizer.CanFocus)
|
||||
if (!textBoxListViewText.Focused && !textBoxListViewTextAlternate.Focused && Configuration.Settings.VideoControls.WaveformFocusOnMouseEnter &&
|
||||
audioVisualizer.WavePeaks != null && !audioVisualizer.Focused && audioVisualizer.CanFocus)
|
||||
{
|
||||
audioVisualizer.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void SubtitleListview1_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
if (!textBoxListViewText.Focused && !textBoxListViewTextAlternate.Focused && Configuration.Settings.VideoControls.WaveformFocusOnMouseEnter &&
|
||||
Configuration.Settings.VideoControls.WaveformListViewFocusOnMouseEnter && !SubtitleListview1.Focused && SubtitleListview1.CanFocus)
|
||||
{
|
||||
SubtitleListview1.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripButtonFixCommonErrors_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -19240,7 +19227,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_timerCheckForUpdates != null)
|
||||
_timerCheckForUpdates.Stop();
|
||||
}
|
||||
catch { }
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
using (var form = new CheckForUpdates(this))
|
||||
{
|
||||
|
@ -37,14 +37,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
comboBoxSubtitleFontSize.SelectedIndex = 10;
|
||||
|
||||
}
|
||||
|
||||
internal void Initialize(NOcrDb _nOcrDb)
|
||||
{
|
||||
if (_nOcrDb != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +87,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var charactersLearned = new List<string>();
|
||||
foreach (ListViewItem item in listViewFonts.Items)
|
||||
{
|
||||
|
||||
if (item.Checked)
|
||||
{
|
||||
_subtitleFontName = item.Text;
|
||||
@ -128,7 +125,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
NOcrChar match = nOcrD.GetMatch(list[0].NikseBitmap);
|
||||
if (match == null)
|
||||
{
|
||||
|
||||
pictureBox1.Image = list[0].NikseBitmap.GetBitmap();
|
||||
this.Refresh();
|
||||
Application.DoEvents();
|
||||
|
@ -2080,7 +2080,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return oc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (tryItalicScaling)
|
||||
@ -2630,7 +2629,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return oc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (tryItalicScaling)
|
||||
@ -2686,7 +2684,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// return c;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -3826,7 +3823,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (index + 1 < list.Count && list[index + 1].NikseBitmap != null) // only allow expand to EndOfLine or space
|
||||
{
|
||||
|
||||
index++;
|
||||
expandSelectionList.Add(list[index]);
|
||||
}
|
||||
@ -3864,7 +3860,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
matches.Add(new CompareMatch("*", false, 0, null));
|
||||
}
|
||||
_italicCheckedLast = _vobSubOcrCharacter.IsItalic;
|
||||
|
||||
}
|
||||
else if (item.NikseBitmap == null)
|
||||
{
|
||||
@ -4199,7 +4194,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void SaveNOcr()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
_nOcrDb.Save();
|
||||
@ -4328,7 +4322,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (index + 1 < list.Count && list[index + 1].NikseBitmap != null) // only allow expand to EndOfLine or space
|
||||
{
|
||||
|
||||
index++;
|
||||
expandSelectionList.Add(list[index]);
|
||||
}
|
||||
@ -4375,7 +4368,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
matches.Add(new CompareMatch("*", false, 0, null));
|
||||
}
|
||||
_italicCheckedLast = _vobSubOcrNOcrCharacter.IsItalic;
|
||||
|
||||
}
|
||||
else if (item.NikseBitmap == null)
|
||||
{
|
||||
@ -5118,7 +5110,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
bitmap.Dispose();
|
||||
p.Result = GetStringWithItalicTags(matches);
|
||||
|
||||
}
|
||||
|
||||
private void ImageCompareThreadRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
@ -5597,7 +5588,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_mainOcrIndex++;
|
||||
_mainOcrTimer.Start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadNOcrWithCurrentLanguage()
|
||||
@ -6214,7 +6204,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
unItalicText += "!";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (line.EndsWith('?') && !unItalicText.EndsWith('?') && !unItalicText.EndsWith("?</i>"))
|
||||
@ -6818,7 +6807,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
using (var formVobSubEditCharacters = new VobSubEditCharacters(comboBoxCharacterDatabase.SelectedItem.ToString(), null, _binaryOcrDb))
|
||||
{
|
||||
|
||||
formVobSubEditCharacters.Initialize(name, text);
|
||||
DialogResult result = formVobSubEditCharacters.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
@ -7281,7 +7269,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
current.Text = old.Text;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
subtitleListView1.Fill(_subtitle);
|
||||
@ -7490,7 +7477,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
/// </summary>
|
||||
static EncodingTools()
|
||||
{
|
||||
|
||||
List<int> streamEcodings = new List<int>();
|
||||
List<int> allEncodings = new List<int>();
|
||||
List<int> mimeEcodings = new List<int>();
|
||||
@ -65,7 +64,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
// all singlebyte encodings
|
||||
foreach (EncodingInfo enc in Encoding.GetEncodings())
|
||||
{
|
||||
|
||||
if (!enc.GetEncoding().IsSingleByte)
|
||||
continue;
|
||||
|
||||
@ -155,7 +153,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
return enc;
|
||||
}
|
||||
@ -182,7 +179,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
|
||||
private static Encoding DetectOutgoingEncoding(string input, int[] preferredEncodings, bool preserveOrder)
|
||||
{
|
||||
|
||||
if (input == null)
|
||||
throw new ArgumentNullException("input");
|
||||
|
||||
@ -234,7 +230,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
Marshal.Copy(pDetectedEncs, theResult, 0, theResult.Length);
|
||||
result = Encoding.GetEncoding(theResult[0]);
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -252,7 +247,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
|
||||
public static Encoding[] DetectOutgoingEncodings(string input, int[] preferredEncodings, bool preserveOrder)
|
||||
{
|
||||
|
||||
if (input == null)
|
||||
throw new ArgumentNullException("input");
|
||||
|
||||
@ -304,9 +298,7 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
// get the encodings for the codepages
|
||||
for (int i = 0; i < detectedCodepages; i++)
|
||||
result.Add(Encoding.GetEncoding(theResult[i]));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -353,7 +345,6 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
/// <returns>an array of Encoding with assumed encodings</returns>
|
||||
public static Encoding[] DetectInputCodepages(byte[] input, int maxEncodings)
|
||||
{
|
||||
|
||||
if (maxEncodings < 1)
|
||||
throw new ArgumentOutOfRangeException("maxEncodings", "at least one encoding must be returned");
|
||||
|
||||
@ -477,9 +468,7 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
return new StreamReader(stream, detectedEncoding);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
size++;
|
||||
}
|
||||
|
||||
}
|
||||
if (size > 2)
|
||||
{
|
||||
@ -198,7 +197,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
parts.Add(new ImageSplitterItem(0, startY, bmp.CopyRectangle(new Rectangle(0, startY, bmp.Width, size + 1))));
|
||||
}
|
||||
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
@ -243,7 +241,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
size++;
|
||||
}
|
||||
|
||||
}
|
||||
if (size > 2)
|
||||
{
|
||||
@ -295,7 +292,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
size++;
|
||||
}
|
||||
|
||||
}
|
||||
if (size > 2)
|
||||
{
|
||||
@ -355,7 +351,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
x < bmp.Width - 2 &&
|
||||
!IsVerticalLineTransparent(bmp, ref tempY, x + 1))
|
||||
{
|
||||
|
||||
//Add space?
|
||||
if (lastEndX > 0 && lastEndX + xOrMorePixelsMakesSpace < startX)
|
||||
{
|
||||
@ -751,7 +746,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
else if (x < bmp.Width - 1 && y == bmp.Height - 1 && bmp.GetAlpha(x + 1, y) == 0 && bmp.GetAlpha(x + 1, y - 1) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user