Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 4955)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 4956)
@@ -99,22 +99,16 @@
     private SnapHelper snapHelper = new SnapHelper();
 
-    private Shortcut extraShortcut;
     private Shortcut backspaceShortcut;
-    private int snappingKeyCode;
-    
+    private Shortcut snappingShortcut;
+
     private JCheckBoxMenuItem snapCheckboxMenuItem;
-    
-            
+
     public DrawAction(MapFrame mapFrame) {
         super(tr("Draw"), "node/autonode", tr("Draw nodes"),
-                Shortcut.registerShortcut("mapmode:draw", tr("Mode: {0}", tr("Draw")), KeyEvent.VK_A, Shortcut.GROUP_EDIT),
-                mapFrame, ImageProvider.getCursor("crosshair", null));
-
-        // Add extra shortcut N
-        extraShortcut = Shortcut.registerShortcut("mapmode:drawfocus", tr("Mode: Draw Focus"), KeyEvent.VK_N, Shortcut.GROUP_EDIT);
-        Main.registerActionShortcut(this, extraShortcut);
-
-        snappingKeyCode = Shortcut.registerShortcut("mapmode:drawanglesnapping", tr("Mode: Draw Angle snapping"), KeyEvent.VK_TAB, Shortcut.GROUP_EDIT)
-                .getKeyStroke().getKeyCode();
+            Shortcut.registerShortcut("mapmode:draw", tr("Mode: {0}", tr("Draw")), KeyEvent.VK_A, Shortcut.GROUP_EDIT),
+            mapFrame, ImageProvider.getCursor("crosshair", null));
+
+        snappingShortcut = Shortcut.registerShortcut("mapmode:drawanglesnapping",
+            tr("Mode: Draw Angle snapping"), KeyEvent.VK_TAB, Shortcut.GROUP_EDIT);
         addMenuItem();
         snapHelper.setMenuCheckBox(snapCheckboxMenuItem);
@@ -128,5 +122,5 @@
             JMenuItem item = Main.main.menu.editMenu.getItem(i);
             if (item!=null && item.getAction() !=null && item.getAction() instanceof SnapChangeAction) {
-                Main.main.menu.editMenu.remove(i); 
+                Main.main.menu.editMenu.remove(i);
             }
         }
@@ -139,5 +133,6 @@
     private void redrawIfRequired() {
         updateStatusLine();
-        if ((!drawHelperLine || wayIsFinished) && !drawTargetHighlight) return;
+        if ((!drawHelperLine || wayIsFinished) && !drawTargetHighlight)
+            return;
         // update selection to reflect which way being modified
         if (currentBaseNode != null && getCurrentDataSet().getSelected().isEmpty() == false) {
@@ -155,5 +150,6 @@
     }
 
-    @Override public void enterMode() {
+    @Override
+    public void enterMode() {
         if (!isEnabled())
             return;
@@ -165,17 +161,18 @@
         snapHelper.init();
         snapCheckboxMenuItem.getAction().setEnabled(true);
-        
+
          timer = new Timer(0, new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent ae) {
-                 timer.stop();
-                 if (set.remove(releaseEvent.getKeyCode())) {
-                   doKeyReleaseEvent(releaseEvent);
-                 }
+                timer.stop();
+                if (set.remove(releaseEvent.getKeyCode())) {
+                    doKeyReleaseEvent(releaseEvent);
+                }
             }
 
         });
-       Main.map.statusLine.getAnglePanel().addMouseListener(snapHelper.anglePopupListener);
-        backspaceShortcut = Shortcut.registerShortcut("mapmode:backspace", tr("Backspace in Add mode"), KeyEvent.VK_BACK_SPACE, Shortcut.GROUP_EDIT);
+        Main.map.statusLine.getAnglePanel().addMouseListener(snapHelper.anglePopupListener);
+        backspaceShortcut = Shortcut.registerShortcut("mapmode:backspace",
+            tr("Backspace in Add mode"), KeyEvent.VK_BACK_SPACE, Shortcut.GROUP_EDIT);
         Main.registerActionShortcut(new BackSpaceAction(), backspaceShortcut);
 
@@ -193,5 +190,6 @@
     }
 
