yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::ScreenEditAction Class Reference

Undoable action for screen editor edits. More...

#include <screen_undo_actions.h>

Inheritance diagram for yaze::editor::ScreenEditAction:
Collaboration diagram for yaze::editor::ScreenEditAction:

Public Types

using RestoreFn = std::function<void(const ScreenSnapshot&)>
 

Public Member Functions

 ScreenEditAction (ScreenSnapshot before, ScreenSnapshot after, RestoreFn restore, std::string description)
 
absl::Status Undo () override
 
absl::Status Redo () override
 
std::string Description () const override
 Human-readable description (e.g., "Paint 12 tiles on map 5")
 
size_t MemoryUsage () const override
 Approximate memory footprint for budget enforcement.
 
bool CanMergeWith (const UndoAction &) const override
 
- Public Member Functions inherited from yaze::editor::UndoAction
virtual ~UndoAction ()=default
 
virtual void MergeWith (UndoAction &)
 

Private Attributes

ScreenSnapshot before_
 
ScreenSnapshot after_
 
RestoreFn restore_
 
std::string description_
 

Detailed Description

Undoable action for screen editor edits.

Stores before and after snapshots and uses a caller-provided restore callback to apply them back into the ScreenEditor. Follows the same pattern as DungeonObjectsAction and Tile16EditAction.

Definition at line 72 of file screen_undo_actions.h.

Member Typedef Documentation

◆ RestoreFn

using yaze::editor::ScreenEditAction::RestoreFn = std::function<void(const ScreenSnapshot&)>

Definition at line 74 of file screen_undo_actions.h.

Constructor & Destructor Documentation

◆ ScreenEditAction()

yaze::editor::ScreenEditAction::ScreenEditAction ( ScreenSnapshot before,
ScreenSnapshot after,
RestoreFn restore,
std::string description )
inline

Definition at line 76 of file screen_undo_actions.h.

Member Function Documentation

◆ Undo()

absl::Status yaze::editor::ScreenEditAction::Undo ( )
inlineoverridevirtual

Implements yaze::editor::UndoAction.

Definition at line 83 of file screen_undo_actions.h.

References before_, and restore_.

◆ Redo()

absl::Status yaze::editor::ScreenEditAction::Redo ( )
inlineoverridevirtual

Implements yaze::editor::UndoAction.

Definition at line 91 of file screen_undo_actions.h.

References after_, and restore_.

◆ Description()

std::string yaze::editor::ScreenEditAction::Description ( ) const
inlineoverridevirtual

Human-readable description (e.g., "Paint 12 tiles on map 5")

Implements yaze::editor::UndoAction.

Definition at line 99 of file screen_undo_actions.h.

References description_.

◆ MemoryUsage()

size_t yaze::editor::ScreenEditAction::MemoryUsage ( ) const
inlineoverridevirtual

◆ CanMergeWith()

bool yaze::editor::ScreenEditAction::CanMergeWith ( const UndoAction & ) const
inlineoverridevirtual

Whether this action can merge with the previous action on the stack. Called only when both actions have the same concrete type.

Reimplemented from yaze::editor::UndoAction.

Definition at line 115 of file screen_undo_actions.h.

Member Data Documentation

◆ before_

ScreenSnapshot yaze::editor::ScreenEditAction::before_
private

Definition at line 118 of file screen_undo_actions.h.

Referenced by MemoryUsage(), and Undo().

◆ after_

ScreenSnapshot yaze::editor::ScreenEditAction::after_
private

Definition at line 119 of file screen_undo_actions.h.

Referenced by MemoryUsage(), and Redo().

◆ restore_

RestoreFn yaze::editor::ScreenEditAction::restore_
private

Definition at line 120 of file screen_undo_actions.h.

Referenced by Redo(), and Undo().

◆ description_

std::string yaze::editor::ScreenEditAction::description_
private

Definition at line 121 of file screen_undo_actions.h.

Referenced by Description().


The documentation for this class was generated from the following file: