Changeset 7606 in josm
- Timestamp:
- 2014-10-07T02:37:12+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r7590 r7606 116 116 contentPane.getActionMap().put("MapMover.Zoomer.down", new ZoomerAction("down")); 117 117 118 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 119 Shortcut.registerShortcut("view:zoominalternate", tr("Map: {0}", tr("Zoom in")), KeyEvent.VK_COMMA, Shortcut.CTRL).getKeyStroke(), 120 "MapMover.Zoomer.in"); 121 contentPane.getActionMap().put("MapMover.Zoomer.in", new ZoomerAction(",")); 122 123 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 124 Shortcut.registerShortcut("view:zoomoutalternate", tr("Map: {0}", tr("Zoom out")), KeyEvent.VK_PERIOD, Shortcut.CTRL).getKeyStroke(), 125 "MapMover.Zoomer.out"); 126 contentPane.getActionMap().put("MapMover.Zoomer.out", new ZoomerAction(".")); 118 // see #10592 - Disable these alternate shortcuts on OS X because of conflict with system shortcut 119 if (!Main.isPlatformOsx()) { 120 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 121 Shortcut.registerShortcut("view:zoominalternate", tr("Map: {0}", tr("Zoom in")), KeyEvent.VK_COMMA, Shortcut.CTRL).getKeyStroke(), 122 "MapMover.Zoomer.in"); 123 contentPane.getActionMap().put("MapMover.Zoomer.in", new ZoomerAction(",")); 124 125 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 126 Shortcut.registerShortcut("view:zoomoutalternate", tr("Map: {0}", tr("Zoom out")), KeyEvent.VK_PERIOD, Shortcut.CTRL).getKeyStroke(), 127 "MapMover.Zoomer.out"); 128 contentPane.getActionMap().put("MapMover.Zoomer.out", new ZoomerAction(".")); 129 } 127 130 } 128 131 } -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r7539 r7606 413 413 Shortcut conflict = findShortcut(requestedKey, defaultModifier); 414 414 if (conflict != null) { 415 if (Main.isPlatformOsx()) { 416 // Try to reassign Meta to Ctrl 417 int newmodifier = findNewOsxModifier(requestedGroup); 418 if ( findShortcut(requestedKey, newmodifier) == null ) { 419 return reassignShortcut(shortText, longText, requestedKey, conflict, requestedGroup, requestedKey, newmodifier); 420 } 421 } 415 422 for (int m : mods) { 416 423 for (int k : keys) { 417 424 int newmodifier = getGroupModifier(m); 418 425 if ( findShortcut(k, newmodifier) == null ) { 419 Shortcut newsc = new Shortcut(shortText, longText, requestedKey, m, k, newmodifier, false, false); 420 Main.info(tr("Silent shortcut conflict: ''{0}'' moved by ''{1}'' to ''{2}''.", 421 shortText, conflict.getShortText(), newsc.getKeyText())); 422 newsc.saveDefault(); 423 shortcuts.put(shortText, newsc); 424 return newsc; 426 return reassignShortcut(shortText, longText, requestedKey, conflict, m, k, newmodifier); 425 427 } 426 428 } … … 436 438 } 437 439 440 private static int findNewOsxModifier(int requestedGroup) { 441 switch (requestedGroup) { 442 case CTRL: return KeyEvent.CTRL_DOWN_MASK; 443 case ALT_CTRL: return KeyEvent.ALT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK; 444 case CTRL_SHIFT: return KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK; 445 case ALT_CTRL_SHIFT: return KeyEvent.ALT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK; 446 default: return 0; 447 } 448 } 449 450 private static Shortcut reassignShortcut(String shortText, String longText, int requestedKey, Shortcut conflict, 451 int m, int k, int newmodifier) { 452 Shortcut newsc = new Shortcut(shortText, longText, requestedKey, m, k, newmodifier, false, false); 453 Main.info(tr("Silent shortcut conflict: ''{0}'' moved by ''{1}'' to ''{2}''.", 454 shortText, conflict.getShortText(), newsc.getKeyText())); 455 newsc.saveDefault(); 456 shortcuts.put(shortText, newsc); 457 return newsc; 458 } 459 438 460 /** 439 461 * Replies the platform specific key stroke for the 'Copy' command, i.e.
Note:
See TracChangeset
for help on using the changeset viewer.