-    @Override public void exitMode() {
+    @Override
+    public void exitMode() {
         super.exitMode();
         Main.map.mapView.removeMouseListener(this);
@@ -203,5 +201,5 @@
         snapCheckboxMenuItem.getAction().setEnabled(false);
         Main.map.statusLine.getAnglePanel().removeMouseListener(snapHelper.anglePopupListener);
-        
+
         removeHighlighting();
         try {
@@ -226,5 +224,5 @@
             return;
         if (event instanceof KeyEvent) {
-                processKeyEvent((KeyEvent) event);
+            processKeyEvent((KeyEvent) event);
         } //  toggle angle snapping
         updateKeyModifiers((InputEvent) event);
@@ -233,46 +231,46 @@
         redrawIfRequired();
     }
-    
-    
-    // events for crossplatform key holding processing 
-    // thanks to http://www.arco.in-berlin.de/keyevent.html 
+
+    // events for crossplatform key holding processing
+    // thanks to http://www.arco.in-berlin.de/keyevent.html
     private final TreeSet<Integer> set = new TreeSet<Integer>();
     private KeyEvent releaseEvent;
     private Timer timer;
     void processKeyEvent(KeyEvent e) {
-        if (e.getKeyCode() != snappingKeyCode) return;
-        //e.consume(); // ticket #7250 -  TAB should work in other windows
+        if (!snappingShortcut.isEvent(e))
+            return;
 
         if (e.getID() == KeyEvent.KEY_PRESSED) {
-             if (timer.isRunning()) {
-                  timer.stop();
-                } else {
-                  if (set.add((e.getKeyCode()))) doKeyPressEvent(e);
-                }
-             
-        }
-        if (e.getID() == KeyEvent.KEY_RELEASED) {
             if (timer.isRunning()) {
-              timer.stop();
-               if (set.remove(e.getKeyCode())) {
-                  doKeyReleaseEvent(e);
-               }
+                timer.stop();
+            } else if (set.add((e.getKeyCode()))) {
+                doKeyPressEvent(e);
+            }
+        } else if (e.getID() == KeyEvent.KEY_RELEASED) {
+            if (timer.isRunning()) {
+                timer.stop();
+                if (set.remove(e.getKeyCode())) {
+                    doKeyReleaseEvent(e);
+                }
             } else {
-              releaseEvent = e;
-              timer.restart();
-            }
-        }
-        
-    }
-    
+                releaseEvent = e;
+                timer.restart();
+            }
+        }
+    }
+
     private void doKeyPressEvent(KeyEvent e) {
-        if (e.getKeyCode() != snappingKeyCode) return;
+        if (!snappingShortcut.isEvent(e))
+            return;
         snapHelper.setFixedMode();
-        computeHelperLine(); redrawIfRequired();
+        computeHelperLine();
+        redrawIfRequired();
     }
     private void doKeyReleaseEvent(KeyEvent e) {
-        if (e.getKeyCode() != snappingKeyCode) return;
+        if (!snappingShortcut.isEvent(e))
+            return;
         snapHelper.unFixOrTurnOff();
-        computeHelperLine(); redrawIfRequired();
+        computeHelperLine();
+        redrawIfRequired();
     }
 
@@ -306,5 +304,5 @@
         Main.map.selectSelectTool(true);
         snapHelper.noSnapNow();
-    
+
         // Redraw to remove the helper line stub
         computeHelperLine();
@@ -321,5 +319,5 @@
         }
     }
