yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
palette_reorder_control.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_PALETTE_REORDER_CONTROL_H_
2#define YAZE_APP_EDITOR_GRAPHICS_PALETTE_REORDER_CONTROL_H_
3
4#include <functional>
5#include <map>
6#include <optional>
7#include <string>
8
10
11namespace yaze::editor {
12
13// Stages a source-scoped permutation without editing the model. The Graphics
14// editor owns the mutation callback and its combined palette/pixel history.
16 public:
17 using Apply = std::function<absl::Status(const std::vector<size_t>&,
18 const PalettePermutation&)>;
19 void Draw(GraphicsEditorState& state, const Apply& apply, bool busy);
20
21 private:
22 void Begin(const GraphicsEditorState& state);
23 bool SourceChanged(const GraphicsEditorState& state) const;
24
25 std::optional<GraphicsEditContext> source_;
26 uint64_t source_revision_ = 0;
27 uint64_t palette_revision_ = 0;
28 std::map<uint16_t, uint64_t> sheet_revisions_;
29 // New slot -> old slot; converted to old -> new for the model command.
30 PalettePermutation order_{0, 1, 2, 3, 4, 5, 6, 7};
32 bool whole_pattern_ = false;
33 std::string error_;
34};
35
36} // namespace yaze::editor
37#endif // YAZE_APP_EDITOR_GRAPHICS_PALETTE_REORDER_CONTROL_H_
Shared state between GraphicsEditor panel components.
std::function< absl::Status(const std::vector< size_t > &, const PalettePermutation &)> Apply
std::map< uint16_t, uint64_t > sheet_revisions_
std::optional< GraphicsEditContext > source_
bool SourceChanged(const GraphicsEditorState &state) const
void Draw(GraphicsEditorState &state, const Apply &apply, bool busy)
void Begin(const GraphicsEditorState &state)
Editors are the view controllers for the application.
std::array< uint8_t, 8 > PalettePermutation