2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
|
|
|
// Copyright (C) 2001-2015 David Capello
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2 as
|
|
|
|
// published by the Free Software Foundation.
|
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();
|
2014-08-15 10:07:47 +08:00
|
|
|
Command* clone() const override { return new CopyCommand(*this); }
|
2012-01-06 06:45:03 +08:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
CopyCommand::CopyCommand()
|
|
|
|
: Command("Copy",
|
|
|
|
"Copy",
|
|
|
|
CmdUIOnlyFlag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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
|