mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Merge pull request #4420 from OmrSi/new-extend-shortcuts
Add two more extend shortcuts
This commit is contained in:
commit
e56c15052b
@ -2033,7 +2033,6 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<AdjustSetStartTimeKeepDuration>Set start time, keep duration</AdjustSetStartTimeKeepDuration>
|
||||
<AdjustSetEndAndOffsetTheRest>Set end, offset the rest</AdjustSetEndAndOffsetTheRest>
|
||||
<AdjustSetEndAndOffsetTheRestAndGoToNext>Set end, offset the rest and go to next</AdjustSetEndAndOffsetTheRestAndGoToNext>
|
||||
<AdjustExtendCurrentSubtitle>Extend current line to next subtitle or max duration</AdjustExtendCurrentSubtitle>
|
||||
<AdjustSnapStartToNextSceneChange>Snap selected lines start to next scene change</AdjustSnapStartToNextSceneChange>
|
||||
<AdjustSnapStartToNextSceneChangeWithGap>Snap selected lines start to next scene change with min. gap</AdjustSnapStartToNextSceneChangeWithGap>
|
||||
<AdjustSnapEndToPreviousSceneChange>Snap selected lines end to previous scene change</AdjustSnapEndToPreviousSceneChange>
|
||||
@ -2044,6 +2043,9 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<AdjustExtendToPreviousSceneChangeWithGap>Extend selected lines to previous scene change with min. gap (or previous subtitle)</AdjustExtendToPreviousSceneChangeWithGap>
|
||||
<AdjustExtendToNextSubtitle>Extend selected lines to next subtitle</AdjustExtendToNextSubtitle>
|
||||
<AdjustExtendToPreviousSubtitle>Extend selected lines to previous subtitle</AdjustExtendToPreviousSubtitle>
|
||||
<AdjustExtendCurrentSubtitle>Extend current line to next subtitle or max duration</AdjustExtendCurrentSubtitle>
|
||||
<AdjustExtendPreviousLineEndToCurrentStart>Extend previous line's end to current's start</AdjustExtendPreviousLineEndToCurrentStart>
|
||||
<AdjustExtendNextLineStartToCurrentEnd>Extend next line's start to current's end</AdjustExtendNextLineStartToCurrentEnd>
|
||||
<RecalculateDurationOfCurrentSubtitle>Re-calculate duration of current subtitle</RecalculateDurationOfCurrentSubtitle>
|
||||
<MainCreateStartDownEndUp>Insert new subtitle at key-down, set end time at key-up</MainCreateStartDownEndUp>
|
||||
<MergeDialog>Merge dialog (insert dashes)</MergeDialog>
|
||||
|
@ -2327,7 +2327,6 @@ can edit in same subtitle file (collaboration)",
|
||||
AdjustSetStartTimeKeepDuration = "Set start time, keep duration",
|
||||
AdjustSetEndAndOffsetTheRest = "Set end, offset the rest",
|
||||
AdjustSetEndAndOffsetTheRestAndGoToNext = "Set end, offset the rest and go to next",
|
||||
AdjustExtendCurrentSubtitle = "Extend current line to next subtitle or max duration",
|
||||
AdjustSnapStartToNextSceneChange = "Snap selected lines start to next scene change",
|
||||
AdjustSnapStartToNextSceneChangeWithGap = "Snap selected lines start to next scene change with min. gap",
|
||||
AdjustSnapEndToPreviousSceneChange = "Snap selected lines end to previous scene change",
|
||||
@ -2338,6 +2337,9 @@ can edit in same subtitle file (collaboration)",
|
||||
AdjustExtendToPreviousSceneChangeWithGap = "Extend selected lines to previous scene change with min. gap (or previous subtitle)",
|
||||
AdjustExtendToNextSubtitle = "Extend selected lines to next subtitle",
|
||||
AdjustExtendToPreviousSubtitle = "Extend selected lines to previous subtitle",
|
||||
AdjustExtendCurrentSubtitle = "Extend current line to next subtitle or max duration",
|
||||
AdjustExtendPreviousLineEndToCurrentStart = "Extend previous line's end to current's start",
|
||||
AdjustExtendNextLineStartToCurrentEnd = "Extend next line's start to current's end",
|
||||
RecalculateDurationOfCurrentSubtitle = "Re-calculate duration of current subtitle",
|
||||
MainCreateStartDownEndUp = "Insert new subtitle at key-down, set end time at key-up",
|
||||
MergeDialog = "Merge dialog (insert dashes)",
|
||||
|
@ -5521,9 +5521,6 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/AdjustSetEndAndOffsetTheRestAndGoToNext":
|
||||
language.Settings.AdjustSetEndAndOffsetTheRestAndGoToNext = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendCurrentSubtitle":
|
||||
language.Settings.AdjustExtendCurrentSubtitle = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustSnapStartToNextSceneChange":
|
||||
language.Settings.AdjustSnapStartToNextSceneChange = reader.Value;
|
||||
break;
|
||||
@ -5554,6 +5551,15 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/AdjustExtendToPreviousSubtitle":
|
||||
language.Settings.AdjustExtendToPreviousSubtitle = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendCurrentSubtitle":
|
||||
language.Settings.AdjustExtendCurrentSubtitle = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendPreviousLineEndToCurrentStart":
|
||||
language.Settings.AdjustExtendPreviousLineEndToCurrentStart = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendNextLineStartToCurrentEnd":
|
||||
language.Settings.AdjustExtendNextLineStartToCurrentEnd = reader.Value;
|
||||
break;
|
||||
case "Settings/RecalculateDurationOfCurrentSubtitle":
|
||||
language.Settings.RecalculateDurationOfCurrentSubtitle = reader.Value;
|
||||
break;
|
||||
|
@ -2199,7 +2199,6 @@
|
||||
public string AdjustSetStartTimeKeepDuration { get; set; }
|
||||
public string AdjustSetEndAndOffsetTheRest { get; set; }
|
||||
public string AdjustSetEndAndOffsetTheRestAndGoToNext { get; set; }
|
||||
public string AdjustExtendCurrentSubtitle { get; set; }
|
||||
public string AdjustSnapStartToNextSceneChange { get; set; }
|
||||
public string AdjustSnapStartToNextSceneChangeWithGap { get; set; }
|
||||
public string AdjustSnapEndToPreviousSceneChange { get; set; }
|
||||
@ -2210,6 +2209,9 @@
|
||||
public string AdjustExtendToPreviousSceneChangeWithGap { get; set; }
|
||||
public string AdjustExtendToNextSubtitle { get; set; }
|
||||
public string AdjustExtendToPreviousSubtitle { get; set; }
|
||||
public string AdjustExtendCurrentSubtitle { get; set; }
|
||||
public string AdjustExtendPreviousLineEndToCurrentStart { get; set; }
|
||||
public string AdjustExtendNextLineStartToCurrentEnd { get; set; }
|
||||
public string RecalculateDurationOfCurrentSubtitle { get; set; }
|
||||
public string MainCreateStartDownEndUp { get; set; }
|
||||
public string MergeDialog { get; set; }
|
||||
|
@ -1749,7 +1749,6 @@ $HorzAlign = Center
|
||||
public string GeneralGoToNextSubtitleAndFocusVideo { get; set; }
|
||||
public string GeneralGoToPrevSubtitleAndPlay { get; set; }
|
||||
public string GeneralGoToNextSubtitleAndPlay { get; set; }
|
||||
public string GeneralExtendCurrentSubtitle { get; set; }
|
||||
public string GeneralAutoCalcCurrentDuration { get; set; }
|
||||
public string GeneralPlayFirstSelected { get; set; }
|
||||
public string GeneralHelp { get; set; }
|
||||
@ -1938,6 +1937,9 @@ $HorzAlign = Center
|
||||
public string MainAdjustExtendToPreviousSceneChangeWithGap { get; set; }
|
||||
public string MainAdjustExtendToNextSubtitle { get; set; }
|
||||
public string MainAdjustExtendToPreviousSubtitle { get; set; }
|
||||
public string MainAdjustExtendCurrentSubtitle { get; set; }
|
||||
public string MainAdjustExtendPreviousLineEndToCurrentStart { get; set; }
|
||||
public string MainAdjustExtendNextLineStartToCurrentEnd { get; set; }
|
||||
public string MainInsertAfter { get; set; }
|
||||
public string MainTextBoxAutoBreak { get; set; }
|
||||
public string MainTextBoxBreakAtPosition { get; set; }
|
||||
@ -2084,7 +2086,6 @@ $HorzAlign = Center
|
||||
WaveformPlaySelectionEnd = string.Empty;
|
||||
GeneralGoToNextSubtitleAndFocusVideo = string.Empty;
|
||||
GeneralGoToPreviousSubtitleAndFocusVideo = string.Empty;
|
||||
GeneralExtendCurrentSubtitle = string.Empty;
|
||||
GeneralAutoCalcCurrentDuration = string.Empty;
|
||||
GeneralPlayFirstSelected = string.Empty;
|
||||
GeneralHelp = "F1";
|
||||
@ -2106,6 +2107,9 @@ $HorzAlign = Center
|
||||
MainAdjustExtendToPreviousSceneChangeWithGap = string.Empty;
|
||||
MainAdjustExtendToNextSubtitle = "Control+Shift+E";
|
||||
MainAdjustExtendToPreviousSubtitle = "Alt+Shift+E";
|
||||
MainAdjustExtendCurrentSubtitle = string.Empty;
|
||||
MainAdjustExtendPreviousLineEndToCurrentStart = string.Empty;
|
||||
MainAdjustExtendNextLineStartToCurrentEnd = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5913,12 +5917,6 @@ $HorzAlign = Center
|
||||
settings.Shortcuts.GeneralGoToPreviousSubtitleAndFocusVideo = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("GeneralExtendCurrentSubtitle");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Shortcuts.GeneralExtendCurrentSubtitle = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("GeneralAutoCalcCurrentDuration");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -7046,6 +7044,24 @@ $HorzAlign = Center
|
||||
settings.Shortcuts.MainAdjustExtendToPreviousSubtitle = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainAdjustExtendCurrentSubtitle");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Shortcuts.MainAdjustExtendCurrentSubtitle = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainAdjustExtendPreviousLineEndToCurrentStart");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Shortcuts.MainAdjustExtendPreviousLineEndToCurrentStart = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainAdjustExtendNextLineStartToCurrentEnd");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Shortcuts.MainAdjustExtendNextLineStartToCurrentEnd = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainInsertAfter");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -8120,7 +8136,6 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("GeneralGoToNextSubtitleAndFocusVideo", settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
|
||||
textWriter.WriteElementString("GeneralGoToPrevSubtitleAndPlay", settings.Shortcuts.GeneralGoToPrevSubtitleAndPlay);
|
||||
textWriter.WriteElementString("GeneralGoToNextSubtitleAndPlay", settings.Shortcuts.GeneralGoToNextSubtitleAndPlay);
|
||||
textWriter.WriteElementString("GeneralExtendCurrentSubtitle", settings.Shortcuts.GeneralExtendCurrentSubtitle);
|
||||
textWriter.WriteElementString("GeneralAutoCalcCurrentDuration", settings.Shortcuts.GeneralAutoCalcCurrentDuration);
|
||||
textWriter.WriteElementString("GeneralPlayFirstSelected", settings.Shortcuts.GeneralPlayFirstSelected);
|
||||
textWriter.WriteElementString("GeneralHelp", settings.Shortcuts.GeneralHelp);
|
||||
@ -8308,6 +8323,9 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("MainAdjustExtendToPreviousSceneChangeWithGap", settings.Shortcuts.MainAdjustExtendToPreviousSceneChangeWithGap);
|
||||
textWriter.WriteElementString("MainAdjustExtendToNextSubtitle", settings.Shortcuts.MainAdjustExtendToNextSubtitle);
|
||||
textWriter.WriteElementString("MainAdjustExtendToPreviousSubtitle", settings.Shortcuts.MainAdjustExtendToPreviousSubtitle);
|
||||
textWriter.WriteElementString("MainAdjustExtendCurrentSubtitle", settings.Shortcuts.MainAdjustExtendCurrentSubtitle);
|
||||
textWriter.WriteElementString("MainAdjustExtendPreviousLineEndToCurrentStart", settings.Shortcuts.MainAdjustExtendPreviousLineEndToCurrentStart);
|
||||
textWriter.WriteElementString("MainAdjustExtendNextLineStartToCurrentEnd", settings.Shortcuts.MainAdjustExtendNextLineStartToCurrentEnd);
|
||||
textWriter.WriteElementString("MainInsertAfter", settings.Shortcuts.MainInsertAfter);
|
||||
textWriter.WriteElementString("MainTextBoxAutoBreak", settings.Shortcuts.MainTextBoxAutoBreak);
|
||||
textWriter.WriteElementString("MainTextBoxBreakAtPosition", settings.Shortcuts.MainTextBoxBreakAtPosition);
|
||||
|
@ -14760,65 +14760,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_makeHistoryPaused = false;
|
||||
}
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendCurrentSubtitle == e.KeyData)
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count == 1)
|
||||
{
|
||||
var historyAdded = false;
|
||||
var idx = SubtitleListview1.SelectedItems[0].Index;
|
||||
var p = _subtitle.Paragraphs[idx];
|
||||
var next = _subtitle.GetParagraphOrDefault(idx + 1);
|
||||
if (next == null || next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
historyAdded = true;
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
historyAdded = true;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
var originalNext = _subtitleAlternate.GetParagraphOrDefault(_subtitleAlternate.GetIndex(original) + 1);
|
||||
if (originalNext == null || originalNext.StartTime.TotalMilliseconds > original.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
}
|
||||
|
||||
original.EndTime.TotalMilliseconds = original.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
}
|
||||
|
||||
original.EndTime.TotalMilliseconds = originalNext.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefreshSelectedParagraph();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.F3 && e.Modifiers == Keys.Shift)
|
||||
{
|
||||
FindPrevious();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendCurrentSubtitle == e.KeyData)
|
||||
{
|
||||
ExtendCurrentSubtitle();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendToNextSubtitle == e.KeyData)
|
||||
{
|
||||
ExtendSelectedLinesToNextLine();
|
||||
@ -14829,6 +14780,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ExtendSelectedLinesToPreviousLine();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendPreviousLineEndToCurrentStart == e.KeyData)
|
||||
{
|
||||
ExtendPreviousEndToCurrentStart();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendNextLineStartToCurrentEnd == e.KeyData)
|
||||
{
|
||||
ExtendNextStartToCurrentEnd();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustSnapStartToNextSceneChange == e.KeyData)
|
||||
{
|
||||
SnapSelectedLinesStartToNextSceneChange();
|
||||
@ -15142,6 +15103,58 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// put new entries above tabs
|
||||
}
|
||||
|
||||
private void ExtendCurrentSubtitle()
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count == 1)
|
||||
{
|
||||
var historyAdded = false;
|
||||
var idx = SubtitleListview1.SelectedItems[0].Index;
|
||||
var p = _subtitle.Paragraphs[idx];
|
||||
var next = _subtitle.GetParagraphOrDefault(idx + 1);
|
||||
if (next == null || next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
historyAdded = true;
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
historyAdded = true;
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
var originalNext = _subtitleAlternate.GetParagraphOrDefault(_subtitleAlternate.GetIndex(original) + 1);
|
||||
if (originalNext == null || originalNext.StartTime.TotalMilliseconds > original.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
}
|
||||
|
||||
original.EndTime.TotalMilliseconds = original.StartTime.TotalMilliseconds + Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendCurrentSubtitle));
|
||||
}
|
||||
|
||||
original.EndTime.TotalMilliseconds = originalNext.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefreshSelectedParagraph();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtendSelectedLinesToNextLine()
|
||||
{
|
||||
var historyAdded = false;
|
||||
@ -15193,11 +15206,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var previous = _subtitle.GetParagraphOrDefault(idx - 1);
|
||||
if (previous != null)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendToPreviousSubtitle));
|
||||
historyAdded = true;
|
||||
}
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
@ -15216,6 +15224,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendToPreviousSubtitle));
|
||||
historyAdded = true;
|
||||
}
|
||||
|
||||
p.StartTime.TotalMilliseconds = previous.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
|
||||
@ -15223,6 +15238,88 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtendPreviousEndToCurrentStart()
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count == 1)
|
||||
{
|
||||
var historyAdded = false;
|
||||
var idx = SubtitleListview1.SelectedItems[0].Index;
|
||||
var p = _subtitle.Paragraphs[idx];
|
||||
var previous = _subtitle.GetParagraphOrDefault(idx - 1);
|
||||
if (previous != null)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendPreviousLineEndToCurrentStart));
|
||||
historyAdded = true;
|
||||
}
|
||||
previous.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
var originalPrevious = _subtitleAlternate.GetParagraphOrDefault(_subtitleAlternate.GetIndex(original) - 1);
|
||||
if (originalPrevious != null)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendPreviousLineEndToCurrentStart));
|
||||
historyAdded = true;
|
||||
}
|
||||
|
||||
originalPrevious.EndTime.TotalMilliseconds = original.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SubtitleListview1.SetStartTimeAndDuration(idx - 1, previous, _subtitle.GetParagraphOrDefault(idx), _subtitle.GetParagraphOrDefault(idx - 2));
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtendNextStartToCurrentEnd()
|
||||
{
|
||||
if (SubtitleListview1.SelectedItems.Count == 1)
|
||||
{
|
||||
var historyAdded = false;
|
||||
var idx = SubtitleListview1.SelectedItems[0].Index;
|
||||
var p = _subtitle.Paragraphs[idx];
|
||||
var next = _subtitle.GetParagraphOrDefault(idx + 1);
|
||||
if (next != null)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendNextLineStartToCurrentEnd));
|
||||
historyAdded = true;
|
||||
}
|
||||
next.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
if (original != null)
|
||||
{
|
||||
var originalNext = _subtitleAlternate.GetParagraphOrDefault(_subtitleAlternate.GetIndex(original) + 1);
|
||||
if (originalNext != null)
|
||||
{
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendNextLineStartToCurrentEnd));
|
||||
historyAdded = true;
|
||||
}
|
||||
|
||||
originalNext.StartTime.TotalMilliseconds = original.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SubtitleListview1.SetStartTimeAndDuration(idx + 1, next, _subtitle.GetParagraphOrDefault(idx + 2), _subtitle.GetParagraphOrDefault(idx));
|
||||
}
|
||||
}
|
||||
|
||||
private void SnapSelectedLinesStartToNextSceneChange(bool withGap = false)
|
||||
{
|
||||
var historyAdded = false;
|
||||
@ -15431,11 +15528,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
double nearestSceneChange = previousSceneChanges.Aggregate((x, y) => Math.Abs(x - p.StartTime.TotalSeconds) < Math.Abs(y - p.StartTime.TotalSeconds) ? x : y);
|
||||
double nearestEndTimeWithGap = previous != null ? previous.EndTime.TotalMilliseconds + Configuration.Settings.General.MinimumMillisecondsBetweenLines : -9999;
|
||||
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendToPreviousSceneChange));
|
||||
historyAdded = true;
|
||||
}
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
var original = Utilities.GetOriginalParagraph(idx, p, _subtitleAlternate.Paragraphs);
|
||||
@ -15461,6 +15553,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (!historyAdded)
|
||||
{
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeX, Configuration.Settings.Language.Settings.AdjustExtendToPreviousSceneChange));
|
||||
historyAdded = true;
|
||||
}
|
||||
|
||||
if (!withGap)
|
||||
{
|
||||
p.StartTime.TotalMilliseconds = Math.Max(nearestSceneChange * 1000, nearestEndTimeWithGap);
|
||||
|
@ -1351,7 +1351,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AddNode(createAndAdjustNode, language.AdjustSetEndNextStartAndGoToNext, nameof(Configuration.Settings.Shortcuts.MainAdjustSetEndNextStartAndGoToNext));
|
||||
AddNode(createAndAdjustNode, language.AdjustViaEndAutoStart, nameof(Configuration.Settings.Shortcuts.MainAdjustViaEndAutoStart));
|
||||
AddNode(createAndAdjustNode, language.AdjustViaEndAutoStartAndGoToNext, nameof(Configuration.Settings.Shortcuts.MainAdjustViaEndAutoStartAndGoToNext));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendCurrentSubtitle, nameof(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle));
|
||||
AddNode(createAndAdjustNode, language.AdjustSelected100MsBack, nameof(Configuration.Settings.Shortcuts.MainAdjustSelected100MsBack));
|
||||
AddNode(createAndAdjustNode, language.AdjustSelected100MsForward, nameof(Configuration.Settings.Shortcuts.MainAdjustSelected100MsForward));
|
||||
AddNode(createAndAdjustNode, string.Format(language.AdjustStartXMsBack, Configuration.Settings.Tools.MoveStartEndMs), nameof(Configuration.Settings.Shortcuts.MainAdjustStartXMsBack));
|
||||
@ -1377,6 +1376,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToPreviousSceneChangeWithGap, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSceneChangeWithGap));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToNextSubtitle, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSubtitle));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToPreviousSubtitle, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSubtitle));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendCurrentSubtitle, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendCurrentSubtitle));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendPreviousLineEndToCurrentStart, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendPreviousLineEndToCurrentStart));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendNextLineStartToCurrentEnd, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendNextLineStartToCurrentEnd));
|
||||
if (createAndAdjustNode.Nodes.Count > 0)
|
||||
{
|
||||
_shortcuts.Nodes.Add(createAndAdjustNode);
|
||||
|
@ -62,7 +62,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public Keys MainGoToNextSubtitleAndFocusVideo { get; set; }
|
||||
public Keys MainGoToPrevSubtitleAndPlay { get; set; }
|
||||
public Keys MainGoToNextSubtitleAndPlay { get; set; }
|
||||
public Keys MainAdjustExtendCurrentSubtitle { get; set; }
|
||||
public Keys MainAutoCalcCurrentDuration { get; set; }
|
||||
public Keys MainUnbreakNoSpace { get; set; }
|
||||
public Keys MainGeneralToggleBookmarks { get; set; }
|
||||
@ -124,6 +123,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public Keys MainAdjustExtendToPreviousSceneChangeWithGap { get; set; }
|
||||
public Keys MainAdjustExtendToNextSubtitle { get; set; }
|
||||
public Keys MainAdjustExtendToPreviousSubtitle { get; set; }
|
||||
public Keys MainAdjustExtendCurrentSubtitle { get; set; }
|
||||
public Keys MainAdjustExtendPreviousLineEndToCurrentStart { get; set; }
|
||||
public Keys MainAdjustExtendNextLineStartToCurrentEnd { get; set; }
|
||||
public Keys MainInsertAfter { get; set; }
|
||||
public Keys MainInsertBefore { get; set; }
|
||||
public Keys MainTextBoxAutoBreak { get; set; }
|
||||
@ -229,7 +231,6 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
MainGoToNextSubtitleAndFocusVideo = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndFocusVideo);
|
||||
MainGoToPrevSubtitleAndPlay = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToPrevSubtitleAndPlay);
|
||||
MainGoToNextSubtitleAndPlay = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralGoToNextSubtitleAndPlay);
|
||||
MainAdjustExtendCurrentSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralExtendCurrentSubtitle);
|
||||
MainAutoCalcCurrentDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralAutoCalcCurrentDuration);
|
||||
MainUnbreakNoSpace = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralUnbrekNoSpace);
|
||||
MainGeneralToggleBookmarks = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleBookmarks);
|
||||
@ -316,6 +317,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
MainAdjustExtendToPreviousSceneChangeWithGap = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSceneChangeWithGap);
|
||||
MainAdjustExtendToNextSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSubtitle);
|
||||
MainAdjustExtendToPreviousSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSubtitle);
|
||||
MainAdjustExtendCurrentSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendCurrentSubtitle);
|
||||
MainAdjustExtendPreviousLineEndToCurrentStart = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendPreviousLineEndToCurrentStart);
|
||||
MainAdjustExtendNextLineStartToCurrentEnd = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendNextLineStartToCurrentEnd);
|
||||
MainInsertAfter = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainInsertAfter);
|
||||
MainInsertBefore = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainInsertBefore);
|
||||
MainTextBoxAutoBreak = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxAutoBreak);
|
||||
|
Loading…
Reference in New Issue
Block a user