1 | // Aseprite |
---|---|
2 | // Copyright (C) 2001-2017 David Capello |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | #include "config.h" |
9 | #endif |
10 | |
11 | #include "app/app.h" |
12 | #include "app/commands/command.h" |
13 | #include "app/context.h" |
14 | #include "app/doc.h" |
15 | #include "app/pref/preferences.h" |
16 | |
17 | namespace app { |
18 | |
19 | using namespace gfx; |
20 | |
21 | class ShowOnionSkinCommand : public Command { |
22 | public: |
23 | ShowOnionSkinCommand() |
24 | : Command(CommandId::ShowOnionSkin(), CmdUIOnlyFlag) |
25 | { |
26 | } |
27 | |
28 | protected: |
29 | bool onChecked(Context* context) override { |
30 | DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument()); |
31 | return docPref.onionskin.active(); |
32 | } |
33 | |
34 | void onExecute(Context* context) override { |
35 | DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument()); |
36 | docPref.onionskin.active(!docPref.onionskin.active()); |
37 | } |
38 | }; |
39 | |
40 | Command* CommandFactory::createShowOnionSkinCommand() |
41 | { |
42 | return new ShowOnionSkinCommand; |
43 | } |
44 | |
45 | } // namespace app |
46 |