Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor key binding panel for easier usage #25104

Merged
merged 5 commits into from Oct 13, 2023

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Oct 12, 2023

There are 2 issues I want to tackle with this pull:

  • RealmKeyBinding.Action is an integer, always. This makes it very difficult to use it in UI, since for UI display, you'd want to be calling GetLocalisableDescription() on a strongly-typed enum instance rather than an integer; calling it on an integer doesn't return the binding name, it just returns the number.

    2a0e4c3 is intended for this. It adds a helper method to always unconditionally unmap Action to a strongly-typed object.

  • GlobalAction has no notion of sections. I want to disallow reusing one key across multiple bindings in a section. This makes retrieval of the set of key bindings to check for conflicts tricky. Previous code would kind of bodge it using the default key bindings, but all the pieces are right there and making this API just a bit nicer is not much work. So I did that in 1c784c9 - GlobalActionCategory corresponds 1:1 to the key binding setting sections.

    This in turn enables c2e92cb, which while tangential to my future plans, feels pretty nice and gets rid of a bunch of boilerplate.

@peppy peppy enabled auto-merge October 13, 2023 04:53
@peppy peppy merged commit 7c36848 into ppy:master Oct 13, 2023
10 of 11 checks passed
@bdach bdach deleted the make-realm-key-binding-action-suck-less branch October 13, 2023 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants