aseprite/src/app/commands/cmd_save_file.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.7 KiB
C
Raw Normal View History

2015-02-12 23:16:25 +08:00
// Aseprite
// Copyright (C) 2021-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 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.
#ifndef APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED
#define APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED
2014-03-30 06:40:17 +08:00
#pragma once
#include "app/commands/command.h"
#include "app/commands/new_params.h"
#include "doc/anidir.h"
#include "doc/frames_sequence.h"
#include "gfx/point.h"
#include "gfx/rect.h"
#include <string>
namespace app {
2018-07-07 22:54:44 +08:00
class Doc;
struct SaveFileParams : public NewParams {
Param<bool> ui{
this,
true,
{ "ui", "useUI" }
};
Param<bool> recent{ this, true, "recent" };
Param<std::string> filename{ this, std::string(), "filename" };
Param<std::string> filenameFormat{
2024-12-17 01:52:19 +08:00
this,
std::string(),
{ "filenameFormat", "filename-format" }
2024-12-17 01:52:19 +08:00
};
Param<std::string> tag{
2024-12-17 01:52:19 +08:00
this,
std::string(),
{ "tag", "frame-tag" }
2024-12-17 01:52:19 +08:00
};
Param<doc::AniDir> aniDir{
2024-12-17 01:52:19 +08:00
this,
doc::AniDir::FORWARD,
{ "aniDir", "ani-dir" }
2024-12-17 01:52:19 +08:00
};
Param<std::string> slice{ this, std::string(), "slice" };
Param<doc::frame_t> fromFrame{
2024-12-17 01:52:19 +08:00
this,
0,
{ "fromFrame", "from-frame" }
2024-12-17 01:52:19 +08:00
};
Param<doc::frame_t> toFrame{
2024-12-17 01:52:19 +08:00
this,
0,
{ "toFrame", "to-frame" }
2024-12-17 01:52:19 +08:00
};
Param<bool> ignoreEmpty{ this, false, "ignoreEmpty" };
Param<double> scale{ this, 1.0, "scale" };
Param<gfx::Rect> bounds{ this, gfx::Rect(), "bounds" };
Param<bool> playSubtags{ this, false, "playSubtags" };
2024-12-17 01:52:19 +08:00
};
class SaveFileBaseCommand : public CommandWithNewParams<SaveFileParams> {
public:
enum class MarkAsSaved { Off, On };
enum class SaveInBackground { Off, On };
enum class ResizeOnTheFly { Off, On };
2025-07-24 07:00:12 +08:00
SaveFileBaseCommand(const char* id);
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,
2018-07-07 22:54:44 +08:00
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::FramesSequence m_framesSeq;
2019-10-02 01:55:08 +08:00
bool m_adjustFramesByTag;
};
} // namespace app
#endif