Minor UI work

This commit is contained in:
niksedk 2023-07-22 17:46:37 +02:00
parent ac03546766
commit e46f4e4092
2 changed files with 8 additions and 9 deletions

View File

@ -215,7 +215,7 @@ namespace Nikse.SubtitleEdit.Controls
} }
else if (e.KeyData == Keys.Enter) else if (e.KeyData == Keys.Enter)
{ {
TimeCodeChanged?.Invoke(this, e); AddValue(0);
e.SuppressKeyPress = true; e.SuppressKeyPress = true;
} }
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A) if (e.Modifiers == Keys.Control && e.KeyCode == Keys.A)

View File

@ -12722,7 +12722,7 @@ namespace Nikse.SubtitleEdit.Forms
private void UpdateStartTimeInfo(TimeCode startTime) private void UpdateStartTimeInfo(TimeCode startTime)
{ {
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedItems.Count > 0 && startTime != null) if (_subtitle.Paragraphs.Count > 0 && _subtitleListViewIndex >= 0 && startTime != null)
{ {
UpdateOverlapErrors(startTime); UpdateOverlapErrors(startTime);
@ -12770,9 +12770,9 @@ namespace Nikse.SubtitleEdit.Forms
{ {
string startTimeWarning = string.Empty; string startTimeWarning = string.Empty;
string durationWarning = string.Empty; string durationWarning = string.Empty;
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedIndices.Count > 0 && startTime != null) if (_subtitle.Paragraphs.Count > 0 && _subtitleListViewIndex >= 0 && startTime != null)
{ {
int firstSelectedIndex = SubtitleListview1.SelectedIndices[0]; int firstSelectedIndex = _subtitleListViewIndex;
var prevParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex - 1); var prevParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex - 1);
if (prevParagraph != null && !prevParagraph.EndTime.IsMaxTime && prevParagraph.EndTime.TotalMilliseconds > startTime.TotalMilliseconds && Configuration.Settings.Tools.ListViewSyntaxColorOverlap) if (prevParagraph != null && !prevParagraph.EndTime.IsMaxTime && prevParagraph.EndTime.TotalMilliseconds > startTime.TotalMilliseconds && Configuration.Settings.Tools.ListViewSyntaxColorOverlap)
@ -12915,10 +12915,10 @@ namespace Nikse.SubtitleEdit.Forms
} }
_durationIsDirty = true; _durationIsDirty = true;
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedIndices.Count > 0) if (_subtitle.Paragraphs.Count > 0 && _subtitleListViewIndex >= 0)
{ {
labelStatus.Text = string.Empty; labelStatus.Text = string.Empty;
int firstSelectedIndex = SubtitleListview1.SelectedIndices[0]; int firstSelectedIndex = _subtitleListViewIndex;
var currentParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex); var currentParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
if (currentParagraph != null) if (currentParagraph != null)
{ {
@ -13070,12 +13070,11 @@ namespace Nikse.SubtitleEdit.Forms
private void MaskedTextBoxTextChanged(object sender, EventArgs e) private void MaskedTextBoxTextChanged(object sender, EventArgs e)
{ {
if (_subtitleListViewIndex >= 0 && IsSubtitleLoaded) if (_subtitleListViewIndex >= 0 && SubtitleListview1.Items.Count > 0)
{ {
MakeHistoryForUndoOnlyIfNotRecent(string.Format(_language.StartTimeAdjustedX, "#" + (_subtitleListViewIndex + 1) + ": " + timeUpDownStartTime.TimeCode)); MakeHistoryForUndoOnlyIfNotRecent(string.Format(_language.StartTimeAdjustedX, "#" + (_subtitleListViewIndex + 1) + ": " + timeUpDownStartTime.TimeCode));
int firstSelectedIndex = FirstSelectedIndex; var oldParagraph = _subtitle.GetParagraphOrDefault(_subtitleListViewIndex);
var oldParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
if (oldParagraph != null) if (oldParagraph != null)
{ {
oldParagraph = new Paragraph(oldParagraph, false); oldParagraph = new Paragraph(oldParagraph, false);