1// Aseprite
2// Copyright (C) 2001-2017 David Capello
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include "app/app.h"
12#include "app/commands/command.h"
13#include "app/ui/input_chain.h"
14
15namespace app {
16
17class CutCommand : public Command {
18public:
19 CutCommand();
20
21protected:
22 bool onEnabled(Context* ctx) override;
23 void onExecute(Context* ctx) override;
24};
25
26CutCommand::CutCommand()
27 : Command(CommandId::Cut(), CmdUIOnlyFlag)
28{
29}
30
31bool CutCommand::onEnabled(Context* ctx)
32{
33 return App::instance()->inputChain().canCut(ctx);
34}
35
36void CutCommand::onExecute(Context* ctx)
37{
38 App::instance()->inputChain().cut(ctx);
39}
40
41Command* CommandFactory::createCutCommand()
42{
43 return new CutCommand;
44}
45
46} // namespace app
47