]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/undo/UndoDeleteAudio.java
Moved source into separate src directory due to popular request
[GpsPrune.git] / tim / prune / undo / UndoDeleteAudio.java
diff --git a/tim/prune/undo/UndoDeleteAudio.java b/tim/prune/undo/UndoDeleteAudio.java
deleted file mode 100644 (file)
index 2b69865..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-package tim.prune.undo;\r
-\r
-import tim.prune.I18nManager;\r
-import tim.prune.UpdateMessageBroker;\r
-import tim.prune.data.AudioClip;\r
-import tim.prune.data.DataPoint;\r
-import tim.prune.data.TrackInfo;\r
-\r
-/**\r
- * Operation to undo a delete of a single audio item, either with or without point\r
- */\r
-public class UndoDeleteAudio extends UndoDeleteOperation\r
-{\r
-       private int _audioIndex = -1;\r
-       private AudioClip _audio = null;\r
-       private int _pointIndex = -1;\r
-       private DataPoint _point = null;\r
-\r
-\r
-       /**\r
-        * Constructor\r
-        * @param inAudio audio item\r
-        * @param inAudioIndex index number of audio within list\r
-        * @param inPoint data point\r
-        * @param inPointIndex index number of point within track\r
-        */\r
-       public UndoDeleteAudio(AudioClip inAudio, int inAudioIndex, DataPoint inPoint, int inPointIndex)\r
-       {\r
-               _audio = inAudio;\r
-               _audioIndex = inAudioIndex;\r
-               _point = inPoint;\r
-               _pointIndex = inPointIndex;\r
-       }\r
-\r
-\r
-       /**\r
-        * @return description of operation including filename\r
-        */\r
-       public String getDescription() {\r
-               return I18nManager.getText("undo.removeaudio") + " " + _audio.getName();\r
-       }\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
-               // restore audio\r
-               inTrackInfo.getAudioList().addAudio(_audio, _audioIndex);\r
-               // if there's a point to restore, restore it\r
-               if (_point != null)\r
-               {\r
-                       if (!inTrackInfo.getTrack().insertPoint(_point, _pointIndex)) {\r
-                               throw new UndoException(getDescription());\r
-                       }\r
-                       // Change the current point/range selection if required\r
-                       modifySelection(inTrackInfo, _pointIndex, _pointIndex);\r
-               }\r
-               else\r
-               {\r
-                       // update needed if not already triggered by track update\r
-                       UpdateMessageBroker.informSubscribers();\r
-               }\r
-               // Ensure that audio is associated with point and vice versa\r
-               _audio.setDataPoint(_point);\r
-               if (_point != null) {\r
-                       _point.setAudio(_audio);\r
-               }\r
-       }\r
-}\r