xref: /haiku/src/apps/icon-o-matic/shape/commands/CleanUpPathCommand.cpp (revision a4e4beafe528e4bf368158a1876fe78eea755941)
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 <Catalog.h>
14 #include <Locale.h>
15 
16 #include "VectorPath.h"
17 
18 
19 #undef B_TRANSLATION_CONTEXT
20 #define B_TRANSLATION_CONTEXT "Icon-O-Matic-CleanUpPathCmd"
21 
22 
23 // constructor
CleanUpPathCommand(VectorPath * path)24 CleanUpPathCommand::CleanUpPathCommand(VectorPath* path)
25 	: PathCommand(path),
26 	  fOriginalPath()
27 {
28 	if (fPath)
29 		fOriginalPath = *fPath;
30 }
31 
32 // destructor
~CleanUpPathCommand()33 CleanUpPathCommand::~CleanUpPathCommand()
34 {
35 }
36 
37 // Perform
38 status_t
Perform()39 CleanUpPathCommand::Perform()
40 {
41 	fPath->CleanUp();
42 
43 	return B_OK;
44 }
45 
46 // Undo
47 status_t
Undo()48 CleanUpPathCommand::Undo()
49 {
50 	*fPath = fOriginalPath;
51 
52 	return B_OK;
53 }
54 
55 // GetName
56 void
GetName(BString & name)57 CleanUpPathCommand::GetName(BString& name)
58 {
59 	name << B_TRANSLATE("Clean up path");
60 }
61