2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2017-12-01 10:41:45 +08:00
|
|
|
// Copyright (C) 2001-2017 David Capello
|
2015-02-12 23:16:25 +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.
|
2014-05-08 19:47:45 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "app/app.h"
|
|
|
|
#include "app/commands/command.h"
|
|
|
|
#include "app/context.h"
|
2018-07-07 22:54:44 +08:00
|
|
|
#include "app/doc.h"
|
2015-02-15 20:48:38 +08:00
|
|
|
#include "app/pref/preferences.h"
|
2014-05-08 19:47:45 +08:00
|
|
|
|
|
|
|
namespace app {
|
|
|
|
|
|
|
|
using namespace gfx;
|
|
|
|
|
|
|
|
class ShowOnionSkinCommand : public Command {
|
|
|
|
public:
|
2017-12-02 02:10:21 +08:00
|
|
|
ShowOnionSkinCommand() : Command(CommandId::ShowOnionSkin(), CmdUIOnlyFlag) {}
|
2014-05-08 19:47:45 +08:00
|
|
|
|
|
|
|
protected:
|
2015-10-01 03:34:43 +08:00
|
|
|
bool onChecked(Context* context) override
|
|
|
|
{
|
2015-05-19 03:53:25 +08:00
|
|
|
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
2015-02-15 20:48:38 +08:00
|
|
|
return docPref.onionskin.active();
|
2014-05-08 19:47:45 +08:00
|
|
|
}
|
|
|
|
|
2015-10-01 03:34:43 +08:00
|
|
|
void onExecute(Context* context) override
|
|
|
|
{
|
2015-05-19 03:53:25 +08:00
|
|
|
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
2015-02-15 20:48:38 +08:00
|
|
|
docPref.onionskin.active(!docPref.onionskin.active());
|
2014-05-08 19:47:45 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Command* CommandFactory::createShowOnionSkinCommand()
|
|
|
|
{
|
|
|
|
return new ShowOnionSkinCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace app
|