X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fundo%2FUndoLoad.java;h=377f21c22f93f7b0a95f7c73378a30a09d5276c7;hp=5c0818fc94a65eade07b5d0fd391f482ebbc4469;hb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;hpb=3745d70b1427bb8ac1a085e47cbdc566936784e1 diff --git a/tim/prune/undo/UndoLoad.java b/tim/prune/undo/UndoLoad.java index 5c0818f..377f21c 100644 --- a/tim/prune/undo/UndoLoad.java +++ b/tim/prune/undo/UndoLoad.java @@ -16,6 +16,8 @@ public class UndoLoad implements UndoOperation private DataPoint[] _contents = null; private PhotoList _photoList = null; private FileInfo _oldFileInfo = null; + // Numbers of each media before operation + private int _numPhotos = -1, _numAudios = -1; /** @@ -58,6 +60,16 @@ public class UndoLoad implements UndoOperation return desc; } + /** + * Set the number of photos and audios before the load operation + * @param inNumPhotos number of photos + * @param inNumAudios number of audios + */ + public void setNumPhotosAudios(int inNumPhotos, int inNumAudios) + { + _numPhotos = inNumPhotos; + _numAudios = inNumAudios; + } /** * Perform the undo operation on the given Track @@ -81,10 +93,12 @@ public class UndoLoad implements UndoOperation else { // replace photos how they were - if (_photoList != null) - { + if (_photoList != null) { inTrackInfo.getPhotoList().restore(_photoList); } + // Crop media lists to previous size (if specified) + if (_numPhotos > -1) {inTrackInfo.getPhotoList().cropTo(_numPhotos);} + if (_numAudios > -1) {inTrackInfo.getAudioList().cropTo(_numAudios);} // replace track contents with old if (!inTrackInfo.getTrack().replaceContents(_contents)) { @@ -94,4 +108,4 @@ public class UndoLoad implements UndoOperation // clear selection inTrackInfo.getSelection().clearAll(); } -} \ No newline at end of file +}