Fix #244 - Allow for use global num shortcuts

This commit is contained in:
niksedk 2014-09-20 08:41:09 +02:00
parent f56998dba2
commit 61c25e9896

View File

@ -10715,18 +10715,20 @@ namespace Nikse.SubtitleEdit.Forms
if (e.Modifiers == (Keys.Control | Keys.Shift) && e.KeyCode == Keys.ShiftKey) if (e.Modifiers == (Keys.Control | Keys.Shift) && e.KeyCode == Keys.ShiftKey)
return; return;
// do not check for shortcuts if text is being entered...
var fc = FindFocusedControl(this); var fc = FindFocusedControl(this);
if (fc != null && (fc is TextBox || fc is ComboBox)) if (fc != null && e.Modifiers != Keys.Control && e.Modifiers != (Keys.Control | Keys.Shift) && e.Modifiers != (Keys.Control | Keys.Shift | Keys.Alt))
{ {
if (e.Modifiers != Keys.Control && e.Modifiers != (Keys.Control | Keys.Shift) && e.Modifiers != (Keys.Control | Keys.Shift | Keys.Alt)) // do not check for shortcuts if text is being entered and a textbox is focused
{ if ((fc.Name == textBoxListViewText.Name || fc.Name == textBoxListViewTextAlternate.Name || fc.Name == textBoxSearchWord.Name) && e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
return; return;
if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
// do not check for shortcuts if a number is being entered and a time box is focused
if (fc.Parent != null && (fc.Parent.Name == timeUpDownStartTime.Name || fc.Parent.Name == numericUpDownDuration.Name) &&
(e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 || e.KeyValue >= 48 && e.KeyValue <= 57))
return; return;
} }
}
bool inListView = tabControlSubtitle.SelectedIndex == TabControlListView; bool inListView = tabControlSubtitle.SelectedIndex == TabControlListView;