Changeset 1592 in josm


Ignore:
Timestamp:
2009-05-15T10:05:37+02:00 (9 years ago)
Author:
stoecker
Message:

fixed #2583 - patch by Michel Marti - fon't move objects when copying between layers

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r1523 r1592  
    8787     */
    8888    public static DataSet pasteBuffer = new DataSet();
     89    public static Layer pasteSource;
    8990    /**
    9091     * The projection method used.
     
    348349                new javax.swing.JLabel(tr("There are unsaved changes. Discard the changes and continue?")+msg),
    349350                new String[] {tr("Save and Exit"), tr("Discard and Exit"), tr("Cancel")},
    350                 new String[] {"save.png", "exit.png", "cancel.png"}).getValue(); 
     351                new String[] {"save.png", "exit.png", "cancel.png"}).getValue();
    351352
    352353                // Save before exiting
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r1523 r1592  
    4848
    4949        Main.pasteBuffer = copyData();
     50        Main.pasteSource = Main.main.editLayer();
    5051        Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */
    5152
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r1351 r1592  
    2424import org.openstreetmap.josm.data.osm.Way;
    2525import org.openstreetmap.josm.data.coor.EastNorth;
     26import org.openstreetmap.josm.gui.layer.Layer;
    2627import org.openstreetmap.josm.tools.Shortcut;
    2728
     
    3536
    3637    public void actionPerformed(ActionEvent e) {
    37         pasteData(Main.pasteBuffer, e);
     38        pasteData(Main.pasteBuffer, Main.pasteSource, e);
    3839    }
    39    
    40     public static void pasteData(DataSet pasteBuffer, ActionEvent e) {
     40
     41    public static void pasteData(DataSet pasteBuffer, Layer source, ActionEvent e) {
    4142        /* Find the middle of the pasteBuffer area */
    4243        double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100;
     
    5253        EastNorth mPosition;
    5354        if((e.getModifiers() & ActionEvent.CTRL_MASK) ==0){
     55            /* adjust the coordinates to the middle of the visible map area */
    5456            mPosition = Main.map.mapView.getCenter();
    5557        } else {
     
    6769            Node nnew = new Node(n);
    6870            nnew.id = 0;
    69             /* adjust the coordinates to the middle of the visible map area */
    70             nnew.eastNorth = new EastNorth(nnew.eastNorth.east() + offsetEast, nnew.eastNorth.north() + offsetNorth);
    71             nnew.coor = Main.proj.eastNorth2latlon(nnew.eastNorth);
     71            if (Main.main.editLayer() == source) {
     72                nnew.eastNorth = new EastNorth(nnew.eastNorth.east() + offsetEast, nnew.eastNorth.north() + offsetNorth);
     73                nnew.coor = Main.proj.eastNorth2latlon(nnew.eastNorth);
     74            }
    7275            map.put(n, nnew);
    7376        }
Note: See TracChangeset for help on using the changeset viewer.