Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 26439)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 26440)
@@ -36,5 +36,8 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.command.ChangeCommand;
+import org.openstreetmap.josm.command.ChangeNodesCommand;
 import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.command.DeleteCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.Bounds;
@@ -53,5 +56,5 @@
         AWTEventListener {
     private static final String SIMPLIFYMODE_MESSAGE=
-            tr("Press Enter to simplify or save, Ctrl-Enter to save with tags, Up/Down to tune simplification");
+            tr("Q=Options, Enter=save, Ctrl-Enter=save with tags, Up/Down=tune");
     private static final String DRAWINGMODE_MESSAGE=
     tr("Click or Click&drag to continue, Ctrl-Click to add fixed node, Shift-Click to delete, Enter to simplify or save, Ctrl-Shift-Click to start new line");
@@ -65,6 +68,4 @@
     private boolean ctrl;
     private boolean shift;
-    private boolean oldCtrl;
-    private boolean oldShift;
     private double eps;
     private final Stroke strokeForSimplified;
@@ -75,4 +76,5 @@
     private final Cursor cursorReady;
     private final Cursor cursorNode;
+    private final Cursor cursorDrawing;
     private boolean nearpoint;
     private LatLon highlighted;
@@ -80,4 +82,6 @@
     private Stroke strokeForDelete;
     private int dragNode=-1;
+    private SequenceCommand delCmd;
+    private List<Node> oldNodes;
 
 
@@ -97,4 +101,5 @@
         cursorReady = ImageProvider.getCursor("crosshair", "ready");
         cursorNode = ImageProvider.getCursor("crosshair", "joinnode");
+        cursorDrawing = ImageProvider.getCursor("crosshair", "mode");
         //loadPrefs();
     }
@@ -120,5 +125,14 @@
         Main.map.mapView.addTemporaryLayer(this);
 
-        Main.map.mapView.setCursor(cursorDraw);
+        updateCursor();
+        Collection<Way> selectedWays = Main.main.getCurrentDataSet().getSelectedWays();
+        if (selectedWays!=null // if there is a selection
+            && selectedWays.size()==1 // and one way is selected
+            && line.getPoints().size()==0) /* and ther is no already drawn line */ {
+            // we can start drawing new way starting from old one
+            Way w = selectedWays.iterator().next();
+            
+            if (w.isNew()) loadFromWay(w);
+        }
 
         try {
@@ -229,4 +243,7 @@
             doKeyEvent((KeyEvent) event);
         }
+        if (event.getID() == KeyEvent.KEY_RELEASED) {
+            doKeyReleaseEvent((KeyEvent) event);
+        }
         updateCursor();
 //        updateStatusLine();
@@ -265,10 +282,13 @@
             return;
         }
