xref: /haiku/src/apps/icon-o-matic/shape/commands/CleanUpPathCommand.cpp (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 /*
2  * Copyright 2006, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #include "CleanUpPathCommand.h"
10 
11 #include <stdio.h>
12 
13 #include "VectorPath.h"
14 
15 // constructor
16 CleanUpPathCommand::CleanUpPathCommand(VectorPath* path)
17 	: PathCommand(path),
18 	  fOriginalPath()
19 {
20 	if (fPath)
21 		fOriginalPath = *fPath;
22 }
23 
24 // destructor
25 CleanUpPathCommand::~CleanUpPathCommand()
26 {
27 }
28 
29 // Perform
30 status_t
31 CleanUpPathCommand::Perform()
32 {
33 	fPath->CleanUp();
34 
35 	return B_OK;
36 }
37 
38 // Undo
39 status_t
40 CleanUpPathCommand::Undo()
41 {
42 	*fPath = fOriginalPath;
43 
44 	return B_OK;
45 }
46 
47 // GetName
48 void
49 CleanUpPathCommand::GetName(BString& name)
50 {
51 	name << "Clean Up Path";
52 }
53