aseprite/src/app/commands/cmd_copy_merged.cpp

52 lines
1.1 KiB
C++
Raw Normal View History

// Aseprite
// Copyright (C) 2016 David Capello
//
2016-08-27 04:02:58 +08:00
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/util/clipboard.h"
namespace app {
class CopyMergedCommand : public Command {
public:
CopyMergedCommand();
Command* clone() const override { return new CopyMergedCommand(*this); }
protected:
bool onEnabled(Context* ctx) override;
void onExecute(Context* ctx) override;
};
CopyMergedCommand::CopyMergedCommand()
: Command("CopyMerged",
"Copy Merged",
CmdUIOnlyFlag)
{
}
bool CopyMergedCommand::onEnabled(Context* ctx)
{
return ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::HasVisibleMask);
}
void CopyMergedCommand::onExecute(Context* ctx)
{
ContextReader reader(ctx);
clipboard::copy_merged(reader);
}
Command* CommandFactory::createCopyMergedCommand()
{
return new CopyMergedCommand;
}
} // namespace app