Ignore:
Timestamp:
2007-08-08T14:56:38+02:00 (18 years ago)
Author:
imi
Message:
  • fixed undo/redo to be global
  • fixed adding of objects work with undo/redo (#212)
Location:
src/org/openstreetmap/josm/actions/mapmode
Files:
5 edited

Legend:

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

    r298 r301  
    170170                }               
    171171       
    172                 Main.main.editLayer().add(c);
     172                Main.main.undoRedo.add(c);
    173173                Main.ds.setSelected(n);
    174174                Main.map.mapView.repaint();
  • src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java

    r298 r301  
    146146
    147147                        Segment ls = new Segment(start, end);
    148                         Main.main.editLayer().add(new AddCommand(ls));
     148                        Main.main.undoRedo.add(new AddCommand(ls));
    149149                        Collection<OsmPrimitive> sel = Main.ds.getSelected();
    150150                        sel.add(ls);
  • src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java

    r298 r301  
    107107                        copy.segments.remove(s);
    108108                        if (copy.segments.isEmpty()) {
    109                                 Main.main.editLayer().add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{way})));
     109                                Main.main.undoRedo.add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{way})));
    110110                                way = null;
    111111                        } else
    112                                 Main.main.editLayer().add(new ChangeCommand(way, copy));
     112                                Main.main.undoRedo.add(new ChangeCommand(way, copy));
    113113                } else {
    114114                        if (way == null) {
    115115                                way = new Way();
    116116                                way.segments.add(s);
    117                                 Main.main.editLayer().add(new AddCommand(way));
     117                                Main.main.undoRedo.add(new AddCommand(way));
    118118                        } else {
    119119                                Way copy = new Way(way);
     
    123123                                                break;
    124124                                copy.segments.add(i, s);
    125                                 Main.main.editLayer().add(new ChangeCommand(way, copy));
     125                                Main.main.undoRedo.add(new ChangeCommand(way, copy));
    126126                        }
    127127                }
     
    198198                                w.segments.clear();
    199199                        w.segments.addAll(sortedSegments);
    200                         Main.main.editLayer().add(new ChangeCommand(wayToAdd, w));
     200                        Main.main.undoRedo.add(new ChangeCommand(wayToAdd, w));
    201201                        return wayToAdd;
    202202                }
     
    207207                Way w = new Way();
    208208                w.segments.addAll(sortedSegments);
    209                 Main.main.editLayer().add(new AddCommand(w));
     209                Main.main.undoRedo.add(new AddCommand(w));
    210210                return w;
    211211        }
  • src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r298 r301  
    126126                v.data.addAll(selection);
    127127                if (!v.data.isEmpty())
    128                         Main.main.editLayer().add(new DeleteCommand(v.data));
     128                        Main.main.undoRedo.add(new DeleteCommand(v.data));
    129129        }
    130130
     
    164164                }
    165165                if (!del.isEmpty())
    166                         Main.main.editLayer().add(new DeleteCommand(del));
     166                        Main.main.undoRedo.add(new DeleteCommand(del));
    167167        }
    168168
     
    213213                cmds.add(new ChangeCommand(seg1, s));
    214214                cmds.add(new DeleteCommand(Arrays.asList(new OsmPrimitive[]{n, seg2})));
    215                 Main.main.editLayer().add(new SequenceCommand(tr("Delete Node"), cmds));
     215                Main.main.undoRedo.add(new SequenceCommand(tr("Delete Node"), cmds));
    216216                return null;
    217217    }
  • src/org/openstreetmap/josm/actions/mapmode/MoveAction.java

    r298 r301  
    106106                }
    107107
    108                 Command c = !Main.main.editLayer().commands.isEmpty() ? Main.main.editLayer().commands.getLast() : null;
     108                Command c = !Main.main.undoRedo.commands.isEmpty() ? Main.main.undoRedo.commands.getLast() : null;
    109109                if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand)c).objects))
    110110                        ((MoveCommand)c).moveAgain(dx,dy);
    111111                else
    112                         Main.main.editLayer().add(new MoveCommand(selection, dx, dy));
     112                        Main.main.undoRedo.add(new MoveCommand(selection, dx, dy));
    113113
    114114                Main.map.mapView.repaint();
Note: See TracChangeset for help on using the changeset viewer.