2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2017-12-01 10:41:45 +08:00
|
|
|
// Copyright (C) 2001-2017 David Capello
|
2015-02-12 23:16:25 +08:00
|
|
|
//
|
2016-08-27 04:02:58 +08:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-01-06 06:45:03 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-08-08 21:33:45 +08:00
|
|
|
#include "app/app.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/commands/command.h"
|
2015-05-10 06:55:33 +08:00
|
|
|
#include "app/ui/input_chain.h"
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
|
|
|
|
|
|
|
class CopyCommand : public Command {
|
2012-01-06 06:45:03 +08:00
|
|
|
public:
|
|
|
|
CopyCommand();
|
|
|
|
|
|
|
|
protected:
|
2015-05-10 06:55:33 +08:00
|
|
|
bool onEnabled(Context* ctx) override;
|
|
|
|
void onExecute(Context* ctx) override;
|
2012-01-06 06:45:03 +08:00
|
|
|
};
|
|
|
|
|
2025-08-06 02:59:31 +08:00
|
|
|
CopyCommand::CopyCommand() : Command(CommandId::Copy())
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-05-10 06:55:33 +08:00
|
|
|
bool CopyCommand::onEnabled(Context* ctx)
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
2015-05-10 06:55:33 +08:00
|
|
|
return App::instance()->inputChain().canCopy(ctx);
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
2015-05-10 06:55:33 +08:00
|
|
|
void CopyCommand::onExecute(Context* ctx)
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
2015-05-10 06:55:33 +08:00
|
|
|
App::instance()->inputChain().copy(ctx);
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createCopyCommand()
|
|
|
|
{
|
|
|
|
return new CopyCommand;
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|