]> gitweb.fperrin.net Git - GpsPrune.git/blob - src/tim/prune/undo/UndoRotatePhoto.java
72cf40f92d68d800d0c3f202f9f4305fa8eb6d82
[GpsPrune.git] / src / tim / prune / undo / UndoRotatePhoto.java
1 package tim.prune.undo;\r
2 \r
3 import tim.prune.I18nManager;\r
4 import tim.prune.UpdateMessageBroker;\r
5 import tim.prune.data.Photo;\r
6 import tim.prune.data.TrackInfo;\r
7 \r
8 /**\r
9  * Operation to undo the rotation of a photo\r
10  */\r
11 public class UndoRotatePhoto implements UndoOperation\r
12 {\r
13         private Photo _photo = null;\r
14         private boolean _rightwards = true;\r
15 \r
16 \r
17         /**\r
18          * Constructor\r
19          * @param inPhoto photo\r
20          * @param inDir true if original operation was rightwards (clockwise) rotation\r
21          */\r
22         public UndoRotatePhoto(Photo inPhoto, boolean inDir)\r
23         {\r
24                 _photo = inPhoto;\r
25                 _rightwards = inDir;\r
26         }\r
27 \r
28 \r
29         /**\r
30          * @return description of operation including photo name\r
31          */\r
32         public String getDescription()\r
33         {\r
34                 return I18nManager.getText("undo.rotatephoto") + " " + _photo.getName();\r
35         }\r
36 \r
37 \r
38         /**\r
39          * Perform the undo operation on the given Track\r
40          * @param inTrackInfo TrackInfo object on which to perform the operation\r
41          */\r
42         public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
43         {\r
44                 _photo.rotate(!_rightwards);\r
45                 // inform subscribers\r
46                 UpdateMessageBroker.informSubscribers();\r
47         }\r
48 }