Changed two hardcoded shortcuts to be configuable (auto break / remove line break) in text box

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2191 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-11-16 08:15:31 +00:00
parent 72285a144e
commit 4ea6e460f9
6 changed files with 46 additions and 10 deletions

View File

@ -139,8 +139,10 @@ namespace Nikse.SubtitleEdit.Forms
Keys _mainAdjustSelected100MsForward = Keys.None;
Keys _mainAdjustSelected100MsBack = Keys.None;
Keys _mainInsertAfter = Keys.None;
Keys _mainTextBoxInsertAfter = Keys.None;
Keys _mainInsertBefore = Keys.None;
Keys _mainTextBoxInsertAfter = Keys.None;
Keys _mainTextBoxAutoBreak = Keys.None;
Keys _mainTextBoxUnbreak = Keys.None;
Keys _mainMergeDialogue = Keys.None;
Keys _mainToggleFocus = Keys.None;
Keys _mainListViewToggleDashes = Keys.None;
@ -6690,12 +6692,12 @@ namespace Nikse.SubtitleEdit.Forms
textBoxListViewText.SelectAll();
e.SuppressKeyPress = true;
}
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.R)
else if (e.KeyData == _mainTextBoxAutoBreak)
{
ButtonAutoBreakClick(null, null);
e.SuppressKeyPress = true;
}
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.U)
else if (e.KeyData == _mainTextBoxUnbreak)
{
ButtonUnBreakClick(null, null);
e.SuppressKeyPress = true;
@ -6714,7 +6716,6 @@ namespace Nikse.SubtitleEdit.Forms
{
textBoxListViewText.Text = string.Format("<{0}>{1}</{0}>", tag, textBoxListViewText.Text);
}
//SubtitleListview1.SetText(i, textBoxListViewText.Text);
}
else
{
@ -13822,8 +13823,10 @@ namespace Nikse.SubtitleEdit.Forms
_mainAdjustSelected100MsForward = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainAdjustSelected100MsForward);
_mainAdjustSelected100MsBack = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainAdjustSelected100MsBack);
_mainInsertAfter = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainInsertAfter);
_mainTextBoxInsertAfter = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxInsertAfter);
_mainInsertBefore = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainInsertBefore);
_mainTextBoxInsertAfter = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxInsertAfter);
_mainTextBoxAutoBreak = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxAutoBreak);
_mainTextBoxUnbreak = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTextBoxUnbreak);
_mainMergeDialogue = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainMergeDialogue);
_mainToggleFocus = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainToogleFocus);
_waveformVerticalZoom = Utilities.GetKeys(Configuration.Settings.Shortcuts.WaveformVerticalZoom);
@ -13853,8 +13856,15 @@ namespace Nikse.SubtitleEdit.Forms
actionType = null;
shortcut = null;
mi = null;
System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(pluginFileName));
System.Reflection.Assembly assembly;
try
{
assembly = System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(pluginFileName));
}
catch
{
return null;
}
string objectName = Path.GetFileNameWithoutExtension(pluginFileName);
if (assembly != null)
{
@ -15898,13 +15908,13 @@ namespace Nikse.SubtitleEdit.Forms
{
e.SuppressKeyPress = true;
}
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.R)
else if (e.KeyData == _mainTextBoxAutoBreak)
{
if (textBoxListViewTextAlternate.Text.Length > 0)
textBoxListViewTextAlternate.Text = Utilities.AutoBreakLine(textBoxListViewTextAlternate.Text);
e.SuppressKeyPress = true;
}
else if (e.Modifiers == Keys.Control && e.KeyCode == Keys.U)
else if (e.KeyData == _mainTextBoxUnbreak)
{
textBoxListViewTextAlternate.Text = Utilities.UnbreakLine(textBoxListViewTextAlternate.Text);
e.SuppressKeyPress = true;

View File

@ -606,6 +606,10 @@ namespace Nikse.SubtitleEdit.Forms
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.MainTextBoxMoveFirstWordFromNextUp))
textBoxNode.Nodes.Add(Configuration.Settings.Language.Settings.MainTextBoxMoveFirstWordFromNextUp + GetShortcutText(Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp));
textBoxNode.Nodes.Add(Configuration.Settings.Language.Main.Menu.ContextMenu.InsertAfter + GetShortcutText(Configuration.Settings.Shortcuts.MainTextBoxInsertAfter));
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.MainTextBoxAutoBreak))
textBoxNode.Nodes.Add(Configuration.Settings.Language.Settings.MainTextBoxAutoBreak + GetShortcutText(Configuration.Settings.Shortcuts.MainTextBoxAutoBreak));
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.MainTextBoxUnbreak))
textBoxNode.Nodes.Add(Configuration.Settings.Language.Settings.MainTextBoxUnbreak + GetShortcutText(Configuration.Settings.Shortcuts.MainTextBoxUnbreak));
treeViewShortcuts.Nodes.Add(textBoxNode);
var createNode = new TreeNode(Configuration.Settings.Language.Main.VideoControls.Create);
@ -1245,6 +1249,10 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Shortcuts.MainTextBoxMoveFirstWordFromNextUp = GetShortcut(node.Text);
else if (Configuration.Settings.Language.Main.Menu.ContextMenu.InsertAfter != null && text == Configuration.Settings.Language.Main.Menu.ContextMenu.InsertAfter.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainTextBoxInsertAfter = GetShortcut(node.Text);
else if (Configuration.Settings.Language.Settings.MainTextBoxAutoBreak != null && text == Configuration.Settings.Language.Settings.MainTextBoxAutoBreak.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainTextBoxAutoBreak = GetShortcut(node.Text);
else if (Configuration.Settings.Language.Settings.MainTextBoxUnbreak != null && text == Configuration.Settings.Language.Settings.MainTextBoxUnbreak.Replace("&", string.Empty))
Configuration.Settings.Shortcuts.MainTextBoxUnbreak = GetShortcut(node.Text);
}
}

