mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Work on #4657
This commit is contained in:
parent
d0e92212ea
commit
a83eb5cb2e
@ -2175,6 +2175,8 @@ $HorzAlign = Center
|
||||
public string GeneralMergeSelectedLinesAndUnbreakCjk { get; set; }
|
||||
public string GeneralMergeSelectedLinesOnlyFirstText { get; set; }
|
||||
public string GeneralMergeSelectedLinesBilingual { get; set; }
|
||||
public string GeneralMergeWithPreviousBilingual { get; set; }
|
||||
public string GeneralMergeWithNextBilingual { get; set; }
|
||||
public string GeneralMergeOriginalAndTranslation { get; set; }
|
||||
public string GeneralToggleTranslationMode { get; set; }
|
||||
public string GeneralSwitchOriginalAndTranslation { get; set; }
|
||||
@ -7784,6 +7786,18 @@ $HorzAlign = Center
|
||||
shortcuts.GeneralMergeSelectedLinesBilingual = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("GeneralMergeWithPreviousBilingual");
|
||||
if (subNode != null)
|
||||
{
|
||||
shortcuts.GeneralMergeWithPreviousBilingual = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("GeneralMergeWithNextBilingual");
|
||||
if (subNode != null)
|
||||
{
|
||||
shortcuts.GeneralMergeWithNextBilingual = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("GeneralMergeWithNext");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -10765,6 +10779,8 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("GeneralMergeSelectedLinesAndUnbreakCjk", shortcuts.GeneralMergeSelectedLinesAndUnbreakCjk);
|
||||
textWriter.WriteElementString("GeneralMergeSelectedLinesOnlyFirstText", shortcuts.GeneralMergeSelectedLinesOnlyFirstText);
|
||||
textWriter.WriteElementString("GeneralMergeSelectedLinesBilingual", shortcuts.GeneralMergeSelectedLinesBilingual);
|
||||
textWriter.WriteElementString("GeneralMergeWithPreviousBilingual", shortcuts.GeneralMergeWithPreviousBilingual);
|
||||
textWriter.WriteElementString("GeneralMergeWithNextBilingual", shortcuts.GeneralMergeWithNextBilingual);
|
||||
textWriter.WriteElementString("GeneralMergeWithNext", shortcuts.GeneralMergeWithNext);
|
||||
textWriter.WriteElementString("GeneralMergeWithPrevious", shortcuts.GeneralMergeWithPrevious);
|
||||
textWriter.WriteElementString("GeneralMergeWithPreviousAndUnbreak", shortcuts.GeneralMergeWithPreviousAndUnbreak);
|
||||
|
@ -11903,9 +11903,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void MergeSelectedLinesBilingual()
|
||||
private void MergeSelectedLinesBilingual(int[] selectedIndices)
|
||||
{
|
||||
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedItems.Count > 1)
|
||||
if (_subtitle.Paragraphs.Count > 0 && selectedIndices.Length > 1)
|
||||
{
|
||||
var sb1 = new StringBuilder();
|
||||
var sb2 = new StringBuilder();
|
||||
@ -11914,7 +11914,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int firstIndex = 0;
|
||||
double durationMilliseconds = 0;
|
||||
int next = 0;
|
||||
foreach (int index in SubtitleListview1.SelectedIndices)
|
||||
foreach (var index in selectedIndices)
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
@ -11936,7 +11936,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var arr = _subtitle.Paragraphs[index].Text.Trim().SplitToLines();
|
||||
if (arr.Count > 0)
|
||||
{
|
||||
int mid = (int)(arr.Count / 2);
|
||||
int mid = arr.Count / 2;
|
||||
for (var i = 0; i < arr.Count; i++)
|
||||
{
|
||||
var l = arr[i];
|
||||
@ -11963,10 +11963,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
MakeHistoryForUndo(_language.BeforeMergeLines);
|
||||
|
||||
var currentParagraph = _subtitle.Paragraphs[firstIndex];
|
||||
string text1 = sb1.ToString().TrimEnd();
|
||||
string text2 = sb2.ToString().TrimEnd();
|
||||
string text1 = sb1.ToString().Trim();
|
||||
string text2 = sb2.ToString().Trim();
|
||||
|
||||
currentParagraph.Text = text1 + Environment.NewLine + text2;
|
||||
currentParagraph.Text = (text1 + Environment.NewLine + text2).Trim();
|
||||
|
||||
//display time
|
||||
currentParagraph.EndTime.TotalMilliseconds = currentParagraph.StartTime.TotalMilliseconds + durationMilliseconds;
|
||||
@ -11985,7 +11985,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = deleteIndices.Count - 1; i >= 0; i--)
|
||||
for (var i = deleteIndices.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_subtitle.Paragraphs.RemoveAt(deleteIndices[i]);
|
||||
}
|
||||
@ -16712,7 +16712,23 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_subtitle.Paragraphs.Count > 0 && SubtitleListview1.SelectedItems.Count >= 1 && SubtitleListview1.SelectedItems.Count < 10)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
MergeSelectedLinesBilingual();
|
||||
MergeSelectedLinesBilingual(SubtitleListview1.GetSelectedIndices());
|
||||
}
|
||||
}
|
||||
else if (_shortcuts.MainGeneralMergeWithPreviousBilingual == e.KeyData)
|
||||
{
|
||||
if (_subtitle.Paragraphs.Count > 1 && SubtitleListview1.SelectedItems.Count >= 1)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
MergeSelectedLinesBilingual(new int[] { SubtitleListview1.SelectedItems[0].Index - 1, SubtitleListview1.SelectedItems[0].Index });
|
||||
}
|
||||
}
|
||||
else if (_shortcuts.MainGeneralMergeWithNextBilingual == e.KeyData)
|
||||
{
|
||||
if (_subtitle.Paragraphs.Count > 1 && SubtitleListview1.SelectedItems.Count >= 1)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
MergeSelectedLinesBilingual(new int[] { SubtitleListview1.SelectedItems[0].Index, SubtitleListview1.SelectedItems[0].Index + 1 });
|
||||
}
|
||||
}
|
||||
else if (_shortcuts.MainGeneralMergeSelectedLinesOnlyFirstText == e.KeyData)
|
||||
|
@ -1241,6 +1241,8 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
||||
AddNode(generalNode, language.MergeSelectedLinesAndUnbreakCjk, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndUnbreakCjk));
|
||||
AddNode(generalNode, language.MergeSelectedLinesOnlyFirstText, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesOnlyFirstText));
|
||||
AddNode(generalNode, language.MergeSelectedLinesBilingual, nameof(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesBilingual));
|
||||
AddNode(generalNode, language.MergeWithPreviousBilingual, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithPreviousBilingual));
|
||||
AddNode(generalNode, language.MergeSelectedLinesBilingual, nameof(Configuration.Settings.Shortcuts.GeneralMergeWithNextBilingual));
|
||||
AddNode(generalNode, language.MergeOriginalAndTranslation, nameof(Configuration.Settings.Shortcuts.GeneralMergeOriginalAndTranslation));
|
||||
AddNode(generalNode, language.ToggleTranslationMode, nameof(Configuration.Settings.Shortcuts.GeneralToggleTranslationMode));
|
||||
AddNode(generalNode, language.SwitchOriginalAndTranslation, nameof(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslation));
|
||||
|
@ -2860,6 +2860,8 @@ can edit in same subtitle file (collaboration)",
|
||||
MergeSelectedLinesAndUnbreakCjk = "Merge selected lines and unbreak without space (CJK)",
|
||||
MergeSelectedLinesOnlyFirstText = "Merge selected lines, keep only first non-empty text",
|
||||
MergeSelectedLinesBilingual = "Merge selected lines bilingual",
|
||||
MergeWithPreviousBilingual = "Merge with prevous bilingual",
|
||||
MergeWithNextBilingual = "Merge with next bilingual",
|
||||
SplitSelectedLineBilingual = "Split selected line bilingual",
|
||||
ToggleTranslationMode = "Toggle translator mode",
|
||||
SwitchOriginalAndTranslation = "Switch original and translation",
|
||||
|
@ -2711,6 +2711,8 @@
|
||||
public string MergeSelectedLinesAndUnbreakCjk { get; set; }
|
||||
public string MergeSelectedLinesOnlyFirstText { get; set; }
|
||||
public string MergeSelectedLinesBilingual { get; set; }
|
||||
public string MergeWithPreviousBilingual { get; set; }
|
||||
public string MergeWithNextBilingual { get; set; }
|
||||
public string SplitSelectedLineBilingual { get; set; }
|
||||
public string ToggleTranslationMode { get; set; }
|
||||
public string SwitchOriginalAndTranslation { get; set; }
|
||||
|
@ -12,6 +12,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public Keys MainGeneralMergeSelectedLinesAndUnbreak { get; set; }
|
||||
public Keys MainGeneralMergeSelectedLinesAndUnbreakNoSpace { get; set; }
|
||||
public Keys MainGeneralMergeSelectedLinesBilingual { get; set; }
|
||||
public Keys MainGeneralMergeWithPreviousBilingual { get; set; }
|
||||
public Keys MainGeneralMergeWithNextBilingual { get; set; }
|
||||
public Keys MainGeneralMergeSelectedLinesOnlyFirstText { get; set; }
|
||||
public Keys MainGeneralToggleTranslationMode { get; set; }
|
||||
public Keys MainGeneralSwitchTranslationAndOriginal { get; set; }
|
||||
@ -247,6 +249,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
MainGeneralMergeSelectedLinesAndUnbreak = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndUnbreak);
|
||||
MainGeneralMergeSelectedLinesAndUnbreakNoSpace = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesAndUnbreakCjk);
|
||||
MainGeneralMergeSelectedLinesBilingual = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesBilingual);
|
||||
MainGeneralMergeWithPreviousBilingual = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithPreviousBilingual);
|
||||
MainGeneralMergeWithNextBilingual = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeWithNextBilingual);
|
||||
MainGeneralMergeSelectedLinesOnlyFirstText = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralMergeSelectedLinesOnlyFirstText);
|
||||
MainGeneralToggleTranslationMode = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralToggleTranslationMode);
|
||||
MainGeneralSwitchTranslationAndOriginal = UiUtil.GetKeys(Configuration.Settings.Shortcuts.GeneralSwitchOriginalAndTranslation);
|
||||
|
Loading…
Reference in New Issue
Block a user