1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef TRANSFORM_COMMAND_H 10 #define TRANSFORM_COMMAND_H 11 12 #include <Point.h> 13 #include <String.h> 14 15 #include "Command.h" 16 17 class TransformCommand : public Command { 18 public: 19 TransformCommand(BPoint pivot, 20 BPoint translation, 21 double rotation, 22 double xScale, 23 double yScale, 24 25 const char* actionName, 26 uint32 nameIndex); 27 28 TransformCommand(const char* actionName, 29 uint32 nameIndex); 30 31 virtual ~TransformCommand(); 32 33 // Command interface 34 virtual status_t InitCheck(); 35 36 virtual status_t Perform(); 37 virtual status_t Undo(); 38 virtual status_t Redo(); 39 40 virtual void GetName(BString& name); 41 42 // TransformCommand 43 void SetNewTransformation(BPoint pivot, 44 BPoint translation, 45 double rotation, 46 double xScale, 47 double yScale); 48 49 void SetNewTranslation(BPoint translation); 50 // convinience for "nudging" 51 52 void SetName(const char* actionName, 53 uint32 nameIndex); 54 55 protected: 56 virtual status_t _SetTransformation(BPoint pivot, 57 BPoint translation, 58 double rotation, 59 double xScale, 60 double yScale) const = 0; 61 62 BPoint fOldPivot; 63 BPoint fOldTranslation; 64 double fOldRotation; 65 double fOldXScale; 66 double fOldYScale; 67 68 BPoint fNewPivot; 69 BPoint fNewTranslation; 70 double fNewRotation; 71 double fNewXScale; 72 double fNewYScale; 73 74 BString fName; 75 uint32 fNameIndex; 76 }; 77 78 #endif // TRANSFORM_COMMAND_H 79