SetEventsCommand class
#include <Jazz2/Editor/Document/Commands.h>
Changes events of the grid.
Collected the same way as by SetTilesCommand.
Base classes
- class EditCommand
- Undoable change of a level being edited.
Public types
- struct Change
- Change of a single event.
Constructors, destructors, conversion operators
- SetEventsCommand(const LevelDocument& document, String name)
- Creates an empty change of events.
Public functions
-
void Set(std::
int32_t x, std:: int32_t y, const Formats:: EventRecord& event) - Sets an event, positions outside of the grid are ignored.
- void Seal()
- Completes the collection, see SetTilesCommand::
Seal(). - auto IsEmpty() const -> bool
- Returns
trueif there's nothing to change. - auto GetArea() const -> Recti
- Returns the area of all changed events.
- auto GetChanges() const -> ArrayView<const Change>
- Returns the changes collected so far.
- void Do(LevelDocument& document, DocumentChanges& changes) override
- Applies the change to the document, again after it was undone.
- void Undo(LevelDocument& document, DocumentChanges& changes) override
- Reverts the change.
- auto TryMerge(EditCommand& next) -> bool override
- Merges a change of the same events by the same name, as made while a value is dragged.
- auto CanMerge(EditCommand& next) -> bool override
- Returns
trueif TryMerge() would take overnext, without taking it over. - auto GetName() const -> String override
- Returns the name shown in the history.
-
auto GetMemoryUsage() const -> std::
size_t override - Returns the memory the command takes.
Function documentation
bool Jazz2:: Editor:: SetEventsCommand:: CanMerge(EditCommand& next) override
Returns true if TryMerge() would take over next, without taking it over.
A transaction is merged only if all of its changes can be, it asks each of them first. A command that merges has to say the same here as its TryMerge() does.