mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Try to improve list view select/deselect performance
This commit is contained in:
parent
b8421454d4
commit
6f01845788
56
src/ui/Forms/Main.Designer.cs
generated
56
src/ui/Forms/Main.Designer.cs
generated
@ -40,9 +40,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode3 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode4 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode5 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
Nikse.SubtitleEdit.Core.Common.TimeCode timeCode6 = new Nikse.SubtitleEdit.Core.Common.TimeCode();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.labelStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripSelected = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
@ -3586,14 +3586,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.timeUpDownVideoPosition.Name = "timeUpDownVideoPosition";
|
||||
this.timeUpDownVideoPosition.Size = new System.Drawing.Size(111, 27);
|
||||
this.timeUpDownVideoPosition.TabIndex = 12;
|
||||
timeCode1.Hours = 0;
|
||||
timeCode1.Milliseconds = 0;
|
||||
timeCode1.Minutes = 0;
|
||||
timeCode1.Seconds = 0;
|
||||
timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode1.TotalMilliseconds = 0D;
|
||||
timeCode1.TotalSeconds = 0D;
|
||||
this.timeUpDownVideoPosition.TimeCode = timeCode1;
|
||||
timeCode4.Hours = 0;
|
||||
timeCode4.Milliseconds = 0;
|
||||
timeCode4.Minutes = 0;
|
||||
timeCode4.Seconds = 0;
|
||||
timeCode4.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode4.TotalMilliseconds = 0D;
|
||||
timeCode4.TotalSeconds = 0D;
|
||||
this.timeUpDownVideoPosition.TimeCode = timeCode4;
|
||||
this.timeUpDownVideoPosition.UseVideoOffset = false;
|
||||
//
|
||||
// buttonGotoSub
|
||||
@ -3826,14 +3826,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.timeUpDownVideoPositionAdjust.Name = "timeUpDownVideoPositionAdjust";
|
||||
this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(111, 27);
|
||||
this.timeUpDownVideoPositionAdjust.TabIndex = 13;
|
||||
timeCode2.Hours = 0;
|
||||
timeCode2.Milliseconds = 0;
|
||||
timeCode2.Minutes = 0;
|
||||
timeCode2.Seconds = 0;
|
||||
timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode2.TotalMilliseconds = 0D;
|
||||
timeCode2.TotalSeconds = 0D;
|
||||
this.timeUpDownVideoPositionAdjust.TimeCode = timeCode2;
|
||||
timeCode5.Hours = 0;
|
||||
timeCode5.Milliseconds = 0;
|
||||
timeCode5.Minutes = 0;
|
||||
timeCode5.Seconds = 0;
|
||||
timeCode5.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode5.TotalMilliseconds = 0D;
|
||||
timeCode5.TotalSeconds = 0D;
|
||||
this.timeUpDownVideoPositionAdjust.TimeCode = timeCode5;
|
||||
this.timeUpDownVideoPositionAdjust.UseVideoOffset = false;
|
||||
//
|
||||
// buttonAdjustSetEndTime
|
||||
@ -4351,7 +4351,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.SubtitleListview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragEnter);
|
||||
this.SubtitleListview1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SubtitleListview1KeyDown);
|
||||
this.SubtitleListview1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDoubleClick);
|
||||
this.SubtitleListview1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDown);
|
||||
this.SubtitleListview1.MouseEnter += new System.EventHandler(this.SubtitleListview1_MouseEnter);
|
||||
this.SubtitleListview1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseUp);
|
||||
//
|
||||
// imageListBookmarks
|
||||
//
|
||||
@ -5035,14 +5037,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.timeUpDownStartTime.Name = "timeUpDownStartTime";
|
||||
this.timeUpDownStartTime.Size = new System.Drawing.Size(111, 27);
|
||||
this.timeUpDownStartTime.TabIndex = 0;
|
||||
timeCode3.Hours = 0;
|
||||
timeCode3.Milliseconds = 0;
|
||||
timeCode3.Minutes = 0;
|
||||
timeCode3.Seconds = 0;
|
||||
timeCode3.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode3.TotalMilliseconds = 0D;
|
||||
timeCode3.TotalSeconds = 0D;
|
||||
this.timeUpDownStartTime.TimeCode = timeCode3;
|
||||
timeCode6.Hours = 0;
|
||||
timeCode6.Milliseconds = 0;
|
||||
timeCode6.Minutes = 0;
|
||||
timeCode6.Seconds = 0;
|
||||
timeCode6.TimeSpan = System.TimeSpan.Parse("00:00:00");
|
||||
timeCode6.TotalMilliseconds = 0D;
|
||||
timeCode6.TotalSeconds = 0D;
|
||||
this.timeUpDownStartTime.TimeCode = timeCode6;
|
||||
this.timeUpDownStartTime.UseVideoOffset = false;
|
||||
//
|
||||
// numericUpDownDuration
|
||||
|
@ -70,6 +70,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private long _listViewTextTicks = -1;
|
||||
private string _listViewOriginalTextUndoLast;
|
||||
private long _listViewOriginalTextTicks = -1;
|
||||
private bool _listViewMouseDown;
|
||||
private long _sourceTextTicks = -1;
|
||||
|
||||
private int _videoAudioTrackNumber = -1;
|
||||
@ -9488,6 +9489,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void SubtitleListView1SelectedIndexChange()
|
||||
{
|
||||
StopAutoDuration();
|
||||
|
||||
if (_listViewMouseDown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShowLineInformationListView();
|
||||
if (_subtitle.Paragraphs.Count > 0)
|
||||
{
|
||||
@ -9800,7 +9807,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
SubtitleListview1.SuspendLayout();
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
var temp = firstSelectedIndex;
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
{
|
||||
@ -9814,7 +9821,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(firstSelectedIndex, true);
|
||||
}
|
||||
|
||||
SubtitleListview1.ResumeLayout();
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private int _lastNumberOfNewLines = -1;
|
||||
@ -15604,17 +15612,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.Home && e.Modifiers == Keys.Alt)
|
||||
{
|
||||
SubtitleListview1.FirstVisibleIndex = -1;
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0, true);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.End && e.Modifiers == Keys.Alt)
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(SubtitleListview1.Items.Count - 1, true);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainGeneralGoToFirstSelectedLine == e.KeyData) //Locate first selected line in subtitle listview
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count > 0)
|
||||
@ -19088,7 +19085,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control)
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.SelectAll();
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
RefreshSelectedParagraph();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control)
|
||||
@ -19113,27 +19113,63 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
InsertAfter(string.Empty, true);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.Home)
|
||||
else if ((e.Modifiers == Keys.Control && e.KeyCode == Keys.Home) ||
|
||||
(e.Modifiers == Keys.Alt && e.KeyCode == Keys.Home) ||
|
||||
(e.Modifiers == Keys.None && e.KeyCode == Keys.Home))
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.FirstVisibleIndex = -1;
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(0, true);
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
RefreshSelectedParagraph();
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.End)
|
||||
else if ((e.Modifiers == Keys.Control && e.KeyCode == Keys.End) ||
|
||||
(e.Modifiers == Keys.Alt && e.KeyCode == Keys.End) ||
|
||||
(e.Modifiers == Keys.None && e.KeyCode == Keys.End))
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(SubtitleListview1.Items.Count - 1, true);
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
RefreshSelectedParagraph();
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.Enter)
|
||||
{
|
||||
SubtitleListview1_MouseDoubleClick(null, null);
|
||||
}
|
||||
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.PageDown)
|
||||
{
|
||||
var topIndex = FirstSelectedIndex;
|
||||
var numberOfVisibleItems = (SubtitleListview1.Height - 30) / SubtitleListview1.GetItemRect(0).Height;
|
||||
var next = Math.Min(SubtitleListview1.Items.Count - 1, topIndex + numberOfVisibleItems);
|
||||
if (next >= 0 && next < SubtitleListview1.Items.Count)
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.SelectNone();
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.Items[next].Selected = true;
|
||||
SubtitleListview1.Items[next].Focused = true;
|
||||
SubtitleListview1.EnsureVisible(next);
|
||||
}
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.Modifiers == Keys.None && e.KeyCode == Keys.PageUp)
|
||||
{
|
||||
var topIndex = FirstSelectedIndex;
|
||||
var numberOfVisibleItems = (SubtitleListview1.Height - 30) / SubtitleListview1.GetItemRect(0).Height;
|
||||
var next = Math.Max(0, topIndex - numberOfVisibleItems);
|
||||
if (next >= 0 && next < SubtitleListview1.Items.Count)
|
||||
{
|
||||
SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.SelectNone();
|
||||
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
|
||||
SubtitleListview1.Items[next].Selected = true;
|
||||
SubtitleListview1.Items[next].Focused = true;
|
||||
SubtitleListview1.EnsureVisible(next);
|
||||
}
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveTimeCodesFromSelectedLines()
|
||||
@ -32140,5 +32176,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
item.PerformClick();
|
||||
}
|
||||
}
|
||||
|
||||
private void SubtitleListview1_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
_listViewMouseDown = true;
|
||||
}
|
||||
|
||||
private void SubtitleListview1_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
_listViewMouseDown = false;
|
||||
SubtitleListview1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -682,6 +682,9 @@
|
||||
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>652, 56</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>652, 56</value>
|
||||
</metadata>
|
||||
<data name="toolStripButtonWaveformZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
@ -774,12 +777,12 @@
|
||||
<metadata name="imageListBookmarks.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>981, 56</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStripTextBoxListView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>668, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStripTextBoxSourceView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>193, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStripTextBoxListView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>668, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStripEmpty.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 95</value>
|
||||
</metadata>
|
||||
@ -791,7 +794,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAQwBLAEMASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAASQBLAEkASwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
Loading…
Reference in New Issue
Block a user