2015-02-12 15:16:25 +00:00
|
|
|
// Aseprite
|
2022-06-15 02:19:39 +00:00
|
|
|
// Copyright (C) 2021-2022 Igara Studio S.A.
|
2018-03-15 23:34:01 +00:00
|
|
|
// Copyright (C) 2001-2018 David Capello
|
2015-02-12 15:16:25 +00:00
|
|
|
//
|
2016-08-26 20:02:58 +00:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2014-03-29 19:58:35 +00:00
|
|
|
|
|
|
|
#ifndef APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED
|
|
|
|
#define APP_COMMANDS_CMD_SAVE_FILE_H_INCLUDED
|
2014-03-29 22:40:17 +00:00
|
|
|
#pragma once
|
2014-03-29 19:58:35 +00:00
|
|
|
|
|
|
|
#include "app/commands/command.h"
|
2022-06-13 20:04:12 +00:00
|
|
|
#include "app/commands/new_params.h"
|
|
|
|
#include "doc/anidir.h"
|
2016-09-17 04:01:28 +00:00
|
|
|
#include "doc/selected_frames.h"
|
2022-06-15 02:19:39 +00:00
|
|
|
#include "gfx/point.h"
|
2014-03-29 19:58:35 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace app {
|
2018-07-07 14:54:44 +00:00
|
|
|
class Doc;
|
2014-03-29 19:58:35 +00:00
|
|
|
|
2022-06-13 20:04:12 +00:00
|
|
|
struct SaveFileParams : public NewParams {
|
|
|
|
Param<bool> ui { this, true, { "ui", "useUI" } };
|
|
|
|
Param<std::string> filename { this, std::string(), "filename" };
|
|
|
|
Param<std::string> filenameFormat { this, std::string(), { "filenameFormat", "filename-format" } };
|
|
|
|
Param<std::string> tag { this, std::string(), { "tag", "frame-tag" } };
|
|
|
|
Param<doc::AniDir> aniDir { this, doc::AniDir::FORWARD, { "aniDir", "ani-dir" } };
|
|
|
|
Param<std::string> slice { this, std::string(), "slice" };
|
|
|
|
Param<doc::frame_t> fromFrame { this, 0, { "fromFrame", "from-frame" } };
|
|
|
|
Param<doc::frame_t> toFrame { this, 0, { "toFrame", "to-frame" } };
|
|
|
|
Param<bool> ignoreEmpty { this, false, "ignoreEmpty" };
|
2022-06-15 02:19:39 +00:00
|
|
|
Param<double> scale { this, 1.0, "scale" };
|
2022-06-13 20:04:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SaveFileBaseCommand : public CommandWithNewParams<SaveFileParams> {
|
2014-03-29 19:58:35 +00:00
|
|
|
public:
|
2022-06-13 15:46:11 +00:00
|
|
|
enum class MarkAsSaved { Off, On };
|
|
|
|
enum class SaveInBackground { Off, On };
|
2022-06-15 02:19:39 +00:00
|
|
|
enum class ResizeOnTheFly { Off, On };
|
2022-06-13 15:46:11 +00:00
|
|
|
|
2017-12-01 02:41:45 +00:00
|
|
|
SaveFileBaseCommand(const char* id, CommandFlags flags);
|
2014-03-29 19:58:35 +00:00
|
|
|
|
|
|
|
protected:
|
2015-03-11 18:40:22 +00:00
|
|
|
void onLoadParams(const Params& params) override;
|
2014-08-15 02:07:47 +00:00
|
|
|
bool onEnabled(Context* context) override;
|
2014-03-29 19:58:35 +00:00
|
|
|
|
2018-03-15 23:34:01 +00:00
|
|
|
std::string saveAsDialog(
|
|
|
|
Context* context,
|
|
|
|
const std::string& dlgTitle,
|
|
|
|
const std::string& filename,
|
2022-06-13 15:46:11 +00:00
|
|
|
const MarkAsSaved markAsSaved,
|
|
|
|
const SaveInBackground saveInBackground = SaveInBackground::On,
|
2018-03-15 23:34:01 +00:00
|
|
|
const std::string& forbiddenFilename = std::string());
|
|
|
|
void saveDocumentInBackground(
|
|
|
|
const Context* context,
|
2018-07-07 14:54:44 +00:00
|
|
|
Doc* document,
|
2018-03-15 23:34:01 +00:00
|
|
|
const std::string& filename,
|
2022-06-15 02:19:39 +00:00
|
|
|
const MarkAsSaved markAsSaved,
|
|
|
|
const ResizeOnTheFly resizeOnTheFly = ResizeOnTheFly::Off,
|
|
|
|
const gfx::PointF& scale = gfx::PointF(1.0, 1.0));
|
2014-03-29 19:58:35 +00:00
|
|
|
|
2016-09-17 04:01:28 +00:00
|
|
|
doc::SelectedFrames m_selFrames;
|
2019-10-01 17:55:08 +00:00
|
|
|
bool m_adjustFramesByTag;
|
2014-03-29 19:58:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace app
|
|
|
|
|
|
|
|
#endif
|