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 PasteCommand : public Command {
18public:
19 PasteCommand();
20
21protected:
22 bool onEnabled(Context* ctx) override;
23 void onExecute(Context* ctx) override;
24};
25
26PasteCommand::PasteCommand()
27 : Command(CommandId::Paste(), CmdUIOnlyFlag)
28{
29}
30
31bool PasteCommand::onEnabled(Context* ctx)
32{
33 return App::instance()->inputChain().canPaste(ctx);
34}
35
36void PasteCommand::onExecute(Context* ctx)
37{
38 App::instance()->inputChain().paste(ctx);
39}
40
41Command* CommandFactory::createPasteCommand()
42{
43 return new PasteCommand;
44}
45
46} // namespace app
47