Changeset 301 in josm for src/org/openstreetmap/josm/actions


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
Files:
13 edited

Legend:

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

    r298 r301  
    6868                }
    6969
    70                 Main.main.editLayer().add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
     70                Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Circle"), cmds));
    7171                Main.map.repaint();
    7272        }
  • src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r298 r301  
    110110
    111111                // Do it!
    112                 Main.main.editLayer().add(new SequenceCommand(tr("Align Nodes in Line"), cmds));
     112                Main.main.undoRedo.add(new SequenceCommand(tr("Align Nodes in Line"), cmds));
    113113                Main.map.repaint();
    114114        }
  • src/org/openstreetmap/josm/actions/CombineWayAction.java

    r298 r301  
    9999                cmds.add(new DeleteCommand(selectedWays));
    100100                cmds.add(new ChangeCommand(oldWay, newWay));
    101                 Main.main.editLayer().add(new SequenceCommand(tr("Combine {0} ways", selectedWays.size()), cmds));
     101                Main.main.undoRedo.add(new SequenceCommand(tr("Combine {0} ways", selectedWays.size()), cmds));
    102102                Main.ds.setSelected(oldWay);
    103103        }
  • src/org/openstreetmap/josm/actions/RedoAction.java

    r298 r301  
    3030                        return;
    3131                Main.map.repaint();
    32                 Main.main.editLayer().redo();
     32                Main.main.undoRedo.redo();
    3333        }
    3434}
  • src/org/openstreetmap/josm/actions/ReorderAction.java

    r298 r301  
    5959
    6060                                if( c != null )
    61                                         Main.main.editLayer().add( c );
     61                                        Main.main.undoRedo.add(c);
    6262                        }
    6363                }
  • src/org/openstreetmap/josm/actions/ReverseSegmentAction.java

    r298 r301  
    5454                c.add(new ChangeCommand(s, snew));
    5555        }
    56         Main.main.editLayer().add(new SequenceCommand(tr("Reverse Segments"), c));
     56        Main.main.undoRedo.add(new SequenceCommand(tr("Reverse Segments"), c));
    5757        Main.map.repaint();
    5858    }
  • src/org/openstreetmap/josm/actions/SplitWayAction.java

    r298 r301  
    455455                NameVisitor v = new NameVisitor();
    456456                v.visit(selectedWay);
    457                 Main.main.editLayer().add(new SequenceCommand(tr("Split way {0} into {1} parts",v.name, segmentSets.size()), commandList));
     457                Main.main.undoRedo.add(new SequenceCommand(tr("Split way {0} into {1} parts",v.name, segmentSets.size()), commandList));
    458458                Main.ds.setSelected(newSelection);
    459459        }
  • src/org/openstreetmap/josm/actions/UndoAction.java

    r298 r301  
    3030                        return;
    3131                Main.map.repaint();
    32                 Main.main.editLayer().undo();
     32                Main.main.undoRedo.undo();
    3333        }
    3434}
  • 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.