Process shortcut keys regardless of whether they have menus or not (this should be in UWT proper)

This commit is contained in:
Michael Becker 2019-08-04 11:11:30 -04:00
parent c34b1e5bf9
commit f7b1306612

View File

@ -123,13 +123,13 @@ namespace UniversalEditor.UserInterface
protected override void OnKeyDown(KeyEventArgs e)
{
// we have to process key shortcuts manually if we do not use a traditional menu bar
if ((e.ModifierKeys & KeyboardModifierKey.Control) == KeyboardModifierKey.Control) {
switch (e.Key) {
case KeyboardKey.Q:
{
Application.Stop (0);
break;
}
foreach (Command cmd in Application.Commands) {
if (cmd.Shortcut == null) continue;
if (cmd.Shortcut.Key == e.Key && cmd.Shortcut.ModifierKeys == e.ModifierKeys) {
Application.ExecuteCommand (cmd.ID);
e.Cancel = true;
break;
}
}
}
@ -139,7 +139,7 @@ namespace UniversalEditor.UserInterface
Layout = new BoxLayout(Orientation.Vertical);
this.IconName = "universal-editor";
this.CommandDisplayMode = CommandDisplayMode.Both;
this.CommandDisplayMode = CommandDisplayMode.Ribbon;
foreach (CommandItem ci in Engine.CurrentEngine.MainMenu.Items)
{
@ -594,7 +594,7 @@ namespace UniversalEditor.UserInterface
}
if (this.Windows.Count == 0)
{
this.Destroy();
CloseWindow ();
}
}
@ -605,7 +605,7 @@ namespace UniversalEditor.UserInterface
public void CloseWindow()
{
throw new NotImplementedException();
this.Destroy ();
}
public void PrintDocument()