mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 20:22:41 +01:00
Add new shortcut "Move first word to previous subtitle" - thx Rychelle :)
This commit is contained in:
parent
41acc6c3c0
commit
8722f3338d
@ -7914,6 +7914,12 @@ namespace Nikse.SubtitleEdit.Core.Settings
|
|||||||
shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext = subNode.InnerText;
|
shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext = subNode.InnerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subNode = node.SelectSingleNode("MainTextBoxMoveFirstWordToPrev");
|
||||||
|
if (subNode != null)
|
||||||
|
{
|
||||||
|
shortcuts.MainTextBoxMoveFirstWordToPrev = subNode.InnerText;
|
||||||
|
}
|
||||||
|
|
||||||
subNode = node.SelectSingleNode("MainTextBoxSelectionToLower");
|
subNode = node.SelectSingleNode("MainTextBoxSelectionToLower");
|
||||||
if (subNode != null)
|
if (subNode != null)
|
||||||
{
|
{
|
||||||
@ -10166,6 +10172,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
|
|||||||
textWriter.WriteElementString("MainTextBoxMoveLastWordDownCurrent", shortcuts.MainTextBoxMoveLastWordDownCurrent);
|
textWriter.WriteElementString("MainTextBoxMoveLastWordDownCurrent", shortcuts.MainTextBoxMoveLastWordDownCurrent);
|
||||||
textWriter.WriteElementString("MainTextBoxMoveFirstWordUpCurrent", shortcuts.MainTextBoxMoveFirstWordUpCurrent);
|
textWriter.WriteElementString("MainTextBoxMoveFirstWordUpCurrent", shortcuts.MainTextBoxMoveFirstWordUpCurrent);
|
||||||
textWriter.WriteElementString("MainTextBoxMoveFromCursorToNext", shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext);
|
textWriter.WriteElementString("MainTextBoxMoveFromCursorToNext", shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext);
|
||||||
|
textWriter.WriteElementString("MainTextBoxMoveFirstWordToPrev", shortcuts.MainTextBoxMoveFirstWordToPrev);
|
||||||
textWriter.WriteElementString("MainTextBoxSelectionToLower", shortcuts.MainTextBoxSelectionToLower);
|
textWriter.WriteElementString("MainTextBoxSelectionToLower", shortcuts.MainTextBoxSelectionToLower);
|
||||||
textWriter.WriteElementString("MainTextBoxSelectionToUpper", shortcuts.MainTextBoxSelectionToUpper);
|
textWriter.WriteElementString("MainTextBoxSelectionToUpper", shortcuts.MainTextBoxSelectionToUpper);
|
||||||
textWriter.WriteElementString("MainTextBoxSelectionToggleCasing", shortcuts.MainTextBoxSelectionToggleCasing);
|
textWriter.WriteElementString("MainTextBoxSelectionToggleCasing", shortcuts.MainTextBoxSelectionToggleCasing);
|
||||||
|
@ -291,6 +291,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
|
|||||||
public string MainTextBoxMoveLastWordDownCurrent { get; set; }
|
public string MainTextBoxMoveLastWordDownCurrent { get; set; }
|
||||||
public string MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
public string MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
||||||
public string MainTextBoxMoveFromCursorToNextAndGoToNext { get; set; }
|
public string MainTextBoxMoveFromCursorToNextAndGoToNext { get; set; }
|
||||||
|
public string MainTextBoxMoveFirstWordToPrev { get; set; }
|
||||||
public string MainTextBoxSelectionToLower { get; set; }
|
public string MainTextBoxSelectionToLower { get; set; }
|
||||||
public string MainTextBoxSelectionToUpper { get; set; }
|
public string MainTextBoxSelectionToUpper { get; set; }
|
||||||
public string MainTextBoxSelectionToggleCasing { get; set; }
|
public string MainTextBoxSelectionToggleCasing { get; set; }
|
||||||
|
@ -11893,6 +11893,53 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MoveFirstWordToPrev(SETextBox tb)
|
||||||
|
{
|
||||||
|
int firstIndex = FirstSelectedIndex;
|
||||||
|
if (firstIndex <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var prev = _subtitle.GetParagraphOrDefault(firstIndex - 1);
|
||||||
|
var current = _subtitle.GetParagraphOrDefault(firstIndex);
|
||||||
|
|
||||||
|
if (tb == textBoxListViewTextOriginal)
|
||||||
|
{
|
||||||
|
prev = Utilities.GetOriginalParagraph(firstIndex - 1, prev, _subtitleOriginal.Paragraphs);
|
||||||
|
current = Utilities.GetOriginalParagraph(firstIndex, current, _subtitleOriginal.Paragraphs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev != null && current != null)
|
||||||
|
{
|
||||||
|
var moveUpDown = new MoveWordUpDown(prev.Text, current.Text);
|
||||||
|
moveUpDown.MoveWordUp();
|
||||||
|
if (moveUpDown.S1 != prev.Text && moveUpDown.S2 != current.Text)
|
||||||
|
{
|
||||||
|
MakeHistoryForUndo(_language.BeforeLineUpdatedInListView);
|
||||||
|
prev.Text = moveUpDown.S1;
|
||||||
|
current.Text = moveUpDown.S2;
|
||||||
|
if (tb == textBoxListViewTextOriginal)
|
||||||
|
{
|
||||||
|
SubtitleListview1.SetOriginalText(firstIndex - 1, prev.Text);
|
||||||
|
SubtitleListview1.SetOriginalText(firstIndex, current.Text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SubtitleListview1.SetText(firstIndex - 1, prev.Text);
|
||||||
|
SubtitleListview1.SetText(firstIndex, current.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectionStart = textBoxListViewText.SelectionStart;
|
||||||
|
tb.Text = current.Text;
|
||||||
|
if (selectionStart >= 0)
|
||||||
|
{
|
||||||
|
tb.SelectionStart = selectionStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void MoveLastWordDown(SETextBox tb)
|
private void MoveLastWordDown(SETextBox tb)
|
||||||
{
|
{
|
||||||
int firstIndex = FirstSelectedIndex;
|
int firstIndex = FirstSelectedIndex;
|
||||||
@ -18715,6 +18762,19 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
}
|
}
|
||||||
|
else if (e.KeyData == _shortcuts.MainTextBoxMoveFirstWordToPrev)
|
||||||
|
{
|
||||||
|
if (textBoxListViewTextOriginal.Focused)
|
||||||
|
{
|
||||||
|
MoveFirstWordToPrev(textBoxListViewTextOriginal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MoveFirstWordToPrev(textBoxListViewText);
|
||||||
|
}
|
||||||
|
|
||||||
|
e.SuppressKeyPress = true;
|
||||||
|
}
|
||||||
else if (_shortcuts.MainAutoCalcCurrentDuration == e.KeyData)
|
else if (_shortcuts.MainAutoCalcCurrentDuration == e.KeyData)
|
||||||
{
|
{
|
||||||
RecalcCurrentDuration();
|
RecalcCurrentDuration();
|
||||||
|
@ -1824,6 +1824,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
|||||||
AddNode(textBoxNode, language.MainTextBoxMoveLastWordDownCurrent, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveLastWordDownCurrent));
|
AddNode(textBoxNode, language.MainTextBoxMoveLastWordDownCurrent, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveLastWordDownCurrent));
|
||||||
AddNode(textBoxNode, language.MainTextBoxMoveFirstWordUpCurrent, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordUpCurrent));
|
AddNode(textBoxNode, language.MainTextBoxMoveFirstWordUpCurrent, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordUpCurrent));
|
||||||
AddNode(textBoxNode, language.MainTextBoxMoveFromCursorToNext, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext));
|
AddNode(textBoxNode, language.MainTextBoxMoveFromCursorToNext, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext));
|
||||||
|
AddNode(textBoxNode, language.MainTextBoxMoveFirstWordToPrev, nameof(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordToPrev));
|
||||||
AddNode(textBoxNode, language.MainTextBoxSelectionToLower, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToLower));
|
AddNode(textBoxNode, language.MainTextBoxSelectionToLower, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToLower));
|
||||||
AddNode(textBoxNode, language.MainTextBoxSelectionToUpper, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToUpper));
|
AddNode(textBoxNode, language.MainTextBoxSelectionToUpper, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToUpper));
|
||||||
AddNode(textBoxNode, language.MainTextBoxSelectionToRuby, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToRuby), true);
|
AddNode(textBoxNode, language.MainTextBoxSelectionToRuby, nameof(Configuration.Settings.Shortcuts.MainTextBoxSelectionToRuby), true);
|
||||||
|
@ -3162,6 +3162,7 @@ can edit in same subtitle file (collaboration)",
|
|||||||
MainTextBoxMoveLastWordDownCurrent = "Move last word from first line down (current subtitle)",
|
MainTextBoxMoveLastWordDownCurrent = "Move last word from first line down (current subtitle)",
|
||||||
MainTextBoxMoveFirstWordUpCurrent = "Move first word from next line up (current subtitle)",
|
MainTextBoxMoveFirstWordUpCurrent = "Move first word from next line up (current subtitle)",
|
||||||
MainTextBoxMoveFromCursorToNext = "Move text after cursor position to next subtitle and go to next",
|
MainTextBoxMoveFromCursorToNext = "Move text after cursor position to next subtitle and go to next",
|
||||||
|
MainTextBoxMoveFirstWordToPrev = "Move first word to previous subtitle",
|
||||||
MainTextBoxSelectionToLower = "Selection to lowercase",
|
MainTextBoxSelectionToLower = "Selection to lowercase",
|
||||||
MainTextBoxSelectionToUpper = "Selection to uppercase",
|
MainTextBoxSelectionToUpper = "Selection to uppercase",
|
||||||
MainTextBoxSelectionToggleCasing = "Toggle casing of selection (propercase/uppercase/lowercase)",
|
MainTextBoxSelectionToggleCasing = "Toggle casing of selection (propercase/uppercase/lowercase)",
|
||||||
|
@ -2977,6 +2977,7 @@
|
|||||||
public string MainTextBoxMoveFirstWordFromNextUp { get; set; }
|
public string MainTextBoxMoveFirstWordFromNextUp { get; set; }
|
||||||
public string MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
public string MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
||||||
public string MainTextBoxMoveFromCursorToNext { get; set; }
|
public string MainTextBoxMoveFromCursorToNext { get; set; }
|
||||||
|
public string MainTextBoxMoveFirstWordToPrev { get; set; }
|
||||||
public string MainTextBoxMoveLastWordDownCurrent { get; set; }
|
public string MainTextBoxMoveLastWordDownCurrent { get; set; }
|
||||||
public string MainTextBoxSelectionToLower { get; set; }
|
public string MainTextBoxSelectionToLower { get; set; }
|
||||||
public string MainTextBoxSelectionToUpper { get; set; }
|
public string MainTextBoxSelectionToUpper { get; set; }
|
||||||
|
@ -133,6 +133,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
public Keys MainTextBoxMoveFirstWordFromNextUp { get; set; }
|
public Keys MainTextBoxMoveFirstWordFromNextUp { get; set; }
|
||||||
public Keys MainTextBoxMoveLastWordDownCurrent { get; set; }
|
public Keys MainTextBoxMoveLastWordDownCurrent { get; set; }
|
||||||
public Keys MainTextBoxMoveFromCursorToNextAndGoToNext { get; set; }
|
public Keys MainTextBoxMoveFromCursorToNextAndGoToNext { get; set; }
|
||||||
|
public Keys MainTextBoxMoveFirstWordToPrev { get; set; }
|
||||||
public Keys MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
public Keys MainTextBoxMoveFirstWordUpCurrent { get; set; }
|
||||||
public Keys MainTextBoxSelectionToLower { get; set; }
|
public Keys MainTextBoxSelectionToLower { get; set; }
|
||||||
public Keys MainTextBoxSelectionToUpper { get; set; }
|
public Keys MainTextBoxSelectionToUpper { get; set; }
|
||||||
@ -458,6 +459,7 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
MainTextBoxMoveFirstWordFromNextUp = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp);
|
MainTextBoxMoveFirstWordFromNextUp = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp);
|
||||||
MainTextBoxMoveLastWordDownCurrent = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveLastWordDownCurrent);
|
MainTextBoxMoveLastWordDownCurrent = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveLastWordDownCurrent);
|
||||||
MainTextBoxMoveFromCursorToNextAndGoToNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext);
|
MainTextBoxMoveFromCursorToNextAndGoToNext = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFromCursorToNextAndGoToNext);
|
||||||
|
MainTextBoxMoveFirstWordToPrev = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordToPrev);
|
||||||
MainTextBoxMoveFirstWordUpCurrent = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordUpCurrent);
|
MainTextBoxMoveFirstWordUpCurrent = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordUpCurrent);
|
||||||
MainTextBoxSelectionToLower = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxSelectionToLower);
|
MainTextBoxSelectionToLower = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxSelectionToLower);
|
||||||
MainTextBoxSelectionToUpper = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxSelectionToUpper);
|
MainTextBoxSelectionToUpper = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxSelectionToUpper);
|
||||||
|
Loading…
Reference in New Issue
Block a user