mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Try to keep selected line after "Remove text for HI" - thx Atlantis :)
This commit is contained in:
parent
4038fca793
commit
38ec78dd83
@ -7058,14 +7058,49 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
internal void ReloadFromSubtitle(Subtitle subtitle, string messageForUndo)
|
||||
{
|
||||
MakeHistoryForUndo(messageForUndo);
|
||||
var firstSelected = _subtitle.GetParagraphOrDefault(_subtitleListViewIndex);
|
||||
_subtitle.Paragraphs.Clear();
|
||||
_subtitle.Paragraphs.AddRange(subtitle.Paragraphs);
|
||||
UpdateSourceView();
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
|
||||
_subtitleListViewIndex = -1;
|
||||
if (firstSelected != null)
|
||||
{
|
||||
var newSelected = GetFirstAlike(firstSelected);
|
||||
if (newSelected != null)
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(_subtitle.GetIndex(newSelected), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0, true);
|
||||
}
|
||||
|
||||
public Paragraph GetFirstAlike(Paragraph p)
|
||||
{
|
||||
foreach (var item in _subtitle.Paragraphs)
|
||||
{
|
||||
if (Math.Abs(p.StartTime.TotalMilliseconds - item.StartTime.TotalMilliseconds) < 0.1 &&
|
||||
Math.Abs(p.EndTime.TotalMilliseconds - item.EndTime.TotalMilliseconds) < 0.1 &&
|
||||
p.Text == item.Text)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in _subtitle.Paragraphs)
|
||||
{
|
||||
if (Math.Abs(p.StartTime.TotalMilliseconds - item.StartTime.TotalMilliseconds) < 0.1 &&
|
||||
Math.Abs(p.EndTime.TotalMilliseconds - item.EndTime.TotalMilliseconds) < 0.1)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void RemoveTextForHearImpairedToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsSubtitleLoaded)
|
||||
|
@ -285,9 +285,9 @@
|
||||
"♫",
|
||||
"♪,♫"});
|
||||
this.comboBoxRemoveIfTextContains.Location = new System.Drawing.Point(427, 131);
|
||||
this.comboBoxRemoveIfTextContains.MaxLength = 10;
|
||||
this.comboBoxRemoveIfTextContains.MaxLength = 25;
|
||||
this.comboBoxRemoveIfTextContains.Name = "comboBoxRemoveIfTextContains";
|
||||
this.comboBoxRemoveIfTextContains.Size = new System.Drawing.Size(100, 21);
|
||||
this.comboBoxRemoveIfTextContains.Size = new System.Drawing.Size(122, 21);
|
||||
this.comboBoxRemoveIfTextContains.TabIndex = 15;
|
||||
this.comboBoxRemoveIfTextContains.Text = "¶";
|
||||
this.comboBoxRemoveIfTextContains.TextChanged += new System.EventHandler(this.CheckBoxRemoveTextBetweenCheckedChanged);
|
||||
@ -480,10 +480,10 @@
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Remove text for hearing impaired";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormRemoveTextForHearImpaired_KeyDown);
|
||||
this.Load += new System.EventHandler(this.FormRemoveTextForHearImpaired_Load);
|
||||
this.Resize += new System.EventHandler(this.FormRemoveTextForHearImpaired_Resize);
|
||||
this.Shown += new System.EventHandler(this.FormRemoveTextForHearImpaired_Shown);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormRemoveTextForHearImpaired_KeyDown);
|
||||
this.Resize += new System.EventHandler(this.FormRemoveTextForHearImpaired_Resize);
|
||||
this.groupBoxLinesFound.ResumeLayout(false);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.groupBoxRemoveTextConditions.ResumeLayout(false);
|
||||
|
Loading…
Reference in New Issue
Block a user