X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2FRotatePhoto.java;fp=src%2Ftim%2Fprune%2Ffunction%2FRotatePhoto.java;h=493f7cee8081481796617a95e5fec8fd85b9fccc;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/function/RotatePhoto.java b/src/tim/prune/function/RotatePhoto.java new file mode 100644 index 0000000..493f7ce --- /dev/null +++ b/src/tim/prune/function/RotatePhoto.java @@ -0,0 +1,50 @@ +package tim.prune.function; + +import tim.prune.App; +import tim.prune.DataSubscriber; +import tim.prune.GenericFunction; +import tim.prune.I18nManager; +import tim.prune.UpdateMessageBroker; +import tim.prune.data.Photo; +import tim.prune.undo.UndoRotatePhoto; + +/** + * Class to provide the function to rotate a photo + * either clockwise or anticlockwise + */ +public class RotatePhoto extends GenericFunction +{ + /** Direction of rotation */ + private boolean _direction = true; + + /** + * Constructor + * @param inApp application object for callback + * @param inDir true for clockwise, false for anticlockwise + */ + public RotatePhoto(App inApp, boolean inDir) + { + super(inApp); + _direction = inDir; + } + + /** Get the name key */ + public String getNameKey() { + return _direction?"function.rotatephotoright":"function.rotatephotoleft"; + } + + /** + * Begin the function + */ + public void begin() + { + Photo photo = _app.getTrackInfo().getCurrentPhoto(); + if (photo != null) + { + UndoRotatePhoto undo = new UndoRotatePhoto(photo, _direction); + photo.rotate(_direction); + UpdateMessageBroker.informSubscribers(DataSubscriber.PHOTOS_MODIFIED); + _app.completeFunction(undo, I18nManager.getText("confirm.rotatephoto")); + } + } +}