2016-09-15 20:50:00 +08:00
|
|
|
// Aseprite
|
2022-10-20 23:31:22 +08:00
|
|
|
// Copyright (C) 2022 Igara Studio S.A.
|
2017-12-01 10:41:45 +08:00
|
|
|
// Copyright (C) 2001-2017 David Capello
|
2016-09-15 20:50:00 +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/app.h"
|
|
|
|
#include "app/commands/command.h"
|
|
|
|
#include "app/ui/editor/editor.h"
|
|
|
|
|
|
|
|
namespace app {
|
|
|
|
|
|
|
|
class FitScreenCommand : public Command {
|
|
|
|
public:
|
|
|
|
FitScreenCommand();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool onEnabled(Context* context) override;
|
|
|
|
void onExecute(Context* context) override;
|
|
|
|
};
|
|
|
|
|
2025-08-06 02:59:31 +08:00
|
|
|
FitScreenCommand::FitScreenCommand() : Command(CommandId::FitScreen())
|
2016-09-15 20:50:00 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FitScreenCommand::onEnabled(Context* context)
|
|
|
|
{
|
2022-10-20 23:31:22 +08:00
|
|
|
return (Editor::activeEditor() != nullptr);
|
2016-09-15 20:50:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void FitScreenCommand::onExecute(Context* context)
|
|
|
|
{
|
2022-10-20 23:31:22 +08:00
|
|
|
Editor::activeEditor()->setScrollAndZoomToFitScreen();
|
2016-09-15 20:50:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createFitScreenCommand()
|
|
|
|
{
|
|
|
|
return new FitScreenCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace app
|