mirror of https://github.com/aseprite/aseprite.git
48 lines
994 B
C++
48 lines
994 B
C++
// Aseprite
|
|
// Copyright (C) 2020 Igara Studio S.A.
|
|
// Copyright (C) 2016-2017 David Capello
|
|
//
|
|
// 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();
|
|
|
|
protected:
|
|
bool onEnabled(Context* ctx) override;
|
|
void onExecute(Context* ctx) override;
|
|
};
|
|
|
|
CopyMergedCommand::CopyMergedCommand() : Command(CommandId::CopyMerged())
|
|
{
|
|
}
|
|
|
|
bool CopyMergedCommand::onEnabled(Context* ctx)
|
|
{
|
|
return ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | ContextFlags::HasVisibleMask);
|
|
}
|
|
|
|
void CopyMergedCommand::onExecute(Context* ctx)
|
|
{
|
|
ContextReader reader(ctx);
|
|
ctx->clipboard()->copyMerged(reader);
|
|
}
|
|
|
|
Command* CommandFactory::createCopyMergedCommand()
|
|
{
|
|
return new CopyMergedCommand;
|
|
}
|
|
|
|
} // namespace app
|