mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Merge pull request #183 from ivandrofly/patch-10
Refact & more keys allowed
This commit is contained in:
commit
cac2d68aac
@ -560,6 +560,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Paragraph p = _subtitle.Paragraphs[i];
|
||||
if (p.Text.Trim().Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,7 +86,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
(e.KeyValue >= 96 && e.KeyValue <= 105))
|
||||
{
|
||||
}
|
||||
else if (e.KeyData == (Keys.Shift | Keys.Home) || e.KeyData == (Keys.Shift | Keys.End))
|
||||
else if (e.KeyData == (Keys.Shift | Keys.Home) || e.KeyData == (Keys.Shift | Keys.End) ||
|
||||
e.KeyCode == (Keys.MButton | Keys.Space) || e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Space))
|
||||
{
|
||||
}
|
||||
else if (e.KeyCode == Keys.Enter)
|
||||
@ -104,7 +105,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (e.Modifiers != Keys.Control && e.Modifiers != Keys.Alt)
|
||||
{
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
|
@ -37,31 +37,46 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void TextBox1KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.D0 ||
|
||||
e.KeyCode == Keys.D1 ||
|
||||
e.KeyCode == Keys.D2 ||
|
||||
e.KeyCode == Keys.D3 ||
|
||||
e.KeyCode == Keys.D4 ||
|
||||
e.KeyCode == Keys.D5 ||
|
||||
e.KeyCode == Keys.D6 ||
|
||||
e.KeyCode == Keys.D7 ||
|
||||
e.KeyCode == Keys.D8 ||
|
||||
e.KeyCode == Keys.D9 ||
|
||||
e.KeyCode == Keys.Delete ||
|
||||
e.KeyCode == Keys.Left ||
|
||||
e.KeyCode == Keys.Right ||
|
||||
e.KeyCode == Keys.Back ||
|
||||
(e.KeyValue >= 96 && e.KeyValue <= 105))
|
||||
{
|
||||
}
|
||||
else if (e.KeyCode == Keys.Enter)
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
ButtonOkClick(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
if (e.KeyCode == Keys.D0 ||
|
||||
e.KeyCode == Keys.D1 ||
|
||||
e.KeyCode == Keys.D2 ||
|
||||
e.KeyCode == Keys.D3 ||
|
||||
e.KeyCode == Keys.D4 ||
|
||||
e.KeyCode == Keys.D5 ||
|
||||
e.KeyCode == Keys.D6 ||
|
||||
e.KeyCode == Keys.D7 ||
|
||||
e.KeyCode == Keys.D8 ||
|
||||
e.KeyCode == Keys.D9 ||
|
||||
e.KeyCode == Keys.Delete ||
|
||||
e.KeyCode == Keys.Left ||
|
||||
e.KeyCode == Keys.Right ||
|
||||
e.KeyCode == Keys.Back ||
|
||||
(e.KeyValue >= 96 && e.KeyValue <= 105))
|
||||
{
|
||||
}
|
||||
else if (e.KeyData == (Keys.Shift | Keys.Home) || e.KeyData == (Keys.Shift | Keys.End) ||
|
||||
e.KeyCode == (Keys.MButton | Keys.Space) || e.KeyCode == (Keys.LButton | Keys.RButton | Keys.Space))
|
||||
{
|
||||
}
|
||||
else if (e.KeyData == (Keys.Control | Keys.V) && Clipboard.GetText(TextDataFormat.UnicodeText).Length > 0)
|
||||
{
|
||||
var p = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||
int num;
|
||||
if (!int.TryParse(p, out num))
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
else if (e.Modifiers != Keys.Control && e.Modifiers != Keys.Alt)
|
||||
{
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user