Skip to content

Commit

Permalink
Add main view shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rekkonnect committed May 11, 2024
1 parent 7910041 commit 09dd7ed
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Syndiesis/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ private void CollapseAllClick(object? sender, RoutedEventArgs e)
}

private void HandleSettingsClick(object? sender, RoutedEventArgs e)
{
RequestSettings();
}

private void RequestSettings()
{
SettingsRequested?.Invoke();
}
Expand Down Expand Up @@ -190,4 +195,32 @@ protected override void OnGotFocus(GotFocusEventArgs e)
base.OnGotFocus(e);
codeEditor.Focus();
}

protected override void OnKeyDown(KeyEventArgs e)
{
var modifiers = e.KeyModifiers;

bool hasControl = modifiers.HasFlag(KeyModifiers.Control);

switch (e.Key)
{
case Key.S:
if (hasControl)
{
RequestSettings();
e.Handled = true;
}
break;

case Key.R:
if (hasControl)
{
Reset();
e.Handled = true;
}
break;
}

base.OnKeyDown(e);
}
}

0 comments on commit 09dd7ed

Please sign in to comment.