// Aseprite // Copyright (C) 2021-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. #ifndef APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED #define APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED #pragma once #include "app/commands/command.h" #include "app/commands/new_params.h" #include "doc/anidir.h" #include "doc/selected_frames.h" #include "gfx/point.h" #include namespace app { class Doc; struct SaveFileParams : public NewParams { Param ui { this, true, { "ui", "useUI" } }; Param filename { this, std::string(), "filename" }; Param filenameFormat { this, std::string(), { "filenameFormat", "filename-format" } }; Param tag { this, std::string(), { "tag", "frame-tag" } }; Param aniDir { this, doc::AniDir::FORWARD, { "aniDir", "ani-dir" } }; Param slice { this, std::string(), "slice" }; Param fromFrame { this, 0, { "fromFrame", "from-frame" } }; Param toFrame { this, 0, { "toFrame", "to-frame" } }; Param ignoreEmpty { this, false, "ignoreEmpty" }; Param scale { this, 1.0, "scale" }; }; class SaveFileBaseCommand : public CommandWithNewParams { public: enum class MarkAsSaved { Off, On }; enum class SaveInBackground { Off, On }; enum class ResizeOnTheFly { Off, On }; SaveFileBaseCommand(const char* id, CommandFlags flags); protected: void onLoadParams(const Params& params) override; bool onEnabled(Context* context) override; std::string saveAsDialog( Context* context, const std::string& dlgTitle, const std::string& filename, const MarkAsSaved markAsSaved, const SaveInBackground saveInBackground = SaveInBackground::On, const std::string& forbiddenFilename = std::string()); void saveDocumentInBackground( const Context* context, Doc* document, const std::string& filename, const MarkAsSaved markAsSaved, const ResizeOnTheFly resizeOnTheFly = ResizeOnTheFly::Off, const gfx::PointF& scale = gfx::PointF(1.0, 1.0)); doc::SelectedFrames m_selFrames; bool m_adjustFramesByTag; }; } // namespace app #endif