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

Undoable action for edits to a music song. More...

#include <music_undo_actions.h>

Inheritance diagram for yaze::editor::MusicSongEditAction:
Collaboration diagram for yaze::editor::MusicSongEditAction:

Public Member Functions

 MusicSongEditAction (int song_index, zelda3::music::MusicSong before_snapshot, zelda3::music::MusicSong after_snapshot, zelda3::music::MusicBank *music_bank)
 
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.
 
- Public Member Functions inherited from yaze::editor::UndoAction
virtual ~UndoAction ()=default
 
virtual bool CanMergeWith (const UndoAction &) const
 
virtual void MergeWith (UndoAction &)
 

Private Attributes

int song_index_
 
zelda3::music::MusicSong before_snapshot_
 
zelda3::music::MusicSong after_snapshot_
 
zelda3::music::MusicBankmusic_bank_
 

Detailed Description

Undoable action for edits to a music song.

Captures a full snapshot of the MusicSong before and after the edit so that Undo restores the before-state and Redo restores the after-state. Applies changes via a pointer to the owning MusicBank.

Definition at line 25 of file music_undo_actions.h.

Constructor & Destructor Documentation

◆ MusicSongEditAction()

yaze::editor::MusicSongEditAction::MusicSongEditAction ( int song_index,
zelda3::music::MusicSong before_snapshot,
zelda3::music::MusicSong after_snapshot,
zelda3::music::MusicBank * music_bank )
inline

Definition at line 27 of file music_undo_actions.h.

Member Function Documentation

◆ Undo()

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

Implements yaze::editor::UndoAction.

Definition at line 36 of file music_undo_actions.h.

References before_snapshot_, yaze::zelda3::music::MusicBank::GetSong(), music_bank_, and song_index_.

Here is the call graph for this function:

◆ Redo()

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

Implements yaze::editor::UndoAction.

Definition at line 46 of file music_undo_actions.h.

References after_snapshot_, yaze::zelda3::music::MusicBank::GetSong(), music_bank_, and song_index_.

Here is the call graph for this function:

◆ Description()

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

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

Implements yaze::editor::UndoAction.

Definition at line 56 of file music_undo_actions.h.

References song_index_.

◆ MemoryUsage()

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

Approximate memory footprint for budget enforcement.

Reimplemented from yaze::editor::UndoAction.

Definition at line 60 of file music_undo_actions.h.

References after_snapshot_, before_snapshot_, and yaze::zelda3::music::MusicSong::segments.

Member Data Documentation

◆ song_index_

int yaze::editor::MusicSongEditAction::song_index_
private

Definition at line 77 of file music_undo_actions.h.

Referenced by Description(), Redo(), and Undo().

◆ before_snapshot_

zelda3::music::MusicSong yaze::editor::MusicSongEditAction::before_snapshot_
private

Definition at line 78 of file music_undo_actions.h.

Referenced by MemoryUsage(), and Undo().

◆ after_snapshot_

zelda3::music::MusicSong yaze::editor::MusicSongEditAction::after_snapshot_
private

Definition at line 79 of file music_undo_actions.h.

Referenced by MemoryUsage(), and Redo().

◆ music_bank_

zelda3::music::MusicBank* yaze::editor::MusicSongEditAction::music_bank_
private

Definition at line 80 of file music_undo_actions.h.

Referenced by Redo(), and Undo().


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