Optimize select/deselect list view lines a little

Related to #5429
This commit is contained in:
niksedk 2021-11-01 07:01:43 +01:00
parent c06a38afde
commit 35011cf526
2 changed files with 31 additions and 9 deletions

View File

@ -187,6 +187,7 @@ namespace Nikse.SubtitleEdit.Forms
private bool _restorePreviewAfterSecondSubtitle;
private ListBox _intellisenceList;
private ListBox _intellisenceListOriginal;
private bool _updateSelectedCountStatusBar;
public bool IsMenuOpen { get; private set; }
@ -9595,21 +9596,21 @@ namespace Nikse.SubtitleEdit.Forms
private void ShowLineInformationListView()
{
var profile = Configuration.Settings.General.CurrentProfile + " ";
if (!ShowProfileInStatusBar)
{
profile = string.Empty;
}
if (InListView)
{
if (SubtitleListview1.SelectedItems.Count == 1)
{
var profile = Configuration.Settings.General.CurrentProfile + " ";
if (!ShowProfileInStatusBar)
{
profile = string.Empty;
}
toolStripSelected.Text = profile + string.Format("{0}/{1}", SubtitleListview1.SelectedItems[0].Index + 1, SubtitleListview1.Items.Count);
}
else
{
toolStripSelected.Text = profile + string.Format(_language.XLinesSelected, SubtitleListview1.SelectedItems.Count);
_updateSelectedCountStatusBar = true;
}
}
}
@ -22941,6 +22942,26 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (_updateSelectedCountStatusBar)
{
var profile = Configuration.Settings.General.CurrentProfile + " ";
if (!ShowProfileInStatusBar)
{
profile = string.Empty;
}
if (SubtitleListview1.SelectedItems.Count == 1)
{
toolStripSelected.Text = profile + string.Format("{0}/{1}", SubtitleListview1.SelectedItems[0].Index + 1, SubtitleListview1.Items.Count);
}
else
{
toolStripSelected.Text = profile + string.Format(_language.XLinesSelected, SubtitleListview1.SelectedItems.Count);
}
_updateSelectedCountStatusBar = false;
}
_timerSlow.Start();
}

View File

@ -728,8 +728,9 @@ namespace Nikse.SubtitleEdit.Logic
return;
}
sb.Append(line.CountCharacters(false, Configuration.Settings.General.IgnoreArabicDiacritics));
if (line.CountCharacters(false, Configuration.Settings.General.IgnoreArabicDiacritics) > Configuration.Settings.General.SubtitleLineMaximumLength || i >= Configuration.Settings.General.MaxNumberOfLines)
var count = line.CountCharacters(false, Configuration.Settings.General.IgnoreArabicDiacritics);
sb.Append(count);
if (count > Configuration.Settings.General.SubtitleLineMaximumLength || i >= Configuration.Settings.General.MaxNumberOfLines)
{
label.ForeColor = Color.Red;
}