-
+        startDrawing(e.getPoint());
+    }
+
+    private void startDrawing(Point point) {
         //if (line.isClosed()) { setStatusLine(tr(SIMPLIFYMODE_MESSAGE));return;  }
         drawing = true;
 
-        LatLon p = getLatLon(e);
-        Node nd1 = getNearestNode(e.getPoint(), settings.maxDist);
+        LatLon p = mv.getLatLon(point.x, point.y);
+        Node nd1 = getNearestNode(point, settings.maxDist);
         if (nd1!=null) {
             // found node, make it fixed point of the line
@@ -284,15 +304,19 @@
         setStatusLine(tr("Please move the mouse to draw new way"));
         repaint();
-
     }
 
     @Override
     public void mouseReleased(MouseEvent e) {
+        if (e.getButton() != MouseEvent.BUTTON1) return;
+        stopDrawing();
+    }
+    
+    private void stopDrawing() {
         if (!isEnabled()) return;
-        if (e.getButton() != MouseEvent.BUTTON1) return;
         dragNode = -1;
         drawing = false;
         highlighted=null;
         if (!line.isClosed()) setStatusLine(DRAWINGMODE_MESSAGE);
+        updateCursor();
         repaint();
     }
@@ -311,5 +335,5 @@
 
         nearestIdx=line.findClosestPoint(e.getPoint(),settings.maxDist);
-
+        
         if (!drawing) {
             if (dragNode>=0) {
@@ -329,4 +353,5 @@
             return;
         }
+        updateCursor();
         if (line.isClosed()) setStatusLine(SIMPLIFYMODE_MESSAGE);
 
@@ -336,5 +361,5 @@
         Point lastP = line.getLastPoint(); // last point of line fragment being edited
 
-        if (nearpoint){
+            if (nearpoint){
             if ( Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > 1e-2) {
                 line.addFixed(nd1.getCoor()); // snap to node coords
@@ -343,5 +368,5 @@
         } else {
             if (Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > settings.minPixelsBetweenPoints) {
-                line.addLast(getLatLon(e)); // free mouse-drawing
+                          line.addLast(getLatLon(e)); // free mouse-drawing
                 repaint();
             }
@@ -353,5 +378,6 @@
     private void doKeyEvent(KeyEvent e) {
         ///  System.out.println(e);
-        if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
+        switch(e.getKeyCode()) {
+        case KeyEvent.VK_BACK_SPACE:
             if (line.wasSimplified()) {
                 line.clearSimplifiedVersion();
@@ -360,6 +386,6 @@
             }
             back();
-        }
-        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+        break;
+        case KeyEvent.VK_ENTER:
             // first Enter = simplify, second = save the way
             if (!line.wasSimplified()) {
@@ -370,21 +396,21 @@
                 showSimplifyHint();
             } else saveAsWay();
-        }
-        if (e.getKeyCode() == KeyEvent.VK_DOWN) {
+        break;
+        case KeyEvent.VK_DOWN:
             // more details
             e.consume();
             changeEpsilon(settings.epsilonMult);
-        }
-        if (e.getKeyCode() == KeyEvent.VK_UP) {
+        break;
+        case KeyEvent.VK_UP:
             // less details
             e.consume();
             changeEpsilon(1/settings.epsilonMult);
-        }
-        if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+        break;
+        case KeyEvent.VK_ESCAPE:
             // less details
             e.consume();
             line.moveToTheEnd();
-        }
-        if (e.getKeyCode() == KeyEvent.VK_Q) {
+        break;
+        case KeyEvent.VK_Q:
             // less details
             e.consume();
@@ -398,13 +424,21 @@
             } catch (SecurityException ex) {  }
             repaint();
-        }
-    }
-
+        break;
+        case KeyEvent.VK_SPACE:
+            if (!drawing) {
+                Point p = Main.map.mapView.getMousePosition();
+                if (p!=null) startDrawing(p);
+            }
+        break;
+        }
+    }
+    
+    private void doKeyReleaseEvent(KeyEvent keyEvent) {
+            if (keyEvent.getKeyCode()==KeyEvent.VK_SPACE) stopDrawing();
+    }
     /**
      * Updates shift and ctrl key states
      */
     private void updateKeyModifiers(InputEvent e) {
-        oldCtrl = ctrl;
-        oldShift = shift;
         ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
         shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
@@ -420,4 +454,5 @@
 // <editor-fold defaultstate="collapsed" desc="Different action helper methods">
     public void newDrawing() {
+        delCmd=null; oldNodes=null;
         eps=settings.startingEps;
         line.clear();
@@ -436,8 +471,8 @@
         for (LatLon p : pts) {
             Node nd=null;
-            if (line.isFixed(p)) {
+            //if (line.isFixed(p)) {
                 // there may be a node with same ccoords!
                 nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isUsablePredicate);
-            }
+            //}
             if (nd==null) {
                 if (i>0 && p.equals(first)) nd=firstNode; else {
@@ -466,5 +501,16 @@
             }
         }
-        cmds.add(new AddCommand(w));
+        if (delCmd!=null) {
+            List<Node> nodes = w.getNodes();
+            for (Node nd: oldNodes) {
+                // node from old way but not in new way 
+                if (!nodes.contains(nd)) {
+                    List<OsmPrimitive> refs = nd.getReferrers();
+                    // does someone need this node? if no-delete it.
+                    if (refs.isEmpty()) cmds.add(new DeleteCommand(nd));                                       
+                }
+            }
+            cmds.add(new AddCommand(w));
+        } else cmds.add(new AddCommand(w));
         Command c = new SequenceCommand(tr("Draw the way by mouse"), cmds);
         Main.main.undoRedo.add(c);
@@ -524,4 +570,5 @@
         if (ctrl) Main.map.mapView.setCursor(cursorCtrl); else
         if (nearpoint) Main.map.mapView.setCursor(cursorCtrl); else
+        if (drawing) Main.map.mapView.setCursor(cursorDrawing); else
         Main.map.mapView.setCursor(cursorDraw);
 
@@ -548,3 +595,24 @@
             +SIMPLIFYMODE_MESSAGE);
     }
+
+    private void loadFromWay(Way w) {
+        List<LatLon> pts=line.getPoints();
+
+        Collection<Command> cmds = new LinkedList<Command>();
+        
+        Node firstNode=null;
+        Object[] nodes = w.getNodes().toArray();
+        int n=nodes.length;
+        if (w.isClosed()) n--;
+        for (int i=0;i<n;i++) {
+            Node nd=(Node) nodes[i];
+            line.addLast(nd.getCoor());
+        }
+        if (w.isClosed()) line.closeLine();
+        oldNodes = w.getNodes();
+        cmds.add(new DeleteCommand(w));
+        delCmd = new SequenceCommand(tr("Convert way to FastDraw line"), cmds);
+        Main.main.undoRedo.add(delCmd);
+    }
+
 }
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 26439)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 26440)
@@ -5,4 +5,5 @@
  * Licence: GPL v2 or later
  * Author:  Alexei Kasatkin, 2011
+ * Ideas: Kotelnikov, Michael Barabanov (ticket #3840)
  */
 
