btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / icon-o-matic / shape / commands / UnassignPathCommand.cpp
blob299fd853dceeae18b95bc3e80a265a8b0ca0c835
1 /*
2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
9 #include "UnassignPathCommand.h"
11 #include <Catalog.h>
12 #include <Locale.h>
14 #include "PathContainer.h"
15 #include "Shape.h"
16 #include "VectorPath.h"
19 #undef B_TRANSLATION_CONTEXT
20 #define B_TRANSLATION_CONTEXT "Icon-O-Matic-UnassignPathCmd"
23 // constructor
24 UnassignPathCommand::UnassignPathCommand(Shape* shape,
25 VectorPath* path)
26 : Command(),
27 fShape(shape),
28 fPath(path),
29 fPathRemoved(false)
33 // destructor
34 UnassignPathCommand::~UnassignPathCommand()
36 if (fPathRemoved && fPath)
37 fPath->ReleaseReference();
40 // InitCheck
41 status_t
42 UnassignPathCommand::InitCheck()
44 return fShape && fPath ? B_OK : B_NO_INIT;
47 // Perform
48 status_t
49 UnassignPathCommand::Perform()
51 // remove path from shape
52 fShape->Paths()->RemovePath(fPath);
53 fPathRemoved = true;
55 return B_OK;
58 // Undo
59 status_t
60 UnassignPathCommand::Undo()
62 // add path to shape
63 fShape->Paths()->AddPath(fPath);
64 fPathRemoved = false;
66 return B_OK;
69 // GetName
70 void
71 UnassignPathCommand::GetName(BString& name)
73 name << B_TRANSLATE("Unassign Path");