\r
import tim.prune.I18nManager;\r
import tim.prune.data.DataPoint;\r
+import tim.prune.data.FileInfo;\r
import tim.prune.data.PhotoList;\r
import tim.prune.data.TrackInfo;\r
\r
private int _cropIndex = -1;\r
private int _numLoaded = -1;\r
private DataPoint[] _contents = null;\r
- private String _previousFilename = null;\r
private PhotoList _photoList = null;\r
+ private FileInfo _oldFileInfo = null;\r
+ // Numbers of each media before operation\r
+ private int _numPhotos = -1, _numAudios = -1;\r
\r
\r
/**\r
_cropIndex = inIndex;\r
_numLoaded = inNumLoaded;\r
_contents = null;\r
- _previousFilename = null;\r
}\r
\r
\r
_cropIndex = -1;\r
_numLoaded = inNumLoaded;\r
_contents = inOldTrackInfo.getTrack().cloneContents();\r
- if (inOldTrackInfo.getFileInfo().getNumFiles() == 1)\r
- _previousFilename = inOldTrackInfo.getFileInfo().getFilename();\r
+ _oldFileInfo = inOldTrackInfo.getFileInfo().clone();\r
_photoList = inPhotoList;\r
}\r
\r
return desc;\r
}\r
\r
+ /**\r
+ * Set the number of photos and audios before the load operation\r
+ * @param inNumPhotos number of photos\r
+ * @param inNumAudios number of audios\r
+ */\r
+ public void setNumPhotosAudios(int inNumPhotos, int inNumAudios)\r
+ {\r
+ _numPhotos = inNumPhotos;\r
+ _numAudios = inNumAudios;\r
+ }\r
\r
/**\r
* Perform the undo operation on the given Track\r
*/\r
public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
{\r
- // remove file from fileinfo\r
- inTrackInfo.getFileInfo().removeFile();\r
- if (_previousFilename != null)\r
- {\r
- inTrackInfo.getFileInfo().setFile(_previousFilename);\r
+ // remove source from fileinfo\r
+ if (_oldFileInfo == null) {\r
+ inTrackInfo.getFileInfo().removeSource();\r
+ }\r
+ else {\r
+ inTrackInfo.setFileInfo(_oldFileInfo);\r
}\r
// Crop / replace\r
if (_contents == null)\r
else\r
{\r
// replace photos how they were\r
- if (_photoList != null)\r
- {\r
+ if (_photoList != null) {\r
inTrackInfo.getPhotoList().restore(_photoList);\r
}\r
+ // Crop media lists to previous size (if specified)\r
+ if (_numPhotos > -1) {inTrackInfo.getPhotoList().cropTo(_numPhotos);}\r
+ if (_numAudios > -1) {inTrackInfo.getAudioList().cropTo(_numAudios);}\r
// replace track contents with old\r
if (!inTrackInfo.getTrack().replaceContents(_contents))\r
{\r
// clear selection\r
inTrackInfo.getSelection().clearAll();\r
}\r
-}
\ No newline at end of file
+}\r