Changeset 6557 in josm for trunk/src


Ignore:
Timestamp:
2013-12-28T23:23:40+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #3722 - fix shortcuts for "next photo" and "previous photo" after a tag is set

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r6546 r6557  
    446446        tagTable.getActionMap().put("onTableInsert",addAction);
    447447
    448         // unassign some standard shortcuts for JTable to allow upload / download
     448        // unassign some standard shortcuts for JTable to allow upload / download / image browsing
    449449        InputMapUtils.unassignCtrlShiftUpDown(tagTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
     450        InputMapUtils.unassignPageUpDown(tagTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    450451
    451452        // unassign some standard shortcuts for correct copy-pasting, fix #8508
  • trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java

    r6362 r6557  
    2222    }
    2323   
     24    /**
     25     * Unassign Ctrl-Shift/Alt-Shift Up/Down from the given component
     26     * to allow global JOSM shortcuts to work in this component.
     27     * @param cmp The Swing component
     28     * @param condition one of the following values:
     29     * <ul>
     30     * <li>JComponent.FOCUS_INPUTMAP_CREATED
     31     * <li>JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
     32     * <li>JComponent.WHEN_IN_FOCUSED_WINDOW
     33     * </ul>
     34     */
    2435    public static void unassignCtrlShiftUpDown(JComponent cmp, int condition) {
    2536        InputMap inputMap=SwingUtilities.getUIInputMap(cmp, condition);
     
    2940        inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,InputEvent.ALT_MASK|InputEvent.SHIFT_MASK));
    3041        SwingUtilities.replaceUIInputMap(cmp,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,inputMap);
     42    }
     43
     44    /**
     45     * Unassign PageUp/PageDown from the given component
     46     * to allow global JOSM shortcuts to work in this component.
     47     * @param cmp The Swing component
     48     * @param condition one of the following values:
     49     * <ul>
     50     * <li>JComponent.FOCUS_INPUTMAP_CREATED
     51     * <li>JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
     52     * <li>JComponent.WHEN_IN_FOCUSED_WINDOW
     53     * </ul>
     54     * @since 6557
     55     */
     56    public static void unassignPageUpDown(JComponent cmp, int condition) {
     57        InputMap inputMap = SwingUtilities.getUIInputMap(cmp, condition);
     58        inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0));
     59        inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0));
     60        SwingUtilities.replaceUIInputMap(cmp, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);
    3161    }
    3262
Note: See TracChangeset for help on using the changeset viewer.