Changeset 14017 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/KeyboardUtils.java
r14016 r14017 181 181 } else if (!"LU".equals(l.getCountry())) { 182 182 // France and Belgium, https://en.wikipedia.org/wiki/AZERTY 183 result.add('²'); // 10000B2183 result.add('²'); 184 184 } 185 185 // BÉPO, https://en.wikipedia.org/wiki/Keyboard_layout#B%C3%89PO … … 202 202 case "de": // German 203 203 // https://en.wikipedia.org/wiki/German_keyboard_layout 204 result.add( '^');204 result.add((char) KeyEvent.VK_DEAD_CIRCUMFLEX); 205 205 break; 206 206 case "cs": // Czech … … 213 213 // Hungary, https://en.wikipedia.org/wiki/QWERTZ#Hungary 214 214 result.add('0'); 215 break;216 case "pl": // Polish217 // Poland, https://en.wikipedia.org/wiki/QWERTZ#Poland218 result.add('µ');219 result.add('^');220 result.add('˛'); // https://en.wikipedia.org/wiki/Ogonek221 215 break; 222 216 case "bs": // Bosnian … … 243 237 case "et": // Estonian 244 238 // https://en.wikipedia.org/wiki/QWERTY#Estonian 245 result.add( 'ˇ'); // https://en.wikipedia.org/wiki/Caron239 result.add((char) KeyEvent.VK_DEAD_CARON); // https://en.wikipedia.org/wiki/Caron 246 240 break; 247 241 case "is": // Icelandic 248 242 // https://en.wikipedia.org/wiki/Icelandic_keyboard_layout 249 243 result.add('°'); // https://en.wikipedia.org/wiki/Ring_(diacritic) 244 // FIXME It doesn't work with Java 8: [KEY_PRESSED,keyCode=0,keyChar=Undefined keyChar,extendedKeyCode=0x0] 250 245 break; 251 246 case "es": // Spanish … … 290 285 // https://en.wikipedia.org/wiki/QWERTY#Spain,_also_known_as_Spanish_(International_sort) 291 286 result.add('º'); // https://en.wikipedia.org/wiki/Ordinal_indicator 287 // FIXME It doesn't work with Java 8: [KEY_PRESSED,keyCode=0,keyChar=Undefined keyChar,extendedKeyCode=0x0] 292 288 break; 293 289 default: … … 303 299 // Add default US QWERTY keys, https://en.wikipedia.org/wiki/QWERTY 304 300 // Works also for Dvorak, https://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard 305 result.add('`'); 306 result.add( '~');301 result.add('`'); // On US QWERTY, this is not a dead key 302 result.add((char) KeyEvent.VK_DEAD_GRAVE); // On International QWERTY, this is a dead key 307 303 return result; 308 304 } -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r14013 r14017 462 462 new StringBuilder(shortText).append(" (").append(i).append(')').toString(), longText, 463 463 // Add extended keyCode if not a regular one 464 regularKeyCodes.containsKey(code) ? regularKeyCodes.get(code) : c | KeyboardUtils.EXTENDED_KEYCODE_FLAG, 464 regularKeyCodes.containsKey(code) ? regularKeyCodes.get(code) : 465 isDeadKey(code) ? code : c | KeyboardUtils.EXTENDED_KEYCODE_FLAG, 465 466 requestedGroup)); 466 467 i++; 467 468 } 468 469 return result; 470 } 471 472 static boolean isDeadKey(int keyCode) { 473 return KeyEvent.VK_DEAD_GRAVE <= keyCode && keyCode <= KeyEvent.VK_DEAD_SEMIVOICED_SOUND; 469 474 } 470 475 -
trunk/test/unit/org/openstreetmap/josm/tools/KeyboardUtilsTest.java
r14012 r14017 4 4 import static org.junit.Assert.assertEquals; 5 5 6 import java.awt.event.KeyEvent; 6 7 import java.util.Arrays; 7 8 import java.util.LinkedHashMap; … … 53 54 @Test 54 55 public void testgetCharactersForKeyE00() { 55 testgetCharactersForKeyE00("ar", 'ذ', '>', '`', '~'); 56 testgetCharactersForKeyE00("fr_FR", '²', '$', '`', '~'); 57 testgetCharactersForKeyE00("fr_CA", '#', '$', '/', '`', '~'); 58 testgetCharactersForKeyE00("sq", '\\', '`', '~'); 59 testgetCharactersForKeyE00("it", '\\', '`', '~'); 60 testgetCharactersForKeyE00("pt", '\\', '`', '~'); 61 testgetCharactersForKeyE00("pt_BR", '\'', '`', '~'); 62 testgetCharactersForKeyE00("de", '^', '`', '~'); 63 testgetCharactersForKeyE00("cs", ';', '`', '~'); 64 testgetCharactersForKeyE00("he", '`', '~'); 65 testgetCharactersForKeyE00("hu", '0', '`', '~'); 66 testgetCharactersForKeyE00("pl", 'µ', '^', '˛', '`', '~'); 67 testgetCharactersForKeyE00("bs", '¸', '`', '~'); 68 testgetCharactersForKeyE00("hr", '¸', '`', '~'); 69 testgetCharactersForKeyE00("sl", '¸', '`', '~'); 70 testgetCharactersForKeyE00("sr", '¸', '`', '~'); 71 testgetCharactersForKeyE00("ro", ']', '`', '~'); 72 testgetCharactersForKeyE00("da", '½', '`', '~'); 73 testgetCharactersForKeyE00("fo", '½', '`', '~'); 74 testgetCharactersForKeyE00("nl", '@', '`', '~'); 75 testgetCharactersForKeyE00("et", 'ˇ', '`', '~'); 76 testgetCharactersForKeyE00("is", '°', '`', '~'); 77 testgetCharactersForKeyE00("es", '|', '`', '~'); 78 testgetCharactersForKeyE00("es_ES", 'º', '`', '~'); 79 testgetCharactersForKeyE00("tr", '"', '*', '`', '~'); 80 testgetCharactersForKeyE00("de_LU", '^', '²', '§', '`', '~'); 81 testgetCharactersForKeyE00("fr_LU", '$', '²', '§', '`', '~'); 82 testgetCharactersForKeyE00("de_CH", '^', '§', '`', '~'); 83 testgetCharactersForKeyE00("fr_CH", '²', '$', '§', '`', '~'); 84 testgetCharactersForKeyE00("de_LI", '^', '§', '`', '~'); 85 testgetCharactersForKeyE00("fi_FI", '§', '`', '~'); 86 testgetCharactersForKeyE00("sv_SE", '§', '`', '~'); 87 testgetCharactersForKeyE00("no_NO", '|', '`', '~'); 88 testgetCharactersForKeyE00("sv_NO", '|', '`', '~'); 56 char deadCircumflex = (char) KeyEvent.VK_DEAD_CIRCUMFLEX; 57 char deadGrave = (char) KeyEvent.VK_DEAD_GRAVE; 58 char deadCaron = (char) KeyEvent.VK_DEAD_CARON; 59 testgetCharactersForKeyE00("ar", 'ذ', '>', '`', deadGrave); 60 testgetCharactersForKeyE00("fr_FR", '²', '$', '`', deadGrave); 61 testgetCharactersForKeyE00("fr_CA", '#', '$', '/', '`', deadGrave); 62 testgetCharactersForKeyE00("sq", '\\', '`', deadGrave); 63 testgetCharactersForKeyE00("it", '\\', '`', deadGrave); 64 testgetCharactersForKeyE00("pt", '\\', '`', deadGrave); 65 testgetCharactersForKeyE00("pt_BR", '\'', '`', deadGrave); 66 testgetCharactersForKeyE00("de", deadCircumflex, '`', deadGrave); 67 testgetCharactersForKeyE00("cs", ';', '`', deadGrave); 68 testgetCharactersForKeyE00("he", '`', deadGrave); 69 testgetCharactersForKeyE00("hu", '0', '`', deadGrave); 70 testgetCharactersForKeyE00("pl", '`', deadGrave); 71 testgetCharactersForKeyE00("bs", '¸', '`', deadGrave); 72 testgetCharactersForKeyE00("hr", '¸', '`', deadGrave); 73 testgetCharactersForKeyE00("sl", '¸', '`', deadGrave); 74 testgetCharactersForKeyE00("sr", '¸', '`', deadGrave); 75 testgetCharactersForKeyE00("ro", ']', '`', deadGrave); 76 testgetCharactersForKeyE00("da", '½', '`', deadGrave); 77 testgetCharactersForKeyE00("fo", '½', '`', deadGrave); 78 testgetCharactersForKeyE00("nl", '@', '`', deadGrave); 79 testgetCharactersForKeyE00("et", deadCaron, '`', deadGrave); 80 testgetCharactersForKeyE00("is", '°', '`', deadGrave); 81 testgetCharactersForKeyE00("es", '|', '`', deadGrave); 82 testgetCharactersForKeyE00("es_ES", 'º', '`', deadGrave); 83 testgetCharactersForKeyE00("tr", '"', '*', '`', deadGrave); 84 testgetCharactersForKeyE00("de_LU", deadCircumflex, '²', '§', '`', deadGrave); 85 testgetCharactersForKeyE00("fr_LU", '$', '²', '§', '`', deadGrave); 86 testgetCharactersForKeyE00("fr_CH", '²', '$', '§', '`', deadGrave); 87 testgetCharactersForKeyE00("de_CH", deadCircumflex, '§', '`', deadGrave); 88 testgetCharactersForKeyE00("de_LI", deadCircumflex, '§', '`', deadGrave); 89 testgetCharactersForKeyE00("fi_FI", '§', '`', deadGrave); 90 testgetCharactersForKeyE00("sv_SE", '§', '`', deadGrave); 91 testgetCharactersForKeyE00("no_NO", '|', '`', deadGrave); 92 testgetCharactersForKeyE00("sv_NO", '|', '`', deadGrave); 89 93 } 90 94
Note:
See TracChangeset
for help on using the changeset viewer.