mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Working on making "original subtitle" working with different commands like
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@574 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
6f9d85cb87
commit
8caec407d3
@ -89,7 +89,10 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
return _spectrogramBitmaps != null && _spectrogramBitmaps.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSpectrogram { get; set; }
|
||||
private bool _tempShowSpectrogram;
|
||||
|
||||
public bool ShowWaveform { get; set; }
|
||||
|
||||
private double _startPositionSeconds = 0;
|
||||
@ -157,7 +160,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
_subtitle = null;
|
||||
_noClear = false;
|
||||
_wavePeaks = value;
|
||||
ShowWaveform = true;
|
||||
// ShowWaveform = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,6 +1109,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
public void InitializeSpectrogram(string spectrogramDirectory)
|
||||
{
|
||||
_spectrogramBitmaps = new List<Bitmap>();
|
||||
_tempShowSpectrogram = ShowSpectrogram;
|
||||
ShowSpectrogram = false;
|
||||
if (System.IO.Directory.Exists(spectrogramDirectory))
|
||||
{
|
||||
@ -1123,7 +1127,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
doc.Load(System.IO.Path.Combine(_spectrogramDirectory, "Info.xml"));
|
||||
_sampleDuration = Convert.ToDouble(doc.DocumentElement.SelectSingleNode("SampleDuration").InnerText);
|
||||
_totalDuration = Convert.ToDouble(doc.DocumentElement.SelectSingleNode("TotalDuration").InnerText);
|
||||
ShowSpectrogram = true;
|
||||
ShowSpectrogram = _tempShowSpectrogram;
|
||||
}
|
||||
|
||||
void LoadSpectrogramBitmapsAsync(object sender, System.ComponentModel.DoWorkEventArgs e)
|
||||
|
4
src/Forms/Main.Designer.cs
generated
4
src/Forms/Main.Designer.cs
generated
@ -3123,6 +3123,7 @@
|
||||
this.textBoxListViewTextAlternate.TabIndex = 33;
|
||||
this.textBoxListViewTextAlternate.Visible = false;
|
||||
this.textBoxListViewTextAlternate.TextChanged += new System.EventHandler(this.textBoxListViewTextAlternate_TextChanged);
|
||||
this.textBoxListViewTextAlternate.Enter += new System.EventHandler(this.textBoxListViewTextAlternate_Enter);
|
||||
this.textBoxListViewTextAlternate.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewTextAlternate_KeyDown);
|
||||
this.textBoxListViewTextAlternate.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewTextAlternate_MouseDoubleClick);
|
||||
this.textBoxListViewTextAlternate.MouseMove += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewTextAlternate_MouseMove);
|
||||
@ -3460,6 +3461,7 @@
|
||||
this.textBoxListViewText.Size = new System.Drawing.Size(570, 56);
|
||||
this.textBoxListViewText.TabIndex = 5;
|
||||
this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged);
|
||||
this.textBoxListViewText.Enter += new System.EventHandler(this.textBoxListViewText_Enter);
|
||||
this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown);
|
||||
this.textBoxListViewText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewText_KeyUp);
|
||||
this.textBoxListViewText.Leave += new System.EventHandler(this.textBoxListViewText_Leave);
|
||||
@ -3499,7 +3501,7 @@
|
||||
this.SubtitleListview1.HideSelection = false;
|
||||
this.SubtitleListview1.Location = new System.Drawing.Point(1, 3);
|
||||
this.SubtitleListview1.Name = "SubtitleListview1";
|
||||
this.SubtitleListview1.Size = new System.Drawing.Size(932, 148);
|
||||
this.SubtitleListview1.Size = new System.Drawing.Size(933, 148);
|
||||
this.SubtitleListview1.TabIndex = 0;
|
||||
this.SubtitleListview1.UseCompatibleStateImageBehavior = false;
|
||||
this.SubtitleListview1.View = System.Windows.Forms.View.Details;
|
||||
|
@ -220,10 +220,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
tabControlSubtitle.SelectTab(TabControlSourceView);
|
||||
|
||||
|
||||
audioVisualizer.Visible = Configuration.Settings.General.ShowWaveForm;
|
||||
panelWaveFormControls.Visible = Configuration.Settings.General.ShowWaveForm;
|
||||
trackBarWaveFormPosition.Visible = Configuration.Settings.General.ShowWaveForm;
|
||||
toolStripButtonToggleWaveForm.Checked = Configuration.Settings.General.ShowWaveForm;
|
||||
audioVisualizer.Visible = Configuration.Settings.General.ShowAudioVisualizer;
|
||||
audioVisualizer.ShowWaveform = Configuration.Settings.General.ShowWaveform;
|
||||
audioVisualizer.ShowSpectrogram = Configuration.Settings.General.ShowSpectrogram;
|
||||
panelWaveFormControls.Visible = Configuration.Settings.General.ShowAudioVisualizer;
|
||||
trackBarWaveFormPosition.Visible = Configuration.Settings.General.ShowAudioVisualizer;
|
||||
toolStripButtonToggleWaveForm.Checked = Configuration.Settings.General.ShowAudioVisualizer;
|
||||
toolStripButtonToggleVideo.Checked = Configuration.Settings.General.ShowVideoPlayer;
|
||||
|
||||
string fileName = string.Empty;
|
||||
@ -1031,7 +1033,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SubtitleListview1.Items.Count == 0)
|
||||
if (SubtitleListview1.Items.Count == 0 || SubtitleListview1.TopItem == null)
|
||||
return -1;
|
||||
return SubtitleListview1.TopItem.Index;
|
||||
}
|
||||
@ -1425,7 +1427,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
audioVisualizer.ResetSpectrogram();
|
||||
audioVisualizer.Invalidate();
|
||||
|
||||
if (Configuration.Settings.General.ShowVideoPlayer || Configuration.Settings.General.ShowWaveForm)
|
||||
if (Configuration.Settings.General.ShowVideoPlayer || Configuration.Settings.General.ShowAudioVisualizer)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(videoFileName) && File.Exists(videoFileName))
|
||||
{
|
||||
@ -2363,7 +2365,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
//if we fail to find the text, we might want to start searching from the top of the file.
|
||||
bool foundIt = false;
|
||||
if (_findHelper.Find(_subtitle, selectedIndex))
|
||||
if (_findHelper.Find(_subtitle, _subtitleAlternate, selectedIndex))
|
||||
{
|
||||
foundIt = true;
|
||||
}
|
||||
@ -2372,7 +2374,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (MessageBox.Show(_language.FindContinue, _language.FindContinueTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
selectedIndex = -1;
|
||||
if (_findHelper.Find(_subtitle, selectedIndex))
|
||||
if (_findHelper.Find(_subtitle, _subtitleAlternate, selectedIndex))
|
||||
foundIt = true;
|
||||
}
|
||||
}
|
||||
@ -2380,11 +2382,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (foundIt)
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
|
||||
textBoxListViewText.SelectionLength = _findHelper.FindTextLength;
|
||||
TextBox tb;
|
||||
if (_findHelper.MatchInOriginal)
|
||||
tb = textBoxListViewTextAlternate;
|
||||
else
|
||||
tb = textBoxListViewText;
|
||||
tb.Focus();
|
||||
tb.SelectionStart = _findHelper.SelectedPosition;
|
||||
tb.SelectionLength = _findHelper.FindTextLength;
|
||||
ShowStatus(string.Format(_language.XFoundAtLineNumberY, _findHelper.FindText, _findHelper.SelectedIndex + 1));
|
||||
_findHelper.SelectedPosition++;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2424,13 +2432,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int selectedIndex = -1;
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
selectedIndex = SubtitleListview1.SelectedItems[0].Index;
|
||||
if (_findHelper.FindNext(_subtitle, selectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, selectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
ShowStatus(string.Format(_language.XFoundAtLineNumberY, _findHelper.FindText, _findHelper.SelectedIndex+1));
|
||||
textBoxListViewText.Focus();
|
||||
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
|
||||
textBoxListViewText.SelectionLength = _findHelper.FindTextLength;
|
||||
TextBox tb;
|
||||
if (_findHelper.MatchInOriginal)
|
||||
tb = textBoxListViewTextAlternate;
|
||||
else
|
||||
tb = textBoxListViewText;
|
||||
tb.Focus();
|
||||
tb.SelectionStart = _findHelper.SelectedPosition;
|
||||
tb.SelectionLength = _findHelper.FindTextLength;
|
||||
_findHelper.SelectedPosition++;
|
||||
}
|
||||
else
|
||||
@ -2440,12 +2453,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (MessageBox.Show(_language.FindContinue, _language.FindContinueTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
_findHelper.StartLineIndex = 0;
|
||||
if (_findHelper.Find(_subtitle, 0))
|
||||
if (_findHelper.Find(_subtitle, _subtitleAlternate, 0))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
|
||||
textBoxListViewText.SelectionLength = _findHelper.FindTextLength;
|
||||
TextBox tb;
|
||||
if (_findHelper.MatchInOriginal)
|
||||
tb = textBoxListViewTextAlternate;
|
||||
else
|
||||
tb = textBoxListViewText;
|
||||
tb.Focus();
|
||||
tb.SelectionStart = _findHelper.SelectedPosition;
|
||||
tb.SelectionLength = _findHelper.FindTextLength;
|
||||
ShowStatus(string.Format(_language.XFoundAtLineNumberY, _findHelper.FindText, _findHelper.SelectedIndex + 1));
|
||||
_findHelper.SelectedPosition++;
|
||||
return;
|
||||
@ -2620,7 +2638,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (replaceDialog.ReplaceAll)
|
||||
{
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
|
||||
@ -2644,7 +2662,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_findHelper.SelectedIndex = 0;
|
||||
_findHelper.SelectedPosition = 0;
|
||||
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.SelectionStart = _findHelper.SelectedPosition;
|
||||
@ -2660,7 +2678,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (replaceDialog.FindOnly)
|
||||
{
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
@ -2680,7 +2698,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_findHelper.StartLineIndex = 0;
|
||||
_findHelper.SelectedIndex = 0;
|
||||
_findHelper.SelectedPosition = 0;
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
@ -2713,7 +2731,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
msg = _language.OneReplacementMade + " ";
|
||||
}
|
||||
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
@ -2738,7 +2756,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_findHelper.SelectedPosition = 0;
|
||||
|
||||
|
||||
if (_findHelper.FindNext(_subtitle, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
if (_findHelper.FindNext(_subtitle, _subtitleAlternate, _findHelper.SelectedIndex, _findHelper.SelectedPosition))
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_findHelper.SelectedIndex);
|
||||
textBoxListViewText.Focus();
|
||||
@ -3753,6 +3771,25 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.BeginUpdate();
|
||||
foreach (int i in indexes)
|
||||
{
|
||||
if (_subtitleAlternate != null)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(i, _subtitle.Paragraphs[i], _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
if (original.Text.Contains("<" + tag + ">"))
|
||||
{
|
||||
original.Text = original.Text.Replace("<" + tag + ">", string.Empty);
|
||||
original.Text = original.Text.Replace("</" + tag + ">", string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
original.Text = string.Format("<{0}>{1}</{0}>", tag, original.Text);
|
||||
}
|
||||
SubtitleListview1.SetAlternateText(i, original.Text);
|
||||
_changeAlternate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (_subtitle.Paragraphs[i].Text.Contains("<" + tag + ">"))
|
||||
{
|
||||
_subtitle.Paragraphs[i].Text = _subtitle.Paragraphs[i].Text.Replace("<" + tag + ">", string.Empty);
|
||||
@ -4215,6 +4252,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
p.Text = Utilities.RemoveHtmlTags(p.Text);
|
||||
SubtitleListview1.SetText(item.Index, p.Text);
|
||||
|
||||
if (_subtitleAlternate != null)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(item.Index, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
original.Text = Utilities.RemoveHtmlTags(original.Text);
|
||||
SubtitleListview1.SetAlternateText(item.Index, original.Text);
|
||||
_changeAlternate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowSource();
|
||||
@ -4502,7 +4550,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
if (sb.Length > 200)
|
||||
return;
|
||||
return;
|
||||
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
MakeHistoryForUndo(_language.BeforeMergeLines);
|
||||
@ -4581,6 +4629,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
MakeHistoryForUndo(_language.BeforeMergeLines);
|
||||
|
||||
if (_subtitleAlternate != null)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(firstSelectedIndex, currentParagraph, _subtitleAlternate.Paragraphs);
|
||||
Paragraph originalNext = Utilities.GetOriginalParagraph(firstSelectedIndex+1,nextParagraph, _subtitleAlternate.Paragraphs);
|
||||
|
||||
original.Text = original.Text.Replace(Environment.NewLine, " ");
|
||||
original.Text += Environment.NewLine + originalNext.Text.Replace(Environment.NewLine, " ");
|
||||
original.Text = ChangeAllLinesItalictoSingleItalic(original.Text);
|
||||
original.Text = Utilities.AutoBreakLine(original.Text);
|
||||
_subtitleAlternate.Paragraphs.Remove(originalNext);
|
||||
}
|
||||
|
||||
currentParagraph.Text = currentParagraph.Text.Replace(Environment.NewLine, " ");
|
||||
currentParagraph.Text += Environment.NewLine + nextParagraph.Text.Replace(Environment.NewLine, " ");
|
||||
currentParagraph.Text = ChangeAllLinesItalictoSingleItalic(currentParagraph.Text);
|
||||
@ -4846,6 +4906,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.General.AutoRepeatOn = checkBoxAutoRepeatOn.Checked;
|
||||
Configuration.Settings.General.AutoContinueOn = checkBoxAutoContinue.Checked;
|
||||
Configuration.Settings.General.SyncListViewWithVideoWhilePlaying = checkBoxSyncListViewWithVideoWhilePlaying.Checked;
|
||||
if (audioVisualizer != null)
|
||||
{
|
||||
Configuration.Settings.General.ShowWaveform = audioVisualizer.ShowWaveform;
|
||||
Configuration.Settings.General.ShowSpectrogram = audioVisualizer.ShowSpectrogram;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(_fileName))
|
||||
Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName);
|
||||
|
||||
@ -6523,7 +6588,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void ToolStripMenuItemCompareClick(object sender, EventArgs e)
|
||||
{
|
||||
var compareForm = new Compare();
|
||||
compareForm.Initialize(_subtitle, _fileName, Configuration.Settings.Language.General.CurrentSubtitle);
|
||||
if (_subtitleAlternate != null && _subtitleAlternateFileName != null)
|
||||
compareForm.Initialize(_subtitle, _fileName, _subtitleAlternate, _subtitleAlternateFileName);
|
||||
else
|
||||
compareForm.Initialize(_subtitle, _fileName, Configuration.Settings.Language.General.CurrentSubtitle);
|
||||
compareForm.Show();
|
||||
}
|
||||
|
||||
@ -7471,6 +7539,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelCharactersPerSecond.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelCharactersPerSecond.Width);
|
||||
labelTextLineTotal.Left = textBoxListViewText.Left + (textBoxListViewText.Width - labelTextLineTotal.Width);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
|
||||
// Due to strange bug in listview when maximizing
|
||||
SaveSubtitleListviewIndexes();
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
RestoreSubtitleListviewIndexes();
|
||||
|
||||
panelVideoPlayer.Refresh();
|
||||
}
|
||||
|
||||
private void PlayCurrent()
|
||||
@ -7782,7 +7857,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
ShowVideoPlayer();
|
||||
}
|
||||
Configuration.Settings.General.ShowWaveForm = toolStripButtonToggleWaveForm.Checked;
|
||||
Configuration.Settings.General.ShowAudioVisualizer = toolStripButtonToggleWaveForm.Checked;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@ -7800,12 +7875,38 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(i);
|
||||
if (p != null)
|
||||
{
|
||||
if (_subtitleAlternate != null && onlySelected)
|
||||
{
|
||||
Paragraph original = Utilities.GetOriginalParagraph(i, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
original.StartTime.TotalMilliseconds += adjustMilliseconds;
|
||||
original.EndTime.TotalMilliseconds += adjustMilliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
p.StartTime.TotalMilliseconds += adjustMilliseconds;
|
||||
p.EndTime.TotalMilliseconds += adjustMilliseconds;
|
||||
SubtitleListview1.SetStartTime(i, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && !onlySelected)
|
||||
{
|
||||
for (int i = 0; i < _subtitleAlternate.Paragraphs.Count; i++)
|
||||
{
|
||||
Paragraph p = _subtitleAlternate.GetParagraphOrDefault(i);
|
||||
if (p != null)
|
||||
{
|
||||
p.StartTime.TotalMilliseconds += adjustMilliseconds;
|
||||
p.EndTime.TotalMilliseconds += adjustMilliseconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null)
|
||||
_changeAlternate = true;
|
||||
_change = true;
|
||||
SubtitleListview1.EndUpdate();
|
||||
if (_subtitle.WasLoadedWithFrameNumbers)
|
||||
@ -10506,6 +10607,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
selText = selText.TrimEnd('?');
|
||||
selText = selText.TrimEnd(',');
|
||||
selText = selText.TrimEnd(')');
|
||||
selText = selText.TrimEnd(']');
|
||||
selText = selText.TrimEnd(':');
|
||||
selText = selText.TrimEnd(';');
|
||||
selText = selText.TrimEnd(' ');
|
||||
@ -10624,5 +10726,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void textBoxListViewText_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (_findHelper != null)
|
||||
_findHelper.MatchInOriginal = false;
|
||||
}
|
||||
|
||||
private void textBoxListViewTextAlternate_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (_findHelper != null)
|
||||
_findHelper.MatchInOriginal = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -681,7 +681,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAASABCQEgAQkBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAYgBCQGIAQkBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
@ -18,6 +18,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public int WindowPositionLeft { get; set; }
|
||||
public int WindowPositionTop { get; set; }
|
||||
public int StartLineIndex { get; set; }
|
||||
public bool MatchInOriginal { get; set; }
|
||||
|
||||
public int FindTextLength
|
||||
{
|
||||
@ -55,9 +56,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
StartLineIndex = startLineIndex;
|
||||
}
|
||||
|
||||
public bool Find(Subtitle subtitle, int startIndex)
|
||||
public bool Find(Subtitle subtitle, Subtitle originalSubtitle, int startIndex)
|
||||
{
|
||||
return FindNext(subtitle, startIndex, 0);
|
||||
return FindNext(subtitle, originalSubtitle, startIndex, 0);
|
||||
}
|
||||
|
||||
public bool Find(TextBox textBox, int startIndex)
|
||||
@ -96,7 +97,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool FindNext(Subtitle subtitle, int startIndex, int position)
|
||||
public bool FindNext(Subtitle subtitle, Subtitle originalSubtitle, int startIndex, int position)
|
||||
{
|
||||
Success = false;
|
||||
int index = 0;
|
||||
@ -106,15 +107,38 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
if (index >= startIndex)
|
||||
{
|
||||
int pos = FindPositionInText(p.Text, position);
|
||||
if (pos >= 0)
|
||||
int pos = 0;
|
||||
if (!MatchInOriginal)
|
||||
{
|
||||
SelectedIndex = index;
|
||||
SelectedPosition = pos;
|
||||
Success = true;
|
||||
return true;
|
||||
pos = FindPositionInText(p.Text, position);
|
||||
if (pos >= 0)
|
||||
{
|
||||
MatchInOriginal = false;
|
||||
SelectedIndex = index;
|
||||
SelectedPosition = pos;
|
||||
Success = true;
|
||||
return true;
|
||||
}
|
||||
position = 0;
|
||||
}
|
||||
MatchInOriginal = false;
|
||||
|
||||
if (originalSubtitle != null)
|
||||
{
|
||||
Paragraph o = Utilities.GetOriginalParagraph(index, p, originalSubtitle.Paragraphs);
|
||||
if (o != null)
|
||||
{
|
||||
pos = FindPositionInText(o.Text, position);
|
||||
if (pos >= 0)
|
||||
{
|
||||
MatchInOriginal = true;
|
||||
SelectedIndex = index;
|
||||
SelectedPosition = pos;
|
||||
Success = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
position = 0;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -212,7 +212,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public bool ShowToolbarHelp { get; set; }
|
||||
|
||||
public bool ShowVideoPlayer { get; set; }
|
||||
public bool ShowWaveForm { get; set; }
|
||||
public bool ShowAudioVisualizer { get; set; }
|
||||
public bool ShowWaveform { get; set; }
|
||||
public bool ShowSpectrogram { get; set; }
|
||||
public bool ShowFrameRate { get; set; }
|
||||
public double DefaultFrameRate { get; set; }
|
||||
public double CurrentFrameRate { get; set; }
|
||||
@ -276,7 +278,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
ShowToolbarHelp = true;
|
||||
|
||||
ShowVideoPlayer = false;
|
||||
ShowWaveForm = false;
|
||||
ShowAudioVisualizer = false;
|
||||
ShowWaveform = true;
|
||||
ShowSpectrogram = true;
|
||||
ShowFrameRate = false;
|
||||
DefaultFrameRate = 23.976;
|
||||
CurrentFrameRate = DefaultFrameRate;
|
||||
@ -647,9 +651,15 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
subNode = node.SelectSingleNode("ShowVideoPlayer");
|
||||
if (subNode != null)
|
||||
settings.General.ShowVideoPlayer = Convert.ToBoolean(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("ShowWaveForm");
|
||||
subNode = node.SelectSingleNode("ShowAudioVisualizer");
|
||||
if (subNode != null)
|
||||
settings.General.ShowWaveForm = Convert.ToBoolean(subNode.InnerText);
|
||||
settings.General.ShowAudioVisualizer = Convert.ToBoolean(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("ShowWaveform");
|
||||
if (subNode != null)
|
||||
settings.General.ShowWaveform = Convert.ToBoolean(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("ShowSpectrogram");
|
||||
if (subNode != null)
|
||||
settings.General.ShowSpectrogram = Convert.ToBoolean(subNode.InnerText);
|
||||
subNode = node.SelectSingleNode("DefaultFrameRate");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -1174,7 +1184,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("ShowToolbarHelp", settings.General.ShowToolbarHelp.ToString());
|
||||
textWriter.WriteElementString("ShowFrameRate", settings.General.ShowFrameRate.ToString());
|
||||
textWriter.WriteElementString("ShowVideoPlayer", settings.General.ShowVideoPlayer.ToString());
|
||||
textWriter.WriteElementString("ShowWaveForm", settings.General.ShowWaveForm.ToString());
|
||||
textWriter.WriteElementString("ShowAudioVisualizer", settings.General.ShowAudioVisualizer.ToString());
|
||||
textWriter.WriteElementString("ShowWaveform", settings.General.ShowWaveform.ToString());
|
||||
textWriter.WriteElementString("ShowSpectrogram", settings.General.ShowSpectrogram.ToString());
|
||||
textWriter.WriteElementString("DefaultFrameRate", settings.General.DefaultFrameRate.ToString());
|
||||
textWriter.WriteElementString("DefaultEncoding", settings.General.DefaultEncoding);
|
||||
textWriter.WriteElementString("AutoGuessAnsiEncoding", settings.General.AutoGuessAnsiEncoding.ToString());
|
||||
|
@ -200,6 +200,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
if (buffer[index] == 0xFE && buffer[index - 15] == 0x60)
|
||||
con = false;
|
||||
if (buffer[index] == 0xFE && buffer[index - 12] == 0x60)
|
||||
con = false;
|
||||
}
|
||||
|
||||
int FEIndex = index;
|
||||
@ -226,7 +228,13 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int timeStartIndex = FEIndex - 15;
|
||||
if (buffer[timeStartIndex] == 0x60)
|
||||
{
|
||||
p.StartTime = GetTimeCode(timeStartIndex+1, buffer);
|
||||
p.StartTime = GetTimeCode(timeStartIndex + 1, buffer);
|
||||
p.EndTime = GetTimeCode(timeStartIndex + 5, buffer);
|
||||
}
|
||||
else if (buffer[timeStartIndex+3] == 0x60)
|
||||
{
|
||||
timeStartIndex += 3;
|
||||
p.StartTime = GetTimeCode(timeStartIndex + 1, buffer);
|
||||
p.EndTime = GetTimeCode(timeStartIndex + 5, buffer);
|
||||
}
|
||||
return p;
|
||||
|
Loading…
Reference in New Issue
Block a user