aseprite/src/app/commands/cmd_copy_merged.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
994 B
C++
Raw Normal View History

// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2016-2017 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();
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