| 1 | // Aseprite |
| 2 | // Copyright (C) 2019-2022 Igara Studio S.A. |
| 3 | // Copyright (C) 2016-2017 David Capello |
| 4 | // |
| 5 | // This program is distributed under the terms of |
| 6 | // the End-User License Agreement for Aseprite. |
| 7 | |
| 8 | #ifndef APP_CLI_CLI_OPEN_FILE_H_INCLUDED |
| 9 | #define APP_CLI_CLI_OPEN_FILE_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "doc/frame.h" |
| 13 | #include "gfx/rect.h" |
| 14 | |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
| 18 | namespace app { |
| 19 | |
| 20 | class Doc; |
| 21 | class FileOpROI; |
| 22 | |
| 23 | struct CliOpenFile { |
| 24 | Doc* document = nullptr; |
| 25 | std::string filename; |
| 26 | std::string filenameFormat; |
| 27 | std::string tag; |
| 28 | std::string slice; |
| 29 | std::vector<std::string> includeLayers; |
| 30 | std::vector<std::string> excludeLayers; |
| 31 | doc::frame_t fromFrame = -1; |
| 32 | doc::frame_t toFrame = -1; |
| 33 | bool splitLayers = false; |
| 34 | bool splitTags = false; |
| 35 | bool splitSlices = false; |
| 36 | bool splitGrid = false; |
| 37 | bool allLayers = false; |
| 38 | bool listLayers = false; |
| 39 | bool listTags = false; |
| 40 | bool listSlices = false; |
| 41 | bool ignoreEmpty = false; |
| 42 | bool trim = false; |
| 43 | bool trimByGrid = false; |
| 44 | bool oneFrame = false; |
| 45 | bool exportTileset = false; |
| 46 | gfx::Rect crop; |
| 47 | |
| 48 | bool hasTag() const { |
| 49 | return (!tag.empty()); |
| 50 | } |
| 51 | |
| 52 | bool hasSlice() const { |
| 53 | return (!slice.empty()); |
| 54 | } |
| 55 | |
| 56 | bool hasFrameRange() const { |
| 57 | return (fromFrame >= 0 && toFrame >= 0); |
| 58 | } |
| 59 | |
| 60 | bool hasLayersFilter() const { |
| 61 | return (!includeLayers.empty() || |
| 62 | !excludeLayers.empty()); |
| 63 | } |
| 64 | |
| 65 | FileOpROI roi() const; |
| 66 | }; |
| 67 | |
| 68 | } // namespace app |
| 69 | |
| 70 | #endif |
| 71 | |