mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
parent
6b0f04c271
commit
0475276d5d
@ -846,6 +846,28 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void FormFixKeyDown(object sender, KeyEventArgs e)
|
private void FormFixKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
var fc = UiUtil.FindFocusedControl(this);
|
||||||
|
if (fc != null && (e.Modifiers == Keys.None || e.Modifiers == Keys.Shift))
|
||||||
|
{
|
||||||
|
var typeName = fc.GetType().Name;
|
||||||
|
|
||||||
|
// do not check for shortcuts if text is being entered and a textbox is focused
|
||||||
|
var textBoxTypes = new List<string> { "AdvancedTextBox", "SimpleTextBox", "SETextBox", "TextBox", "RichTextBox" };
|
||||||
|
if (textBoxTypes.Contains(typeName) &&
|
||||||
|
((e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z) || (e.KeyCode >= Keys.OemSemicolon && e.KeyCode <= Keys.OemBackslash) || e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 || e.KeyValue >= 48 && e.KeyValue <= 57) &&
|
||||||
|
!Configuration.Settings.General.AllowLetterShortcutsInTextBox)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not check for shortcuts if a number is being entered and a time box is focused
|
||||||
|
if (typeName == "UpDownEdit" &&
|
||||||
|
(e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 || e.KeyValue >= 48 && e.KeyValue <= 57))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (e.KeyCode == Keys.Escape)
|
if (e.KeyCode == Keys.Escape)
|
||||||
{
|
{
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
|
@ -15075,18 +15075,6 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
RefreshSelectedParagraph();
|
RefreshSelectedParagraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Control FindFocusedControl(Control control)
|
|
||||||
{
|
|
||||||
var container = control as ContainerControl;
|
|
||||||
while (container != null)
|
|
||||||
{
|
|
||||||
control = container.ActiveControl;
|
|
||||||
container = control as ContainerControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void MainKeyDown(object sender, KeyEventArgs e)
|
internal void MainKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyCode == Keys.LWin)
|
if (e.KeyCode == Keys.LWin)
|
||||||
@ -15126,7 +15114,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fc = FindFocusedControl(this);
|
var fc = UiUtil.FindFocusedControl(this);
|
||||||
if (fc != null && (e.Modifiers == Keys.None || e.Modifiers == Keys.Shift))
|
if (fc != null && (e.Modifiers == Keys.None || e.Modifiers == Keys.Shift))
|
||||||
{
|
{
|
||||||
var typeName = fc.GetType().Name;
|
var typeName = fc.GetType().Name;
|
||||||
|
@ -1361,5 +1361,17 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string DecimalSeparator => CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
public static string DecimalSeparator => CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||||
|
|
||||||
|
public static Control FindFocusedControl(Control control)
|
||||||
|
{
|
||||||
|
var container = control as ContainerControl;
|
||||||
|
while (container != null)
|
||||||
|
{
|
||||||
|
control = container.ActiveControl;
|
||||||
|
container = control as ContainerControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return control;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user