]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/undo/UndoLoad.java
Moved source into separate src directory due to popular request
[GpsPrune.git] / tim / prune / undo / UndoLoad.java
diff --git a/tim/prune/undo/UndoLoad.java b/tim/prune/undo/UndoLoad.java
deleted file mode 100644 (file)
index 377f21c..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-package tim.prune.undo;\r
-\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
-/**\r
- * Operation to undo a load operation\r
- */\r
-public class UndoLoad implements UndoOperation\r
-{\r
-       private int _cropIndex = -1;\r
-       private int _numLoaded = -1;\r
-       private DataPoint[] _contents = 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
-        * Constructor for appending\r
-        * @param inIndex index number of crop point\r
-        * @param inNumLoaded number of points loaded\r
-        */\r
-       public UndoLoad(int inIndex, int inNumLoaded)\r
-       {\r
-               _cropIndex = inIndex;\r
-               _numLoaded = inNumLoaded;\r
-               _contents = null;\r
-       }\r
-\r
-\r
-       /**\r
-        * Constructor for replacing\r
-        * @param inOldTrackInfo track info being replaced\r
-        * @param inNumLoaded number of points loaded\r
-        * @param inPhotoList photo list, if any\r
-        */\r
-       public UndoLoad(TrackInfo inOldTrackInfo, int inNumLoaded, PhotoList inPhotoList)\r
-       {\r
-               _cropIndex = -1;\r
-               _numLoaded = inNumLoaded;\r
-               _contents = inOldTrackInfo.getTrack().cloneContents();\r
-               _oldFileInfo = inOldTrackInfo.getFileInfo().clone();\r
-               _photoList = inPhotoList;\r
-       }\r
-\r
-\r
-       /**\r
-        * @return description of operation including number of points loaded\r
-        */\r
-       public String getDescription()\r
-       {\r
-               String desc = I18nManager.getText("undo.load");\r
-               if (_numLoaded > 0)\r
-                       desc = desc + " (" + _numLoaded + ")";\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
-        * @param inTrackInfo TrackInfo object on which to perform the operation\r
-        */\r
-       public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
-       {\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
-               {\r
-                       // crop track to previous size\r
-                       inTrackInfo.getTrack().cropTo(_cropIndex);\r
-               }\r
-               else\r
-               {\r
-                       // replace photos how they were\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
-                               throw new UndoException(getDescription());\r
-                       }\r
-               }\r
-               // clear selection\r
-               inTrackInfo.getSelection().clearAll();\r
-       }\r
-}\r