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