More general approach

This commit is contained in:
Martijn van Berkel (Flitskikker) 2024-10-20 12:23:57 +02:00
parent 13cfef9144
commit c13db1f4a7

View File

@ -539,23 +539,24 @@ namespace Nikse.SubtitleEdit.Core.Forms
bestRightInCueFrame = newRightInCueFrame; bestRightInCueFrame = newRightInCueFrame;
} }
// Check cases // Re-check if, with the new cues, the subtitles are actually connected
var isLeftOutCueOnShotChange = IsCueOnShotChange(bestLeftOutCueFrame, false); var newDistance = FramesToMilliseconds(bestRightInCueFrame) - FramesToMilliseconds(bestLeftOutCueFrame);
var isRightInCueOnShotChange = IsCueOnShotChange(bestRightInCueFrame, true); if (newDistance < Configuration.Settings.BeautifyTimeCodes.Profile.ConnectedSubtitlesTreatConnected)
var performGeneralChaining = false;
if (isLeftOutCueOnShotChange && isRightInCueOnShotChange
&& bestLeftOutCueFrameInfo.result == FindBestCueResult.SnappedToRedZone && bestRightInCueFrameInfo.result == FindBestCueResult.SnappedToRedZone
&& bestLeftOutCueFrame == bestRightInCueFrame)
{ {
// If both cues are being snapped to the exact same shot change, the subtitles really are connected // Yes, so handle using the designated function, ignoring its check connected check
// So, handle using the designated function, ignoring the "treat connected" value (because otherwise it would have handled it before going into this function) // (because otherwise it would have handled it before going into the FixChainableSubtitles function)
FixConnectedSubtitles(leftParagraph, rightParagraph, checkConnected: false); FixConnectedSubtitles(leftParagraph, rightParagraph, checkConnected: false);
return true; return true;
} }
else if (isRightInCueOnShotChange)
// Check cases
var isLeftOutCueOnShotChange = IsCueOnShotChange(bestLeftOutCueFrame, false);
var isRightInCueOnShotChange = IsCueOnShotChange(bestRightInCueFrame, true);
var performGeneralChaining = false;
if (isRightInCueOnShotChange)
{ {
// The right in cue is on a shot change // The right in cue is on a shot change
// Try to chain the subtitles // Try to chain the subtitles