2016-05-17 23:59:48 +08:00
|
|
|
// Aseprite
|
2020-09-25 22:13:52 +08:00
|
|
|
// Copyright (C) 2020 Igara Studio S.A.
|
2017-12-01 10:41:45 +08:00
|
|
|
// Copyright (C) 2016-2017 David Capello
|
2016-05-17 23:59:48 +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.
|
2016-05-17 23:59:48 +08:00
|
|
|
|
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
2025-08-06 02:59:31 +08:00
|
|
|
CopyMergedCommand::CopyMergedCommand() : Command(CommandId::CopyMerged())
|
2016-05-17 23:59:48 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CopyMergedCommand::onEnabled(Context* ctx)
|
|
|
|
{
|
2016-05-20 00:19:02 +08:00
|
|
|
return ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | ContextFlags::HasVisibleMask);
|
2016-05-17 23:59:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CopyMergedCommand::onExecute(Context* ctx)
|
|
|
|
{
|
|
|
|
ContextReader reader(ctx);
|
2020-09-25 22:13:52 +08:00
|
|
|
ctx->clipboard()->copyMerged(reader);
|
2016-05-17 23:59:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createCopyMergedCommand()
|
|
|
|
{
|
|
|
|
return new CopyMergedCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace app
|