Skip to content

Commit

Permalink
Check for InputModifiers.None in KeyDown events
Browse files Browse the repository at this point in the history
  • Loading branch information
mat1jaczyyy committed Aug 16, 2019
1 parent 1323933 commit 3aac201
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Apollo/Helpers/SelectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ public bool HandleKey(KeyEventArgs e) {
else if (e.Key == Key.A) SelectAll();
else return false;

} else {
} else if (e.Modifiers == InputModifiers.None) {
if (e.Key == Key.Delete || e.Key == Key.Back) Action("Delete");
else if (e.Key == Key.D0 || e.Key == Key.NumPad0) Action("Mute");
else if (e.Key == Key.F2) Action("Rename");
else return false;
}

} else return false;

return true;
}
Expand Down
5 changes: 4 additions & 1 deletion Apollo/Windows/PatternWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ void Frame_AfterClick(object sender, PointerReleasedEventArgs e) {
async void Window_KeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Enter || e.Key == Key.Space) {
if (e.Modifiers == InputModifiers.Shift) PatternFire(Fire, null);
else PatternPlay(Play, null);
else if (e.Modifiers == InputModifiers.None) PatternPlay(Play, null);
return;
}

if (Locked) return;
Expand All @@ -462,6 +463,8 @@ async void Window_KeyDown(object sender, KeyEventArgs e) {
return;
}

if (e.Modifiers != InputModifiers.None && e.Modifiers != InputModifiers.Shift) return;

bool shift = e.Modifiers == InputModifiers.Shift;

if (e.Key == Key.Up || e.Key == Key.Left) {
Expand Down
2 changes: 2 additions & 0 deletions Apollo/Windows/ProjectWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ async void Window_KeyDown(object sender, KeyEventArgs e) {
if (Program.WindowKey(this, e) || await Program.Project.HandleKey(this, e) || Program.Project.Undo.HandleKey(e) || Selection.HandleKey(e))
return;

if (e.Modifiers != InputModifiers.None && e.Modifiers != InputModifiers.Shift) return;

if (e.Key == Key.Up) Selection.Move(false, e.Modifiers == InputModifiers.Shift);
else if (e.Key == Key.Down) Selection.Move(true, e.Modifiers == InputModifiers.Shift);
else if (e.Key == Key.Enter)
Expand Down
2 changes: 2 additions & 0 deletions Apollo/Windows/TrackWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ async void Window_KeyDown(object sender, KeyEventArgs e) {
if (Program.WindowKey(this, e) || await Program.Project.HandleKey(this, e) || Program.Project.Undo.HandleKey(e) || Selection.HandleKey(e))
return;

if (e.Modifiers != InputModifiers.None && e.Modifiers != InputModifiers.Shift) return;

bool vertical = Selection.Start.GetType() == typeof(Chain);

if (vertical) {
Expand Down

0 comments on commit 3aac201

Please sign in to comment.