-    
+
     /**
      * If user clicked with the left button, add a node at the current mouse
@@ -348,5 +346,5 @@
         //
         Main.map.mapView.requestFocus();
-        
+
         if(e.getClickCount() > 1 && mousePos != null && mousePos.equals(oldMousePos)) {
             // A double click equals "user clicked last node again, finish way"
@@ -357,5 +355,5 @@
         }
         oldMousePos = mousePos;
-        
+
         // we copy ctrl/alt/shift from the event just in case our global
         // AWTEvent didn't make it through the security manager. Unclear
@@ -401,5 +399,5 @@
                 EastNorth foundPoint = n.getEastNorth();
                 // project found node to snapping line
-                newEN = snapHelper.getSnapPoint(foundPoint); 
+                newEN = snapHelper.getSnapPoint(foundPoint);
                 if (foundPoint.distance(newEN) > 1e-4) {
                     n = new Node(newEN); // point != projected, so we create new node
@@ -418,8 +416,8 @@
             if (n.getCoor().isOutSideWorld()) {
                 JOptionPane.showMessageDialog(
-                        Main.parent,
-                        tr("Cannot add a node outside of the world."),
-                        tr("Warning"),
-                        JOptionPane.WARNING_MESSAGE
+                    Main.parent,
+                    tr("Cannot add a node outside of the world."),
+                    tr("Warning"),
+                    JOptionPane.WARNING_MESSAGE
                 );
                 return;
@@ -428,15 +426,15 @@
 
             if (!ctrl) {
-                    // Insert the node into all the nearby way segments
-                    List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
-                            Main.map.mapView.getPoint(n), OsmPrimitive.isSelectablePredicate);
-                    if (snapHelper.isActive()) { // 
-                        tryToMoveNodeOnIntersection(wss,n);
-                    }
-                    insertNodeIntoAllNearbySegments(wss, n, newSelection, cmds, replacedWays, reuseWays);
-                    }
+                // Insert the node into all the nearby way segments
+                List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
+                    Main.map.mapView.getPoint(n), OsmPrimitive.isSelectablePredicate);
+                if (snapHelper.isActive()) {
+                    tryToMoveNodeOnIntersection(wss,n);
+                }
+                insertNodeIntoAllNearbySegments(wss, n, newSelection, cmds, replacedWays, reuseWays);
+            }
         }
         // now "n" is newly created or reused node that shoud be added to some way
-        
+
         // This part decides whether or not a "segment" (i.e. a connection) is made to an
         // existing node.
@@ -588,5 +586,5 @@
         redrawIfRequired();
     }
-    
+
     private void insertNodeIntoAllNearbySegments(List<WaySegment> wss, Node n, Collection<OsmPrimitive> newSelection, Collection<Command> cmds, ArrayList<Way> replacedWays, ArrayList<Way> reuseWays) {
         Map<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
@@ -613,6 +611,5 @@
             pruneSuccsAndReverse(is);
             for (int i : is) {
-                segSet.add(
-                        Pair.sort(new Pair<Node,Node>(w.getNode(i), w.getNode(i+1))));
+                segSet.add(Pair.sort(new Pair<Node,Node>(w.getNode(i), w.getNode(i+1))));
             }
             for (int i : is) {
@@ -636,5 +633,4 @@
         adjustNode(segSet, n);
     }
-
 
     /**
@@ -698,9 +694,11 @@
     }
 
-    @Override public void mouseDragged(MouseEvent e) {
+    @Override
+    public void mouseDragged(MouseEvent e) {
         mouseMoved(e);
     }
 
-    @Override public void mouseMoved(MouseEvent e) {
+    @Override
+    public void mouseMoved(MouseEvent e) {
         if(!Main.map.mapView.isActiveLayerDrawable())
             return;
@@ -767,5 +765,5 @@
         determineCurrentBaseNodeAndPreviousNode(selection);
         if (previousNode == null) snapHelper.noSnapNow();
-        
+
         if (currentBaseNode == null || currentBaseNode == currentMouseNode)
             return; // Don't create zero length way segments.
@@ -773,17 +771,14 @@
 
         double curHdg = Math.toDegrees(currentBaseNode.getEastNorth()
-                .heading(currentMouseEastNorth));
+            .heading(currentMouseEastNorth));
         double baseHdg=-1;
         if (previousNode != null) {
             baseHdg =  Math.toDegrees(previousNode.getEastNorth()
-                    .heading(currentBaseNode.getEastNorth()));
-        }
-     
+                .heading(currentBaseNode.getEastNorth()));
+        }
+
         snapHelper.checkAngleSnapping(currentMouseEastNorth,baseHdg, curHdg);
 
         // status bar was filled by snapHelper
-        
-        // Now done in redrawIfRequired()
-        //updateStatusLine();
     }
 
@@ -794,7 +789,7 @@
     }
 
-    /** 
-     * Helper function that sets fields currentBaseNode and previousNode 
-     * @param selection 
+    /**
+     * Helper function that sets fields currentBaseNode and previousNode
+     * @param selection
      * uses also lastUsedNode field
      */
