1#ifndef YAZE_APP_EDITOR_GRAPHICS_UNDO_ACTIONS_H_
2#define YAZE_APP_EDITOR_GRAPHICS_UNDO_ACTIONS_H_
11#include "absl/status/status.h"
12#include "absl/strings/str_format.h"
32 std::vector<uint8_t> after_data,
40 absl::Status
Undo()
override {
43 return absl::OutOfRangeError(
44 absl::StrFormat(
"Sheet %02X out of range",
sheet_id_));
50 return absl::OkStatus();
53 absl::Status
Redo()
override {
56 return absl::OutOfRangeError(
57 absl::StrFormat(
"Sheet %02X out of range",
sheet_id_));
63 return absl::OkStatus();
Undoable action for pixel edits on a graphics sheet.
absl::Status Undo() override
bool CanMergeWith(const UndoAction &) const override
GraphicsPixelEditAction(uint16_t sheet_id, std::vector< uint8_t > before_data, std::vector< uint8_t > after_data, std::string description, MarkDirtyFn mark_dirty)
size_t MemoryUsage() const override
Approximate memory footprint for budget enforcement.
std::string Description() const override
Human-readable description (e.g., "Paint 12 tiles on map 5")
std::vector< uint8_t > before_data_
std::function< void(uint16_t)> MarkDirtyFn
std::vector< uint8_t > after_data_
absl::Status Redo() override
Abstract base for all undoable actions (Command pattern)
auto mutable_gfx_sheets()
Get mutable reference to all graphics sheets.
void NotifySheetModified(int sheet_index)
Notify Arena that a graphics sheet has been modified.