Streamline Hotkeys #9315
butterw
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Streamline Hotkeys
From a development perspective, putting all current shortcuts as constants in a single code file is simple enough to do and has many advantages:
I've looked into it a bit, my suggestion is that all keyboard hotkeys should be defined as constants with a meaningfull name in a single file (ex: org.triplea.swing.key.hotkeys).
Instead of using harcoded values, import the hotkeys file for all menu accelerators/keyboard listeners.
KeyEvent.VK_RIGHT >> KeyCode.RIGHT >> HotKeys.SCROLL_RIGHT1
ex in TripleAFrame.java:
if (keyCode == KeyEvent.VK_RIGHT)
would become
if (keyCode == HotKeys.ScrollRight1)
In this case we can have multiple hotkeys for the same action (to be able to support WASD or equivalent)
in most cases there would be a single hotkey for an action.
ex: newSaveMenu with a value KeyCode.S
Beta Was this translation helpful? Give feedback.
All reactions