xref: /haiku/src/apps/icon-o-matic/transformable/TransformCommand.h (revision e1c4049fed1047bdb957b0529e1921e97ef94770)
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 
27 								TransformCommand(const char* actionName);
28 
29 	virtual						~TransformCommand();
30 
31 	// Command interface
32 	virtual	status_t			InitCheck();
33 
34 	virtual	status_t			Perform();
35 	virtual status_t			Undo();
36 	virtual status_t			Redo();
37 
38 	virtual void				GetName(BString& name);
39 
40 	// TransformCommand
41 			void				SetNewTransformation(BPoint pivot,
42 													 BPoint translation,
43 													 double rotation,
44 													 double xScale,
45 													 double yScale);
46 
47 			void				SetNewTranslation(BPoint translation);
48 				// convinience for "nudging"
49 
50 			void				SetName(const char* actionName);
51 
52  protected:
53 	virtual	status_t			_SetTransformation(BPoint pivot,
54 												   BPoint translation,
55 												   double rotation,
56 												   double xScale,
57 												   double yScale) const = 0;
58 
59 			BPoint				fOldPivot;
60 			BPoint				fOldTranslation;
61 			double				fOldRotation;
62 			double				fOldXScale;
63 			double				fOldYScale;
64 
65 			BPoint				fNewPivot;
66 			BPoint				fNewTranslation;
67 			double				fNewRotation;
68 			double				fNewXScale;
69 			double				fNewYScale;
70 
71 			BString				fName;
72 };
73 
74 #endif // TRANSFORM_COMMAND_H
75