- Timestamp:
- 2008-10-23T11:25:14+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r1023 r1050 68 68 69 69 public AboutAction() { 70 super(tr("About"), "about", tr("Display the about screen."), ShortCut.registerShortCut("system:about", tr("About..."), KeyEvent.VK_F1, ShortCut.GROUP_DIRECT ), true);70 super(tr("About"), "about", tr("Display the about screen."), ShortCut.registerShortCut("system:about", tr("About..."), KeyEvent.VK_F1, ShortCut.GROUP_DIRECT, ShortCut.SHIFT), true); 71 71 } 72 72 -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r1023 r1050 36 36 public CreateCircleAction() { 37 37 super(tr("Create Circle"), "createcircle", tr("Create a circle from three selected nodes."), 38 ShortCut.registerShortCut("tools:createcircle", tr("Tool: Create circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT ), true);38 ShortCut.registerShortCut("tools:createcircle", tr("Tool: Create circle"), KeyEvent.VK_O, ShortCut.GROUP_EDIT, ShortCut.SHIFT), true); 39 39 } 40 40 -
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r1023 r1050 27 27 super(tr("Paste Tags"), "pastetags", 28 28 tr("Apply tags of contents of paste buffer to all selected items."), 29 ShortCut.registerShortCut("system:pastestyle", tr("Edit: Paste tags"), KeyEvent.VK_V, ShortCut.GROUP_MENU ), true);29 ShortCut.registerShortCut("system:pastestyle", tr("Edit: Paste tags"), KeyEvent.VK_V, ShortCut.GROUP_MENU, ShortCut.SHIFT_CTRL), true); 30 30 DataSet.selListeners.add(this); 31 31 copyAction.addListener(this); -
trunk/src/org/openstreetmap/josm/actions/SaveAsAction.java
r1047 r1050 23 23 public SaveAsAction(Layer layer) { 24 24 super(tr("Save as ..."), "save_as", tr("Save the current data to a new file."), 25 ShortCut.registerShortCut("system:saveas", tr("File: Save as..."), KeyEvent.VK_S, ShortCut.GROUP_MENU ), layer);25 ShortCut.registerShortCut("system:saveas", tr("File: Save as..."), KeyEvent.VK_S, ShortCut.GROUP_MENU, ShortCut.SHIFT_CTRL), layer); 26 26 } 27 27 -
trunk/src/org/openstreetmap/josm/actions/UnselectAllAction.java
r1047 r1050 21 21 // Add extra shortcut C-S-a 22 22 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 23 ShortCut.registerShortCut("edit:unselectall2", tr("Edit: Unselect all (2)"), KeyEvent.VK_A, ShortCut.GROUP_MENU).getKeyStroke(), 23 ShortCut.registerShortCut("edit:unselectall2", tr("Edit: Unselect all (2)"), 24 KeyEvent.VK_A, ShortCut.GROUP_MENU, ShortCut.SHIFT_CTRL).getKeyStroke(), 24 25 tr("Unselect All")); 25 26 -
trunk/src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java
r1023 r1050 11 11 public AudioSlowerAction() { 12 12 super(tr("Slower"), "audio-slower", tr("Slower Forward"), 13 ShortCut.registerShortCut("audio:slower", tr("Audio: Slower"), KeyEvent.VK_F 9, ShortCut.GROUP_DIRECT), true);13 ShortCut.registerShortCut("audio:slower", tr("Audio: Slower"), KeyEvent.VK_F4, ShortCut.GROUP_DIRECT), true); 14 14 } 15 15 } -
trunk/src/org/openstreetmap/josm/tools/ShortCut.java
r1023 r1050 29 29 */ 30 30 public class ShortCut { 31 public static final int SHIFT = KeyEvent.SHIFT_DOWN_MASK; 32 public static final int CTRL = KeyEvent.CTRL_DOWN_MASK; 33 public static final int SHIFT_CTRL = KeyEvent.SHIFT_DOWN_MASK|KeyEvent.CTRL_DOWN_MASK; 31 34 private String shortText; // the unique ID of the shortcut 32 35 private String longText; // a human readable description that will be shown in the preferences … … 306 309 int i = 0; 307 310 for (ShortCut sc : ShortCuts.values()) { 308 if (!sc.getAutomatic() && !sc.getReset() ) {311 if (!sc.getAutomatic() && !sc.getReset() && sc.getAssignedUser()) { 309 312 Main.pref.put("shortcut.shortcut."+i, sc.asPrefString()); 310 313 i++; … … 316 319 // this is used to register a shortcut that was read from the preferences 317 320 private static void registerShortCut(ShortCut sc) { 318 if (sc.getAssignedDefault()) { // a 100% default shortcut will go though unchanged -- unless the groups have been reconfigured 319 registerShortCut(sc.getShortText(), sc.getLongText(), sc.getRequestedKey(), sc.getRequestedGroup(), sc); 320 } else if (sc.getAssignedUser()) { // put a user configured shortcut in as-is -- unless there's a conflict 321 ShortCut potentialShortCut = findShortcut(sc.getAssignedKey(), sc.getAssignedModifier()); 322 if (potentialShortCut == null) { 323 ShortCuts.put(sc.getShortText(), sc); 324 } else { 325 registerShortCut(sc.getShortText(), sc.getLongText(), sc.getRequestedKey(), sc.getRequestedGroup(), sc); 326 } 327 } else { // this shortcut was auto-moved before, re-register and warn if it changes 328 registerShortCut(sc.getShortText(), sc.getLongText(), sc.getRequestedKey(), sc.getRequestedGroup(), sc); 329 } 321 registerShortCut(sc.getShortText(), sc.getLongText(), sc.getRequestedKey(), sc.getRequestedGroup(), sc.getAssignedModifier(), sc); 330 322 } 331 323 … … 367 359 * constants defined above. 368 360 */ 361 public static ShortCut registerShortCut(String shortText, String longText, int requestedKey, int requestedGroup, int modifier) { 362 return registerShortCut(shortText, longText, requestedKey, requestedGroup, modifier, null); 363 } 369 364 public static ShortCut registerShortCut(String shortText, String longText, int requestedKey, int requestedGroup) { 370 return registerShortCut(shortText, longText, requestedKey, requestedGroup, null); 365 return registerShortCut(shortText, longText, requestedKey, requestedGroup, null, null); 366 } 367 368 private static ShortCut registerShortCut(String shortText, String longText, int requestedKey, int requestedGroup, 369 ShortCut originalShortCut) { 370 return registerShortCut(shortText, longText, requestedKey, requestedGroup, null, originalShortCut); 371 371 } 372 372 … … 376 376 // read from the preferences file). New shortcuts will never warn, even when they land on some funny 377 377 // random fallback key like Ctrl+Alt+Shift+Z for "File Open..." <g> 378 private static ShortCut registerShortCut(String shortText, String longText, int requestedKey, int requestedGroup, ShortCut originalShortCut) { 378 private static ShortCut registerShortCut(String shortText, String longText, int requestedKey, int requestedGroup, Integer modifier, 379 ShortCut originalShortCut) { 379 380 doInit(); 380 381 if (ShortCuts.containsKey(shortText)) { // a re-register? maybe a sc already read from the preferences? … … 384 385 } 385 386 Integer defaultModifier = Groups.get(requestedGroup + GROUPS_DEFAULT); 386 if (defaultModifier == null) { // garbage in, no shortcurt out 387 if(modifier != null) { 388 defaultModifier = modifier; 389 } 390 else if (defaultModifier == null) { // garbage in, no shortcurt out 387 391 defaultModifier = Groups.get(GROUP_NONE + GROUPS_DEFAULT); 388 392 }
Note:
See TracChangeset
for help on using the changeset viewer.