mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Merge pull request #4329 from OmrSi/extend-to-SC-with-gap
Add "Extend to next scene change with gap" shortcut
This commit is contained in:
commit
536432dadc
@ -2320,6 +2320,7 @@ can edit in same subtitle file (collaboration)",
|
||||
AdjustSetEndAndOffsetTheRestAndGoToNext = "Set end, offset the rest and go to next",
|
||||
AdjustExtendCurrentSubtitle = "Extend current line to next subtitle or max duration",
|
||||
AdjustExtendToNextSceneChange = "Extend selected lines to next scene change (or next subtitle)",
|
||||
AdjustExtendToNextSceneChangeWithGap = "Extend selected lines to next scene change with min. gap (or next subtitle)",
|
||||
AdjustExtendToPreviousSceneChange = "Extend selected lines to previous scene change (or previous subtitle)",
|
||||
AdjustExtendToNextSubtitle = "Extend selected lines to next subtitle",
|
||||
AdjustExtendToPreviousSubtitle = "Extend selected lines to previous subtitle",
|
||||
|
@ -5500,6 +5500,9 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/AdjustExtendToNextSceneChange":
|
||||
language.Settings.AdjustExtendToNextSceneChange = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendToNextSceneChangeWithGap":
|
||||
language.Settings.AdjustExtendToNextSceneChangeWithGap = reader.Value;
|
||||
break;
|
||||
case "Settings/AdjustExtendToPreviousSceneChange":
|
||||
language.Settings.AdjustExtendToPreviousSceneChange = reader.Value;
|
||||
break;
|
||||
|
@ -2191,6 +2191,7 @@
|
||||
public string AdjustSetEndAndOffsetTheRestAndGoToNext { get; set; }
|
||||
public string AdjustExtendCurrentSubtitle { get; set; }
|
||||
public string AdjustExtendToNextSceneChange { get; set; }
|
||||
public string AdjustExtendToNextSceneChangeWithGap { get; set; }
|
||||
public string AdjustExtendToPreviousSceneChange { get; set; }
|
||||
public string AdjustExtendToNextSubtitle { get; set; }
|
||||
public string AdjustExtendToPreviousSubtitle { get; set; }
|
||||
|
@ -1906,6 +1906,7 @@ $HorzAlign = Center
|
||||
public string MoveEndOneFrameBackKeepGapNext { get; set; }
|
||||
public string MoveEndOneFrameForwardKeepGapNext { get; set; }
|
||||
public string MainAdjustExtendToNextSceneChange { get; set; }
|
||||
public string MainAdjustExtendToNextSceneChangeWithGap { get; set; }
|
||||
public string MainAdjustExtendToPreviousSceneChange { get; set; }
|
||||
public string MainAdjustExtendToNextSubtitle { get; set; }
|
||||
public string MainAdjustExtendToPreviousSubtitle { get; set; }
|
||||
@ -2062,6 +2063,7 @@ $HorzAlign = Center
|
||||
Waveform1000MsRight = "Right";
|
||||
MainTranslateGoogleTranslate = "Control+Shift+G";
|
||||
MainAdjustExtendToNextSceneChange = string.Empty;
|
||||
MainAdjustExtendToNextSceneChangeWithGap = string.Empty;
|
||||
MainAdjustExtendToPreviousSceneChange = string.Empty;
|
||||
MainAdjustExtendToNextSubtitle = "Control+Shift+E";
|
||||
MainAdjustExtendToPreviousSubtitle = "Alt+Shift+E";
|
||||
@ -6835,6 +6837,12 @@ $HorzAlign = Center
|
||||
settings.Shortcuts.MainAdjustExtendToNextSceneChange = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainAdjustExtendToNextSceneChangeWithGap");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Shortcuts.MainAdjustExtendToNextSceneChangeWithGap = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("MainAdjustExtendToPreviousSceneChange");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -8088,6 +8096,7 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("MoveEndOneFrameBackKeepGapNext", settings.Shortcuts.MoveEndOneFrameBackKeepGapNext);
|
||||
textWriter.WriteElementString("MoveEndOneFrameForwardKeepGapNext", settings.Shortcuts.MoveEndOneFrameForwardKeepGapNext);
|
||||
textWriter.WriteElementString("MainAdjustExtendToNextSceneChange", settings.Shortcuts.MainAdjustExtendToNextSceneChange);
|
||||
textWriter.WriteElementString("MainAdjustExtendToNextSceneChangeWithGap", settings.Shortcuts.MainAdjustExtendToNextSceneChangeWithGap);
|
||||
textWriter.WriteElementString("MainAdjustExtendToPreviousSceneChange", settings.Shortcuts.MainAdjustExtendToPreviousSceneChange);
|
||||
textWriter.WriteElementString("MainAdjustExtendToNextSubtitle", settings.Shortcuts.MainAdjustExtendToNextSubtitle);
|
||||
textWriter.WriteElementString("MainAdjustExtendToPreviousSubtitle", settings.Shortcuts.MainAdjustExtendToPreviousSubtitle);
|
||||
|
@ -14717,6 +14717,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ExtendSelectedLinesToNextSceneChange();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendToNextSceneChangeWithGap == e.KeyData)
|
||||
{
|
||||
ExtendSelectedLinesToNextSceneChange(true);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (_shortcuts.MainAdjustExtendToPreviousSceneChange == e.KeyData)
|
||||
{
|
||||
ExtendSelectedLinesToPreviousSceneChange();
|
||||
@ -15076,7 +15081,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtendSelectedLinesToNextSceneChange()
|
||||
private void ExtendSelectedLinesToNextSceneChange(bool withGap = false)
|
||||
{
|
||||
var historyAdded = false;
|
||||
foreach (ListViewItem selectedItem in SubtitleListview1.SelectedItems)
|
||||
@ -15096,7 +15101,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
historyAdded = true;
|
||||
}
|
||||
|
||||
p.EndTime.TotalMilliseconds = Math.Min(nearestSceneChange * 1000, nearestStartTimeWithGap);
|
||||
if (!withGap)
|
||||
{
|
||||
p.EndTime.TotalMilliseconds = Math.Min(nearestSceneChange * 1000, nearestStartTimeWithGap);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.EndTime.TotalMilliseconds = Math.Min(nearestSceneChange * 1000 - Configuration.Settings.General.MinimumMillisecondsBetweenLines, nearestStartTimeWithGap);
|
||||
}
|
||||
|
||||
if (_subtitleAlternate != null && Configuration.Settings.General.AllowEditOfOriginalSubtitle)
|
||||
{
|
||||
|
@ -1361,6 +1361,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
AddNode(createAndAdjustNode, language.AdjustEndOneFrameForwardKeepGapNext, nameof(Configuration.Settings.Shortcuts.MoveEndOneFrameForwardKeepGapNext));
|
||||
AddNode(createAndAdjustNode, language.RecalculateDurationOfCurrentSubtitle, nameof(Configuration.Settings.Shortcuts.GeneralAutoCalcCurrentDuration));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToNextSceneChange, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSceneChange));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToNextSceneChangeWithGap, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSceneChangeWithGap));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToPreviousSceneChange, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSceneChange));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToNextSubtitle, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSubtitle));
|
||||
AddNode(createAndAdjustNode, language.AdjustExtendToPreviousSubtitle, nameof(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSubtitle));
|
||||
|
@ -110,6 +110,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public Keys MainAdjustMoveEndOneFrameBackKeepGapNext { get; set; }
|
||||
public Keys MainAdjustMoveEndOneFrameForwardKeepGapNext { get; set; }
|
||||
public Keys MainAdjustExtendToNextSceneChange { get; set; }
|
||||
public Keys MainAdjustExtendToNextSceneChangeWithGap { get; set; }
|
||||
public Keys MainAdjustExtendToPreviousSceneChange { get; set; }
|
||||
public Keys MainAdjustExtendToNextSubtitle { get; set; }
|
||||
public Keys MainAdjustExtendToPreviousSubtitle { get; set; }
|
||||
@ -287,6 +288,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
MainAdjustMoveEndOneFrameBackKeepGapNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MoveEndOneFrameBackKeepGapNext);
|
||||
MainAdjustMoveEndOneFrameForwardKeepGapNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MoveEndOneFrameForwardKeepGapNext);
|
||||
MainAdjustExtendToNextSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSceneChange);
|
||||
MainAdjustExtendToNextSceneChangeWithGap = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSceneChangeWithGap);
|
||||
MainAdjustExtendToPreviousSceneChange = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSceneChange);
|
||||
MainAdjustExtendToNextSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToNextSubtitle);
|
||||
MainAdjustExtendToPreviousSubtitle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainAdjustExtendToPreviousSubtitle);
|
||||
|
Loading…
Reference in New Issue
Block a user