Changeset 5282 in josm for trunk


Ignore:
Timestamp:
2012-06-17T16:53:49+02:00 (7 years ago)
Author:
akks
Message:

Fix #7751: allow to disable angle snapping toggle on repeating A

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r5223 r5282  
    9797
    9898    private JCheckBoxMenuItem snapCheckboxMenuItem;
     99    private boolean useRepeatedShortcut;
    99100
    100101    public DrawAction(MapFrame mapFrame) {
     
    253254        if (event instanceof KeyEvent) {
    254255            KeyEvent e = (KeyEvent) event;
    255             if (snappingShortcut.isEvent(e) || getShortcut().isEvent(e)) {
     256            if (snappingShortcut.isEvent(e) || (useRepeatedShortcut && getShortcut().isEvent(e))) {
    256257                Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    257258                if (SwingUtilities.getWindowAncestor(focused) instanceof JFrame)
     
    270271    private Timer timer;
    271272    void processKeyEvent(KeyEvent e) {
    272         if (!snappingShortcut.isEvent(e) && !getShortcut().isEvent(e))
     273        if (!snappingShortcut.isEvent(e) && !(useRepeatedShortcut && getShortcut().isEvent(e)))
    273274            return;
    274275       
     
    12781279
    12791280            showAngle = Main.pref.getBoolean("draw.anglesnap.showAngle", true);
     1281            useRepeatedShortcut = Main.pref.getBoolean("draw.anglesnap.toggleOnRepeatedA", true);
    12801282
    12811283            normalStroke = new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
     
    15881590
    15891591        MouseListener anglePopupListener = new PopupMenuLauncher( new JPopupMenu() {
     1592            JCheckBoxMenuItem repeatedCb = new JCheckBoxMenuItem(new AbstractAction(tr("Toggle snapping by {0}", getShortcut().getKeyText())){
     1593                public void actionPerformed(ActionEvent e) {
     1594                    boolean sel=((JCheckBoxMenuItem) e.getSource()).getState();
     1595                    Main.pref.put("draw.anglesnap.toggleOnRepeatedA", sel);
     1596                    init();
     1597                }
     1598            });
    15901599            JCheckBoxMenuItem helperCb = new JCheckBoxMenuItem(new AbstractAction(tr("Show helper geometry")){
    15911600                public void actionPerformed(ActionEvent e) {
     
    16091618                helperCb.setState(Main.pref.getBoolean("draw.anglesnap.drawConstructionGeometry",true));
    16101619                projectionCb.setState(Main.pref.getBoolean("draw.anglesnap.projectionsnapgvff",true));
     1620                repeatedCb.setState(Main.pref.getBoolean("draw.anglesnap.toggleOnRepeatedA",true));
     1621                add(repeatedCb);
    16111622                add(helperCb);
    16121623                add(projectionCb);;
Note: See TracChangeset for help on using the changeset viewer.