This commit is contained in:
niksedk 2021-11-18 20:04:44 +01:00
parent 1a0b6d772a
commit 5950e37b07
4 changed files with 39 additions and 17 deletions

View File

@ -9,12 +9,11 @@
* IMPROVED:
* Update Bulgarian translation - thx Калин
* Update Finish translation - thx Teijo
* Video from url - try to make it easier to use (auto dl)
* Video from url - try to make it easier to use (auto dl youtube-dl/ffmpeg)
* Remember last chosen video offset - thx OmrSi
* Add "Count" label in "Go to bookmark" - thx OmrSi
* Speed up slow loading mp4 without subs as sub - thx Leon
* Auto-load audio file after import plain text - thx Leon
* Open video from url will now prompt for download of youtube-dl/mpv
* FIXED:
* Fix selected line in "set start and offset the rest" - thx Janusz/Tom
* Fix issue with "Fix invalid italic tags" - thx Charvelx04

View File

@ -135,6 +135,7 @@ namespace Nikse.SubtitleEdit.Core.Common
{
return new TimeSpan();
}
return TimeSpan.FromMilliseconds(TotalMilliseconds);
}
set => TotalMilliseconds = value.TotalMilliseconds;

View File

@ -1713,29 +1713,26 @@ namespace Nikse.SubtitleEdit.Controls
}
SelectNone();
var currentItem = Items[index];
if (TopItem.Index <= beforeIndex && bottomIndex > afterIndex)
{
Items[index].Selected = true;
Items[index].EnsureVisible();
EnsureVisible(index);
currentItem.Selected = true;
if (focus)
{
Items[index].Focused = true;
currentItem.Focused = true;
}
EnsureVisible(index);
return;
}
Items[beforeIndex].EnsureVisible();
EnsureVisible(beforeIndex);
Items[afterIndex].EnsureVisible();
EnsureVisible(afterIndex);
Items[index].Selected = true;
Items[index].EnsureVisible();
currentItem.Selected = true;
if (focus)
{
Items[index].Focused = true;
currentItem.Focused = true;
}
EnsureVisible(index);
}
public void SelectIndexAndEnsureVisible(int index)

View File

@ -9051,7 +9051,7 @@ namespace Nikse.SubtitleEdit.Forms
if (!string.IsNullOrEmpty(_cutText))
{
Clipboard.SetText(_cutText);
ClipboardSetText(_cutText);
_cutText = string.Empty;
}
@ -10965,7 +10965,13 @@ namespace Nikse.SubtitleEdit.Forms
SubtitleListview1.Fill(_subtitle, _subtitleOriginal);
}
SubtitleListview1.SelectIndexAndEnsureVisible(Configuration.Settings.General.SplitBehavior == 0 ? firstSelectedIndex + 1 : firstSelectedIndex, true);
var index = firstSelectedIndex;
if (Configuration.Settings.General.SplitBehavior != 2 || !mediaPlayer.IsPaused)
{
index++;
}
SubtitleListview1.SelectIndexAndEnsureVisible(index, true);
UpdateSourceView();
ShowStatus(_language.LineSplitted);
SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged;
@ -18815,6 +18821,25 @@ namespace Nikse.SubtitleEdit.Forms
Text = text + " - " + Title;
}
private void ClipboardSetText(string text)
{
for (int i = 0; i < 5; i++)
{
try
{
Clipboard.Clear();
Clipboard.SetText(text);
return;
}
catch
{
System.Threading.Thread.Sleep(100);
}
}
MessageBox.Show("Unable to set clipboard text - some other application might have locked the clipboard.");
}
private void SubtitleListview1KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control) //Ctrl+c = Copy to clipboard
@ -18836,7 +18861,7 @@ namespace Nikse.SubtitleEdit.Forms
tmp.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(Configuration.Settings.General.CurrentVideoOffsetInMs));
}
Clipboard.SetText(tmp.ToText(new SubRip()).TrimEnd());
ClipboardSetText(tmp.ToText(new SubRip()).TrimEnd());
}
e.SuppressKeyPress = true;
@ -18855,7 +18880,7 @@ namespace Nikse.SubtitleEdit.Forms
if (sb.ToString().TrimEnd().Length > 0)
{
Clipboard.SetText(sb.ToString().TrimEnd());
ClipboardSetText(sb.ToString().TrimEnd());
}
e.SuppressKeyPress = true;
@ -26662,7 +26687,7 @@ namespace Nikse.SubtitleEdit.Forms
selectedLines.AddTimeToAllParagraphs(TimeSpan.FromMilliseconds(Configuration.Settings.General.CurrentVideoOffsetInMs));
}
Clipboard.SetText(selectedLines.ToText(GetCurrentSubtitleFormat()).TrimEnd());
ClipboardSetText(selectedLines.ToText(GetCurrentSubtitleFormat()).TrimEnd());
}
public void PlayPause()