mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Focus line after "go to line"
This commit is contained in:
parent
69a6bf913c
commit
512786ecea
@ -269,30 +269,21 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
else if (e.KeyData == (Keys.Control | Keys.G))
|
else if (e.KeyData == (Keys.Control | Keys.G))
|
||||||
{
|
{
|
||||||
var isSubtitleListview1Active = true;
|
var subView = SubtitleListview1;
|
||||||
if (subtitleListView2 != null && subtitleListView2.Visible)
|
if (subtitleListView2 != null && subtitleListView2.Visible && !SubtitleListview1.Focused)
|
||||||
{
|
{
|
||||||
var point = PointToClient(MousePosition);
|
var x = PointToClient(MousePosition).X;
|
||||||
if (point.X >= subtitleListView2.Left && point.X <= subtitleListView2.Left + subtitleListView2.Width)
|
if (x >= subtitleListView2.Left && x <= subtitleListView2.Left + subtitleListView2.Width)
|
||||||
{
|
{
|
||||||
isSubtitleListview1Active = false;
|
subView = subtitleListView2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
using (var gotoForm = new GoToLine())
|
using (var gotoForm = new GoToLine())
|
||||||
{
|
{
|
||||||
gotoForm.Initialize(1, isSubtitleListview1Active ? _subtitle.Paragraphs.Count : _otherSubtitle.Paragraphs.Count);
|
gotoForm.Initialize(1, subView.Items.Count);
|
||||||
if (gotoForm.ShowDialog() == DialogResult.OK)
|
if (gotoForm.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (isSubtitleListview1Active)
|
subView.SelectIndexAndEnsureVisible(gotoForm.LineNumber - 1, true);
|
||||||
{
|
|
||||||
SubtitleListview1.Items[gotoForm.LineNumber - 1].Selected = true;
|
|
||||||
SubtitleListview1.EnsureVisible(gotoForm.LineNumber - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subtitleListView2.Items[gotoForm.LineNumber - 1].Selected = true;
|
|
||||||
subtitleListView2.EnsureVisible(gotoForm.LineNumber - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user