View File

@ -1535,6 +1535,8 @@ Fortsæt?</SubtitleAppendPrompt>
<ShowBeamer>Start undertekst fremviser (fuldskærm)</ShowBeamer>
<MainTextBoxMoveLastWordDown>Flyt sidste ord ned til næste linje</MainTextBoxMoveLastWordDown>
<MainTextBoxMoveFirstWordFromNextUp>Flyt første ord fra næste linje op</MainTextBoxMoveFirstWordFromNextUp>
<MainTextBoxAutoBreak>Auto-ombryd tekst</MainTextBoxAutoBreak>
<MainTextBoxUnbreak>Fjern linjeskift</MainTextBoxUnbreak>
</Settings>
<ShowEarlierLater>
<Title>Vis valgte linjer tidligere/senere</Title>

View File

@ -1794,6 +1794,8 @@ can edit in same subtitle file (collaboration)",
ShowBeamer = "Start subtitle fullscreen beamer",
MainTextBoxMoveLastWordDown = "Move last word down to next subtitle line",
MainTextBoxMoveFirstWordFromNextUp = "Move first word from next subtitle line up",
MainTextBoxAutoBreak = "Auto break text",
MainTextBoxUnbreak = "Unbreak text",
};
ShowEarlierLater = new LanguageStructure.ShowEarlierLater

View File

@ -1692,6 +1692,8 @@
public string ShowBeamer { get; set; }
public string MainTextBoxMoveLastWordDown { get; set; }
public string MainTextBoxMoveFirstWordFromNextUp { get; set; }
public string MainTextBoxAutoBreak { get; set; }
public string MainTextBoxUnbreak { get; set; }
}
public class ShowEarlierLater

View File

@ -754,6 +754,8 @@ namespace Nikse.SubtitleEdit.Logic
public string MainAdjustSelected100MsBack { get; set; }
public string MainInsertAfter { get; set; }
public string MainTextBoxInsertAfter { get; set; }
public string MainTextBoxAutoBreak { get; set; }
public string MainTextBoxUnbreak { get; set; }
public string MainWaveformInsertAtCurrentPosition { get; set; }
public string MainInsertBefore { get; set; }
public string MainMergeDialogue { get; set; }
@ -840,9 +842,11 @@ namespace Nikse.SubtitleEdit.Logic
MainAdjustSelected100MsForward = string.Empty;
MainAdjustSelected100MsBack = string.Empty;
MainInsertAfter = "Alt+Insert";
MainTextBoxInsertAfter = "Alt+Insert";
MainWaveformInsertAtCurrentPosition = "Insert";
MainInsertBefore = "Control+Shift+Insert";
MainTextBoxInsertAfter = "Alt+Insert";
MainTextBoxAutoBreak = "Control+R";
MainTextBoxUnbreak = string.Empty;
MainMergeDialogue = string.Empty;
WaveformVerticalZoom = string.Empty;
WaveformPlaySelection = string.Empty;
@ -2143,6 +2147,12 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("MainTextBoxInsertAfter");
if (subNode != null)
settings.Shortcuts.MainTextBoxInsertAfter = subNode.InnerText;
subNode = node.SelectSingleNode("MainTextBoxAutoBreak");
if (subNode != null)
settings.Shortcuts.MainTextBoxAutoBreak = subNode.InnerText;
subNode = node.SelectSingleNode("MainTextBoxUnbreak");
if (subNode != null)
settings.Shortcuts.MainTextBoxUnbreak = subNode.InnerText;
subNode = node.SelectSingleNode("MainWaveformInsertAtCurrentPosition");
if (subNode != null)
settings.Shortcuts.MainWaveformInsertAtCurrentPosition = subNode.InnerText;
@ -2681,6 +2691,8 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("MainAdjustSelected100MsBack", settings.Shortcuts.MainAdjustSelected100MsBack);
textWriter.WriteElementString("MainInsertAfter", settings.Shortcuts.MainInsertAfter);
textWriter.WriteElementString("MainTextBoxInsertAfter", settings.Shortcuts.MainTextBoxInsertAfter);
textWriter.WriteElementString("MainTextBoxAutoBreak", settings.Shortcuts.MainTextBoxAutoBreak);
textWriter.WriteElementString("MainTextBoxUnbreak", settings.Shortcuts.MainTextBoxUnbreak);
textWriter.WriteElementString("MainWaveformInsertAtCurrentPosition", settings.Shortcuts.MainWaveformInsertAtCurrentPosition);
textWriter.WriteElementString("MainInsertBefore", settings.Shortcuts.MainInsertBefore);
textWriter.WriteElementString("MainMergeDialogue", settings.Shortcuts.MainMergeDialogue);