1 package tim.prune.undo;
\r
3 import tim.prune.I18nManager;
\r
4 import tim.prune.data.TrackInfo;
\r
7 * Operation to undo a load photos operation
\r
9 public class UndoLoadPhotos implements UndoOperation
\r
11 private int _numPhotos = -1;
\r
12 private int _numPoints = -1;
\r
17 * @param inNumPhotos number of photos loaded
\r
18 * @param inNumPoints number of points loaded
\r
20 public UndoLoadPhotos(int inNumPhotos, int inNumPoints)
\r
22 _numPhotos = inNumPhotos;
\r
23 _numPoints = inNumPoints;
\r
28 * @return description of operation including number of photos loaded
\r
30 public String getDescription()
\r
32 String desc = I18nManager.getText("undo.loadphotos");
\r
34 desc = desc + " (" + _numPhotos + ")";
\r
40 * Perform the undo operation on the given Track
\r
41 * Delete both track points and Photo objects
\r
42 * @param inTrackInfo TrackInfo object on which to perform the operation
\r
44 public void performUndo(TrackInfo inTrackInfo) throws UndoException
\r
47 // crop track to previous size
\r
50 cropIndex = inTrackInfo.getTrack().getNumPoints() - _numPoints;
\r
51 inTrackInfo.getTrack().cropTo(cropIndex);
\r
53 // crop photo list to previous size
\r
54 cropIndex = inTrackInfo.getPhotoList().getNumPhotos() - _numPhotos;
\r
55 inTrackInfo.getPhotoList().cropTo(cropIndex);
\r
57 inTrackInfo.getSelection().clearAll();
\r