@@ -804,8 +799,10 @@
         for (OsmPrimitive p : selection) {
             if (p instanceof Node) {
-                if (selectedNode != null) return;
+                if (selectedNode != null)
+                    return;
                 selectedNode = (Node) p;
             } else if (p instanceof Way) {
-                if (selectedWay != null) return;
+                if (selectedWay != null)
+                    return;
                 selectedWay = (Way) p;
             }
@@ -835,5 +832,5 @@
             if (selectedNode == selectedWay.lastNode()) {
                 currentBaseNode = selectedNode;
-                if (selectedWay.getNodesCount()>1) 
+                if (selectedWay.getNodesCount()>1)
                     previousNode = selectedWay.getNode(selectedWay.getNodesCount()-2);
             }
@@ -879,6 +876,4 @@
 
     private static void pruneSuccsAndReverse(List<Integer> is) {
-        //if (is.size() < 2) return;
-
         HashSet<Integer> is2 = new HashSet<Integer>();
         for (int i : is) {
@@ -929,5 +924,6 @@
             // In practice this will probably only happen when a way has been duplicated
 
-            if (u == 0) return;
+            if (u == 0)
+                return;
 
             // q is a number between 0 and 1
@@ -950,5 +946,4 @@
                 return;
             }
-
         default:
             EastNorth P = n.getEastNorth();
@@ -970,14 +965,15 @@
 
     private void tryToMoveNodeOnIntersection(List<WaySegment> wss, Node n) {
-        if (wss.isEmpty()) return;
+        if (wss.isEmpty())
+            return;
         WaySegment ws = wss.get(0);
         EastNorth p1=ws.getFirstNode().getEastNorth();
         EastNorth p2=ws.getSecondNode().getEastNorth();
-	if (snapHelper.dir2!=null && currentBaseNode!=null) {
+        if (snapHelper.dir2!=null && currentBaseNode!=null) {
             EastNorth xPoint = Geometry.getSegmentSegmentIntersection(p1, p2, snapHelper.dir2, currentBaseNode.getEastNorth());
             if (xPoint!=null) n.setEastNorth(xPoint);
         }
     }
-/**
+    /**
      * Takes the data from computeHelperLine to determine which ways/nodes should be highlighted
      * (if feature enabled). Also sets the target cursor if appropriate.
@@ -1011,5 +1007,5 @@
             Main.map.mapView.setNewCursor(cursor, this);
             return;
-    }
+        }
 
         Main.map.mapView.setNewCursor(cursorJoinWay, this);
@@ -1032,25 +1028,24 @@
         oldHighlights = new HashSet<OsmPrimitive>();
     }
-    
+
     public void paint(Graphics2D g, MapView mv, Bounds box) {
         // sanity checks
-        if (Main.map.mapView == null) return;
-        if (mousePos == null) return;
-
+        if (Main.map.mapView == null || mousePos == null
         // don't draw line if we don't know where from or where to
-        if (currentBaseNode == null || currentMouseEastNorth == null) return;
-
+        || currentBaseNode == null || currentMouseEastNorth == null
         // don't draw line if mouse is outside window
-        if (!Main.map.mapView.getBounds().contains(mousePos)) return;
-        
+        || !Main.map.mapView.getBounds().contains(mousePos))
+            return;
+
         Graphics2D g2 = g;
         snapHelper.drawIfNeeded(g2,mv);
-        if (!drawHelperLine || wayIsFinished || shift) return;
-        
+        if (!drawHelperLine || wayIsFinished || shift)
+          return;
+
         if (!snapHelper.isActive()) { // else use color and stoke from  snapHelper.draw
             g2.setColor(selectedColor);
             g2.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-        } else {
-            if (!snapHelper.drawConstructionGeometry) return;
+        } else if (!snapHelper.drawConstructionGeometry) {
+            return;
         }
         GeneralPath b = new GeneralPath();
@@ -1072,5 +1067,6 @@
     }
 
-    @Override public String getModeHelpText() {
+    @Override
+    public String getModeHelpText() {
         String rv = "";
         /*
@@ -1149,5 +1145,6 @@
     }
 
-    @Override public boolean layerIsSupported(Layer l) {
+    @Override
+    public boolean layerIsSupported(Layer l) {
         return l instanceof OsmDataLayer;
     }
@@ -1161,5 +1158,4 @@
     public void destroy() {
         super.destroy();
-        Main.unregisterActionShortcut(extraShortcut);
     }
 
@@ -1170,5 +1166,5 @@
             Main.main.undoRedo.undo();
             Node n=null;
-            Command lastCmd=Main.main.undoRedo.commands.peekLast();  
+            Command lastCmd=Main.main.undoRedo.commands.peekLast();
             if (lastCmd==null) return;
             for (OsmPrimitive p: lastCmd.getParticipatingPrimitives()) {
@@ -1181,41 +1177,42 @@
                     // we have no way to continue, so we forget about found node
                         n=null;
-                        break; 
+                        break;
                     }
                 }
             }
-            // select last added node - maybe we will continue drawing from it 
+            // select last added node - maybe we will continue drawing from it
             if (n!=null) getCurrentDataSet().addSelected(n);
        }
- }
+    }
 
     private class SnapHelper {
         boolean snapOn; // snapping is turned on
-        
+
         private boolean active; // snapping is active for current mouse position
         private boolean fixed; // snap angle is fixed
-        private boolean absoluteFix; // snap angle is absolute 
-        
-        private boolean drawConstructionGeometry; 
-        private boolean showProjectedPoint; 
-        private boolean showAngle; 
+        private boolean absoluteFix; // snap angle is absolute
+
+        private boolean drawConstructionGeometry;
+        private boolean showProjectedPoint;
+        private boolean showAngle;
 
         private boolean snapToProjections;
-        
+
         EastNorth dir2;
         EastNorth projected;
         String labelText;
         double lastAngle;
+
         double customBaseHeading=-1; // angle of base line, if not last segment)
         private EastNorth segmentPoint1; // remembered first point of base segment
         private EastNorth segmentPoint2; // remembered second point of base segment
         private EastNorth projectionSource; // point that we are projecting to the line
-                
-        double snapAngles[]; 
-        double snapAngleTolerance; 
-        
+
+        double snapAngles[];
+        double snapAngleTolerance;
+
         double pe,pn; // (pe,pn) - direction of snapping line
         double e0,n0; // (e0,n0) - origin of snapping line
-        
+
         final String fixFmt="%d "+tr("FIX");
         Color snapHelperColor;
@@ -1225,15 +1222,15 @@
         private Stroke helperStroke;
         private Stroke highlightStroke;
-        
+
         JCheckBoxMenuItem checkBox;
-        
+
         public void init() {
             snapOn=false;
             checkBox.setState(snapOn);
             fixed=false; absoluteFix=false;
-                        
-            Collection<String> angles = Main.pref.getCollection("draw.anglesnap.angles", 
-                    Arrays.asList("0","30","45","60","90","120","135","150","180"));
-            
+
+            Collection<String> angles = Main.pref.getCollection("draw.anglesnap.angles",
+                Arrays.asList("0","30","45","60","90","120","135","150","180"));
+
             snapAngles = new double[2*angles.size()];
             int i=0;
@@ -1246,5 +1243,5 @@
                     snapAngles[i]=0;i++;
                     snapAngles[i]=0;i++;
-                } 
+                }
             }
             snapAngleTolerance = Main.pref.getDouble("draw.anglesnap.tolerance", 5.0);
@@ -1258,25 +1255,24 @@
             snapHelperColor = Main.pref.getColor(marktr("draw angle snap"), Color.ORANGE);
 
-            highlightColor = Main.pref.getColor(marktr("draw angle snap highlight"), new Color(Color.ORANGE.getRed(),Color.ORANGE.getGreen(),Color.ORANGE.getBlue(),128));
+            highlightColor = Main.pref.getColor(marktr("draw angle snap highlight"),
+                new Color(Color.ORANGE.getRed(),Color.ORANGE.getGreen(),Color.ORANGE.getBlue(),128));
             highlightStroke = new BasicStroke(10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
-            
+
             float dash1[] = { 4.0f };
             helperStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
-                         BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
-
-        }
-        
+                BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
+        }
+
         public void saveAngles(String ... angles) {
             Main.pref.putCollection("draw.anglesnap.angles", Arrays.asList(angles));
         }
-        
+
         public  void setMenuCheckBox(JCheckBoxMenuItem checkBox) {
             this.checkBox = checkBox;
         }
-        
 
         public  void drawIfNeeded(Graphics2D g2, MapView mv) {
-            if (!snapOn) return;
-            if (!active) return;
+            if (!snapOn || !active)
+                return;
             Point p1=mv.getPoint(currentBaseNode);
             Point p2=mv.getPoint(dir2);
@@ -1289,13 +1285,13 @@
                 b = new GeneralPath();
                 if (absoluteFix) {
-                    b.moveTo(p2.x,p2.y); 
+                    b.moveTo(p2.x,p2.y);
                     b.lineTo(2*p1.x-p2.x,2*p1.y-p2.y); // bi-directional line
                 } else {
                     b.moveTo(p2.x,p2.y);
                     b.lineTo(p3.x,p3.y);
-                } 
+                }
                 g2.draw(b);
             }
-            if (projectionSource!=null) {
+            if (projectionSource != null) {
                 g2.setColor(snapHelperColor);
                 g2.setStroke(helperStroke);
@@ -1303,10 +1299,9 @@
                 b.moveTo(p3.x,p3.y);
                 Point pp=mv.getPoint(projectionSource);
-                b.lineTo(pp.x,pp.y); 
+                b.lineTo(pp.x,pp.y);
                 g2.draw(b);
             }
-            
-            
-            if (customBaseHeading>=0) {
+
+            if (customBaseHeading >= 0) {
                 g2.setColor(highlightColor);
                 g2.setStroke(highlightStroke);
@@ -1314,17 +1309,16 @@
                 Point pp1=mv.getPoint(segmentPoint1);
                 Point pp2=mv.getPoint(segmentPoint2);
-                b.moveTo(pp1.x,pp1.y); 
+                b.moveTo(pp1.x,pp1.y);
                 b.lineTo(pp2.x,pp2.y);
                 g2.draw(b);
             }
-            
-            
+
             g2.setColor(selectedColor);
             g2.setStroke(normalStroke);
             b = new GeneralPath();
-            b.moveTo(p1.x,p1.y); 
+            b.moveTo(p1.x,p1.y);
             b.lineTo(p3.x,p3.y);
             g2.draw(b);
-            
+
             g2.drawString(labelText, p3.x-5, p3.y+20);
             if (showProjectedPoint) {
@@ -1332,10 +1326,9 @@
                 g2.drawOval(p3.x-5, p3.y-5, 10, 10); // projected point
             }
-            
+
             g2.setColor(snapHelperColor);
             g2.setStroke(helperStroke);
-            
-        }
-        
+        }
+
         /* If mouse position is close to line at 15-30-45-... angle, remembers this direction
          */
@@ -1344,12 +1337,12 @@
             EastNorth snapPoint = currentEN;
             double angle = -1;
-            
-            double activeBaseHeading = (customBaseHeading>=0)? customBaseHeading : baseHeading; 
-            
+
+            double activeBaseHeading = (customBaseHeading>=0)? customBaseHeading : baseHeading;
+
             if (snapOn && (activeBaseHeading>=0)) {
                 angle = curHeading - activeBaseHeading;
                 if (angle < 0) angle+=360;
                 if (angle > 360) angle=0;
-                
+
                 double nearestAngle;
                 if (fixed) {
@@ -1362,5 +1355,7 @@
                         // if angle is to previous segment, exclude 180 degrees
                         lastAngle = nearestAngle;
-                    } else active=false;
+                    } else {
+                        active=false;
+                    }
                 }
 
@@ -1388,5 +1383,5 @@
             double hdg = Math.toDegrees(p0.heading(snapPoint));
             // heading of segment from current to calculated point, not to mouse position
-            
+
             if (baseHeading >=0 ) { // there is previous line segment with some heading
                 angle = hdg - baseHeading;
@@ -1420,13 +1415,17 @@
             }
         }
-        
+
         public  EastNorth getSnapPoint(EastNorth p) {
-            if (!active) return p;
+            if (!active)
+                return p;
             double de=p.east()-e0;
             double dn=p.north()-n0;
             double l = de*pe+dn*pn;
             double delta = Main.map.mapView.getDist100Pixel()/20;
-            if (!absoluteFix && l<delta) {active=false; return p; } //  do not go backward!
-            
+            if (!absoluteFix && l<delta) {
+                active=false;
+                return p;
+            } //  do not go backward!
+
             projectionSource=null;
             if (snapToProjections) {
@@ -1440,5 +1439,5 @@
                         if (Math.abs(l1-l) < delta) {
                             l=l1;
-                            projectionSource =  en; 
+                            projectionSource =  en;
                             break;
                         }
@@ -1448,8 +1447,8 @@
             return projected = new EastNorth(e0+l*pe, n0+l*pn);
         }
-        
-        
+
+
         public void noSnapNow() {
-            active=false; 
+            active=false;
             dir2=null; projected=null;
             labelText=null;
@@ -1460,5 +1459,5 @@
             segmentPoint1=seg.getFirstNode().getEastNorth();
             segmentPoint2=seg.getSecondNode().getEastNorth();
-            
+
             double hdg = segmentPoint1.heading(segmentPoint2);
             hdg=Math.toDegrees(hdg);
@@ -1473,5 +1472,5 @@
             if (snapOn) {
                 // turn off snapping if we are in fixed mode or no actile snapping line exist
-                if (fixed || !active) { snapOn=false; unsetFixedMode(); } 
+                if (fixed || !active) { snapOn=false; unsetFixedMode(); }
                 else setFixedMode();
             } else {
@@ -1482,5 +1481,5 @@
             customBaseHeading=-1;
         }
-        
+
         private void enableSnapping() {
             snapOn = true;
@@ -1489,5 +1488,5 @@
             unsetFixedMode();
         }
-        
+
         private void toggleSnapping() {
             snapOn = !snapOn;
@@ -1496,20 +1495,23 @@
             unsetFixedMode();
         }
-                
+
         public void setFixedMode() {
-            if (active) { fixed=true; }
-        }
-                
-        
+            if (active) {
+                fixed=true;
+            }
+        }
+
+
         public  void unsetFixedMode() {
-            fixed=false; absoluteFix=false;
+            fixed=false;
+            absoluteFix=false;
             lastAngle=0;
             active=false;
         }
-        
+
         public  boolean isActive() {
             return active;
         }
-        
+
         public  boolean isSnapOn() {
             return snapOn;
@@ -1518,12 +1520,13 @@
         private double getNearestAngle(double angle) {
             double delta,minDelta=1e5, bestAngle=0.0;
-            for (int i=0; i<snapAngles.length; i++) {
+            for (int i=0; i < snapAngles.length; i++) {
                 delta = getAngleDelta(angle,snapAngles[i]);
-                if (delta<minDelta) {
+                if (delta < minDelta) {
                     minDelta=delta;
                     bestAngle=snapAngles[i];
                 }
             }
-            if (Math.abs(bestAngle-360)<1e-3) bestAngle=0;
+            if (Math.abs(bestAngle-360) < 1e-3)
+                bestAngle=0;
             return bestAngle;
         }
@@ -1531,82 +1534,93 @@
         private double getAngleDelta(double a, double b) {
             double delta = Math.abs(a-b);
-            if (delta>180) return 360-delta; else return delta;
+            if (delta>180)
+                return 360-delta;
+            else
+                return delta;
         }
 
         private void unFixOrTurnOff() {
-            if (absoluteFix) unsetFixedMode(); else toggleSnapping();
-        }
-        
+            if (absoluteFix)
+                unsetFixedMode();
+            else
+                toggleSnapping();
+        }
+
         MouseListener anglePopupListener = new PopupMenuLauncher( new JPopupMenu() {
-               JCheckBoxMenuItem helperCb = new JCheckBoxMenuItem(new AbstractAction(tr("Show helper geometry")){
+            JCheckBoxMenuItem helperCb = new JCheckBoxMenuItem(new AbstractAction(tr("Show helper geometry")){
+                public void actionPerformed(ActionEvent e) {
+                    boolean sel=((JCheckBoxMenuItem) e.getSource()).getState();
+                    Main.pref.put("draw.anglesnap.drawConstructionGeometry", sel);
+                    Main.pref.put("draw.anglesnap.drawProjectedPoint", sel);
+                    Main.pref.put("draw.anglesnap.showAngle", sel);
+                    init();
+                    enableSnapping();
+                }
+            });
+            JCheckBoxMenuItem projectionCb = new JCheckBoxMenuItem(new AbstractAction(tr("Snap to node projections")){
+                public void actionPerformed(ActionEvent e) {
+                    boolean sel=((JCheckBoxMenuItem) e.getSource()).getState();
+                    Main.pref.put("draw.anglesnap.projectionsnap", sel);
+                    init();
+                    enableSnapping();
+                }
+            });
+            {
+                helperCb.setState(Main.pref.getBoolean("draw.anglesnap.drawConstructionGeometry",true));
+                projectionCb.setState(Main.pref.getBoolean("draw.anglesnap.projectionsnapgvff",true));
+                add(helperCb);
+                add(projectionCb);;
+                add(new AbstractAction(tr("Disable")) {
                     public void actionPerformed(ActionEvent e) {
-                        boolean sel=((JCheckBoxMenuItem) e.getSource()).getState();
-                        Main.pref.put("draw.anglesnap.drawConstructionGeometry", sel);
-                        Main.pref.put("draw.anglesnap.drawProjectedPoint", sel);
-                        Main.pref.put("draw.anglesnap.showAngle", sel);
-                        init(); enableSnapping();
+                        saveAngles("180");
+                        init();
+                        enableSnapping();
                     }
-               });
-               JCheckBoxMenuItem projectionCb = new JCheckBoxMenuItem(new AbstractAction(tr("Snap to node projections")){
+                });
+                add(new AbstractAction(tr("0,90,...")) {
                     public void actionPerformed(ActionEvent e) {
-                        boolean sel=((JCheckBoxMenuItem) e.getSource()).getState();
-                        Main.pref.put("draw.anglesnap.projectionsnap", sel);
-                        init(); enableSnapping();
+                        saveAngles("0","90","180");
+                        init();
+                        enableSnapping();
                     }
-               });
-            {  
-               helperCb.setState(Main.pref.getBoolean("draw.anglesnap.drawConstructionGeometry",true));
-               projectionCb.setState(Main.pref.getBoolean("draw.anglesnap.projectionsnapgvff",true));
-               add(helperCb);
-               add(projectionCb);;
-               add(new AbstractAction(tr("Disable")) {
-                public void actionPerformed(ActionEvent e) {
-                    saveAngles("180");
-                    init(); enableSnapping();
-                }
-               });
-               add(new AbstractAction(tr("0,90,...")) {
-                public void actionPerformed(ActionEvent e) {
-                    saveAngles("0","90","180");
-                    init(); enableSnapping();
-                }
-               });
-               add(new AbstractAction(tr("0,45,90,...")) {
-                public void actionPerformed(ActionEvent e) {
-                    saveAngles("0","45","90","135","180");
-                    init(); enableSnapping();
-                }
-               });
-               add(new AbstractAction(tr("0,30,45,60,90,...")) {
-                public void actionPerformed(ActionEvent e) {
-                    saveAngles("0","30","45","60","90","120","135","150","180");
-                    init(); enableSnapping();
-                }
-               });
-        }
-    }) {
+                });
+                add(new AbstractAction(tr("0,45,90,...")) {
+                    public void actionPerformed(ActionEvent e) {
+                        saveAngles("0","45","90","135","180");
+                        init();
+                        enableSnapping();
+                    }
+                });
+                add(new AbstractAction(tr("0,30,45,60,90,...")) {
+                    public void actionPerformed(ActionEvent e) {
+                        saveAngles("0","30","45","60","90","120","135","150","180");
+                        init();
+                        enableSnapping();
+                    }
+                });
+            }
+        }) {
             @Override
             public void mouseClicked(MouseEvent e) {
                 super.mouseClicked(e);
-                if (e.getButton()==MouseEvent.BUTTON1) {
+                if (e.getButton() == MouseEvent.BUTTON1) {
                     toggleSnapping();
                     updateStatusLine();
                 }
             }
-    };
-    }
-    
+        };
+    }
+
     private class SnapChangeAction extends JosmAction {
         public SnapChangeAction() {
-             super(tr("Angle snapping"), "anglesnap", 
- 		   tr("Switch angle snapping mode while drawing"), 
- 		   null, false);
-             putValue("help", ht("/Action/Draw/AngleSnap"));
-        }
-        @Override 
+            super(tr("Angle snapping"), "anglesnap",
+                tr("Switch angle snapping mode while drawing"), null, false);
+            putValue("help", ht("/Action/Draw/AngleSnap"));
+        }
+
+        @Override
         public void actionPerformed(ActionEvent e) {
-               if (snapHelper!=null) snapHelper.toggleSnapping(); 
-        }
-        
+               if (snapHelper!=null) snapHelper.toggleSnapping();
+        }
     }
 }
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java	(revision 4955)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java	(revision 4956)
@@ -126,6 +126,6 @@
         super(tr("Parallel"), "parallel", tr("Make parallel copies of ways"),
             Shortcut.registerShortcut("mapmode:parallel", tr("Mode: {0}",
-            tr("Parallel")), KeyEvent.VK_P, Shortcut.GROUP_EDIT,
-            Shortcut.SHIFT_DEFAULT), mapFrame, ImageProvider.getCursor("normal",
+            tr("Parallel")), KeyEvent.VK_P, Shortcut.GROUP_EDIT+
+            Shortcut.GROUPS_ALT1), mapFrame, ImageProvider.getCursor("normal",
             "parallel"));
         putValue("help", ht("/Action/Parallel"));
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 4955)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 4956)
@@ -86,5 +86,6 @@
     public MapPaintDialog() {
         super(tr("Map Paint Styles"), "mapstyle", tr("configure the map painting style"),
-                Shortcut.registerShortcut("subwindow:mappaint", tr("Toggle: {0}", tr("MapPaint")), KeyEvent.VK_M, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150);
+            Shortcut.registerShortcut("subwindow:mappaint", tr("Toggle: {0}", tr("MapPaint")),
+            KeyEvent.VK_M, Shortcut.GROUP_LAYER+Shortcut.GROUPS_ALT1), 150);
         build();
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java	(revision 4955)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java	(revision 4956)
@@ -103,5 +103,5 @@
     // not a list of real physical keys. If someone knows how to get that list?
     private static Map<Integer, String> keyList = setKeyList();
-    
+
     private static Map<Integer, String> setKeyList() {
         Map<Integer, String> list = new LinkedHashMap<Integer, String>();
@@ -125,5 +125,5 @@
         return list;
     }
-    
+
     private JComboBox bxPrim1 = new JComboBox();
     private JComboBox bxPrim2 = new JComboBox();
@@ -145,7 +145,7 @@
     private JCheckBox cbDisable = new JCheckBox();
     private JComboBox tfKey = new JComboBox();
-    
+
     JTable shortcutTable = new JTable();
-    
+
     private JTextField filterField = new JTextField();
 
@@ -219,5 +219,5 @@
 
         listPane.add(listScrollPane);
-        
+
         shortcutTab.add(listPane);
 
@@ -239,6 +239,6 @@
         cbMeta.setAction(action);
         cbMeta.setText(META); // see above for why no tr()
-        
-        
+
+
         shortcutEditPane.add(cbDefault);
         shortcutEditPane.add(new JLabel());
@@ -266,10 +266,10 @@
         editGroupPane.setBorder(BorderFactory.createTitledBorder(tr("Edit Shortcuts")));
         editGroupPane.setLayout(new java.awt.GridLayout(3, 5));
-        
+
         JComboBox[] bxArray = new JComboBox[] {
                     bxPrim1,bxSec1,bxTer1,bxPrim2,bxSec2,bxTer2,
                     bxPrim3,bxSec3,bxTer3,bxPrim4,bxSec4,bxTer4};
-        for (JComboBox bxi: bxArray) bxi.setModel(new DefaultComboBoxModel(modifList)); 
-        
+        for (JComboBox bxi: bxArray) bxi.setModel(new DefaultComboBoxModel(modifList));
+
         editGroupPane.add(new JLabel(tr("Primary modifier:")));
         editGroupPane.add(bxPrim1);
@@ -310,5 +310,5 @@
 
         initbx();
-        for (JComboBox bxi: bxArray) bxi.setAction(action2); 
+        for (JComboBox bxi: bxArray) bxi.setAction(action2);
 
         modifierTab.add(subwindowGroupPane);
@@ -340,5 +340,5 @@
         return pnl;
     }
-    
+
     private void disableAllModifierCheckboxes() {
         cbDefault.setEnabled(false);
@@ -481,5 +481,5 @@
     }
 
-    
+
      class FilterFieldAdapter implements DocumentListener {
         public void filter() {
@@ -492,5 +492,5 @@
                     sorter.setRowFilter(null);
                 } else {
-                    // split search string on whitespace, do case-insensitive AND search 
+                    // split search string on whitespace, do case-insensitive AND search
                     ArrayList<RowFilter<Object, Object>> andFilters = new ArrayList<RowFilter<Object, Object>>();
                     for (String word : expr.split("\\s+")) {
@@ -508,4 +508,4 @@
         public void removeUpdate(DocumentEvent arg0) { filter(); }
     }
-    
+
 }
Index: trunk/src/org/openstreetmap/josm/tools/Shortcut.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 4955)
+++ trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 4956)
@@ -571,3 +571,8 @@
         return sc.getKeyStroke();
     }
+
+    public boolean isEvent(KeyEvent e) {
+        return getKeyStroke() != null && getKeyStroke().equals(
+        KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers()));
+    }
 }
