-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Dynamically add menu mnemonics to all menus #2382
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
Conversation
Added Toolkit.setMenuMnemonics(JMenuItem...) and Toolkit.setMenuMnemonics(JMenuBar).
Human Interface GuidelinesMacGnome(https://developer.gnome.org/hig-book/3.10/hig-book.html#choosing-access-keys)
MicrosoftI couldn't find anything except Windows Mobile guidance, but it's sensible stuff anyway: (http://msdn.microsoft.com/en-us/library/bb158536.aspx)
KDEThere's a massive list of global accelerators here (http://techbase.kde.org/Projects/Usability/HIG/Keyboard_Accelerators). |
There is a syntax error in Toolkit.java:236. The line should be commented out. |
OK, I've found the proper MS stuff: http://msdn.microsoft.com/en-us/library/windows/desktop/bb545460.aspx#accessKeys. There's a table of defaults, and then:
|
@@ -2671,6 +2670,10 @@ public void actionPerformed(ActionEvent e) { | |||
} | |||
}); | |||
this.add(referenceItem); | |||
|
|||
Toolkit.setMenuMnemonics(cutItem, copyItem, discourseItem, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than making all these messy local variables, why not just call Toolkit.setMenuMnemonics(this)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to, but I couldn't figure out how to get JMenuItem
s out of a JPopupMenu
without dubious casting. If you know how to, feel free to do it.
Thanks for the patch—I've added a handful of comments but we should be able to get an alternate version of this incorporated soon. |
* Disabled on Mac, per Apple guidelines. | ||
* <tt>menu</tt> may contain nulls. | ||
* | ||
* Author: George Bateman. Initial work Myer Nore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this involves someone else's work, are we sure that the code can be licensed as Processing code? (i.e. the license of the original source isn't incompatible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They submitted it as a changed form of one of your files (Editor.java
). That sounded like they were implying you had permission to take it as part of the project.
(http://processing.org/bugs/bugzilla/attachments/304 from http://processing.org/bugs/bugzilla/26.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just making sure it wasn't a KDE dev or something like that...
Null-check.
Spacing as requested
OK. Thanks for reading over it. |
Javadoc bug
I just found out that jmi.getText() can be null, so I added null-checking.
We'll need to re-evaluate this once #2084 is integrated. |
I designed this with internationalization in mind (but didn't test or work too hard on that aspect). Obviously it accepts arbitrary text in any language, and it will also only associate ASCII mnemonics, to ensure they can be typed (no |
I have read the code again. I think it is internationalization ready, but I will test it in a few languages to check. |
…o mnem-patch Not quite done yet - temporary commit. Conflicts: app/src/processing/app/Editor.java app/src/processing/app/Mode.java app/src/processing/app/Toolkit.java
Merge menu mnemonics back with current code and integrate with PDE-X.
Only thing left is a bit of the sketch menu. |
Added Toolkit.setMenuMnemsInside(); removed Editor.resetMenuMnemonics(); added mnemonics to sketches in Sketch menu.
@benfry Done! |
Sorry, once more... |
…o mnem-patch Conflicts: pdex/src/processing/mode/experimental/DebugEditor.java
Also condense some code.
I fixed a little bug in #2834, so to avoid complications I've tagged it on the end of this, seeing as the issues are interlinked. |
Dynamically add menu mnemonics to all menus
Thanks... merging this now so it can have some time to bake as we prepare for the next release. Thanks very much for your help and for keeping the patch up to date. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Added and called
Toolkit.setMenuMnemonics(JMenuItem...)
andToolkit.setMenuMnemonics(JMenuBar)
. These automatically set menu mnemonics based on the KDE, Windows, and Gnome human-interface guidelines, except on Mac, where as per Mac HIGs, it does nothing.Really, there should be a
Toolkit.setMenuMnemonics(JPopupMenu)
, but I couldn't make one, so I've calledToolkit.setMenuMnemonics(firstItem, secondItem, thirdItem, ...)
instead.#51