Posts: 70
Threads: 3
Joined: Nov 2014
Welche Sprache wird denn hier im Entwicklerbereich bevorzugt?
Which language is preferred here in the development corner?
Ich nutze Routeconverter auf einem MacBook Pro mit Retina Display. Ich habe im Deutschen Diskussionsforum schon einen Beitrag zum Display geschrieben.
Unter Mac OS X, hier Yosemite, wird nicht die Steuerungs-Taste, sonder die cmd-Taste (früher "Apfel"-Taste) für die meisten Tastaturkürzel benutzt. Ich denke, bzw. weiß auch eigener Programmiererfahrung, dass dies nicht so schwer zu implementieren ist.
Wer würde das machen?
I'm using Routeconverter on a MacBook Pro with retina display and wrote an thread about the missing retina resolution here.
On a Mac OS X, here Yosemite, there is the command key (earlier called "apple key" used for shortcuts and not the control key. I think, better I know from my own java experience, that it is not so difficult to implement this functionality.
Who can do it?
Posts: 7,532
Threads: 230
Joined: Aug 2007
(09.11.2014, 17:09)ryanthara Wrote: Welche Sprache wird denn hier im Entwicklerbereich bevorzugt?
Which language is preferred here in the development corner?
Englisch and German are preferred since that's what most developers speak.
(09.11.2014, 17:09)ryanthara Wrote: Ich nutze Routeconverter auf einem MacBook Pro mit Retina Display. Ich habe im Deutschen Diskussionsforum schon einen Beitrag zum Display geschrieben.
Unter Mac OS X, hier Yosemite, wird nicht die Steuerungs-Taste, sonder die cmd-Taste (früher "Apfel"-Taste) für die meisten Tastaturkürzel benutzt. Ich denke, bzw. weiß auch eigener Programmiererfahrung, dass dies nicht so schwer zu implementieren ist.
Wer würde das machen?
Am Besten Du und dann stellst Du einen Pull-Request. Hintergrund ist, daß ich weder einen Mac besitze noch weiß, was man dafür tun müßte.
--
Christian
Posts: 70
Threads: 3
Joined: Nov 2014
(10.11.2014, 15:53)routeconverter Wrote: ...
Englisch and German are preferred since that's what most developers speak.
Well, then I'll try to give my answers in english.
(10.11.2014, 15:53)routeconverter Wrote: (09.11.2014, 17:09)ryanthara Wrote: Ich nutze Routeconverter auf einem MacBook Pro mit Retina Display. Ich habe im Deutschen Diskussionsforum schon einen Beitrag zum Display geschrieben.
Unter Mac OS X, hier Yosemite, wird nicht die Steuerungs-Taste, sonder die cmd-Taste (früher "Apfel"-Taste) für die meisten Tastaturkürzel benutzt. Ich denke, bzw. weiß auch eigener Programmiererfahrung, dass dies nicht so schwer zu implementieren ist.
Wer würde das machen?
Am Besten Du und dann stellst Du einen Pull-Request. Hintergrund ist, daß ich weder einen Mac besitze noch weiß, was man dafür tun müßte.
I'm still try to get an overview on the code. There are less comments, so it is not as easy it could be. I found out, that the JMenuHelper.java has the code base for the keystrokes. A simple question, are the shortcuts working under windows and linux?
I need a little bit more background. Do you use a visual design tool for the gui? If the answer is yes, which one?
Posts: 7,532
Threads: 230
Joined: Aug 2007
(11.11.2014, 08:33)ryanthara Wrote: (09.11.2014, 17:09)ryanthara Wrote: Unter Mac OS X, hier Yosemite, wird nicht die Steuerungs-Taste, sonder die cmd-Taste (früher "Apfel"-Taste) für die meisten Tastaturkürzel benutzt. Ich denke, bzw. weiß auch eigener Programmiererfahrung, dass dies nicht so schwer zu implementieren ist.
[..] I found out, that the JMenuHelper.java has the code base for the keystrokes.
That is the correct place. I'm using the JDK standard mechanism: javax.swing.KeyStroke#getKeyStroke
(11.11.2014, 08:33)ryanthara Wrote: A simple question, are the shortcuts working under windows and linux?
Yes
(11.11.2014, 08:33)ryanthara Wrote: I need a little bit more background. Do you use a visual design tool for the gui? If the answer is yes, which one?
I'm using IntelliJ IDEA as indicated in the README and FAQ.
But to solve the problem, we need tips like this and this.
Apple states
Quote:You should make your keyboard shortcuts conditional based on the current platform, because standard shortcuts vary across platforms.
and so RouteConverter should be extended to address this. Keystrokes are defined in the source code
Code: contentPane.registerKeyboardAction(new DialogAction(this) {
public void run() {
cancel();
}
}, getKeyStroke(VK_ESCAPE, 0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
and in resource bundles:
Code: new-file-action=New
new-file-action-mnemonic=N
new-file-action-keystroke=ctrl N
So far, I'm just guessing, that "ctrl N" should be "meta N" on Mac OS X - is that valid?
--
Christian
Posts: 70
Threads: 3
Joined: Nov 2014
(11.11.2014, 14:46)routeconverter Wrote: (11.11.2014, 08:33)ryanthara Wrote: [..] I found out, that the JMenuHelper.java has the code base for the keystrokes.
That is the correct place. I'm using the JDK standard mechanism: javax.swing.KeyStroke#getKeyStroke
In most cases the meta-key is ignored and then set to ctrl.
(11.11.2014, 14:46)routeconverter Wrote: (11.11.2014, 08:33)ryanthara Wrote: A simple question, are the shortcuts working under windows and linux?
Yes
(11.11.2014, 08:33)ryanthara Wrote: I need a little bit more background. Do you use a visual design tool for the gui? If the answer is yes, which one?
I'm using IntelliJ IDEA as indicated in the README and FAQ.
But to solve the problem, we need tips like this and this.
Apple states
Quote:You should make your keyboard shortcuts conditional based on the current platform, because standard shortcuts vary across platforms.
and so RouteConverter should be extended to address this. Keystrokes are defined in the source code
Code: contentPane.registerKeyboardAction(new DialogAction(this) {
public void run() {
cancel();
}
}, getKeyStroke(VK_ESCAPE, 0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
and in resource bundles:
Code: new-file-action=New
new-file-action-mnemonic=N
new-file-action-keystroke=ctrl N
So far, I'm just guessing, that "ctrl N" should be "meta N" on Mac OS X - is that valid?
You are right. On Mac OS X the meta-key, formerly known as apple-key is today titled with cmd.
Posts: 7,532
Threads: 230
Joined: Aug 2007
(12.11.2014, 10:40)ryanthara Wrote: (11.11.2014, 14:46)routeconverter Wrote: So far, I'm just guessing, that "ctrl N" should be "meta N" on Mac OS X - is that valid? You are right. On Mac OS X the meta-key, formerly known as apple-key is today titled with cmd.
I see two alternatives: - Replacing "ctrl" with "meta" on Mac OS X before calling KeyStroke.getKeyStroke() - there are just two places in the code in JMenuHelper that have to be changed
- Defining alternative keystrokes (or accelerators in Apple speech) for Mac OS X, i.e. putting new-file-action-keystroke=meta WHATEVER-IS-MAC-SPECIFIC next to new-file-action-keystroke=ctrl N
What do you think would be the best choice?
--
Christian
Posts: 70
Threads: 3
Joined: Nov 2014
I would prefer the way apple described here in this document.
https://developer.apple.com/library/mac/...001909-SW1
"Do not set menu item accelerators with an explicit javax.swing.KeyStroke specification. Modifier keys vary from platform to platform. Instead, use the java.awt.Tookit.getMenuShortcutKeyMask() method to ask the system for the appropriate key rather than defining it manually.
When calling this method, the current platform’s Toolkit implementation returns the proper mask. For example, in the case of adding a Copy item to a menu, using getMenuShortcutKeyMask means that you can replace the complexity of Listing 1 with the simplicity of Listing 2."
Posts: 7,532
Threads: 230
Joined: Aug 2007
I'd prefer this too, but all key strokes are defined within resource bundles next to their mnemonics, icons and localization texts. Search RouteConverter.properties for
open-action=Open...
open-action-mnemonic=O
open-action-keystroke=ctrl O
open-action-icon=slash/navigation/converter/gui/open-action.png
to understand the pattern. So I was searching for a way to combine this definition of actions with Tookit.getMenuShortcutKeyMask() - but the only examples that Google spills out are these very simple one liners.
--
Christian
Posts: 7,532
Threads: 230
Joined: Aug 2007
I've started pushing Mac OS X specific enhancements to the 'better-mac-os-x-integration' branch. Please have a look at them and validate them on Mac OS X.
--
Christian
Posts: 70
Threads: 3
Joined: Nov 2014
I'll do it in the nearby future. I'm finishing my tool and then will test the better-mac-os-x-integration
|